Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to the fields on a type. This includes if a field has been removed from a type, if a field has changed type, or if a nonnull field is added to an input type.
function findFieldsThatChangedType(oldSchema, newSchema) { return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType || oldType instanceof _definition.GraphQLInputObjectType) || !(newType instanceof oldType.constructor)) {\n\t return;\n\t }\n\n\t var oldTypeFieldsDef = oldType.getFields();\n\t var newTypeFieldsDef = newType.getFields();\n\t Object.keys(oldTypeFieldsDef).forEach(function (fieldName) {\n\t // Check if the field is missing on the type in the new schema.\n\t if (!(fieldName in newTypeFieldsDef)) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_REMOVED,\n\t description: typeName + '.' + fieldName + ' was removed.'\n\t });\n\t } else {\n\t // Check if the field's type has changed in the new schema.\n\t var oldFieldType = (0, _definition.getNamedType)(oldTypeFieldsDef[fieldName].type);\n\t var newFieldType = (0, _definition.getNamedType)(newTypeFieldsDef[fieldName].type);\n\t if (oldFieldType && newFieldType && oldFieldType.name !== newFieldType.name) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_CHANGED_KIND,\n\t description: typeName + '.' + fieldName + ' changed type from ' + (oldFieldType.name + ' to ' + newFieldType.name + '.')\n\t });\n\t }\n\t }\n\t });\n\t });\n\t return breakingFieldChanges;\n\t}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr2 = Object.keys(oldTypeMap);\n\n for (var _i2 = 0; _i2 < _arr2.length; _i2++) {\n var typeName = _arr2[_i2];\n\n if (!newTypeMap[typeName]) {\n continue;\n }\n\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (oldType.constructor !== newType.constructor) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: \"\".concat(typeName, \" changed from \") + \"\".concat(typeKindName(oldType), \" to \").concat(typeKindName(newType), \".\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t return;\n\t }\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof newType.constructor)) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_CHANGED_KIND,\n\t description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_REMOVED,\n\t description: typeName + ' was removed.'\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr = Object.keys(oldTypeMap);\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var typeName = _arr[_i];\n\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: \"\".concat(typeName, \" was removed.\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n\t return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema));\n\t}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).breakingChanges, findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema), findRemovedDirectives(oldSchema, newSchema), findRemovedDirectiveArgs(oldSchema, newSchema), findAddedNonNullDirectiveArgs(oldSchema, newSchema), findRemovedDirectiveLocations(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n var dangerousChanges = [];\n\n var _arr3 = Object.keys(oldTypeMap);\n\n for (var _i3 = 0; _i3 < _arr3.length; _i3++) {\n var typeName = _arr3[_i3];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(oldType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(oldType)) || !(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(newType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(newType)) || newType.constructor !== oldType.constructor) {\n continue;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n var _arr4 = Object.keys(oldTypeFields);\n\n for (var _i4 = 0; _i4 < _arr4.length; _i4++) {\n var fieldName = _arr4[_i4];\n\n if (!newTypeFields[fieldName]) {\n continue;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var oldArgDef = _step.value;\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(newArgs, function (arg) {\n return arg.name === oldArgDef.name;\n }); // Arg not present\n\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" was removed\")\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed type from \") + \"\".concat(oldArgDef.type.toString(), \" to \").concat(newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed defaultValue\")\n });\n }\n }\n };\n\n for (var _iterator = oldTypeFields[fieldName].args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n _loop();\n } // Check if arg was added to the field\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n var _loop2 = function _loop2() {\n var newArgDef = _step2.value;\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(oldArgs, function (arg) {\n return arg.name === newArgDef.name;\n });\n\n if (!oldArgDef) {\n var argName = newArgDef.name;\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isRequiredArgument\"])(newArgDef)) {\n breakingChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: \"A required arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n } else {\n dangerousChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: \"An optional arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n }\n }\n };\n\n for (var _iterator2 = newTypeFields[fieldName].args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n _loop2();\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema));\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findInterfacesAddedToObjectTypes(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).dangerousChanges);\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges);\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesAddedToUnion = [];\n Object.keys(newTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInOldUnion = Object.create(null);\n oldType.getTypes().forEach(function (type) {\n typeNamesInOldUnion[type.name] = true;\n });\n newType.getTypes().forEach(function (type) {\n if (!typeNamesInOldUnion[type.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: type.name + ' was added to union type ' + typeName + '.'\n });\n }\n });\n });\n return typesAddedToUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInNewEnum = Object.create(null);\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = newType.getValues()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var value = _step7.value;\n valuesInNewEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = oldType.getValues()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _value = _step8.value;\n\n if (!valuesInNewEnum[_value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: \"\".concat(_value.name, \" was removed from enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n }\n\n return valuesRemovedFromEnums;\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var valuesRemovedFromEnums = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n\t return;\n\t }\n\t var valuesInNewEnum = Object.create(null);\n\t newType.getValues().forEach(function (value) {\n\t valuesInNewEnum[value.name] = true;\n\t });\n\t oldType.getValues().forEach(function (value) {\n\t if (!valuesInNewEnum[value.name]) {\n\t valuesRemovedFromEnums.push({\n\t type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n\t description: value.name + ' was removed from enum type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return valuesRemovedFromEnums;\n\t}", "function getDiffs(oldDoc, newDoc) {\n const changes = new Array();\n const flatOld = flattenObject(oldDoc);\n const flatNew = flattenObject(newDoc);\n // find deleted nodes\n Object.keys(flatOld).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatNew, key)) {\n changes.push({\n action: 'DELETED',\n keyName: key,\n });\n }\n });\n // find added nodes\n Object.keys(flatNew).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatOld, key)) {\n changes.push({\n action: 'ADDED',\n keyName: key,\n });\n }\n });\n // find updated nodes\n Object.keys(flatOld).forEach(key => {\n let oldValue = flatOld[key];\n if (Array.isArray(oldValue)) {\n oldValue = oldValue.join(', ');\n }\n let newValue = flatNew[key];\n if (newValue) {\n if (Array.isArray(newValue)) {\n newValue = newValue.join(', ');\n }\n if (newValue !== oldValue && key !== 'revision' && key !== 'etag') {\n changes.push({\n action: 'CHANGED',\n keyName: key,\n });\n }\n }\n });\n return changes;\n}", "function schemaDiff(comparison) {\n\t// TODO\n\t// TODO\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function processSchema(schema, schemaKey, sourceSchemas, newSchemas, preserveUnneeded) {\n /*\n * Most schemas have a name. However, not all do. We must nevertheless expose those schemas as they have root\n * operations on them. Thus, we convert the key into a form that can be used to identify them.\n */\n schema.name = schemaKeyToTypeName(schemaKey, sourceSchemas);\n\n // If this schema has already been processed (see recursive call, below), return it\n if (newSchemas[schema.name]) {\n return newSchemas[schema.name];\n }\n\n newSchemas[schema.name] = schema;\n\n if (schema.root) {\n schema.rootTypeName = schema.name;\n }\n\n // Process the parent schema, if any. This assumes all extends schemas have just a $ref property.\n var parentSchema = schema.extends;\n if (parentSchema) {\n schema.parentSchema = processSchema(sourceSchemas[parentSchema.$ref], parentSchema.$ref,\n sourceSchemas, newSchemas);\n parentSchema.$ref = schemaKeyToTypeName(parentSchema.$ref, sourceSchemas);\n parentSchema = schema.parentSchema;\n\n if (!schema.rootTypeName) {\n schema.rootTypeName = parentSchema.rootTypeName;\n }\n\n schema.root = schema.root || parentSchema.root;\n }\n\n if (!preserveUnneeded) {\n delete schema.description;\n }\n\n processProperties(schema, parentSchema, sourceSchemas, preserveUnneeded);\n processOperations(schema, parentSchema, sourceSchemas);\n\n return schema;\n}", "function checkInconsistentFieldTypes(fields, layers) {\n fields.forEach(function(key) {\n var types = findFieldTypes(key, layers);\n if (types.length > 1) {\n stop(\"Inconsistent data types in \\\"\" + key + \"\\\" field:\", types.join(', '));\n }\n });\n }", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!(0, _definition.isAbstractType)(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return (0, _naturalCompare.default)(typeA.name, typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!(0, _definition.isAbstractType)(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return (0, _naturalCompare.default)(typeA.name, typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if ((0, _definition.isAbstractType)(type)) {\n var suggestedObjectTypes = [];\n var interfaceUsageCount = Object.create(null);\n schema.getPossibleTypes(type).forEach(function (possibleType) {\n if (!possibleType.getFields()[fieldName]) {\n return;\n }\n // This object type defines this field.\n suggestedObjectTypes.push(possibleType.name);\n possibleType.getInterfaces().forEach(function (possibleInterface) {\n if (!possibleInterface.getFields()[fieldName]) {\n return;\n }\n // This interface type defines this field.\n interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;\n });\n });\n\n // Suggest interface types based on how common they are.\n var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {\n return interfaceUsageCount[b] - interfaceUsageCount[a];\n });\n\n // Suggest both interface and object types.\n return suggestedInterfaceTypes.concat(suggestedObjectTypes);\n }\n\n // Otherwise, must be an Object type, which does not have possible fields.\n return [];\n}", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isAbstractType\"])(type)) {\n var suggestedObjectTypes = [];\n var interfaceUsageCount = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = schema.getPossibleTypes(type)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var possibleType = _step.value;\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedObjectTypes.push(possibleType.name);\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = possibleType.getInterfaces()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var possibleInterface = _step2.value;\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n } // Suggest interface types based on how common they are.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {\n return interfaceUsageCount[b] - interfaceUsageCount[a];\n }); // Suggest both interface and object types.\n\n return suggestedInterfaceTypes.concat(suggestedObjectTypes);\n } // Otherwise, must be an Object type, which does not have possible fields.\n\n\n return [];\n}", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isObjectType\"])(type) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isInterfaceType\"])(type)) {\n var possibleFieldNames = Object.keys(type.getFields());\n return Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n\n return [];\n}", "function diffField(field, val, isArray, isObject, handles) {\n //console.log('CANNOT BE UNDEFINED', field);\n let changed = false;\n\n if (isArray) {\n // compare each value of new data to old data\n changed = val.reduce((acc, curr, i) => {\n return (acc || curr !== field.data[i]);\n }, false)\n changed = changed || (val.length !== field.data.length);\n\n } else {\n changed = (field.data !== val)\n }\n\n if (changed) {\n console.log('-------------THERE WAS A CHANGE------------------')\n field.data = val; // overwrite field\n\n // add subscribers of this data to list of handls to be fired back\n Object.assign(handles, field.subscribers);\n }\n}", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (type instanceof _definition.GraphQLObjectType || type instanceof _definition.GraphQLInterfaceType) {\n var possibleFieldNames = Object.keys(type.getFields());\n return (0, _suggestionList2.default)(fieldName, possibleFieldNames);\n }\n // Otherwise, must be a Union type, which does not define fields.\n return [];\n}", "function diffField(field, val, isArray, isObject, handles) {\n//console.log('CANNOT BE UNDEFINED', field);\nlet changed = false;\n\nif (isArray) {\n // compare each value of new data to old data\n changed = val.reduce((acc, curr, i) => {\n return (acc || curr !== field.data[i]);\n }, false)\n changed = changed || (val.length !== field.data.length);\n\n} else {\n changed = (field.data !== val)\n}\n\nif (changed) {\n console.log('-------------THERE WAS A CHANGE------------------')\n field.data = val; // overwrite field\n\n // add subscribers of this data to list of handls to be fired back\n Object.assign(handles, field.subscribers);\n}\n}", "function patchSchema(data) {\n data.properties.upload_type.enum = data.properties.upload_type.type.enum;\n data.properties.upload_type.type = \"string\";\n data.properties.publication_type.enum =\n data.properties.publication_type.type.enum;\n data.properties.publication_type.type = \"string\";\n data.properties.image_type.enum = data.properties.image_type.type.enum;\n data.properties.image_type.type = \"string\";\n return data;\n}", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function extendSchema(schema, documentAST) {\n\t (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n\t (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n\t // Collect the type definitions and extensions found in the document.\n\t var typeDefinitionMap = {};\n\t var typeExtensionsMap = {};\n\n\t // New directives and types are separate because a directives and types can\n\t // have the same name. For example, a type named \"skip\".\n\t var directiveDefinitions = [];\n\n\t for (var i = 0; i < documentAST.definitions.length; i++) {\n\t var def = documentAST.definitions[i];\n\t switch (def.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t // Sanity check that none of the defined types conflict with the\n\t // schema's existing types.\n\t var typeName = def.name.value;\n\t if (schema.getType(typeName)) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n\t }\n\t typeDefinitionMap[typeName] = def;\n\t break;\n\t case _kinds.TYPE_EXTENSION_DEFINITION:\n\t // Sanity check that this type extension exists within the\n\t // schema's existing types.\n\t var extendedTypeName = def.definition.name.value;\n\t var existingType = schema.getType(extendedTypeName);\n\t if (!existingType) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n\t }\n\t if (!(existingType instanceof _definition.GraphQLObjectType)) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n\t }\n\t var extensions = typeExtensionsMap[extendedTypeName];\n\t if (extensions) {\n\t extensions.push(def);\n\t } else {\n\t extensions = [def];\n\t }\n\t typeExtensionsMap[extendedTypeName] = extensions;\n\t break;\n\t case _kinds.DIRECTIVE_DEFINITION:\n\t var directiveName = def.name.value;\n\t var existingDirective = schema.getDirective(directiveName);\n\t if (existingDirective) {\n\t throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n\t }\n\t directiveDefinitions.push(def);\n\t break;\n\t }\n\t }\n\n\t // If this document contains no new types, extensions, or directives then\n\t // return the same unmodified GraphQLSchema instance.\n\t if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n\t return schema;\n\t }\n\n\t // A cache to use to store the actual GraphQLType definition objects by name.\n\t // Initialize to the GraphQL built in scalars and introspection types. All\n\t // functions below are inline so that this type def cache is within the scope\n\t // of the closure.\n\t var typeDefCache = {\n\t String: _scalars.GraphQLString,\n\t Int: _scalars.GraphQLInt,\n\t Float: _scalars.GraphQLFloat,\n\t Boolean: _scalars.GraphQLBoolean,\n\t ID: _scalars.GraphQLID,\n\t __Schema: _introspection.__Schema,\n\t __Directive: _introspection.__Directive,\n\t __DirectiveLocation: _introspection.__DirectiveLocation,\n\t __Type: _introspection.__Type,\n\t __Field: _introspection.__Field,\n\t __InputValue: _introspection.__InputValue,\n\t __EnumValue: _introspection.__EnumValue,\n\t __TypeKind: _introspection.__TypeKind\n\t };\n\n\t // Get the root Query, Mutation, and Subscription object types.\n\t var queryType = getTypeFromDef(schema.getQueryType());\n\n\t var existingMutationType = schema.getMutationType();\n\t var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n\t var existingSubscriptionType = schema.getSubscriptionType();\n\t var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n\t // Iterate through all types, getting the type definition for each, ensuring\n\t // that any type not directly referenced by a field will get created.\n\t var typeMap = schema.getTypeMap();\n\t var types = Object.keys(typeMap).map(function (typeName) {\n\t return getTypeFromDef(typeMap[typeName]);\n\t });\n\n\t // Do the same with new types, appending to the list of defined types.\n\t Object.keys(typeDefinitionMap).forEach(function (typeName) {\n\t types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n\t });\n\n\t // Then produce and return a Schema with these types.\n\t return new _schema.GraphQLSchema({\n\t query: queryType,\n\t mutation: mutationType,\n\t subscription: subscriptionType,\n\t types: types,\n\t directives: getMergedDirectives()\n\t });\n\n\t // Below are functions used for producing this schema that have closed over\n\t // this scope and have access to the schema, cache, and newly defined types.\n\n\t function getMergedDirectives() {\n\t var existingDirectives = schema.getDirectives();\n\t (0, _invariant2.default)(existingDirectives, 'schema must have default directives');\n\n\t var newDirectives = directiveDefinitions.map(function (directiveAST) {\n\t return getDirective(directiveAST);\n\t });\n\t return existingDirectives.concat(newDirectives);\n\t }\n\n\t function getTypeFromDef(typeDef) {\n\t var type = _getNamedType(typeDef.name);\n\t (0, _invariant2.default)(type, 'Missing type from schema');\n\t return type;\n\t }\n\n\t function getTypeFromAST(astNode) {\n\t var type = _getNamedType(astNode.name.value);\n\t if (!type) {\n\t throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n\t }\n\t return type;\n\t }\n\n\t function getObjectTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n\t return type;\n\t }\n\n\t function getInterfaceTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n\t return type;\n\t }\n\n\t function getInputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n\t return type;\n\t }\n\n\t function getOutputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n\t return type;\n\t }\n\n\t // Given a name, returns a type from either the existing schema or an\n\t // added type.\n\t function _getNamedType(typeName) {\n\t var cachedTypeDef = typeDefCache[typeName];\n\t if (cachedTypeDef) {\n\t return cachedTypeDef;\n\t }\n\n\t var existingType = schema.getType(typeName);\n\t if (existingType) {\n\t var typeDef = extendType(existingType);\n\t typeDefCache[typeName] = typeDef;\n\t return typeDef;\n\t }\n\n\t var typeAST = typeDefinitionMap[typeName];\n\t if (typeAST) {\n\t var _typeDef = buildType(typeAST);\n\t typeDefCache[typeName] = _typeDef;\n\t return _typeDef;\n\t }\n\t }\n\n\t // Given a type's introspection result, construct the correct\n\t // GraphQLType instance.\n\t function extendType(type) {\n\t if (type instanceof _definition.GraphQLObjectType) {\n\t return extendObjectType(type);\n\t }\n\t if (type instanceof _definition.GraphQLInterfaceType) {\n\t return extendInterfaceType(type);\n\t }\n\t if (type instanceof _definition.GraphQLUnionType) {\n\t return extendUnionType(type);\n\t }\n\t return type;\n\t }\n\n\t function extendObjectType(type) {\n\t return new _definition.GraphQLObjectType({\n\t name: type.name,\n\t description: type.description,\n\t interfaces: function interfaces() {\n\t return extendImplementedInterfaces(type);\n\t },\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t isTypeOf: type.isTypeOf\n\t });\n\t }\n\n\t function extendInterfaceType(type) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: type.name,\n\t description: type.description,\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendUnionType(type) {\n\t return new _definition.GraphQLUnionType({\n\t name: type.name,\n\t description: type.description,\n\t types: type.getTypes().map(getTypeFromDef),\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendImplementedInterfaces(type) {\n\t var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n\t // If there are any extensions to the interfaces, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.interfaces.forEach(function (namedType) {\n\t var interfaceName = namedType.name.value;\n\t if (interfaces.some(function (def) {\n\t return def.name === interfaceName;\n\t })) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n\t }\n\t interfaces.push(getInterfaceTypeFromAST(namedType));\n\t });\n\t });\n\t }\n\n\t return interfaces;\n\t }\n\n\t function extendFieldMap(type) {\n\t var newFieldMap = {};\n\t var oldFieldMap = type.getFields();\n\t Object.keys(oldFieldMap).forEach(function (fieldName) {\n\t var field = oldFieldMap[fieldName];\n\t newFieldMap[fieldName] = {\n\t description: field.description,\n\t deprecationReason: field.deprecationReason,\n\t type: extendFieldType(field.type),\n\t args: (0, _keyMap2.default)(field.args, function (arg) {\n\t return arg.name;\n\t }),\n\t resolve: field.resolve\n\t };\n\t });\n\n\t // If there are any extensions to the fields, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.fields.forEach(function (field) {\n\t var fieldName = field.name.value;\n\t if (oldFieldMap[fieldName]) {\n\t throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n\t }\n\t newFieldMap[fieldName] = {\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t type: buildOutputFieldType(field.type),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t });\n\t }\n\n\t return newFieldMap;\n\t }\n\n\t function extendFieldType(typeDef) {\n\t if (typeDef instanceof _definition.GraphQLList) {\n\t return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n\t }\n\t if (typeDef instanceof _definition.GraphQLNonNull) {\n\t return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n\t }\n\t return getTypeFromDef(typeDef);\n\t }\n\n\t function buildType(typeAST) {\n\t switch (typeAST.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t return buildObjectType(typeAST);\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t return buildInterfaceType(typeAST);\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t return buildUnionType(typeAST);\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t return buildScalarType(typeAST);\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t return buildEnumType(typeAST);\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t return buildInputObjectType(typeAST);\n\t }\n\t throw new TypeError('Unknown type kind ' + typeAST.kind);\n\t }\n\n\t function buildObjectType(typeAST) {\n\t return new _definition.GraphQLObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t interfaces: function interfaces() {\n\t return buildImplementedInterfaces(typeAST);\n\t },\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t }\n\t });\n\t }\n\n\t function buildInterfaceType(typeAST) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t },\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildUnionType(typeAST) {\n\t return new _definition.GraphQLUnionType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t types: typeAST.types.map(getObjectTypeFromAST),\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildScalarType(typeAST) {\n\t return new _definition.GraphQLScalarType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t serialize: function serialize(id) {\n\t return id;\n\t },\n\t // Note: validation calls the parse functions to determine if a\n\t // literal value is correct. Returning null would cause use of custom\n\t // scalars to always fail validation. Returning false causes them to\n\t // always pass validation.\n\t parseValue: function parseValue() {\n\t return false;\n\t },\n\t parseLiteral: function parseLiteral() {\n\t return false;\n\t }\n\t });\n\t }\n\n\t function buildEnumType(typeAST) {\n\t return new _definition.GraphQLEnumType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n\t return v.name.value;\n\t }, function () {\n\t return {};\n\t })\n\t });\n\t }\n\n\t function buildInputObjectType(typeAST) {\n\t return new _definition.GraphQLInputObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildInputValues(typeAST.fields);\n\t }\n\t });\n\t }\n\n\t function getDirective(directiveAST) {\n\t return new _directives.GraphQLDirective({\n\t name: directiveAST.name.value,\n\t locations: directiveAST.locations.map(function (node) {\n\t return node.value;\n\t }),\n\t args: directiveAST.arguments && buildInputValues(directiveAST.arguments)\n\t });\n\t }\n\n\t function buildImplementedInterfaces(typeAST) {\n\t return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n\t }\n\n\t function buildFieldMap(typeAST) {\n\t return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n\t return field.name.value;\n\t }, function (field) {\n\t return {\n\t type: buildOutputFieldType(field.type),\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t }\n\n\t function buildInputValues(values) {\n\t return (0, _keyValMap2.default)(values, function (value) {\n\t return value.name.value;\n\t }, function (value) {\n\t var type = buildInputFieldType(value.type);\n\t return {\n\t type: type,\n\t description: (0, _buildASTSchema.getDescription)(value),\n\t defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n\t };\n\t });\n\t }\n\n\t function buildInputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildInputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getInputTypeFromAST(typeAST);\n\t }\n\n\t function buildOutputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildOutputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getOutputTypeFromAST(typeAST);\n\t }\n\t}", "compactEntitySchema(schema, entity, transformedSchemas) {\n const reqEntity = transformedSchemas[entity['entityName']];\n reqEntity.entityName = entity['entityName'];\n reqEntity.name = entity['name'];\n reqEntity.columns = [];\n entity.columns.forEach(col => {\n let defaultValue = col.columnValue ? col.columnValue.defaultValue : '';\n const type = col.sqlType;\n if (type === 'number' && !col.primaryKey) {\n defaultValue = _.isEmpty(defaultValue) ? null : _.parseInt(defaultValue);\n }\n else if (type === 'boolean') {\n defaultValue = _.isEmpty(defaultValue) ? null : (defaultValue === 'true' ? 1 : 0);\n }\n else {\n defaultValue = _.isEmpty(defaultValue) ? null : defaultValue;\n }\n reqEntity.columns.push({\n name: col['name'],\n fieldName: col['fieldName'],\n generatorType: col['generatorType'],\n sqlType: col['sqlType'],\n primaryKey: col['primaryKey'],\n defaultValue: defaultValue\n });\n });\n _.forEach(entity.relations, r => {\n let targetEntitySchema, targetEntity, col, sourceColumn, mapping;\n if (r.cardinality === 'ManyToOne' || r.cardinality === 'OneToOne') {\n targetEntity = _.find(schema.tables, t => t.name === r.targetTable);\n mapping = r.mappings[0];\n if (targetEntity) {\n targetEntity = targetEntity.entityName;\n sourceColumn = mapping.sourceColumn;\n col = reqEntity.columns.find(column => column.name === sourceColumn);\n targetEntitySchema = schema.tables.find(table => table.name === r.targetTable);\n const foreignRelation = {\n sourceFieldName: r.fieldName,\n targetEntity: targetEntity,\n targetTable: r.targetTable,\n targetColumn: mapping.targetColumn,\n targetPath: '',\n dataMapper: [],\n targetFieldName: targetEntitySchema.columns.find(column => column.name === mapping.targetColumn).fieldName\n };\n foreignRelation.targetPath = foreignRelation.sourceFieldName + '.' + foreignRelation.targetFieldName;\n foreignRelation.dataMapper = _.chain(targetEntitySchema.columns)\n .keyBy(childCol => foreignRelation.sourceFieldName + '.' + childCol.fieldName)\n .mapValues(childCol => new ColumnInfo(childCol.name, childCol.fieldName)).value();\n col.foreignRelations = col.foreignRelations || [];\n col.foreignRelations.push(foreignRelation);\n }\n }\n });\n return reqEntity;\n }", "convertSchemaToAjvFormat (schema) {\n if (schema === null) return\n\n if (schema.type === 'string') {\n schema.fjs_type = 'string'\n schema.type = ['string', 'object']\n } else if (\n Array.isArray(schema.type) &&\n schema.type.includes('string') &&\n !schema.type.includes('object')\n ) {\n schema.fjs_type = 'string'\n schema.type.push('object')\n }\n for (const property in schema) {\n if (typeof schema[property] === 'object') {\n this.convertSchemaToAjvFormat(schema[property])\n }\n }\n }", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "getFieldsMap(schema) {\n const fieldsMap = {};\n const typesList = schema._typeMap;\n const builtInTypes = [\n \"String\",\n \"Int\",\n \"Float\",\n \"Boolean\",\n \"ID\",\n \"Query\",\n \"__Type\",\n \"__Field\",\n \"__EnumValue\",\n \"__DirectiveLocation\",\n \"__Schema\",\n \"__TypeKind\",\n \"__InputValue\",\n \"__Directive\",\n ];\n // exclude built-in types\n const customTypes = Object.keys(typesList).filter(\n (type) => !builtInTypes.includes(type) && type !== schema._queryType.name\n );\n for (const type of customTypes) {\n const fieldsObj = {};\n let fields = typesList[type]._fields;\n if (typeof fields === \"function\") fields = fields();\n for (const field in fields) {\n const key = fields[field].name;\n const value = fields[field].type.ofType\n ? fields[field].type.ofType.name\n : fields[field].type.name;\n fieldsObj[key] = value;\n }\n fieldsMap[type] = fieldsObj;\n }\n return fieldsMap;\n }", "function mergeTypeDefs (typeDefs) {\n const documents = typeDefs.map((document) => {\n if (typeof document === 'string') {\n return parse(document)\n }\n return document\n })\n const definitions = []\n\n documents.forEach((document) => {\n document.definitions.forEach(definition => {\n switch (definition.kind) {\n case 'ObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'ObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.interfaces = mergeInterfaces(existingDefinition.interfaces, definition.interfaces)\n return\n }\n break\n }\n case 'InterfaceTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InterfaceTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n case 'UnionTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'UnionTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.types = mergeUnionTypes(existingDefinition.types, definition.types)\n return\n }\n break\n }\n case 'EnumTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'EnumTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.values = mergeEnumValues(existingDefinition.values, definition.values)\n return\n }\n break\n }\n case 'InputObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InputObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeInputValues(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n }\n definitions.push(definition)\n })\n })\n\n return {\n kind: 'Document',\n definitions,\n }\n}", "function extendSchema(schema, documentAST, options) {\n Object(_type_schema__WEBPACK_IMPORTED_MODULE_8__[\"assertSchema\"])(schema);\n !(documentAST && documentAST.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DOCUMENT) ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'Must provide valid Document AST') : void 0;\n\n if (!options || !(options.assumeValid || options.assumeValidSDL)) {\n Object(_validation_validate__WEBPACK_IMPORTED_MODULE_7__[\"assertValidSDLExtension\"])(documentAST, schema);\n } // Collect the type definitions and extensions found in the document.\n\n\n var typeDefs = [];\n var typeExtsMap = Object.create(null); // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n\n var directiveDefs = [];\n var schemaDef; // Schema extensions are collected which may add additional operation types.\n\n var schemaExts = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = documentAST.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_DEFINITION) {\n schemaDef = def;\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_EXTENSION) {\n schemaExts.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeDefinitionNode\"])(def)) {\n typeDefs.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeExtensionNode\"])(def)) {\n var extendedTypeName = def.name.value;\n var existingTypeExts = typeExtsMap[extendedTypeName];\n typeExtsMap[extendedTypeName] = existingTypeExts ? existingTypeExts.concat([def]) : [def];\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DIRECTIVE_DEFINITION) {\n directiveDefs.push(def);\n }\n } // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (Object.keys(typeExtsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExts.length === 0 && !schemaDef) {\n return schema;\n }\n\n var schemaConfig = schema.toConfig();\n var astBuilder = new _buildASTSchema__WEBPACK_IMPORTED_MODULE_6__[\"ASTDefinitionBuilder\"](options, function (typeName) {\n var type = typeMap[typeName];\n !type ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, \"Unknown type: \\\"\".concat(typeName, \"\\\".\")) : void 0;\n return type;\n });\n var typeMap = Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(typeDefs, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildType(node);\n });\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = schemaConfig.types[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var existingType = _step2.value;\n typeMap[existingType.name] = extendNamedType(existingType);\n } // Get the extended root operation types.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var operationTypes = {\n query: schemaConfig.query && schemaConfig.query.name,\n mutation: schemaConfig.mutation && schemaConfig.mutation.name,\n subscription: schemaConfig.subscription && schemaConfig.subscription.name\n };\n\n if (schemaDef) {\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = schemaDef.operationTypes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref2 = _step3.value;\n var operation = _ref2.operation;\n var type = _ref2.type;\n operationTypes[operation] = type.name.value;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n } // Then, incorporate schema definition and all schema extensions.\n\n\n var _arr = schemaExts;\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var schemaExt = _arr[_i];\n\n if (schemaExt.operationTypes) {\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = schemaExt.operationTypes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _ref4 = _step4.value;\n var _operation = _ref4.operation;\n var _type = _ref4.type;\n operationTypes[_operation] = _type.name.value;\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n } // Support both original legacy names and extended legacy names.\n\n\n var allowedLegacyNames = schemaConfig.allowedLegacyNames.concat(options && options.allowedLegacyNames || []); // Then produce and return a Schema with these types.\n\n return new _type_schema__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLSchema\"]({\n // Note: While this could make early assertions to get the correctly\n // typed values, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n query: getMaybeTypeByName(operationTypes.query),\n mutation: getMaybeTypeByName(operationTypes.mutation),\n subscription: getMaybeTypeByName(operationTypes.subscription),\n types: Object(_polyfills_objectValues__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeMap),\n directives: getMergedDirectives(),\n astNode: schemaDef || schemaConfig.astNode,\n extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExts),\n allowedLegacyNames: allowedLegacyNames\n }); // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function replaceType(type) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isListType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLList\"](replaceType(type.ofType));\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isNonNullType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLNonNull\"](replaceType(type.ofType));\n }\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n return typeMap[type.name];\n }\n\n function getMaybeTypeByName(typeName) {\n return typeName ? typeMap[typeName] : null;\n }\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives().map(extendDirective);\n !existingDirectives ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'schema must have default directives') : void 0;\n return existingDirectives.concat(directiveDefs.map(function (node) {\n return astBuilder.buildDirective(node);\n }));\n }\n\n function extendNamedType(type) {\n if (Object(_type_introspection__WEBPACK_IMPORTED_MODULE_9__[\"isIntrospectionType\"])(type) || Object(_type_scalars__WEBPACK_IMPORTED_MODULE_10__[\"isSpecifiedScalarType\"])(type)) {\n // Builtin types are not extended.\n return type;\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isScalarType\"])(type)) {\n return extendScalarType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isObjectType\"])(type)) {\n return extendObjectType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInterfaceType\"])(type)) {\n return extendInterfaceType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isUnionType\"])(type)) {\n return extendUnionType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isEnumType\"])(type)) {\n return extendEnumType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInputObjectType\"])(type)) {\n return extendInputObjectType(type);\n } // Not reachable. All possible types have been considered.\n\n /* istanbul ignore next */\n\n\n throw new Error(\"Unexpected type: \\\"\".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type), \"\\\".\"));\n }\n\n function extendDirective(directive) {\n var config = directive.toConfig();\n return new _type_directives__WEBPACK_IMPORTED_MODULE_12__[\"GraphQLDirective\"](_objectSpread({}, config, {\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.args, extendArg)\n }));\n }\n\n function extendInputObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInputObjectType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, function (field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type)\n });\n }), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (field) {\n return field.name.value;\n }, function (field) {\n return astBuilder.buildInputField(field);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendEnumType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[type.name] || [];\n var valueNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.values || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLEnumType\"](_objectSpread({}, config, {\n values: _objectSpread({}, config.values, Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(valueNodes, function (value) {\n return value.name.value;\n }, function (value) {\n return astBuilder.buildEnumValue(value);\n })),\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendScalarType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLScalarType\"](_objectSpread({}, config, {\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var interfaceNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.interfaces || [];\n });\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLObjectType\"](_objectSpread({}, config, {\n interfaces: function interfaces() {\n return [].concat(type.getInterfaces().map(replaceNamedType), interfaceNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendInterfaceType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInterfaceType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendUnionType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var typeNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.types || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLUnionType\"](_objectSpread({}, config, {\n types: function types() {\n return [].concat(type.getTypes().map(replaceNamedType), typeNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendField(field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type),\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(field.args, extendArg)\n });\n }\n\n function extendArg(arg) {\n return _objectSpread({}, arg, {\n type: replaceType(arg.type)\n });\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "schemaVersion() {\r\n if (this.getType().indexOf(\":\") == -1)\r\n return 1;\r\n return 2;\r\n }", "refine(schema, _options) {\n // Don't modify the original schema which may be in use elsewhere\n schema = _.cloneDeep(schema);\n // Deep clone is not required here, we just want\n // to modify the addFields property\n const options = _.clone(_options);\n options.addFields = schema.concat(options.addFields || []);\n // The arrangeFields option is trickier because we've already\n // done a compose() and so the groups are now denormalized as\n // properties of each field. Reconstruct the old\n // arrangeFields option so we can concatenate the new one\n const oldArrangeFields = [];\n _.each(schema, function (field) {\n if (field.group) {\n let group = _.find(oldArrangeFields, { name: field.group.name });\n if (!group) {\n group = _.clone(field.group);\n group.fields = [];\n oldArrangeFields.push(group);\n }\n group.fields.push(field.name);\n }\n });\n options.arrangeFields = oldArrangeFields.concat(options.arrangeFields || []);\n return self.compose(options);\n }", "function graphqlSchemaVersion (newSchema, oldSchema = null, oldVersion = DEFAULT_VERSION) {\n if (!oldSchema) { return oldVersion }\n\n const increment = diffSchema(new Pair(newSchema, oldSchema)\n .map(normalizeSchema)\n .map(buildClientSchema))\n if (increment === INCREMENT_NONE) { return oldVersion }\n if (increment < INCREMENT_MINOR) { return semver.inc(oldVersion, 'patch') }\n if (increment < INCREMENT_MAJOR) { return semver.inc(oldVersion, 'minor') }\n if (increment === INCREMENT_MAJOR) { return semver.inc(oldVersion, 'major') }\n}", "schemafy(keys, schema) {\n return keys\n .concat(schema.required || [])\n .filter(key => this.isNotHidden(key, schema) || this.appGlobalsService.adminMode)\n .concat(schema.alwaysShow || [])\n .sort((a, b) => this.compareKeysBySchemaService.compare(a, b, schema))\n .toOrderedSet();\n }", "getPossibleTypes() {\n const seenTypes = new Set;\n function process(obj) {\n seenTypes.add(obj);\n for (const child of obj.getChildSchemas()) {\n if (seenTypes.has(child)) continue;\n // we know Base.key is SchemaRef\n process(child);\n }\n }\n process(this);\n return Array.from(seenTypes);\n }", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n description: (0, _buildASTSchema.getDescription)(directiveNode),\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function generateSchema(fields) {\r\n var schema = [];\r\n\r\n for (var i in fields) {\r\n var f = {};\r\n f['s0'] = fields[i].name;\r\n f['s1'] = fields[i].dataTypeID;\r\n f['s2'] = 'a' + i;\r\n\r\n // add it to the fields\r\n schema.push(f);\r\n }\r\n\r\n return schema;\r\n}", "getFields() {\n this.schema = this.props.collection._c2._simpleSchema._schema; // Using the provided Collection object, get the simpleSchema object\n\n if(this.props.useFields) // If we're selecting which fields to use\n {\n Object.keys(this.schema).filter((fieldName) => { // Filter (ie remove) this field from the schema by returning boolean\n if(this.props.useFields.indexOf(fieldName) === -1) // If this fieldName does not exist in the useFields array\n {\n delete this.schema[fieldName]; // We remove it from the forum schema\n }\n });\n }\n }", "function tighten(schema) {\n if (!isDefined(schema.type)) {\n if (isDefined(schema.properties)) {\n schema.type = 'object';\n }\n if (isDefined(schema.pattern)) {\n schema.type = 'string';\n }\n if (isDefined(schema.minLength) || isDefined(schema.maxLength)) {\n schema.type = 'string';\n }\n if (isDefined(schema.enum)) {\n var allStrings = _(schema.enum).all(function (item) {\n return typeof item === 'string';\n });\n if (allStrings) {\n schema.type = 'string';\n }\n }\n if (isDefined(schema.items)) {\n schema.type = 'array';\n }\n } else {\n if (_.isArray(schema.type)) {\n _.each(schema.type, function (unionType) {\n tighten(unionType);\n });\n }\n }\n if (!isDefined(schema.required)) {\n schema.required = true;\n }\n if (isDefined(schema.properties)) {\n _(schema.properties).each(function (propertySchema) {\n tighten(propertySchema);\n });\n if (!isDefined(schema.additionalProperties)) {\n schema.additionalProperties = false;\n }\n }\n if (isDefined(schema.items)) {\n if (_.isArray(schema.items)) {\n _.each(schema.items, function (item) {\n tighten(item);\n });\n if (!isDefined(schema.additionalItems)) {\n schema.additionalItems = false;\n }\n } else {\n tighten(schema.items);\n }\n }\n return schema;\n}", "buildDeleteFields(patchContext, origContext, schema){\n var deleteFields = [];\n // must remove nulls from the orig copy to sync with patchContext\n var origCopy = object.deepClone(origContext);\n origCopy = removeNulls(origCopy);\n var userGroups = JWT.getUserGroups();\n _.keys(origCopy).forEach((field, index) => {\n // if patchContext already has a value (such as admin edited\n // import_items fields), don't overwrite\n if(!isValueNull(patchContext[field])){\n return;\n }\n if(schema.properties[field]){\n var fieldSchema = object.getNestedProperty(schema, ['properties', field], true);\n if (!fieldSchema){\n return;\n }\n // skip calculated properties and exclude_from fields\n if (fieldSchema.calculatedProperty && fieldSchema.calculatedProperty === true){\n return;\n }\n if (fieldSchema.exclude_from && (_.contains(fieldSchema.exclude_from,'FFedit-create') || fieldSchema.exclude_from == 'FFedit-create')){\n return;\n }\n // if the user is admin, they already have these fields available;\n // only register as removed if admin did it intentionally\n if (fieldSchema.permission && fieldSchema.permission == \"import_items\"){\n if(_.contains(userGroups, 'admin')) deleteFields.push(field);\n return;\n }\n // check round two fields if the parameter roundTwo is set\n if(fieldSchema.ff_flag && fieldSchema.ff_flag == 'second round'){\n if(this.state.roundTwo) deleteFields.push(field);\n return;\n }\n // if we're here, the submission field was legitimately deleted\n if(!this.state.roundTwo) deleteFields.push(field);\n }\n });\n return deleteFields;\n }", "function mergeClientSchemas(...schemas) {\n\t// Merge types\n\tconst schema = mergeSchemas({ schemas });\n\n\t// Get the directives from each schema\n\tconst schemaDirectives = map(schemas, '_directives');\n\n\t// Merge directives by name (directives are ignored by mergeSchemas())\n\t/* eslint-disable-next-line no-underscore-dangle */\n\tschema._directives = uniqBy(concat(...schemaDirectives), 'name');\n\n\treturn schema;\n}", "getAdditionalSchemas() {\n const additionalSchemas = this.schemas.join('\\n');\n return additionalSchemas;\n }", "validate(schema, options) {\n schema.forEach(field => {\n // Infinite recursion prevention\n const key = `${options.type}:${options.subtype}.${field.name}`;\n if (!self.validatedSchemas[key]) {\n self.validatedSchemas[key] = true;\n self.validateField(field, options);\n }\n });\n }", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "function fieldmap_of(type, oldchain) {\n\n // TODO: add 'suppress' flag for field names starting with ~\n\n if (_.isEmpty(type)) return [];\n if (_.isArray(type)) { // handle anonymous types\n return _.map(type, function(field) {\n var node = {};\n if (_.isArray(field)) {\n var fieldmap = fieldmap_of(field[1]);\n node = {type: field[1]};\n if (!_.isEmpty(fieldmap)) node.recurse = fieldmap;\n return [field[0], node];\n } else {\n return [field, {type: default_type}];\n }\n });\n } else { // named type\n oldchain = oldchain || [];\n var newchain = type_chain(type, type_defs);\n if (_.isEmpty(newchain)) throw new Error('Unknown type: ' + type);\n var mergechain = _.flatten(_.map(oldchain, function(oldlink) {\n return _.reduce(newchain, function(memo, newlink) {\n return _.isArray(oldlink) && _.isArray(newlink) && oldlink[0] === newlink[0] ? memo.concat([newlink]) : memo;\n }, []);\n }));\n // collect and flatten subfields of mergechain links\n var chainfields = _.flatten(_.map(mergechain, function(link) {\n return _.map(link[1], sub => sub[0]);\n }));\n\n // subfields\n var subfields = _.flatten(_.map(newchain, function(link) {\n return _.compact(_.map(subfields_lookup[link[0]], function(field) {\n var name = _.isArray(field) ? field[0] : field;\n // skip if field already gathered by previous type\n if (chainfields.includes(name)) return false;\n if (_.isArray(field)) {\n return {name: field[0], type: field[1], chain: oldchain.concat(newchain)};\n } else {\n return {name: field};\n }\n }));\n }));\n\n // create node and recurse down\n return _.map(subfields, function(field) {\n if (!_.isEmpty(field.type)) {\n var recurse = fieldmap_of(field.type, field.chain);\n if (!_.isEmpty(recurse)) {\n return [field.name, {type: field.type, recurse: recurse}];\n } else {\n return [field.name, {type: field.type}];\n }\n } else {\n return [field.name, {type: default_type}];\n }\n });\n }\n }", "fixSchema(originalSchema, config) {\n let schema = cloneDeep(originalSchema);\n if (config) {\n schema = this.enrichSchemaWithConfig(schema, config);\n }\n schema = this.fixRecursively(schema);\n return schema;\n }", "fix(key, parent, schema) {\n if (schema.hidden) {\n return;\n }\n // Fixes for each type/condition, can be added below.\n const value = parent[key];\n // Recursive calls\n if (schema.type === 'object') {\n if (!schema.properties) {\n throw new Error(`\"${key}\"'s schema has \"type\": \"object\" but doesn't specify \"properties\"`);\n }\n else if (!(value instanceof Object)) {\n throw new Error(`\"${key}\" in ${JSON.stringify(value, null, 2)} is specified as \"object\" by schema but it is not an object in json`);\n }\n // Looping over record to filter out fields that are not in schema.\n Object.keys(value).forEach(prop => {\n if (!schema.properties[prop]) {\n // we don't like fields without schema!\n this.deleteField(value, prop);\n }\n else {\n this.fix(prop, value, schema.properties[prop]);\n }\n });\n }\n else if (schema.type === 'array') {\n if (!schema.items) {\n throw new Error(`\"${key}\"'s schema has \"type\": \"array\" but doesn't specify \"items\"`);\n }\n else if (!Array.isArray(value)) {\n throw new Error(`\"${key}\" in ${JSON.stringify(value, null, 2)} is specified as \"array\" by schema but it is not an array in json`);\n }\n value.forEach((element, index) => {\n this.fix(index, value, schema.items);\n });\n }\n }", "_diffTables(oTable, nTable) {\n\t\tconst oTableName = oTable.tableName;\n\t\tconst nTableName = nTable.tableName;\n\t\tconst tableNameHasChanged = oTableName !== nTableName;\n\t\tconst {\n\t\t\tcharset: nCharset,\n\t\t\tcollation: nCollation,\n\t\t\tcolumns: nColumns\n\t\t} = nTable.schema;\n\n\t\tconst {\n\t\t\tcharset: oCharset,\n\t\t\tcollation: oCollation,\n\t\t\tcolumns: oColumns\n\t\t} = oTable.schema;\n\n\t\tif ( tableNameHasChanged ) {\n\t\t\tthis._renameTable('up', oTableName, nTableName);\n\t\t\tthis._renameTable('dn', nTableName, oTableName);\n\t\t}\n\n\t\tif ( (nCharset !== oCharset) || (nCollation !== oCollation) ) {\n\t\t\tthis._changeTableCharset('up', nTableName, nCharset, nCollation, oCharset, oCollation);\n\t\t\tthis._changeTableCharset('dn', oTableName, oCharset,oCollation);\n\t\t}\n\n\t\tconst columnsDiff = deepDiff(oColumns, nColumns) || [];\n\t\tcolumnsDiff.forEach(d => {\n\t\t\tconst colName = d.path[0];\n\t\t\t// 'N' indicates a newly added property/element\n\t\t\tif (d.kind === 'N') {\n\t\t\t\tconst nCol = nColumns[colName];\n\t\t\t\tthis._addColumn('up', nTableName, colName, nCol);\n\t\t\t\tthis._dropColumn('dn', nTableName, colName);\n\t\t\t}\n\t\t\t// 'E' indicates a property/element was edited\n\t\t\t// 'A' indicates a change occurred within an array\n\t\t\telse if (d.kind === 'E' || d.kind === 'A') {\n\t\t\t\tconst nCol = nColumns[colName];\n\t\t\t\tconst oCol = oColumns[colName];\n\t\t\t\tthis._alterColumn('up', nTableName, colName, nCol);\n\t\t\t\tthis._alterColumn('dn', oTableName, colName, oCol);\n\t\t\t}\n\t\t\t// 'D' indicates a property/element was deleted\n\t\t\t// Changin `if (d.kind === 'D')` into `else`\n\t\t\t// Point? Fixing istanbul coverage report.\n\t\t\t// The `d.kind` can only be `D` anyways and relevant tests are passed!\n\t\t\telse {\n\t\t\t\tthis._dropColumn('up', nTableName, colName);\n\t\t\t\tthis._addColumn('dn', oTableName, colName, oColumns[colName]);\n\t\t\t}\n\t\t});\n\n\t\tthis._diffTableIndexes(oTable, nTable);\n\t}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isPossibleType(typeA, typeB);\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "fixAnyOf(schema) {\n const anyOf = schema.anyOf;\n // find existence count of all enum properties in anyOf elements\n // the reason of this, a field could be enum type for some and not for some other anyOf element\n const enumPropCount = {};\n anyOf.forEach(anyOfElement => {\n Object.keys(anyOfElement.properties)\n .filter(prop => anyOfElement.properties[prop].enum)\n .forEach(prop => {\n if (!enumPropCount[prop]) {\n enumPropCount[prop] = 0;\n }\n enumPropCount[prop]++;\n });\n });\n // combine all enum arrays in anyOf elements\n const enums = {};\n Object.keys(enumPropCount)\n .forEach(prop => {\n anyOf.forEach(anyOfElement => {\n if (!enums[prop]) {\n enums[prop] = [];\n }\n const enumValues = anyOfElement.properties[prop].enum;\n // check if current field is enum for current anyOf element\n if (enumValues) {\n enums[prop] = enums[prop].concat(enumValues);\n }\n });\n });\n const fixedSchema = anyOf[0];\n // shallow cleaning of format and pattern\n Object.keys(fixedSchema.properties)\n .forEach(prop => {\n delete fixedSchema.properties[prop].format;\n delete fixedSchema.properties[prop].pattern;\n });\n Object.keys(enumPropCount)\n .forEach(prop => {\n const uniqueEnumValues = Array.from(new Set(enums[prop]));\n // if a field enum for all anyOf elements\n if (enumPropCount[prop] === anyOf.length) {\n // merge all enum values into one\n fixedSchema.properties[prop].enum = uniqueEnumValues;\n // if a field enum for some of anyOf elements\n }\n else {\n // create a autocomplete config so that it will allow any values\n // but autocomplete from enum values from where the field is defined as enum\n delete fixedSchema.properties[prop].enum;\n fixedSchema.properties[prop].autocompletionConfig = {\n source: uniqueEnumValues,\n size: 7\n };\n }\n });\n // copy disabled attribute inside fixedSchema because it\n // is outside anyOf element and is ignored\n if (schema.disabled) {\n fixedSchema.disabled = true;\n }\n return fixedSchema;\n }", "isEqual(req, schema, one, two) {\n for (const field of schema) {\n const fieldType = self.fieldTypes[field.type];\n if (!fieldType.isEqual) {\n if ((!_.isEqual(one[field.name], two[field.name])) &&\n !((one[field.name] == null) && (two[field.name] == null))) {\n return false;\n }\n } else {\n if (!fieldType.isEqual(req, field, one, two)) {\n return false;\n }\n }\n }\n return true;\n }", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "visibleSchema() {\n if (this.field.style !== 'table') {\n return this.schema;\n }\n const currentItem = this.items.find(item => item.open) || this.items[this.items.length - 1];\n const conditions = this.conditionalFields(currentItem?.schemaInput?.data || {});\n return this.schema.filter(\n field => conditions[field.name] !== false\n );\n }", "function FieldsOnCorrectType(context) {\n return {\n Field: function Field(node) {\n var type = context.getParentType();\n if (type) {\n var fieldDef = context.getFieldDef();\n if (!fieldDef) {\n // This isn't valid. Let's find suggestions, if any.\n var suggestedTypes = [];\n if ((0, _typeDefinition.isAbstractType)(type)) {\n suggestedTypes = getSiblingInterfacesIncludingField(type, node.name.value);\n suggestedTypes = suggestedTypes.concat(getImplementationsIncludingField(type, node.name.value));\n }\n context.reportError(new _error.GraphQLError(undefinedFieldMessage(node.name.value, type.name, suggestedTypes), [node]));\n }\n }\n }\n };\n}", "function reallyDo() {\n var fields = [];\n if (issue_type) {\n var viable_actions = transaction_attributes[issue_type].actions;\n fields = viable_actions[transaction_type].fields;\n }\n if (transaction_type != \"issue certificate\") {\n type_list.splice(defaultTypes.length, type_list.length); // remove anything past the defaultTypes\n } else {\n type_list.splice(0); // no default annotation types for certificates\n type_list.push({name: \"transferForm\", display: \"Transfer Form\", typename: \"text\"});\n }\n for (var t in variableDefaultTypes) {\n type_list.push(variableDefaultTypes[t]);\n }\n var tmp_array = [];\n for (var field in fields) {\n var f = fields[field];\n tmp_array.push({name: f.name, display: f.display_name, required: f.required, typename: f.typname, labels: f.labels});\n }\n if (tmp_array.length > 0 && transaction_type != \"issue certificate\") {\n // only add effective date if we're definitely in a transaction\n var display = \"Effective Date\";\n if ((issue_type == \"Equity Common\" && transaction_type == \"grant\") ||\n (issue_type == \"Equity\" && transaction_type == \"grant\") ||\n (issue_type == \"Debt\" && transaction_type == \"purchase\") ||\n (issue_type == \"Convertible Debt\" && transaction_type == \"purchase\") ||\n (issue_type == \"Safe\" && transaction_type == \"grant\")) {\n display = \"investment date\";\n } else if ((issue_type == \"Option\" && transaction_type == \"grant\") ||\n (issue_type == \"Warrant\" && transaction_type == \"grant\")) {\n display = \"grant date\";\n }\n tmp_array.push({name: 'effective_date', display: display, required: true, typename: 'date'});\n }\n // add new types onto the end (in one action, without changing the reference, for performance reasons)\n var args = [type_list.length, 0].concat(tmp_array);\n Array.prototype.splice.apply(type_list, args);\n // TODO: remove duplicate types, favoring the transaction type\n annotation_list.forEach(function(annot) {\n annot.updateTypeInfo(type_list);\n });\n }" ]
[ "0.81117535", "0.78107697", "0.77804893", "0.77804893", "0.7756349", "0.7756349", "0.77397376", "0.7731341", "0.7702492", "0.7565131", "0.73513144", "0.728823", "0.728823", "0.70311517", "0.70311517", "0.69454265", "0.68164635", "0.68164635", "0.68164635", "0.6685037", "0.668212", "0.66233283", "0.6590712", "0.6483144", "0.6483144", "0.6483144", "0.6483144", "0.6382631", "0.6382631", "0.63667053", "0.63565314", "0.6340792", "0.6330633", "0.60968083", "0.6015735", "0.58039635", "0.58039635", "0.57539535", "0.55188507", "0.55057484", "0.5445515", "0.5445515", "0.5437154", "0.53945655", "0.5220826", "0.5220826", "0.5205957", "0.51634467", "0.5131434", "0.5120861", "0.49336153", "0.49063665", "0.48853824", "0.48809707", "0.4846844", "0.4846844", "0.47912192", "0.47912192", "0.4790824", "0.4790824", "0.47753108", "0.4769558", "0.47671095", "0.47612152", "0.47432896", "0.4726227", "0.47174284", "0.46865922", "0.46865922", "0.46859893", "0.46852916", "0.46763083", "0.46649376", "0.4663896", "0.46610737", "0.46610737", "0.46550724", "0.46550724", "0.46468806", "0.4639445", "0.46114293", "0.46059304", "0.4597413", "0.4589482", "0.45879754", "0.45872164", "0.45872164", "0.45331776", "0.45281518", "0.45266122", "0.4525116", "0.45247272", "0.45055294", "0.4492395", "0.44900024", "0.44900024", "0.4487584", "0.4485583", "0.44796824" ]
0.7791692
3
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to removing types from a union type.
function findTypesRemovedFromUnions(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var typesRemovedFromUnion = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) { return; } var typeNamesInNewUnion = Object.create(null); newType.getTypes().forEach(function (type) { typeNamesInNewUnion[type.name] = true; }); oldType.getTypes().forEach(function (type) { if (!typeNamesInNewUnion[type.name]) { typesRemovedFromUnion.push({ type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, description: type.name + ' was removed from union type ' + typeName + '.' }); } }); }); return typesRemovedFromUnion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_REMOVED,\n\t description: typeName + ' was removed.'\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr = Object.keys(oldTypeMap);\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var typeName = _arr[_i];\n\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: \"\".concat(typeName, \" was removed.\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr2 = Object.keys(oldTypeMap);\n\n for (var _i2 = 0; _i2 < _arr2.length; _i2++) {\n var typeName = _arr2[_i2];\n\n if (!newTypeMap[typeName]) {\n continue;\n }\n\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (oldType.constructor !== newType.constructor) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: \"\".concat(typeName, \" changed from \") + \"\".concat(typeKindName(oldType), \" to \").concat(typeKindName(newType), \".\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t return;\n\t }\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof newType.constructor)) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_CHANGED_KIND,\n\t description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesAddedToUnion = [];\n Object.keys(newTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInOldUnion = Object.create(null);\n oldType.getTypes().forEach(function (type) {\n typeNamesInOldUnion[type.name] = true;\n });\n newType.getTypes().forEach(function (type) {\n if (!typeNamesInOldUnion[type.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: type.name + ' was added to union type ' + typeName + '.'\n });\n }\n });\n });\n return typesAddedToUnion;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n\t return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema));\n\t}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType || oldType instanceof _definition.GraphQLInputObjectType) || !(newType instanceof oldType.constructor)) {\n\t return;\n\t }\n\n\t var oldTypeFieldsDef = oldType.getFields();\n\t var newTypeFieldsDef = newType.getFields();\n\t Object.keys(oldTypeFieldsDef).forEach(function (fieldName) {\n\t // Check if the field is missing on the type in the new schema.\n\t if (!(fieldName in newTypeFieldsDef)) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_REMOVED,\n\t description: typeName + '.' + fieldName + ' was removed.'\n\t });\n\t } else {\n\t // Check if the field's type has changed in the new schema.\n\t var oldFieldType = (0, _definition.getNamedType)(oldTypeFieldsDef[fieldName].type);\n\t var newFieldType = (0, _definition.getNamedType)(newTypeFieldsDef[fieldName].type);\n\t if (oldFieldType && newFieldType && oldFieldType.name !== newFieldType.name) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_CHANGED_KIND,\n\t description: typeName + '.' + fieldName + ' changed type from ' + (oldFieldType.name + ' to ' + newFieldType.name + '.')\n\t });\n\t }\n\t }\n\t });\n\t });\n\t return breakingFieldChanges;\n\t}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).breakingChanges, findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema), findRemovedDirectives(oldSchema, newSchema), findRemovedDirectiveArgs(oldSchema, newSchema), findAddedNonNullDirectiveArgs(oldSchema, newSchema), findRemovedDirectiveLocations(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInNewEnum = Object.create(null);\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = newType.getValues()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var value = _step7.value;\n valuesInNewEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = oldType.getValues()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _value = _step8.value;\n\n if (!valuesInNewEnum[_value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: \"\".concat(_value.name, \" was removed from enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n }\n\n return valuesRemovedFromEnums;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findInterfacesAddedToObjectTypes(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).dangerousChanges);\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges);\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var valuesRemovedFromEnums = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n\t return;\n\t }\n\t var valuesInNewEnum = Object.create(null);\n\t newType.getValues().forEach(function (value) {\n\t valuesInNewEnum[value.name] = true;\n\t });\n\t oldType.getValues().forEach(function (value) {\n\t if (!valuesInNewEnum[value.name]) {\n\t valuesRemovedFromEnums.push({\n\t type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n\t description: value.name + ' was removed from enum type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return valuesRemovedFromEnums;\n\t}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n var dangerousChanges = [];\n\n var _arr3 = Object.keys(oldTypeMap);\n\n for (var _i3 = 0; _i3 < _arr3.length; _i3++) {\n var typeName = _arr3[_i3];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(oldType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(oldType)) || !(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(newType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(newType)) || newType.constructor !== oldType.constructor) {\n continue;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n var _arr4 = Object.keys(oldTypeFields);\n\n for (var _i4 = 0; _i4 < _arr4.length; _i4++) {\n var fieldName = _arr4[_i4];\n\n if (!newTypeFields[fieldName]) {\n continue;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var oldArgDef = _step.value;\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(newArgs, function (arg) {\n return arg.name === oldArgDef.name;\n }); // Arg not present\n\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" was removed\")\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed type from \") + \"\".concat(oldArgDef.type.toString(), \" to \").concat(newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed defaultValue\")\n });\n }\n }\n };\n\n for (var _iterator = oldTypeFields[fieldName].args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n _loop();\n } // Check if arg was added to the field\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n var _loop2 = function _loop2() {\n var newArgDef = _step2.value;\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(oldArgs, function (arg) {\n return arg.name === newArgDef.name;\n });\n\n if (!oldArgDef) {\n var argName = newArgDef.name;\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isRequiredArgument\"])(newArgDef)) {\n breakingChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: \"A required arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n } else {\n dangerousChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: \"An optional arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n }\n }\n };\n\n for (var _iterator2 = newTypeFields[fieldName].args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n _loop2();\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "stripIfExcludedOrgType(types, schema) {\n return Joi.when(Joi.ref('organisationType'), {\n is: Joi.exist().valid(...types),\n then: Joi.any().strip(),\n otherwise: schema,\n });\n }", "function mergeClientSchemas(...schemas) {\n\t// Merge types\n\tconst schema = mergeSchemas({ schemas });\n\n\t// Get the directives from each schema\n\tconst schemaDirectives = map(schemas, '_directives');\n\n\t// Merge directives by name (directives are ignored by mergeSchemas())\n\t/* eslint-disable-next-line no-underscore-dangle */\n\tschema._directives = uniqBy(concat(...schemaDirectives), 'name');\n\n\treturn schema;\n}", "function schemaDiff(comparison) {\n\t// TODO\n\t// TODO\n}", "function processSchema(schema, schemaKey, sourceSchemas, newSchemas, preserveUnneeded) {\n /*\n * Most schemas have a name. However, not all do. We must nevertheless expose those schemas as they have root\n * operations on them. Thus, we convert the key into a form that can be used to identify them.\n */\n schema.name = schemaKeyToTypeName(schemaKey, sourceSchemas);\n\n // If this schema has already been processed (see recursive call, below), return it\n if (newSchemas[schema.name]) {\n return newSchemas[schema.name];\n }\n\n newSchemas[schema.name] = schema;\n\n if (schema.root) {\n schema.rootTypeName = schema.name;\n }\n\n // Process the parent schema, if any. This assumes all extends schemas have just a $ref property.\n var parentSchema = schema.extends;\n if (parentSchema) {\n schema.parentSchema = processSchema(sourceSchemas[parentSchema.$ref], parentSchema.$ref,\n sourceSchemas, newSchemas);\n parentSchema.$ref = schemaKeyToTypeName(parentSchema.$ref, sourceSchemas);\n parentSchema = schema.parentSchema;\n\n if (!schema.rootTypeName) {\n schema.rootTypeName = parentSchema.rootTypeName;\n }\n\n schema.root = schema.root || parentSchema.root;\n }\n\n if (!preserveUnneeded) {\n delete schema.description;\n }\n\n processProperties(schema, parentSchema, sourceSchemas, preserveUnneeded);\n processOperations(schema, parentSchema, sourceSchemas);\n\n return schema;\n}", "getPossibleTypes() {\n const seenTypes = new Set;\n function process(obj) {\n seenTypes.add(obj);\n for (const child of obj.getChildSchemas()) {\n if (seenTypes.has(child)) continue;\n // we know Base.key is SchemaRef\n process(child);\n }\n }\n process(this);\n return Array.from(seenTypes);\n }", "function getDiffs(oldDoc, newDoc) {\n const changes = new Array();\n const flatOld = flattenObject(oldDoc);\n const flatNew = flattenObject(newDoc);\n // find deleted nodes\n Object.keys(flatOld).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatNew, key)) {\n changes.push({\n action: 'DELETED',\n keyName: key,\n });\n }\n });\n // find added nodes\n Object.keys(flatNew).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatOld, key)) {\n changes.push({\n action: 'ADDED',\n keyName: key,\n });\n }\n });\n // find updated nodes\n Object.keys(flatOld).forEach(key => {\n let oldValue = flatOld[key];\n if (Array.isArray(oldValue)) {\n oldValue = oldValue.join(', ');\n }\n let newValue = flatNew[key];\n if (newValue) {\n if (Array.isArray(newValue)) {\n newValue = newValue.join(', ');\n }\n if (newValue !== oldValue && key !== 'revision' && key !== 'etag') {\n changes.push({\n action: 'CHANGED',\n keyName: key,\n });\n }\n }\n });\n return changes;\n}", "fixOptionalChoiceNot(jsonSchema, node) {\n const originalOneOf = new JsonSchemaFile();\n originalOneOf.oneOf = jsonSchema.oneOf.slice(0);\n jsonSchema.anyOf.push(originalOneOf);\n const theOptionalPart = new JsonSchemaFile();\n jsonSchema.oneOf.forEach(function(option, index, array) {\n const notSchema = new JsonSchemaFile();\n notSchema.not = option;\n theOptionalPart.allOf.push(notSchema);\n });\n jsonSchema.anyOf.push(theOptionalPart);\n jsonSchema.oneOf = [];\n }", "function myProductsWithoutDescription(products) {\n\tlet newArray = [];\n\tfor (const product of products) {\n\t\tdelete product.description;\n\t\tnewArray.push(product);\n\t}\n\treturn newArray;\n}", "fixAnyOf(schema) {\n const anyOf = schema.anyOf;\n // find existence count of all enum properties in anyOf elements\n // the reason of this, a field could be enum type for some and not for some other anyOf element\n const enumPropCount = {};\n anyOf.forEach(anyOfElement => {\n Object.keys(anyOfElement.properties)\n .filter(prop => anyOfElement.properties[prop].enum)\n .forEach(prop => {\n if (!enumPropCount[prop]) {\n enumPropCount[prop] = 0;\n }\n enumPropCount[prop]++;\n });\n });\n // combine all enum arrays in anyOf elements\n const enums = {};\n Object.keys(enumPropCount)\n .forEach(prop => {\n anyOf.forEach(anyOfElement => {\n if (!enums[prop]) {\n enums[prop] = [];\n }\n const enumValues = anyOfElement.properties[prop].enum;\n // check if current field is enum for current anyOf element\n if (enumValues) {\n enums[prop] = enums[prop].concat(enumValues);\n }\n });\n });\n const fixedSchema = anyOf[0];\n // shallow cleaning of format and pattern\n Object.keys(fixedSchema.properties)\n .forEach(prop => {\n delete fixedSchema.properties[prop].format;\n delete fixedSchema.properties[prop].pattern;\n });\n Object.keys(enumPropCount)\n .forEach(prop => {\n const uniqueEnumValues = Array.from(new Set(enums[prop]));\n // if a field enum for all anyOf elements\n if (enumPropCount[prop] === anyOf.length) {\n // merge all enum values into one\n fixedSchema.properties[prop].enum = uniqueEnumValues;\n // if a field enum for some of anyOf elements\n }\n else {\n // create a autocomplete config so that it will allow any values\n // but autocomplete from enum values from where the field is defined as enum\n delete fixedSchema.properties[prop].enum;\n fixedSchema.properties[prop].autocompletionConfig = {\n source: uniqueEnumValues,\n size: 7\n };\n }\n });\n // copy disabled attribute inside fixedSchema because it\n // is outside anyOf element and is ignored\n if (schema.disabled) {\n fixedSchema.disabled = true;\n }\n return fixedSchema;\n }", "function markListOperations(schemas) {\n _.each(schemas, function(schema) {\n if (schema.list) {\n if (_.isEmpty(schema.list.parameters)) {\n schema.list.dxFilterMode = dx.core.constants.LIST_TYPES.NONE;\n } else {\n var missingMapsTo = false;\n _.any(schema.list.parameters, function(param) {\n if (!param.mapsTo) {\n missingMapsTo = true;\n return true;\n }\n });\n schema.list.dxFilterMode = missingMapsTo ? dx.core.constants.LIST_TYPES.CUSTOM :\n dx.core.constants.LIST_TYPES.UBER;\n }\n }\n });\n}", "function extendSchema(schema, documentAST, options) {\n Object(_type_schema__WEBPACK_IMPORTED_MODULE_8__[\"assertSchema\"])(schema);\n !(documentAST && documentAST.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DOCUMENT) ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'Must provide valid Document AST') : void 0;\n\n if (!options || !(options.assumeValid || options.assumeValidSDL)) {\n Object(_validation_validate__WEBPACK_IMPORTED_MODULE_7__[\"assertValidSDLExtension\"])(documentAST, schema);\n } // Collect the type definitions and extensions found in the document.\n\n\n var typeDefs = [];\n var typeExtsMap = Object.create(null); // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n\n var directiveDefs = [];\n var schemaDef; // Schema extensions are collected which may add additional operation types.\n\n var schemaExts = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = documentAST.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_DEFINITION) {\n schemaDef = def;\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_EXTENSION) {\n schemaExts.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeDefinitionNode\"])(def)) {\n typeDefs.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeExtensionNode\"])(def)) {\n var extendedTypeName = def.name.value;\n var existingTypeExts = typeExtsMap[extendedTypeName];\n typeExtsMap[extendedTypeName] = existingTypeExts ? existingTypeExts.concat([def]) : [def];\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DIRECTIVE_DEFINITION) {\n directiveDefs.push(def);\n }\n } // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (Object.keys(typeExtsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExts.length === 0 && !schemaDef) {\n return schema;\n }\n\n var schemaConfig = schema.toConfig();\n var astBuilder = new _buildASTSchema__WEBPACK_IMPORTED_MODULE_6__[\"ASTDefinitionBuilder\"](options, function (typeName) {\n var type = typeMap[typeName];\n !type ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, \"Unknown type: \\\"\".concat(typeName, \"\\\".\")) : void 0;\n return type;\n });\n var typeMap = Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(typeDefs, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildType(node);\n });\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = schemaConfig.types[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var existingType = _step2.value;\n typeMap[existingType.name] = extendNamedType(existingType);\n } // Get the extended root operation types.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var operationTypes = {\n query: schemaConfig.query && schemaConfig.query.name,\n mutation: schemaConfig.mutation && schemaConfig.mutation.name,\n subscription: schemaConfig.subscription && schemaConfig.subscription.name\n };\n\n if (schemaDef) {\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = schemaDef.operationTypes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref2 = _step3.value;\n var operation = _ref2.operation;\n var type = _ref2.type;\n operationTypes[operation] = type.name.value;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n } // Then, incorporate schema definition and all schema extensions.\n\n\n var _arr = schemaExts;\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var schemaExt = _arr[_i];\n\n if (schemaExt.operationTypes) {\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = schemaExt.operationTypes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _ref4 = _step4.value;\n var _operation = _ref4.operation;\n var _type = _ref4.type;\n operationTypes[_operation] = _type.name.value;\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n } // Support both original legacy names and extended legacy names.\n\n\n var allowedLegacyNames = schemaConfig.allowedLegacyNames.concat(options && options.allowedLegacyNames || []); // Then produce and return a Schema with these types.\n\n return new _type_schema__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLSchema\"]({\n // Note: While this could make early assertions to get the correctly\n // typed values, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n query: getMaybeTypeByName(operationTypes.query),\n mutation: getMaybeTypeByName(operationTypes.mutation),\n subscription: getMaybeTypeByName(operationTypes.subscription),\n types: Object(_polyfills_objectValues__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeMap),\n directives: getMergedDirectives(),\n astNode: schemaDef || schemaConfig.astNode,\n extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExts),\n allowedLegacyNames: allowedLegacyNames\n }); // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function replaceType(type) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isListType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLList\"](replaceType(type.ofType));\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isNonNullType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLNonNull\"](replaceType(type.ofType));\n }\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n return typeMap[type.name];\n }\n\n function getMaybeTypeByName(typeName) {\n return typeName ? typeMap[typeName] : null;\n }\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives().map(extendDirective);\n !existingDirectives ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'schema must have default directives') : void 0;\n return existingDirectives.concat(directiveDefs.map(function (node) {\n return astBuilder.buildDirective(node);\n }));\n }\n\n function extendNamedType(type) {\n if (Object(_type_introspection__WEBPACK_IMPORTED_MODULE_9__[\"isIntrospectionType\"])(type) || Object(_type_scalars__WEBPACK_IMPORTED_MODULE_10__[\"isSpecifiedScalarType\"])(type)) {\n // Builtin types are not extended.\n return type;\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isScalarType\"])(type)) {\n return extendScalarType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isObjectType\"])(type)) {\n return extendObjectType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInterfaceType\"])(type)) {\n return extendInterfaceType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isUnionType\"])(type)) {\n return extendUnionType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isEnumType\"])(type)) {\n return extendEnumType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInputObjectType\"])(type)) {\n return extendInputObjectType(type);\n } // Not reachable. All possible types have been considered.\n\n /* istanbul ignore next */\n\n\n throw new Error(\"Unexpected type: \\\"\".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type), \"\\\".\"));\n }\n\n function extendDirective(directive) {\n var config = directive.toConfig();\n return new _type_directives__WEBPACK_IMPORTED_MODULE_12__[\"GraphQLDirective\"](_objectSpread({}, config, {\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.args, extendArg)\n }));\n }\n\n function extendInputObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInputObjectType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, function (field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type)\n });\n }), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (field) {\n return field.name.value;\n }, function (field) {\n return astBuilder.buildInputField(field);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendEnumType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[type.name] || [];\n var valueNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.values || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLEnumType\"](_objectSpread({}, config, {\n values: _objectSpread({}, config.values, Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(valueNodes, function (value) {\n return value.name.value;\n }, function (value) {\n return astBuilder.buildEnumValue(value);\n })),\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendScalarType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLScalarType\"](_objectSpread({}, config, {\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var interfaceNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.interfaces || [];\n });\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLObjectType\"](_objectSpread({}, config, {\n interfaces: function interfaces() {\n return [].concat(type.getInterfaces().map(replaceNamedType), interfaceNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendInterfaceType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInterfaceType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendUnionType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var typeNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.types || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLUnionType\"](_objectSpread({}, config, {\n types: function types() {\n return [].concat(type.getTypes().map(replaceNamedType), typeNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendField(field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type),\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(field.args, extendArg)\n });\n }\n\n function extendArg(arg) {\n return _objectSpread({}, arg, {\n type: replaceType(arg.type)\n });\n }\n}", "function mergeTypeDefs (typeDefs) {\n const documents = typeDefs.map((document) => {\n if (typeof document === 'string') {\n return parse(document)\n }\n return document\n })\n const definitions = []\n\n documents.forEach((document) => {\n document.definitions.forEach(definition => {\n switch (definition.kind) {\n case 'ObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'ObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.interfaces = mergeInterfaces(existingDefinition.interfaces, definition.interfaces)\n return\n }\n break\n }\n case 'InterfaceTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InterfaceTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n case 'UnionTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'UnionTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.types = mergeUnionTypes(existingDefinition.types, definition.types)\n return\n }\n break\n }\n case 'EnumTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'EnumTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.values = mergeEnumValues(existingDefinition.values, definition.values)\n return\n }\n break\n }\n case 'InputObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InputObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeInputValues(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n }\n definitions.push(definition)\n })\n })\n\n return {\n kind: 'Document',\n definitions,\n }\n}", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function diff(first, second) {\n const a = new Set(first);\n const b = new Set(second);\n \n return [\n ...first.filter(x => !b.has(x)),\n ...second.filter(x => !a.has(x))\n ];\n}", "function patchSchema(data) {\n data.properties.upload_type.enum = data.properties.upload_type.type.enum;\n data.properties.upload_type.type = \"string\";\n data.properties.publication_type.enum =\n data.properties.publication_type.type.enum;\n data.properties.publication_type.type = \"string\";\n data.properties.image_type.enum = data.properties.image_type.type.enum;\n data.properties.image_type.type = \"string\";\n return data;\n}", "static filterUnexpectedData(orig, startingData, schema) {\n const data = Object.assign({}, startingData);\n Object.keys(schema.describe().children).forEach(key => {\n data[key] = orig[key];\n });\n return data;\n }", "schemafy(keys, schema) {\n return keys\n .concat(schema.required || [])\n .filter(key => this.isNotHidden(key, schema) || this.appGlobalsService.adminMode)\n .concat(schema.alwaysShow || [])\n .sort((a, b) => this.compareKeysBySchemaService.compare(a, b, schema))\n .toOrderedSet();\n }", "function extendSchema(schema, documentAST) {\n\t (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n\t (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n\t // Collect the type definitions and extensions found in the document.\n\t var typeDefinitionMap = {};\n\t var typeExtensionsMap = {};\n\n\t // New directives and types are separate because a directives and types can\n\t // have the same name. For example, a type named \"skip\".\n\t var directiveDefinitions = [];\n\n\t for (var i = 0; i < documentAST.definitions.length; i++) {\n\t var def = documentAST.definitions[i];\n\t switch (def.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t // Sanity check that none of the defined types conflict with the\n\t // schema's existing types.\n\t var typeName = def.name.value;\n\t if (schema.getType(typeName)) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n\t }\n\t typeDefinitionMap[typeName] = def;\n\t break;\n\t case _kinds.TYPE_EXTENSION_DEFINITION:\n\t // Sanity check that this type extension exists within the\n\t // schema's existing types.\n\t var extendedTypeName = def.definition.name.value;\n\t var existingType = schema.getType(extendedTypeName);\n\t if (!existingType) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n\t }\n\t if (!(existingType instanceof _definition.GraphQLObjectType)) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n\t }\n\t var extensions = typeExtensionsMap[extendedTypeName];\n\t if (extensions) {\n\t extensions.push(def);\n\t } else {\n\t extensions = [def];\n\t }\n\t typeExtensionsMap[extendedTypeName] = extensions;\n\t break;\n\t case _kinds.DIRECTIVE_DEFINITION:\n\t var directiveName = def.name.value;\n\t var existingDirective = schema.getDirective(directiveName);\n\t if (existingDirective) {\n\t throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n\t }\n\t directiveDefinitions.push(def);\n\t break;\n\t }\n\t }\n\n\t // If this document contains no new types, extensions, or directives then\n\t // return the same unmodified GraphQLSchema instance.\n\t if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n\t return schema;\n\t }\n\n\t // A cache to use to store the actual GraphQLType definition objects by name.\n\t // Initialize to the GraphQL built in scalars and introspection types. All\n\t // functions below are inline so that this type def cache is within the scope\n\t // of the closure.\n\t var typeDefCache = {\n\t String: _scalars.GraphQLString,\n\t Int: _scalars.GraphQLInt,\n\t Float: _scalars.GraphQLFloat,\n\t Boolean: _scalars.GraphQLBoolean,\n\t ID: _scalars.GraphQLID,\n\t __Schema: _introspection.__Schema,\n\t __Directive: _introspection.__Directive,\n\t __DirectiveLocation: _introspection.__DirectiveLocation,\n\t __Type: _introspection.__Type,\n\t __Field: _introspection.__Field,\n\t __InputValue: _introspection.__InputValue,\n\t __EnumValue: _introspection.__EnumValue,\n\t __TypeKind: _introspection.__TypeKind\n\t };\n\n\t // Get the root Query, Mutation, and Subscription object types.\n\t var queryType = getTypeFromDef(schema.getQueryType());\n\n\t var existingMutationType = schema.getMutationType();\n\t var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n\t var existingSubscriptionType = schema.getSubscriptionType();\n\t var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n\t // Iterate through all types, getting the type definition for each, ensuring\n\t // that any type not directly referenced by a field will get created.\n\t var typeMap = schema.getTypeMap();\n\t var types = Object.keys(typeMap).map(function (typeName) {\n\t return getTypeFromDef(typeMap[typeName]);\n\t });\n\n\t // Do the same with new types, appending to the list of defined types.\n\t Object.keys(typeDefinitionMap).forEach(function (typeName) {\n\t types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n\t });\n\n\t // Then produce and return a Schema with these types.\n\t return new _schema.GraphQLSchema({\n\t query: queryType,\n\t mutation: mutationType,\n\t subscription: subscriptionType,\n\t types: types,\n\t directives: getMergedDirectives()\n\t });\n\n\t // Below are functions used for producing this schema that have closed over\n\t // this scope and have access to the schema, cache, and newly defined types.\n\n\t function getMergedDirectives() {\n\t var existingDirectives = schema.getDirectives();\n\t (0, _invariant2.default)(existingDirectives, 'schema must have default directives');\n\n\t var newDirectives = directiveDefinitions.map(function (directiveAST) {\n\t return getDirective(directiveAST);\n\t });\n\t return existingDirectives.concat(newDirectives);\n\t }\n\n\t function getTypeFromDef(typeDef) {\n\t var type = _getNamedType(typeDef.name);\n\t (0, _invariant2.default)(type, 'Missing type from schema');\n\t return type;\n\t }\n\n\t function getTypeFromAST(astNode) {\n\t var type = _getNamedType(astNode.name.value);\n\t if (!type) {\n\t throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n\t }\n\t return type;\n\t }\n\n\t function getObjectTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n\t return type;\n\t }\n\n\t function getInterfaceTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n\t return type;\n\t }\n\n\t function getInputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n\t return type;\n\t }\n\n\t function getOutputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n\t return type;\n\t }\n\n\t // Given a name, returns a type from either the existing schema or an\n\t // added type.\n\t function _getNamedType(typeName) {\n\t var cachedTypeDef = typeDefCache[typeName];\n\t if (cachedTypeDef) {\n\t return cachedTypeDef;\n\t }\n\n\t var existingType = schema.getType(typeName);\n\t if (existingType) {\n\t var typeDef = extendType(existingType);\n\t typeDefCache[typeName] = typeDef;\n\t return typeDef;\n\t }\n\n\t var typeAST = typeDefinitionMap[typeName];\n\t if (typeAST) {\n\t var _typeDef = buildType(typeAST);\n\t typeDefCache[typeName] = _typeDef;\n\t return _typeDef;\n\t }\n\t }\n\n\t // Given a type's introspection result, construct the correct\n\t // GraphQLType instance.\n\t function extendType(type) {\n\t if (type instanceof _definition.GraphQLObjectType) {\n\t return extendObjectType(type);\n\t }\n\t if (type instanceof _definition.GraphQLInterfaceType) {\n\t return extendInterfaceType(type);\n\t }\n\t if (type instanceof _definition.GraphQLUnionType) {\n\t return extendUnionType(type);\n\t }\n\t return type;\n\t }\n\n\t function extendObjectType(type) {\n\t return new _definition.GraphQLObjectType({\n\t name: type.name,\n\t description: type.description,\n\t interfaces: function interfaces() {\n\t return extendImplementedInterfaces(type);\n\t },\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t isTypeOf: type.isTypeOf\n\t });\n\t }\n\n\t function extendInterfaceType(type) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: type.name,\n\t description: type.description,\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendUnionType(type) {\n\t return new _definition.GraphQLUnionType({\n\t name: type.name,\n\t description: type.description,\n\t types: type.getTypes().map(getTypeFromDef),\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendImplementedInterfaces(type) {\n\t var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n\t // If there are any extensions to the interfaces, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.interfaces.forEach(function (namedType) {\n\t var interfaceName = namedType.name.value;\n\t if (interfaces.some(function (def) {\n\t return def.name === interfaceName;\n\t })) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n\t }\n\t interfaces.push(getInterfaceTypeFromAST(namedType));\n\t });\n\t });\n\t }\n\n\t return interfaces;\n\t }\n\n\t function extendFieldMap(type) {\n\t var newFieldMap = {};\n\t var oldFieldMap = type.getFields();\n\t Object.keys(oldFieldMap).forEach(function (fieldName) {\n\t var field = oldFieldMap[fieldName];\n\t newFieldMap[fieldName] = {\n\t description: field.description,\n\t deprecationReason: field.deprecationReason,\n\t type: extendFieldType(field.type),\n\t args: (0, _keyMap2.default)(field.args, function (arg) {\n\t return arg.name;\n\t }),\n\t resolve: field.resolve\n\t };\n\t });\n\n\t // If there are any extensions to the fields, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.fields.forEach(function (field) {\n\t var fieldName = field.name.value;\n\t if (oldFieldMap[fieldName]) {\n\t throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n\t }\n\t newFieldMap[fieldName] = {\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t type: buildOutputFieldType(field.type),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t });\n\t }\n\n\t return newFieldMap;\n\t }\n\n\t function extendFieldType(typeDef) {\n\t if (typeDef instanceof _definition.GraphQLList) {\n\t return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n\t }\n\t if (typeDef instanceof _definition.GraphQLNonNull) {\n\t return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n\t }\n\t return getTypeFromDef(typeDef);\n\t }\n\n\t function buildType(typeAST) {\n\t switch (typeAST.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t return buildObjectType(typeAST);\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t return buildInterfaceType(typeAST);\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t return buildUnionType(typeAST);\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t return buildScalarType(typeAST);\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t return buildEnumType(typeAST);\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t return buildInputObjectType(typeAST);\n\t }\n\t throw new TypeError('Unknown type kind ' + typeAST.kind);\n\t }\n\n\t function buildObjectType(typeAST) {\n\t return new _definition.GraphQLObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t interfaces: function interfaces() {\n\t return buildImplementedInterfaces(typeAST);\n\t },\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t }\n\t });\n\t }\n\n\t function buildInterfaceType(typeAST) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t },\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildUnionType(typeAST) {\n\t return new _definition.GraphQLUnionType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t types: typeAST.types.map(getObjectTypeFromAST),\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildScalarType(typeAST) {\n\t return new _definition.GraphQLScalarType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t serialize: function serialize(id) {\n\t return id;\n\t },\n\t // Note: validation calls the parse functions to determine if a\n\t // literal value is correct. Returning null would cause use of custom\n\t // scalars to always fail validation. Returning false causes them to\n\t // always pass validation.\n\t parseValue: function parseValue() {\n\t return false;\n\t },\n\t parseLiteral: function parseLiteral() {\n\t return false;\n\t }\n\t });\n\t }\n\n\t function buildEnumType(typeAST) {\n\t return new _definition.GraphQLEnumType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n\t return v.name.value;\n\t }, function () {\n\t return {};\n\t })\n\t });\n\t }\n\n\t function buildInputObjectType(typeAST) {\n\t return new _definition.GraphQLInputObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildInputValues(typeAST.fields);\n\t }\n\t });\n\t }\n\n\t function getDirective(directiveAST) {\n\t return new _directives.GraphQLDirective({\n\t name: directiveAST.name.value,\n\t locations: directiveAST.locations.map(function (node) {\n\t return node.value;\n\t }),\n\t args: directiveAST.arguments && buildInputValues(directiveAST.arguments)\n\t });\n\t }\n\n\t function buildImplementedInterfaces(typeAST) {\n\t return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n\t }\n\n\t function buildFieldMap(typeAST) {\n\t return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n\t return field.name.value;\n\t }, function (field) {\n\t return {\n\t type: buildOutputFieldType(field.type),\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t }\n\n\t function buildInputValues(values) {\n\t return (0, _keyValMap2.default)(values, function (value) {\n\t return value.name.value;\n\t }, function (value) {\n\t var type = buildInputFieldType(value.type);\n\t return {\n\t type: type,\n\t description: (0, _buildASTSchema.getDescription)(value),\n\t defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n\t };\n\t });\n\t }\n\n\t function buildInputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildInputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getInputTypeFromAST(typeAST);\n\t }\n\n\t function buildOutputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildOutputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getOutputTypeFromAST(typeAST);\n\t }\n\t}", "function deDupeDiagnostics(buildDiagnostics, otherDiagnostics) {\n const buildDiagnosticsLines = buildDiagnostics.map((x) => x.range.start.line);\n return otherDiagnostics.filter((x) => buildDiagnosticsLines.indexOf(x.range.start.line) === -1);\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "getAdditionalSchemas() {\n const additionalSchemas = this.schemas.join('\\n');\n return additionalSchemas;\n }", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function fixSchema(schema){\n recurseotron.recurse(schema,{},function(obj,state){\n if ((state.key == 'id') && (typeof obj == 'string')) delete state.parent.id;\n if ((state.key == 'title') && (typeof obj == 'string')) delete state.parent.title;\n if ((state.key == 'description') && (typeof obj == 'string')) delete state.parent.description;\n if ((state.key == 'location') && (typeof obj == 'string')) delete state.parent.location;\n if ((state.key == 'type') && (typeof obj == 'string')) {\n if (obj == 'textarea') {\n state.parent.type = 'string';\n }\n }\n if ((state.key == '$ref') && (typeof obj == 'string') && !obj.startsWith('#/')) {\n state.parent[\"$ref\"] = '#/definitions/'+obj;\n }\n if ((state.key == 'required') && (typeof obj == 'boolean')) {\n if (obj === true) {\n var greatgrandparent = state.parents[state.parents.length-3];\n if (greatgrandparent) {\n if (state.keys[state.keys.length-2] != 'items') { // TODO better check for arrays\n if (!greatgrandparent.required) greatgrandparent.required = [];\n greatgrandparent.required.push(state.keys[state.keys.length-2]);\n }\n }\n }\n delete state.parent.required;\n }\n });\n}", "function cleanDiscriminatorSchema(schema) {\n const copy = { ...schema };\n if (copy.format === '') {\n delete copy.format;\n }\n return copy;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function patternsToUnrelate(oldArray, newArray) {\n console.log('oldArray');\n console.log(oldArray);\n console.log('newArray');\n console.log(newArray);\n\n\n // var ids2Unrelate = oldArray.filter(elem => !newArray.includes(elem.padroes_id));\n var ids2Unrelate = oldArray;\n for(let i=0; i<oldArray.length; i++) {\n for (let j=0; j<newArray.length; j++) {\n console.log('Olha so')\n console.log(typeof oldArray[i].padroes_id);\n console.log(oldArray[i].padroes_id);\n console.log('com');\n console.log(typeof newArray[j]);\n console.log(newArray[j]);\n if (oldArray[i].padroes_id === Number(newArray[j])) oldArray.splice(i, 1);\n }\n }\n\n\n console.log('Ids to unrelate');\n console.log(ids2Unrelate);\n return ids2Unrelate;\n}", "function removeTypesFromUnionOrIntersection(type, typesToRemove) {\n var reducedTypes = [];\n for (var _i = 0, _a = type.types; _i < _a.length; _i++) {\n var t = _a[_i];\n if (!typeIdenticalToSomeType(t, typesToRemove)) {\n reducedTypes.push(t);\n }\n }\n return type.flags & 524288 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes);\n }", "function pruneSchema(resources /*, fullFhirSchema?: Schema*/) {\n return __awaiter(this, void 0, void 0, function () {\n var fullFhirSchema, newSchema, definitionNames, oneOf;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getFullSchema()];\n case 1:\n fullFhirSchema = _a.sent();\n newSchema = {\n $schema: \"http://json-schema.org/draft-07/schema#\",\n $id: \"https://smarthealth.cards/schema/fhir-schema.json\",\n oneOf: [{\n $ref: \"#/definitions/Bundle\"\n }],\n definitions: {\n ResourceList: {\n oneOf: []\n }\n }\n };\n definitionNames = [];\n oneOf = newSchema.definitions.ResourceList.oneOf || [];\n // for each required resource, find all the child definitions\n // definitionNames will fill with all the required child-definitions\n resources.forEach(function (resource) { return findChildRefs(fullFhirSchema, resource, definitionNames); });\n definitionNames.sort();\n definitionNames.forEach(function (name) {\n var def = fullFhirSchema.definitions[name];\n newSchema.definitions[name] = def;\n // If this def is a Resource type, add a $ref to the oneOf collection\n if (def.properties && def.properties.resourceType && def.properties.resourceType.const) {\n oneOf.push({ \"$ref\": \"#/definitions/\" + def.properties.resourceType.const });\n }\n });\n // Schema validation of the Bundle.entries will happen separately. We'll replace the ResourceList type\n // with a generic object to prevent further validation here.\n // The reason is that if the entry items have bad schema, we will get dozens of errors as the bad-schema object\n // fails to match any of the possible Resources. So instead, we validate the entries individually against\n // the resource type specified in its resourceType field.\n newSchema.definitions['Bundle_Entry'].properties.resource = { \"type\": \"object\" };\n return [2 /*return*/, newSchema];\n }\n });\n });\n}", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n description: (0, _buildASTSchema.getDescription)(directiveNode),\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function unionKnownDisjoint(as, bs) {\n return as.concat(bs);\n }", "function diff(fromArr, to) {\n // take the lame way out and return a \"patch\" that literally just removes\n // everything and then adds the entire contents of the \"to\" array using a\n // single splice.\n //\n // TODO: rewrite this!\n\n var i;\n var patches = [];\n\n // remove everything in \"from\"\n for (i = fromArr.length - 1; i >= 0; --i) {\n patches.push(new ListPatches.Remove(i, fromArr[i]));\n }\n\n // add all of \"to\"\n for (i = 0; i < to.length; ++i) {\n patches.push(new ListPatches.Add(i, to[i]));\n }\n\n return new ListPatches.Sequence(patches);\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isPossibleType(typeA, typeB);\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function getSchemaOptions(discriminatorSchemas, componentSchemas) {\n const options = [];\n\n Object.keys(discriminatorSchemas).forEach(dsKey => {\n const discSchema = discriminatorSchemas[dsKey];\n Object.keys(componentSchemas).forEach(componentKey => {\n if (deepEquals(cleanDiscriminatorSchema(discSchema), componentSchemas[componentKey])) {\n options.push({\n label: componentKey,\n value: componentKey,\n });\n }\n });\n });\n\n return options;\n}", "function tighten(schema) {\n if (!isDefined(schema.type)) {\n if (isDefined(schema.properties)) {\n schema.type = 'object';\n }\n if (isDefined(schema.pattern)) {\n schema.type = 'string';\n }\n if (isDefined(schema.minLength) || isDefined(schema.maxLength)) {\n schema.type = 'string';\n }\n if (isDefined(schema.enum)) {\n var allStrings = _(schema.enum).all(function (item) {\n return typeof item === 'string';\n });\n if (allStrings) {\n schema.type = 'string';\n }\n }\n if (isDefined(schema.items)) {\n schema.type = 'array';\n }\n } else {\n if (_.isArray(schema.type)) {\n _.each(schema.type, function (unionType) {\n tighten(unionType);\n });\n }\n }\n if (!isDefined(schema.required)) {\n schema.required = true;\n }\n if (isDefined(schema.properties)) {\n _(schema.properties).each(function (propertySchema) {\n tighten(propertySchema);\n });\n if (!isDefined(schema.additionalProperties)) {\n schema.additionalProperties = false;\n }\n }\n if (isDefined(schema.items)) {\n if (_.isArray(schema.items)) {\n _.each(schema.items, function (item) {\n tighten(item);\n });\n if (!isDefined(schema.additionalItems)) {\n schema.additionalItems = false;\n }\n } else {\n tighten(schema.items);\n }\n }\n return schema;\n}", "_checkSchema() {\n if(!this._data['topics']) {\n throw new Error('Schema Error, expected root array named topics');\n }\n let cleaned = [];\n this._data['topics'].map((value, index) => {\n if(!this._itemConformsToSchema(value, this._itemSchema)) {\n if(!this._ignoreBadItems) {\n throw new Error('Schema Error, item: ' + index + ' does not conform to schema');\n } else {\n console.warn('Item: ' + index + ' does not conform to schema, Ignoring', value);\n }\n } else if(this._ignoreBadItems) {\n cleaned.push(value);\n }\n return value;\n });\n\n if(this._ignoreBadItems) {\n this._data['topics'] = cleaned;\n }\n\n return cleaned;\n }", "function symdiff(arr1, arr2){\n // create an empety array to store the unique values\n var newArr = [];\n // iterate through each item in the first array\n for (var i = 0; i <arr1.length; i++){\n // if the first item in the first array is not in the second array or in the new array\n if(arr2.indexOf(arr1[i])<0 && newArr.indexOf(arr1[i])<0){\n // push the item into the new array\n newArr.push(arr1[i]);\n }\n }\n // iterate through the second array\n arr2.forEach(function(item){\n // if the items in the second array are not present in the first array or in the new array\n if(arr1.indexOf(item)<0 && newArr.indexOf(item)<0){\n // push the item into the new array\n newArr.push(item);\n }\n });\n return newArr;\n\n }", "fixSchema(originalSchema, config) {\n let schema = cloneDeep(originalSchema);\n if (config) {\n schema = this.enrichSchemaWithConfig(schema, config);\n }\n schema = this.fixRecursively(schema);\n return schema;\n }", "function diff(a, b) {\n return [...new Set(a.filter(i => !new Set(b).has(i)))];\n}", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isObjectType\"])(type) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isInterfaceType\"])(type)) {\n var possibleFieldNames = Object.keys(type.getFields());\n return Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n\n return [];\n}", "function arrayDiff(a, b) {\n return a.filter((el) => !b.includes(el));\n}", "buildDeleteFields(patchContext, origContext, schema){\n var deleteFields = [];\n // must remove nulls from the orig copy to sync with patchContext\n var origCopy = object.deepClone(origContext);\n origCopy = removeNulls(origCopy);\n var userGroups = JWT.getUserGroups();\n _.keys(origCopy).forEach((field, index) => {\n // if patchContext already has a value (such as admin edited\n // import_items fields), don't overwrite\n if(!isValueNull(patchContext[field])){\n return;\n }\n if(schema.properties[field]){\n var fieldSchema = object.getNestedProperty(schema, ['properties', field], true);\n if (!fieldSchema){\n return;\n }\n // skip calculated properties and exclude_from fields\n if (fieldSchema.calculatedProperty && fieldSchema.calculatedProperty === true){\n return;\n }\n if (fieldSchema.exclude_from && (_.contains(fieldSchema.exclude_from,'FFedit-create') || fieldSchema.exclude_from == 'FFedit-create')){\n return;\n }\n // if the user is admin, they already have these fields available;\n // only register as removed if admin did it intentionally\n if (fieldSchema.permission && fieldSchema.permission == \"import_items\"){\n if(_.contains(userGroups, 'admin')) deleteFields.push(field);\n return;\n }\n // check round two fields if the parameter roundTwo is set\n if(fieldSchema.ff_flag && fieldSchema.ff_flag == 'second round'){\n if(this.state.roundTwo) deleteFields.push(field);\n return;\n }\n // if we're here, the submission field was legitimately deleted\n if(!this.state.roundTwo) deleteFields.push(field);\n }\n });\n return deleteFields;\n }", "function arrayDiff(a, b) {\n\treturn a.filter(ar => !b.includes(ar));\n}", "compactEntitySchema(schema, entity, transformedSchemas) {\n const reqEntity = transformedSchemas[entity['entityName']];\n reqEntity.entityName = entity['entityName'];\n reqEntity.name = entity['name'];\n reqEntity.columns = [];\n entity.columns.forEach(col => {\n let defaultValue = col.columnValue ? col.columnValue.defaultValue : '';\n const type = col.sqlType;\n if (type === 'number' && !col.primaryKey) {\n defaultValue = _.isEmpty(defaultValue) ? null : _.parseInt(defaultValue);\n }\n else if (type === 'boolean') {\n defaultValue = _.isEmpty(defaultValue) ? null : (defaultValue === 'true' ? 1 : 0);\n }\n else {\n defaultValue = _.isEmpty(defaultValue) ? null : defaultValue;\n }\n reqEntity.columns.push({\n name: col['name'],\n fieldName: col['fieldName'],\n generatorType: col['generatorType'],\n sqlType: col['sqlType'],\n primaryKey: col['primaryKey'],\n defaultValue: defaultValue\n });\n });\n _.forEach(entity.relations, r => {\n let targetEntitySchema, targetEntity, col, sourceColumn, mapping;\n if (r.cardinality === 'ManyToOne' || r.cardinality === 'OneToOne') {\n targetEntity = _.find(schema.tables, t => t.name === r.targetTable);\n mapping = r.mappings[0];\n if (targetEntity) {\n targetEntity = targetEntity.entityName;\n sourceColumn = mapping.sourceColumn;\n col = reqEntity.columns.find(column => column.name === sourceColumn);\n targetEntitySchema = schema.tables.find(table => table.name === r.targetTable);\n const foreignRelation = {\n sourceFieldName: r.fieldName,\n targetEntity: targetEntity,\n targetTable: r.targetTable,\n targetColumn: mapping.targetColumn,\n targetPath: '',\n dataMapper: [],\n targetFieldName: targetEntitySchema.columns.find(column => column.name === mapping.targetColumn).fieldName\n };\n foreignRelation.targetPath = foreignRelation.sourceFieldName + '.' + foreignRelation.targetFieldName;\n foreignRelation.dataMapper = _.chain(targetEntitySchema.columns)\n .keyBy(childCol => foreignRelation.sourceFieldName + '.' + childCol.fieldName)\n .mapValues(childCol => new ColumnInfo(childCol.name, childCol.fieldName)).value();\n col.foreignRelations = col.foreignRelations || [];\n col.foreignRelations.push(foreignRelation);\n }\n }\n });\n return reqEntity;\n }", "static remove(tokens, toremove ){\n for( var i=tokens.length-1; i>=0; i-- ) if( toremove.indexOf(tokens[i].type) >= 0 ) tokens.remove(i)\n return tokens\n }", "function standardizeLets(declars) {\n\t var _arr = declars;\n\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var declar = _arr[_i];\n\t delete declar._let;\n\t }\n\t}", "function standardizeLets(declars) {\n\t var _arr = declars;\n\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var declar = _arr[_i];\n\t delete declar._let;\n\t }\n\t}", "function doTypesOverlap(schema, typeA, typeB) {\n\t // So flow is aware this is constant\n\t var _typeB = typeB;\n\n\t // Equivalent types overlap\n\t if (typeA === _typeB) {\n\t return true;\n\t }\n\n\t if (typeA instanceof _definition.GraphQLInterfaceType || typeA instanceof _definition.GraphQLUnionType) {\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // If both types are abstract, then determine if there is any intersection\n\t // between possible concrete types of each.\n\t return schema.getPossibleTypes(typeA).some(function (type) {\n\t return schema.isPossibleType(_typeB, type);\n\t });\n\t }\n\t // Determine if the latter type is a possible concrete type of the former.\n\t return schema.isPossibleType(typeA, _typeB);\n\t }\n\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // Determine if the former type is a possible concrete type of the latter.\n\t return schema.isPossibleType(_typeB, typeA);\n\t }\n\n\t // Otherwise the types do not overlap.\n\t return false;\n\t}", "getSpeechesForDataTypes(dataTypes) {\n var tmp = [];\n for (var i = 0; i < dataTypes.length; i++) {\n tmp[i] = this._dataTypes[dataTypes[i]] ? this._dataTypes[dataTypes[i]] : undefinedDataType;\n }\n return tmp;\n }", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}" ]
[ "0.795675", "0.795675", "0.7945895", "0.79275715", "0.78931415", "0.78279424", "0.71366733", "0.7054868", "0.70357794", "0.70357794", "0.7021732", "0.69486105", "0.69200313", "0.66691905", "0.6646488", "0.6608136", "0.6602106", "0.6602106", "0.64400434", "0.64400434", "0.6410942", "0.64096034", "0.64096034", "0.64096034", "0.64096034", "0.6344705", "0.62813514", "0.6268513", "0.6268513", "0.6250438", "0.6169906", "0.60394406", "0.60394406", "0.6024636", "0.6024636", "0.6024636", "0.57866687", "0.5516161", "0.54051983", "0.5233992", "0.5233756", "0.52316177", "0.50036484", "0.49920076", "0.49836972", "0.496859", "0.48775634", "0.48175344", "0.47634003", "0.47490406", "0.47251737", "0.4703625", "0.4703625", "0.46973488", "0.4687464", "0.46633407", "0.4663251", "0.46455052", "0.4629801", "0.46184522", "0.46184522", "0.4596622", "0.45715448", "0.45638055", "0.45557877", "0.45406684", "0.45406684", "0.45399326", "0.45399326", "0.45328537", "0.45263517", "0.45133346", "0.45076475", "0.45076475", "0.4506041", "0.4506041", "0.4501858", "0.45004994", "0.44912428", "0.4486807", "0.4486807", "0.44842497", "0.44813132", "0.44730967", "0.44499528", "0.44469878", "0.44431907", "0.44399992", "0.44381952", "0.44356513", "0.44332805", "0.44193843", "0.4419073", "0.4396226", "0.4396226", "0.43953934", "0.43941066", "0.4386775", "0.4386775" ]
0.79045427
5
Given two schemas, returns an Array containing descriptions of any dangerous changes in the newSchema related to adding types to a union type.
function findTypesAddedToUnions(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var typesAddedToUnion = []; Object.keys(newTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) { return; } var typeNamesInOldUnion = Object.create(null); oldType.getTypes().forEach(function (type) { typeNamesInOldUnion[type.name] = true; }); newType.getTypes().forEach(function (type) { if (!typeNamesInOldUnion[type.name]) { typesAddedToUnion.push({ type: DangerousChangeType.TYPE_ADDED_TO_UNION, description: type.name + ' was added to union type ' + typeName + '.' }); } }); }); return typesAddedToUnion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_REMOVED,\n\t description: typeName + ' was removed.'\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr = Object.keys(oldTypeMap);\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var typeName = _arr[_i];\n\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: \"\".concat(typeName, \" was removed.\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t return;\n\t }\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof newType.constructor)) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_CHANGED_KIND,\n\t description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr2 = Object.keys(oldTypeMap);\n\n for (var _i2 = 0; _i2 < _arr2.length; _i2++) {\n var typeName = _arr2[_i2];\n\n if (!newTypeMap[typeName]) {\n continue;\n }\n\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (oldType.constructor !== newType.constructor) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: \"\".concat(typeName, \" changed from \") + \"\".concat(typeKindName(oldType), \" to \").concat(typeKindName(newType), \".\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema));\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n\t return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema));\n\t}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findInterfacesAddedToObjectTypes(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).dangerousChanges);\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType || oldType instanceof _definition.GraphQLInputObjectType) || !(newType instanceof oldType.constructor)) {\n\t return;\n\t }\n\n\t var oldTypeFieldsDef = oldType.getFields();\n\t var newTypeFieldsDef = newType.getFields();\n\t Object.keys(oldTypeFieldsDef).forEach(function (fieldName) {\n\t // Check if the field is missing on the type in the new schema.\n\t if (!(fieldName in newTypeFieldsDef)) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_REMOVED,\n\t description: typeName + '.' + fieldName + ' was removed.'\n\t });\n\t } else {\n\t // Check if the field's type has changed in the new schema.\n\t var oldFieldType = (0, _definition.getNamedType)(oldTypeFieldsDef[fieldName].type);\n\t var newFieldType = (0, _definition.getNamedType)(newTypeFieldsDef[fieldName].type);\n\t if (oldFieldType && newFieldType && oldFieldType.name !== newFieldType.name) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_CHANGED_KIND,\n\t description: typeName + '.' + fieldName + ' changed type from ' + (oldFieldType.name + ' to ' + newFieldType.name + '.')\n\t });\n\t }\n\t }\n\t });\n\t });\n\t return breakingFieldChanges;\n\t}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges);\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).breakingChanges, findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema), findRemovedDirectives(oldSchema, newSchema), findRemovedDirectiveArgs(oldSchema, newSchema), findAddedNonNullDirectiveArgs(oldSchema, newSchema), findRemovedDirectiveLocations(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInNewEnum = Object.create(null);\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = newType.getValues()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var value = _step7.value;\n valuesInNewEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = oldType.getValues()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _value = _step8.value;\n\n if (!valuesInNewEnum[_value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: \"\".concat(_value.name, \" was removed from enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n }\n\n return valuesRemovedFromEnums;\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n var dangerousChanges = [];\n\n var _arr3 = Object.keys(oldTypeMap);\n\n for (var _i3 = 0; _i3 < _arr3.length; _i3++) {\n var typeName = _arr3[_i3];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(oldType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(oldType)) || !(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(newType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(newType)) || newType.constructor !== oldType.constructor) {\n continue;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n var _arr4 = Object.keys(oldTypeFields);\n\n for (var _i4 = 0; _i4 < _arr4.length; _i4++) {\n var fieldName = _arr4[_i4];\n\n if (!newTypeFields[fieldName]) {\n continue;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var oldArgDef = _step.value;\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(newArgs, function (arg) {\n return arg.name === oldArgDef.name;\n }); // Arg not present\n\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" was removed\")\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed type from \") + \"\".concat(oldArgDef.type.toString(), \" to \").concat(newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed defaultValue\")\n });\n }\n }\n };\n\n for (var _iterator = oldTypeFields[fieldName].args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n _loop();\n } // Check if arg was added to the field\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n var _loop2 = function _loop2() {\n var newArgDef = _step2.value;\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(oldArgs, function (arg) {\n return arg.name === newArgDef.name;\n });\n\n if (!oldArgDef) {\n var argName = newArgDef.name;\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isRequiredArgument\"])(newArgDef)) {\n breakingChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: \"A required arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n } else {\n dangerousChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: \"An optional arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n }\n }\n };\n\n for (var _iterator2 = newTypeFields[fieldName].args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n _loop2();\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function extendSchema(schema, documentAST) {\n\t (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n\t (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n\t // Collect the type definitions and extensions found in the document.\n\t var typeDefinitionMap = {};\n\t var typeExtensionsMap = {};\n\n\t // New directives and types are separate because a directives and types can\n\t // have the same name. For example, a type named \"skip\".\n\t var directiveDefinitions = [];\n\n\t for (var i = 0; i < documentAST.definitions.length; i++) {\n\t var def = documentAST.definitions[i];\n\t switch (def.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t // Sanity check that none of the defined types conflict with the\n\t // schema's existing types.\n\t var typeName = def.name.value;\n\t if (schema.getType(typeName)) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n\t }\n\t typeDefinitionMap[typeName] = def;\n\t break;\n\t case _kinds.TYPE_EXTENSION_DEFINITION:\n\t // Sanity check that this type extension exists within the\n\t // schema's existing types.\n\t var extendedTypeName = def.definition.name.value;\n\t var existingType = schema.getType(extendedTypeName);\n\t if (!existingType) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n\t }\n\t if (!(existingType instanceof _definition.GraphQLObjectType)) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n\t }\n\t var extensions = typeExtensionsMap[extendedTypeName];\n\t if (extensions) {\n\t extensions.push(def);\n\t } else {\n\t extensions = [def];\n\t }\n\t typeExtensionsMap[extendedTypeName] = extensions;\n\t break;\n\t case _kinds.DIRECTIVE_DEFINITION:\n\t var directiveName = def.name.value;\n\t var existingDirective = schema.getDirective(directiveName);\n\t if (existingDirective) {\n\t throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n\t }\n\t directiveDefinitions.push(def);\n\t break;\n\t }\n\t }\n\n\t // If this document contains no new types, extensions, or directives then\n\t // return the same unmodified GraphQLSchema instance.\n\t if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n\t return schema;\n\t }\n\n\t // A cache to use to store the actual GraphQLType definition objects by name.\n\t // Initialize to the GraphQL built in scalars and introspection types. All\n\t // functions below are inline so that this type def cache is within the scope\n\t // of the closure.\n\t var typeDefCache = {\n\t String: _scalars.GraphQLString,\n\t Int: _scalars.GraphQLInt,\n\t Float: _scalars.GraphQLFloat,\n\t Boolean: _scalars.GraphQLBoolean,\n\t ID: _scalars.GraphQLID,\n\t __Schema: _introspection.__Schema,\n\t __Directive: _introspection.__Directive,\n\t __DirectiveLocation: _introspection.__DirectiveLocation,\n\t __Type: _introspection.__Type,\n\t __Field: _introspection.__Field,\n\t __InputValue: _introspection.__InputValue,\n\t __EnumValue: _introspection.__EnumValue,\n\t __TypeKind: _introspection.__TypeKind\n\t };\n\n\t // Get the root Query, Mutation, and Subscription object types.\n\t var queryType = getTypeFromDef(schema.getQueryType());\n\n\t var existingMutationType = schema.getMutationType();\n\t var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n\t var existingSubscriptionType = schema.getSubscriptionType();\n\t var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n\t // Iterate through all types, getting the type definition for each, ensuring\n\t // that any type not directly referenced by a field will get created.\n\t var typeMap = schema.getTypeMap();\n\t var types = Object.keys(typeMap).map(function (typeName) {\n\t return getTypeFromDef(typeMap[typeName]);\n\t });\n\n\t // Do the same with new types, appending to the list of defined types.\n\t Object.keys(typeDefinitionMap).forEach(function (typeName) {\n\t types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n\t });\n\n\t // Then produce and return a Schema with these types.\n\t return new _schema.GraphQLSchema({\n\t query: queryType,\n\t mutation: mutationType,\n\t subscription: subscriptionType,\n\t types: types,\n\t directives: getMergedDirectives()\n\t });\n\n\t // Below are functions used for producing this schema that have closed over\n\t // this scope and have access to the schema, cache, and newly defined types.\n\n\t function getMergedDirectives() {\n\t var existingDirectives = schema.getDirectives();\n\t (0, _invariant2.default)(existingDirectives, 'schema must have default directives');\n\n\t var newDirectives = directiveDefinitions.map(function (directiveAST) {\n\t return getDirective(directiveAST);\n\t });\n\t return existingDirectives.concat(newDirectives);\n\t }\n\n\t function getTypeFromDef(typeDef) {\n\t var type = _getNamedType(typeDef.name);\n\t (0, _invariant2.default)(type, 'Missing type from schema');\n\t return type;\n\t }\n\n\t function getTypeFromAST(astNode) {\n\t var type = _getNamedType(astNode.name.value);\n\t if (!type) {\n\t throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n\t }\n\t return type;\n\t }\n\n\t function getObjectTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n\t return type;\n\t }\n\n\t function getInterfaceTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n\t return type;\n\t }\n\n\t function getInputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n\t return type;\n\t }\n\n\t function getOutputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n\t return type;\n\t }\n\n\t // Given a name, returns a type from either the existing schema or an\n\t // added type.\n\t function _getNamedType(typeName) {\n\t var cachedTypeDef = typeDefCache[typeName];\n\t if (cachedTypeDef) {\n\t return cachedTypeDef;\n\t }\n\n\t var existingType = schema.getType(typeName);\n\t if (existingType) {\n\t var typeDef = extendType(existingType);\n\t typeDefCache[typeName] = typeDef;\n\t return typeDef;\n\t }\n\n\t var typeAST = typeDefinitionMap[typeName];\n\t if (typeAST) {\n\t var _typeDef = buildType(typeAST);\n\t typeDefCache[typeName] = _typeDef;\n\t return _typeDef;\n\t }\n\t }\n\n\t // Given a type's introspection result, construct the correct\n\t // GraphQLType instance.\n\t function extendType(type) {\n\t if (type instanceof _definition.GraphQLObjectType) {\n\t return extendObjectType(type);\n\t }\n\t if (type instanceof _definition.GraphQLInterfaceType) {\n\t return extendInterfaceType(type);\n\t }\n\t if (type instanceof _definition.GraphQLUnionType) {\n\t return extendUnionType(type);\n\t }\n\t return type;\n\t }\n\n\t function extendObjectType(type) {\n\t return new _definition.GraphQLObjectType({\n\t name: type.name,\n\t description: type.description,\n\t interfaces: function interfaces() {\n\t return extendImplementedInterfaces(type);\n\t },\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t isTypeOf: type.isTypeOf\n\t });\n\t }\n\n\t function extendInterfaceType(type) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: type.name,\n\t description: type.description,\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendUnionType(type) {\n\t return new _definition.GraphQLUnionType({\n\t name: type.name,\n\t description: type.description,\n\t types: type.getTypes().map(getTypeFromDef),\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendImplementedInterfaces(type) {\n\t var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n\t // If there are any extensions to the interfaces, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.interfaces.forEach(function (namedType) {\n\t var interfaceName = namedType.name.value;\n\t if (interfaces.some(function (def) {\n\t return def.name === interfaceName;\n\t })) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n\t }\n\t interfaces.push(getInterfaceTypeFromAST(namedType));\n\t });\n\t });\n\t }\n\n\t return interfaces;\n\t }\n\n\t function extendFieldMap(type) {\n\t var newFieldMap = {};\n\t var oldFieldMap = type.getFields();\n\t Object.keys(oldFieldMap).forEach(function (fieldName) {\n\t var field = oldFieldMap[fieldName];\n\t newFieldMap[fieldName] = {\n\t description: field.description,\n\t deprecationReason: field.deprecationReason,\n\t type: extendFieldType(field.type),\n\t args: (0, _keyMap2.default)(field.args, function (arg) {\n\t return arg.name;\n\t }),\n\t resolve: field.resolve\n\t };\n\t });\n\n\t // If there are any extensions to the fields, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.fields.forEach(function (field) {\n\t var fieldName = field.name.value;\n\t if (oldFieldMap[fieldName]) {\n\t throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n\t }\n\t newFieldMap[fieldName] = {\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t type: buildOutputFieldType(field.type),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t });\n\t }\n\n\t return newFieldMap;\n\t }\n\n\t function extendFieldType(typeDef) {\n\t if (typeDef instanceof _definition.GraphQLList) {\n\t return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n\t }\n\t if (typeDef instanceof _definition.GraphQLNonNull) {\n\t return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n\t }\n\t return getTypeFromDef(typeDef);\n\t }\n\n\t function buildType(typeAST) {\n\t switch (typeAST.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t return buildObjectType(typeAST);\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t return buildInterfaceType(typeAST);\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t return buildUnionType(typeAST);\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t return buildScalarType(typeAST);\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t return buildEnumType(typeAST);\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t return buildInputObjectType(typeAST);\n\t }\n\t throw new TypeError('Unknown type kind ' + typeAST.kind);\n\t }\n\n\t function buildObjectType(typeAST) {\n\t return new _definition.GraphQLObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t interfaces: function interfaces() {\n\t return buildImplementedInterfaces(typeAST);\n\t },\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t }\n\t });\n\t }\n\n\t function buildInterfaceType(typeAST) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t },\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildUnionType(typeAST) {\n\t return new _definition.GraphQLUnionType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t types: typeAST.types.map(getObjectTypeFromAST),\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildScalarType(typeAST) {\n\t return new _definition.GraphQLScalarType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t serialize: function serialize(id) {\n\t return id;\n\t },\n\t // Note: validation calls the parse functions to determine if a\n\t // literal value is correct. Returning null would cause use of custom\n\t // scalars to always fail validation. Returning false causes them to\n\t // always pass validation.\n\t parseValue: function parseValue() {\n\t return false;\n\t },\n\t parseLiteral: function parseLiteral() {\n\t return false;\n\t }\n\t });\n\t }\n\n\t function buildEnumType(typeAST) {\n\t return new _definition.GraphQLEnumType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n\t return v.name.value;\n\t }, function () {\n\t return {};\n\t })\n\t });\n\t }\n\n\t function buildInputObjectType(typeAST) {\n\t return new _definition.GraphQLInputObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildInputValues(typeAST.fields);\n\t }\n\t });\n\t }\n\n\t function getDirective(directiveAST) {\n\t return new _directives.GraphQLDirective({\n\t name: directiveAST.name.value,\n\t locations: directiveAST.locations.map(function (node) {\n\t return node.value;\n\t }),\n\t args: directiveAST.arguments && buildInputValues(directiveAST.arguments)\n\t });\n\t }\n\n\t function buildImplementedInterfaces(typeAST) {\n\t return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n\t }\n\n\t function buildFieldMap(typeAST) {\n\t return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n\t return field.name.value;\n\t }, function (field) {\n\t return {\n\t type: buildOutputFieldType(field.type),\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t }\n\n\t function buildInputValues(values) {\n\t return (0, _keyValMap2.default)(values, function (value) {\n\t return value.name.value;\n\t }, function (value) {\n\t var type = buildInputFieldType(value.type);\n\t return {\n\t type: type,\n\t description: (0, _buildASTSchema.getDescription)(value),\n\t defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n\t };\n\t });\n\t }\n\n\t function buildInputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildInputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getInputTypeFromAST(typeAST);\n\t }\n\n\t function buildOutputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildOutputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getOutputTypeFromAST(typeAST);\n\t }\n\t}", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n description: (0, _buildASTSchema.getDescription)(directiveNode),\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function extendSchema(schema, documentAST, options) {\n Object(_type_schema__WEBPACK_IMPORTED_MODULE_8__[\"assertSchema\"])(schema);\n !(documentAST && documentAST.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DOCUMENT) ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'Must provide valid Document AST') : void 0;\n\n if (!options || !(options.assumeValid || options.assumeValidSDL)) {\n Object(_validation_validate__WEBPACK_IMPORTED_MODULE_7__[\"assertValidSDLExtension\"])(documentAST, schema);\n } // Collect the type definitions and extensions found in the document.\n\n\n var typeDefs = [];\n var typeExtsMap = Object.create(null); // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n\n var directiveDefs = [];\n var schemaDef; // Schema extensions are collected which may add additional operation types.\n\n var schemaExts = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = documentAST.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_DEFINITION) {\n schemaDef = def;\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_EXTENSION) {\n schemaExts.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeDefinitionNode\"])(def)) {\n typeDefs.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeExtensionNode\"])(def)) {\n var extendedTypeName = def.name.value;\n var existingTypeExts = typeExtsMap[extendedTypeName];\n typeExtsMap[extendedTypeName] = existingTypeExts ? existingTypeExts.concat([def]) : [def];\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DIRECTIVE_DEFINITION) {\n directiveDefs.push(def);\n }\n } // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (Object.keys(typeExtsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExts.length === 0 && !schemaDef) {\n return schema;\n }\n\n var schemaConfig = schema.toConfig();\n var astBuilder = new _buildASTSchema__WEBPACK_IMPORTED_MODULE_6__[\"ASTDefinitionBuilder\"](options, function (typeName) {\n var type = typeMap[typeName];\n !type ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, \"Unknown type: \\\"\".concat(typeName, \"\\\".\")) : void 0;\n return type;\n });\n var typeMap = Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(typeDefs, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildType(node);\n });\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = schemaConfig.types[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var existingType = _step2.value;\n typeMap[existingType.name] = extendNamedType(existingType);\n } // Get the extended root operation types.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var operationTypes = {\n query: schemaConfig.query && schemaConfig.query.name,\n mutation: schemaConfig.mutation && schemaConfig.mutation.name,\n subscription: schemaConfig.subscription && schemaConfig.subscription.name\n };\n\n if (schemaDef) {\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = schemaDef.operationTypes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref2 = _step3.value;\n var operation = _ref2.operation;\n var type = _ref2.type;\n operationTypes[operation] = type.name.value;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n } // Then, incorporate schema definition and all schema extensions.\n\n\n var _arr = schemaExts;\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var schemaExt = _arr[_i];\n\n if (schemaExt.operationTypes) {\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = schemaExt.operationTypes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _ref4 = _step4.value;\n var _operation = _ref4.operation;\n var _type = _ref4.type;\n operationTypes[_operation] = _type.name.value;\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n } // Support both original legacy names and extended legacy names.\n\n\n var allowedLegacyNames = schemaConfig.allowedLegacyNames.concat(options && options.allowedLegacyNames || []); // Then produce and return a Schema with these types.\n\n return new _type_schema__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLSchema\"]({\n // Note: While this could make early assertions to get the correctly\n // typed values, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n query: getMaybeTypeByName(operationTypes.query),\n mutation: getMaybeTypeByName(operationTypes.mutation),\n subscription: getMaybeTypeByName(operationTypes.subscription),\n types: Object(_polyfills_objectValues__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeMap),\n directives: getMergedDirectives(),\n astNode: schemaDef || schemaConfig.astNode,\n extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExts),\n allowedLegacyNames: allowedLegacyNames\n }); // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function replaceType(type) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isListType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLList\"](replaceType(type.ofType));\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isNonNullType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLNonNull\"](replaceType(type.ofType));\n }\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n return typeMap[type.name];\n }\n\n function getMaybeTypeByName(typeName) {\n return typeName ? typeMap[typeName] : null;\n }\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives().map(extendDirective);\n !existingDirectives ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'schema must have default directives') : void 0;\n return existingDirectives.concat(directiveDefs.map(function (node) {\n return astBuilder.buildDirective(node);\n }));\n }\n\n function extendNamedType(type) {\n if (Object(_type_introspection__WEBPACK_IMPORTED_MODULE_9__[\"isIntrospectionType\"])(type) || Object(_type_scalars__WEBPACK_IMPORTED_MODULE_10__[\"isSpecifiedScalarType\"])(type)) {\n // Builtin types are not extended.\n return type;\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isScalarType\"])(type)) {\n return extendScalarType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isObjectType\"])(type)) {\n return extendObjectType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInterfaceType\"])(type)) {\n return extendInterfaceType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isUnionType\"])(type)) {\n return extendUnionType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isEnumType\"])(type)) {\n return extendEnumType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInputObjectType\"])(type)) {\n return extendInputObjectType(type);\n } // Not reachable. All possible types have been considered.\n\n /* istanbul ignore next */\n\n\n throw new Error(\"Unexpected type: \\\"\".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type), \"\\\".\"));\n }\n\n function extendDirective(directive) {\n var config = directive.toConfig();\n return new _type_directives__WEBPACK_IMPORTED_MODULE_12__[\"GraphQLDirective\"](_objectSpread({}, config, {\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.args, extendArg)\n }));\n }\n\n function extendInputObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInputObjectType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, function (field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type)\n });\n }), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (field) {\n return field.name.value;\n }, function (field) {\n return astBuilder.buildInputField(field);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendEnumType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[type.name] || [];\n var valueNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.values || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLEnumType\"](_objectSpread({}, config, {\n values: _objectSpread({}, config.values, Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(valueNodes, function (value) {\n return value.name.value;\n }, function (value) {\n return astBuilder.buildEnumValue(value);\n })),\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendScalarType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLScalarType\"](_objectSpread({}, config, {\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var interfaceNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.interfaces || [];\n });\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLObjectType\"](_objectSpread({}, config, {\n interfaces: function interfaces() {\n return [].concat(type.getInterfaces().map(replaceNamedType), interfaceNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendInterfaceType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInterfaceType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendUnionType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var typeNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.types || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLUnionType\"](_objectSpread({}, config, {\n types: function types() {\n return [].concat(type.getTypes().map(replaceNamedType), typeNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendField(field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type),\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(field.args, extendArg)\n });\n }\n\n function extendArg(arg) {\n return _objectSpread({}, arg, {\n type: replaceType(arg.type)\n });\n }\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var valuesRemovedFromEnums = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n\t return;\n\t }\n\t var valuesInNewEnum = Object.create(null);\n\t newType.getValues().forEach(function (value) {\n\t valuesInNewEnum[value.name] = true;\n\t });\n\t oldType.getValues().forEach(function (value) {\n\t if (!valuesInNewEnum[value.name]) {\n\t valuesRemovedFromEnums.push({\n\t type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n\t description: value.name + ' was removed from enum type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return valuesRemovedFromEnums;\n\t}", "function mergeClientSchemas(...schemas) {\n\t// Merge types\n\tconst schema = mergeSchemas({ schemas });\n\n\t// Get the directives from each schema\n\tconst schemaDirectives = map(schemas, '_directives');\n\n\t// Merge directives by name (directives are ignored by mergeSchemas())\n\t/* eslint-disable-next-line no-underscore-dangle */\n\tschema._directives = uniqBy(concat(...schemaDirectives), 'name');\n\n\treturn schema;\n}", "function extendSchema(schema, documentAST) {\n (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = {};\n var typeExtensionsMap = {};\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case _kinds.OBJECT_TYPE_DEFINITION:\n case _kinds.INTERFACE_TYPE_DEFINITION:\n case _kinds.ENUM_TYPE_DEFINITION:\n case _kinds.UNION_TYPE_DEFINITION:\n case _kinds.SCALAR_TYPE_DEFINITION:\n case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case _kinds.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n }\n }\n\n // If this document contains no new types, then return the same unmodified\n // GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n // Copy directives.\n directives: schema.getDirectives()\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n (0, _invariant2.default)(type, 'Missing type from schema');\n return type;\n }\n\n function getTypeFromAST(astNode) {\n var type = _getNamedType(astNode.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n return type;\n }\n\n function getInterfaceTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n return type;\n }\n\n function getInputTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n return type;\n }\n\n function getOutputTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n return type;\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeAST = typeDefinitionMap[typeName];\n if (typeAST) {\n var _typeDef = buildType(typeAST);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n return new _definition.GraphQLObjectType({\n name: type.name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n }\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = {};\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n resolve: cannotExecuteClientSchema\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n resolve: cannotExecuteClientSchema\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeAST) {\n switch (typeAST.kind) {\n case _kinds.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeAST);\n case _kinds.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeAST);\n case _kinds.UNION_TYPE_DEFINITION:\n return buildUnionType(typeAST);\n case _kinds.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeAST);\n case _kinds.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeAST);\n case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeAST);\n }\n throw new TypeError('Unknown type kind ' + typeAST.kind);\n }\n\n function buildObjectType(typeAST) {\n return new _definition.GraphQLObjectType({\n name: typeAST.name.value,\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeAST);\n },\n fields: function fields() {\n return buildFieldMap(typeAST);\n }\n });\n }\n\n function buildInterfaceType(typeAST) {\n return new _definition.GraphQLInterfaceType({\n name: typeAST.name.value,\n fields: function fields() {\n return buildFieldMap(typeAST);\n },\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function buildUnionType(typeAST) {\n return new _definition.GraphQLUnionType({\n name: typeAST.name.value,\n types: typeAST.types.map(getObjectTypeFromAST),\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function buildScalarType(typeAST) {\n return new _definition.GraphQLScalarType({\n name: typeAST.name.value,\n serialize: function serialize() {\n return null;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeAST) {\n return new _definition.GraphQLEnumType({\n name: typeAST.name.value,\n values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n return v.name.value;\n }, function () {\n return {};\n })\n });\n }\n\n function buildInputObjectType(typeAST) {\n return new _definition.GraphQLInputObjectType({\n name: typeAST.name.value,\n fields: function fields() {\n return buildInputValues(typeAST.fields);\n }\n });\n }\n\n function buildImplementedInterfaces(typeAST) {\n return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeAST) {\n return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n resolve: cannotExecuteClientSchema\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n };\n });\n }\n\n function buildInputFieldType(typeAST) {\n if (typeAST.kind === _kinds.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n }\n if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeAST.type);\n (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeAST);\n }\n\n function buildOutputFieldType(typeAST) {\n if (typeAST.kind === _kinds.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n }\n if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeAST.type);\n (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeAST);\n }\n}", "function processSchema(schema, schemaKey, sourceSchemas, newSchemas, preserveUnneeded) {\n /*\n * Most schemas have a name. However, not all do. We must nevertheless expose those schemas as they have root\n * operations on them. Thus, we convert the key into a form that can be used to identify them.\n */\n schema.name = schemaKeyToTypeName(schemaKey, sourceSchemas);\n\n // If this schema has already been processed (see recursive call, below), return it\n if (newSchemas[schema.name]) {\n return newSchemas[schema.name];\n }\n\n newSchemas[schema.name] = schema;\n\n if (schema.root) {\n schema.rootTypeName = schema.name;\n }\n\n // Process the parent schema, if any. This assumes all extends schemas have just a $ref property.\n var parentSchema = schema.extends;\n if (parentSchema) {\n schema.parentSchema = processSchema(sourceSchemas[parentSchema.$ref], parentSchema.$ref,\n sourceSchemas, newSchemas);\n parentSchema.$ref = schemaKeyToTypeName(parentSchema.$ref, sourceSchemas);\n parentSchema = schema.parentSchema;\n\n if (!schema.rootTypeName) {\n schema.rootTypeName = parentSchema.rootTypeName;\n }\n\n schema.root = schema.root || parentSchema.root;\n }\n\n if (!preserveUnneeded) {\n delete schema.description;\n }\n\n processProperties(schema, parentSchema, sourceSchemas, preserveUnneeded);\n processOperations(schema, parentSchema, sourceSchemas);\n\n return schema;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function mergeTypeDefs (typeDefs) {\n const documents = typeDefs.map((document) => {\n if (typeof document === 'string') {\n return parse(document)\n }\n return document\n })\n const definitions = []\n\n documents.forEach((document) => {\n document.definitions.forEach(definition => {\n switch (definition.kind) {\n case 'ObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'ObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.interfaces = mergeInterfaces(existingDefinition.interfaces, definition.interfaces)\n return\n }\n break\n }\n case 'InterfaceTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InterfaceTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n case 'UnionTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'UnionTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.types = mergeUnionTypes(existingDefinition.types, definition.types)\n return\n }\n break\n }\n case 'EnumTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'EnumTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.values = mergeEnumValues(existingDefinition.values, definition.values)\n return\n }\n break\n }\n case 'InputObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InputObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeInputValues(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n }\n definitions.push(definition)\n })\n })\n\n return {\n kind: 'Document',\n definitions,\n }\n}", "getAdditionalSchemas() {\n const additionalSchemas = this.schemas.join('\\n');\n return additionalSchemas;\n }", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if ((0, _definition.isListType)(type1)) {\n return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isListType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isNonNullType)(type1)) {\n return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if ((0, _definition.isNonNullType)(type2)) {\n return true;\n }\n\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "fixAnyOf(schema) {\n const anyOf = schema.anyOf;\n // find existence count of all enum properties in anyOf elements\n // the reason of this, a field could be enum type for some and not for some other anyOf element\n const enumPropCount = {};\n anyOf.forEach(anyOfElement => {\n Object.keys(anyOfElement.properties)\n .filter(prop => anyOfElement.properties[prop].enum)\n .forEach(prop => {\n if (!enumPropCount[prop]) {\n enumPropCount[prop] = 0;\n }\n enumPropCount[prop]++;\n });\n });\n // combine all enum arrays in anyOf elements\n const enums = {};\n Object.keys(enumPropCount)\n .forEach(prop => {\n anyOf.forEach(anyOfElement => {\n if (!enums[prop]) {\n enums[prop] = [];\n }\n const enumValues = anyOfElement.properties[prop].enum;\n // check if current field is enum for current anyOf element\n if (enumValues) {\n enums[prop] = enums[prop].concat(enumValues);\n }\n });\n });\n const fixedSchema = anyOf[0];\n // shallow cleaning of format and pattern\n Object.keys(fixedSchema.properties)\n .forEach(prop => {\n delete fixedSchema.properties[prop].format;\n delete fixedSchema.properties[prop].pattern;\n });\n Object.keys(enumPropCount)\n .forEach(prop => {\n const uniqueEnumValues = Array.from(new Set(enums[prop]));\n // if a field enum for all anyOf elements\n if (enumPropCount[prop] === anyOf.length) {\n // merge all enum values into one\n fixedSchema.properties[prop].enum = uniqueEnumValues;\n // if a field enum for some of anyOf elements\n }\n else {\n // create a autocomplete config so that it will allow any values\n // but autocomplete from enum values from where the field is defined as enum\n delete fixedSchema.properties[prop].enum;\n fixedSchema.properties[prop].autocompletionConfig = {\n source: uniqueEnumValues,\n size: 7\n };\n }\n });\n // copy disabled attribute inside fixedSchema because it\n // is outside anyOf element and is ignored\n if (schema.disabled) {\n fixedSchema.disabled = true;\n }\n return fixedSchema;\n }", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeA)) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isPossibleType(typeA, typeB);\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_0__[\"isAbstractType\"])(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function schemaDiff(comparison) {\n\t// TODO\n\t// TODO\n}", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "getPossibleTypes() {\n const seenTypes = new Set;\n function process(obj) {\n seenTypes.add(obj);\n for (const child of obj.getChildSchemas()) {\n if (seenTypes.has(child)) continue;\n // we know Base.key is SchemaRef\n process(child);\n }\n }\n process(this);\n return Array.from(seenTypes);\n }", "function patchSchema(data) {\n data.properties.upload_type.enum = data.properties.upload_type.type.enum;\n data.properties.upload_type.type = \"string\";\n data.properties.publication_type.enum =\n data.properties.publication_type.type.enum;\n data.properties.publication_type.type = \"string\";\n data.properties.image_type.enum = data.properties.image_type.type.enum;\n data.properties.image_type.type = \"string\";\n return data;\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesConflict(type1, type2) {\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isListType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type1)) {\n return Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isNonNullType\"])(type2)) {\n return true;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type1) || Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isLeafType\"])(type2)) {\n return type1 !== type2;\n }\n\n return false;\n} // Given a selection set, return the collection of fields (a mapping of response", "function doTypesOverlap(schema, typeA, typeB) {\n\t // So flow is aware this is constant\n\t var _typeB = typeB;\n\n\t // Equivalent types overlap\n\t if (typeA === _typeB) {\n\t return true;\n\t }\n\n\t if (typeA instanceof _definition.GraphQLInterfaceType || typeA instanceof _definition.GraphQLUnionType) {\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // If both types are abstract, then determine if there is any intersection\n\t // between possible concrete types of each.\n\t return schema.getPossibleTypes(typeA).some(function (type) {\n\t return schema.isPossibleType(_typeB, type);\n\t });\n\t }\n\t // Determine if the latter type is a possible concrete type of the former.\n\t return schema.isPossibleType(typeA, _typeB);\n\t }\n\n\t if (_typeB instanceof _definition.GraphQLInterfaceType || _typeB instanceof _definition.GraphQLUnionType) {\n\t // Determine if the former type is a possible concrete type of the latter.\n\t return schema.isPossibleType(_typeB, typeA);\n\t }\n\n\t // Otherwise the types do not overlap.\n\t return false;\n\t}", "fixOptionalChoiceNot(jsonSchema, node) {\n const originalOneOf = new JsonSchemaFile();\n originalOneOf.oneOf = jsonSchema.oneOf.slice(0);\n jsonSchema.anyOf.push(originalOneOf);\n const theOptionalPart = new JsonSchemaFile();\n jsonSchema.oneOf.forEach(function(option, index, array) {\n const notSchema = new JsonSchemaFile();\n notSchema.not = option;\n theOptionalPart.allOf.push(notSchema);\n });\n jsonSchema.anyOf.push(theOptionalPart);\n jsonSchema.oneOf = [];\n }", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function addOtherSchemaTest() {\n var schema_multi = {\n className: \"NobelWinner\",\n fields: {\n name: {\n type: \"Object\",\n fields: {\n alias1 : {\n type: \"String\"\n },\n alias2 : {\n type: \"String\"\n }\n }\n },\n address: {\n type: \"String\"\n }\n }\n };\n XHR.POST(SERVER_URL+'/schemas', schema_multi)\n}", "addQueryBuilders(schema, query) {\n _.each(schema, function (field) {\n const fieldType = self.fieldTypes[field.type];\n if (query[field.name]) {\n return;\n }\n if (fieldType.addQueryBuilder) {\n fieldType.addQueryBuilder(field, query);\n }\n });\n }", "function tighten(schema) {\n if (!isDefined(schema.type)) {\n if (isDefined(schema.properties)) {\n schema.type = 'object';\n }\n if (isDefined(schema.pattern)) {\n schema.type = 'string';\n }\n if (isDefined(schema.minLength) || isDefined(schema.maxLength)) {\n schema.type = 'string';\n }\n if (isDefined(schema.enum)) {\n var allStrings = _(schema.enum).all(function (item) {\n return typeof item === 'string';\n });\n if (allStrings) {\n schema.type = 'string';\n }\n }\n if (isDefined(schema.items)) {\n schema.type = 'array';\n }\n } else {\n if (_.isArray(schema.type)) {\n _.each(schema.type, function (unionType) {\n tighten(unionType);\n });\n }\n }\n if (!isDefined(schema.required)) {\n schema.required = true;\n }\n if (isDefined(schema.properties)) {\n _(schema.properties).each(function (propertySchema) {\n tighten(propertySchema);\n });\n if (!isDefined(schema.additionalProperties)) {\n schema.additionalProperties = false;\n }\n }\n if (isDefined(schema.items)) {\n if (_.isArray(schema.items)) {\n _.each(schema.items, function (item) {\n tighten(item);\n });\n if (!isDefined(schema.additionalItems)) {\n schema.additionalItems = false;\n }\n } else {\n tighten(schema.items);\n }\n }\n return schema;\n}", "static unionType(firstType, secondType, ...additionalTypes) {\r\n return getWriteFunctionForUnionOrIntersectionType(\"|\", [firstType, secondType, ...additionalTypes]);\r\n }", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if ((0, _definition.isAbstractType)(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // Equivalent types overlap\n if (typeA === typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isSubType(typeB, type);\n });\n } // Determine if the latter type is a possible concrete type of the former.\n\n\n return schema.isSubType(typeA, typeB);\n }\n\n if ((0, _definition.isAbstractType)(typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isSubType(typeB, typeA);\n } // Otherwise the types do not overlap.\n\n\n return false;\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function doTypesOverlap(schema, typeA, typeB) {\n // So flow is aware this is constant\n var _typeB = typeB;\n\n // Equivalent types overlap\n if (typeA === _typeB) {\n return true;\n }\n\n if ((0, _definition.isAbstractType)(typeA)) {\n if ((0, _definition.isAbstractType)(_typeB)) {\n // If both types are abstract, then determine if there is any intersection\n // between possible concrete types of each.\n return schema.getPossibleTypes(typeA).some(function (type) {\n return schema.isPossibleType(_typeB, type);\n });\n }\n // Determine if the latter type is a possible concrete type of the former.\n return schema.isPossibleType(typeA, _typeB);\n }\n\n if ((0, _definition.isAbstractType)(_typeB)) {\n // Determine if the former type is a possible concrete type of the latter.\n return schema.isPossibleType(_typeB, typeA);\n }\n\n // Otherwise the types do not overlap.\n return false;\n}", "function applyTypes(source, operations) {\n const input = source;\n let {schema, inferred} = getSchema(source);\n const types = new Map(schema.map(({name, type}) => [name, type]));\n if (operations.types) {\n for (const {name, type} of operations.types) {\n types.set(name, type);\n // update schema with user-selected type\n if (schema === input.schema) schema = schema.slice(); // copy on write\n const colIndex = schema.findIndex((col) => col.name === name);\n if (colIndex > -1) schema[colIndex] = {...schema[colIndex], type};\n }\n source = source.map(d => coerceRow(d, types, schema));\n } else if (inferred) {\n // Coerce data according to new schema, unless that happened due to\n // operations.types, above.\n source = source.map(d => coerceRow(d, types, schema));\n }\n return {source, schema};\n}", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function newTypesComplain(req, res) {\n\n}", "function addTypesToUnion(typeSet, types) {\n for (var _i = 0, types_4 = types; _i < types_4.length; _i++) {\n var type = types_4[_i];\n addTypeToUnion(typeSet, type);\n }\n }", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isObjectType\"])(type) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isInterfaceType\"])(type)) {\n var possibleFieldNames = Object.keys(type.getFields());\n return Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n\n return [];\n}", "function markListOperations(schemas) {\n _.each(schemas, function(schema) {\n if (schema.list) {\n if (_.isEmpty(schema.list.parameters)) {\n schema.list.dxFilterMode = dx.core.constants.LIST_TYPES.NONE;\n } else {\n var missingMapsTo = false;\n _.any(schema.list.parameters, function(param) {\n if (!param.mapsTo) {\n missingMapsTo = true;\n return true;\n }\n });\n schema.list.dxFilterMode = missingMapsTo ? dx.core.constants.LIST_TYPES.CUSTOM :\n dx.core.constants.LIST_TYPES.UBER;\n }\n }\n });\n}", "function getDiffs(oldDoc, newDoc) {\n const changes = new Array();\n const flatOld = flattenObject(oldDoc);\n const flatNew = flattenObject(newDoc);\n // find deleted nodes\n Object.keys(flatOld).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatNew, key)) {\n changes.push({\n action: 'DELETED',\n keyName: key,\n });\n }\n });\n // find added nodes\n Object.keys(flatNew).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatOld, key)) {\n changes.push({\n action: 'ADDED',\n keyName: key,\n });\n }\n });\n // find updated nodes\n Object.keys(flatOld).forEach(key => {\n let oldValue = flatOld[key];\n if (Array.isArray(oldValue)) {\n oldValue = oldValue.join(', ');\n }\n let newValue = flatNew[key];\n if (newValue) {\n if (Array.isArray(newValue)) {\n newValue = newValue.join(', ');\n }\n if (newValue !== oldValue && key !== 'revision' && key !== 'etag') {\n changes.push({\n action: 'CHANGED',\n keyName: key,\n });\n }\n }\n });\n return changes;\n}", "function getSchemaOptions(discriminatorSchemas, componentSchemas) {\n const options = [];\n\n Object.keys(discriminatorSchemas).forEach(dsKey => {\n const discSchema = discriminatorSchemas[dsKey];\n Object.keys(componentSchemas).forEach(componentKey => {\n if (deepEquals(cleanDiscriminatorSchema(discSchema), componentSchemas[componentKey])) {\n options.push({\n label: componentKey,\n value: componentKey,\n });\n }\n });\n });\n\n return options;\n}", "function inspectVariantTypes(types) {\r\n const variantTypes = new Set();\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike))) {\r\n variantTypes.add('nullish');\r\n }\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLike))) {\r\n variantTypes.add('boolean');\r\n }\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike))) {\r\n variantTypes.add('string');\r\n }\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.NumberLike))) {\r\n variantTypes.add('number');\r\n }\r\n if (types.some(type => !tsutils.isTypeFlagSet(type, ts.TypeFlags.Null |\r\n ts.TypeFlags.Undefined |\r\n ts.TypeFlags.VoidLike |\r\n ts.TypeFlags.BooleanLike |\r\n ts.TypeFlags.StringLike |\r\n ts.TypeFlags.NumberLike |\r\n ts.TypeFlags.Any |\r\n ts.TypeFlags.Unknown |\r\n ts.TypeFlags.Never))) {\r\n variantTypes.add('object');\r\n }\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown))) {\r\n variantTypes.add('any');\r\n }\r\n if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Never))) {\r\n variantTypes.add('never');\r\n }\r\n return variantTypes;\r\n }", "function doTypesConflict(type1, type2) {\n if (type1 instanceof _definition.GraphQLList) {\n return type2 instanceof _definition.GraphQLList ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type2 instanceof _definition.GraphQLList) {\n return type1 instanceof _definition.GraphQLList ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type1 instanceof _definition.GraphQLNonNull) {\n return type2 instanceof _definition.GraphQLNonNull ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type2 instanceof _definition.GraphQLNonNull) {\n return type1 instanceof _definition.GraphQLNonNull ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n return false;\n}", "function doTypesConflict(type1, type2) {\n if (type1 instanceof _definition.GraphQLList) {\n return type2 instanceof _definition.GraphQLList ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type2 instanceof _definition.GraphQLList) {\n return type1 instanceof _definition.GraphQLList ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type1 instanceof _definition.GraphQLNonNull) {\n return type2 instanceof _definition.GraphQLNonNull ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if (type2 instanceof _definition.GraphQLNonNull) {\n return type1 instanceof _definition.GraphQLNonNull ? doTypesConflict(type1.ofType, type2.ofType) : true;\n }\n if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) {\n return type1 !== type2;\n }\n return false;\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isAbstractType\"])(type)) {\n var suggestedObjectTypes = [];\n var interfaceUsageCount = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = schema.getPossibleTypes(type)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var possibleType = _step.value;\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedObjectTypes.push(possibleType.name);\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = possibleType.getInterfaces()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var possibleInterface = _step2.value;\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n } // Suggest interface types based on how common they are.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {\n return interfaceUsageCount[b] - interfaceUsageCount[a];\n }); // Suggest both interface and object types.\n\n return suggestedInterfaceTypes.concat(suggestedObjectTypes);\n } // Otherwise, must be an Object type, which does not have possible fields.\n\n\n return [];\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!(0, _definition.isAbstractType)(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return (0, _naturalCompare.default)(typeA.name, typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!(0, _definition.isAbstractType)(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return (0, _naturalCompare.default)(typeA.name, typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "_refreshTypeParser(dataType) {\n\n if (dataType.types.postgres.oids) {\n for (const oid of dataType.types.postgres.oids) {\n this.lib.types.setTypeParser(oid, value => dataType.parse(value, oid, this.lib.types.getTypeParser));\n }\n }\n\n if (dataType.types.postgres.array_oids) {\n for (const oid of dataType.types.postgres.array_oids) {\n this.lib.types.setTypeParser(oid, value =>\n this.lib.types.arrayParser.create(value, v =>\n dataType.parse(v, oid, this.lib.types.getTypeParser)\n ).parse()\n );\n }\n }\n }", "function unionKnownDisjoint(as, bs) {\n return as.concat(bs);\n }", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (type instanceof _definition.GraphQLObjectType || type instanceof _definition.GraphQLInterfaceType) {\n var possibleFieldNames = Object.keys(type.getFields());\n return (0, _suggestionList2.default)(fieldName, possibleFieldNames);\n }\n // Otherwise, must be a Union type, which does not define fields.\n return [];\n}", "function PossibleTypeExtensions(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = context.getDocument().definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_4__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema && schema.getType(typeName);\n\n if (defNode) {\n var expectedKind = defKindToExtKind[defNode.kind];\n\n if (expectedKind !== node.kind) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingDifferentTypeKindMessage(typeName, extensionKindToTypeName(expectedKind)), [defNode, node]));\n }\n } else if (existingType) {\n var _expectedKind = typeToExtKind(existingType);\n\n if (_expectedKind !== node.kind) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingDifferentTypeKindMessage(typeName, extensionKindToTypeName(_expectedKind)), node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeName, allTypeNames);\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingUnknownTypeMessage(typeName, suggestedTypes), node.name));\n }\n }\n}" ]
[ "0.78702915", "0.76301306", "0.7412617", "0.7412617", "0.74009883", "0.7070576", "0.7035441", "0.7035441", "0.7005445", "0.68193376", "0.68171537", "0.68171537", "0.6798756", "0.6781975", "0.6781975", "0.6754903", "0.65813017", "0.6446255", "0.6431304", "0.63871443", "0.63271374", "0.6208715", "0.61564", "0.61564", "0.61564", "0.61564", "0.6144508", "0.61045563", "0.61045563", "0.6038318", "0.6038318", "0.59651357", "0.5927051", "0.58419156", "0.57340443", "0.57329035", "0.57329035", "0.57112163", "0.5666789", "0.5666789", "0.56512874", "0.5505627", "0.5393765", "0.5359349", "0.52951276", "0.52951276", "0.52951276", "0.52445686", "0.52126443", "0.51591915", "0.51591915", "0.5096146", "0.50933176", "0.50933176", "0.5083557", "0.5079934", "0.5032815", "0.50271505", "0.49909747", "0.49855512", "0.49855512", "0.49831378", "0.49831378", "0.4970883", "0.4962567", "0.4935513", "0.4935513", "0.48874366", "0.4869932", "0.48447523", "0.4841004", "0.4833222", "0.4833222", "0.48223147", "0.48223147", "0.48125473", "0.48125473", "0.4795335", "0.4795335", "0.4795335", "0.47711283", "0.4754205", "0.4754205", "0.47499642", "0.4742779", "0.47380975", "0.4708023", "0.46962363", "0.46937704", "0.46411562", "0.46394137", "0.46394137", "0.4631361", "0.4619928", "0.4618512", "0.4618512", "0.4613191", "0.46071768", "0.45962402", "0.45938683" ]
0.7796355
1
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to removing values from an enum type.
function findValuesRemovedFromEnums(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var valuesRemovedFromEnums = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) { return; } var valuesInNewEnum = Object.create(null); newType.getValues().forEach(function (value) { valuesInNewEnum[value.name] = true; }); oldType.getValues().forEach(function (value) { if (!valuesInNewEnum[value.name]) { valuesRemovedFromEnums.push({ type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, description: value.name + ' was removed from enum type ' + typeName + '.' }); } }); }); return valuesRemovedFromEnums; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInNewEnum = Object.create(null);\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = newType.getValues()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var value = _step7.value;\n valuesInNewEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = oldType.getValues()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _value = _step8.value;\n\n if (!valuesInNewEnum[_value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: \"\".concat(_value.name, \" was removed from enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n }\n\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var valuesRemovedFromEnums = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n\t return;\n\t }\n\t var valuesInNewEnum = Object.create(null);\n\t newType.getValues().forEach(function (value) {\n\t valuesInNewEnum[value.name] = true;\n\t });\n\t oldType.getValues().forEach(function (value) {\n\t if (!valuesInNewEnum[value.name]) {\n\t valuesRemovedFromEnums.push({\n\t type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n\t description: value.name + ' was removed from enum type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return valuesRemovedFromEnums;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr = Object.keys(oldTypeMap);\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var typeName = _arr[_i];\n\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: \"\".concat(typeName, \" was removed.\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_REMOVED,\n\t description: typeName + ' was removed.'\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr2 = Object.keys(oldTypeMap);\n\n for (var _i2 = 0; _i2 < _arr2.length; _i2++) {\n var typeName = _arr2[_i2];\n\n if (!newTypeMap[typeName]) {\n continue;\n }\n\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (oldType.constructor !== newType.constructor) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: \"\".concat(typeName, \" changed from \") + \"\".concat(typeKindName(oldType), \" to \").concat(typeKindName(newType), \".\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t return;\n\t }\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof newType.constructor)) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_CHANGED_KIND,\n\t description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findBreakingChanges(oldSchema, newSchema) {\n\t return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema));\n\t}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType || oldType instanceof _definition.GraphQLInputObjectType) || !(newType instanceof oldType.constructor)) {\n\t return;\n\t }\n\n\t var oldTypeFieldsDef = oldType.getFields();\n\t var newTypeFieldsDef = newType.getFields();\n\t Object.keys(oldTypeFieldsDef).forEach(function (fieldName) {\n\t // Check if the field is missing on the type in the new schema.\n\t if (!(fieldName in newTypeFieldsDef)) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_REMOVED,\n\t description: typeName + '.' + fieldName + ' was removed.'\n\t });\n\t } else {\n\t // Check if the field's type has changed in the new schema.\n\t var oldFieldType = (0, _definition.getNamedType)(oldTypeFieldsDef[fieldName].type);\n\t var newFieldType = (0, _definition.getNamedType)(newTypeFieldsDef[fieldName].type);\n\t if (oldFieldType && newFieldType && oldFieldType.name !== newFieldType.name) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_CHANGED_KIND,\n\t description: typeName + '.' + fieldName + ' changed type from ' + (oldFieldType.name + ' to ' + newFieldType.name + '.')\n\t });\n\t }\n\t }\n\t });\n\t });\n\t return breakingFieldChanges;\n\t}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).breakingChanges, findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema), findRemovedDirectives(oldSchema, newSchema), findRemovedDirectiveArgs(oldSchema, newSchema), findAddedNonNullDirectiveArgs(oldSchema, newSchema), findRemovedDirectiveLocations(oldSchema, newSchema));\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n var dangerousChanges = [];\n\n var _arr3 = Object.keys(oldTypeMap);\n\n for (var _i3 = 0; _i3 < _arr3.length; _i3++) {\n var typeName = _arr3[_i3];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(oldType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(oldType)) || !(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(newType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(newType)) || newType.constructor !== oldType.constructor) {\n continue;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n var _arr4 = Object.keys(oldTypeFields);\n\n for (var _i4 = 0; _i4 < _arr4.length; _i4++) {\n var fieldName = _arr4[_i4];\n\n if (!newTypeFields[fieldName]) {\n continue;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var oldArgDef = _step.value;\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(newArgs, function (arg) {\n return arg.name === oldArgDef.name;\n }); // Arg not present\n\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" was removed\")\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed type from \") + \"\".concat(oldArgDef.type.toString(), \" to \").concat(newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed defaultValue\")\n });\n }\n }\n };\n\n for (var _iterator = oldTypeFields[fieldName].args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n _loop();\n } // Check if arg was added to the field\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n var _loop2 = function _loop2() {\n var newArgDef = _step2.value;\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(oldArgs, function (arg) {\n return arg.name === newArgDef.name;\n });\n\n if (!oldArgDef) {\n var argName = newArgDef.name;\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isRequiredArgument\"])(newArgDef)) {\n breakingChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: \"A required arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n } else {\n dangerousChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: \"An optional arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n }\n }\n };\n\n for (var _iterator2 = newTypeFields[fieldName].args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n _loop2();\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findInterfacesAddedToObjectTypes(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).dangerousChanges);\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges);\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesAddedToUnion = [];\n Object.keys(newTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInOldUnion = Object.create(null);\n oldType.getTypes().forEach(function (type) {\n typeNamesInOldUnion[type.name] = true;\n });\n newType.getTypes().forEach(function (type) {\n if (!typeNamesInOldUnion[type.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: type.name + ' was added to union type ' + typeName + '.'\n });\n }\n });\n });\n return typesAddedToUnion;\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "fixAnyOf(schema) {\n const anyOf = schema.anyOf;\n // find existence count of all enum properties in anyOf elements\n // the reason of this, a field could be enum type for some and not for some other anyOf element\n const enumPropCount = {};\n anyOf.forEach(anyOfElement => {\n Object.keys(anyOfElement.properties)\n .filter(prop => anyOfElement.properties[prop].enum)\n .forEach(prop => {\n if (!enumPropCount[prop]) {\n enumPropCount[prop] = 0;\n }\n enumPropCount[prop]++;\n });\n });\n // combine all enum arrays in anyOf elements\n const enums = {};\n Object.keys(enumPropCount)\n .forEach(prop => {\n anyOf.forEach(anyOfElement => {\n if (!enums[prop]) {\n enums[prop] = [];\n }\n const enumValues = anyOfElement.properties[prop].enum;\n // check if current field is enum for current anyOf element\n if (enumValues) {\n enums[prop] = enums[prop].concat(enumValues);\n }\n });\n });\n const fixedSchema = anyOf[0];\n // shallow cleaning of format and pattern\n Object.keys(fixedSchema.properties)\n .forEach(prop => {\n delete fixedSchema.properties[prop].format;\n delete fixedSchema.properties[prop].pattern;\n });\n Object.keys(enumPropCount)\n .forEach(prop => {\n const uniqueEnumValues = Array.from(new Set(enums[prop]));\n // if a field enum for all anyOf elements\n if (enumPropCount[prop] === anyOf.length) {\n // merge all enum values into one\n fixedSchema.properties[prop].enum = uniqueEnumValues;\n // if a field enum for some of anyOf elements\n }\n else {\n // create a autocomplete config so that it will allow any values\n // but autocomplete from enum values from where the field is defined as enum\n delete fixedSchema.properties[prop].enum;\n fixedSchema.properties[prop].autocompletionConfig = {\n source: uniqueEnumValues,\n size: 7\n };\n }\n });\n // copy disabled attribute inside fixedSchema because it\n // is outside anyOf element and is ignored\n if (schema.disabled) {\n fixedSchema.disabled = true;\n }\n return fixedSchema;\n }", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function getDiffs(oldDoc, newDoc) {\n const changes = new Array();\n const flatOld = flattenObject(oldDoc);\n const flatNew = flattenObject(newDoc);\n // find deleted nodes\n Object.keys(flatOld).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatNew, key)) {\n changes.push({\n action: 'DELETED',\n keyName: key,\n });\n }\n });\n // find added nodes\n Object.keys(flatNew).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatOld, key)) {\n changes.push({\n action: 'ADDED',\n keyName: key,\n });\n }\n });\n // find updated nodes\n Object.keys(flatOld).forEach(key => {\n let oldValue = flatOld[key];\n if (Array.isArray(oldValue)) {\n oldValue = oldValue.join(', ');\n }\n let newValue = flatNew[key];\n if (newValue) {\n if (Array.isArray(newValue)) {\n newValue = newValue.join(', ');\n }\n if (newValue !== oldValue && key !== 'revision' && key !== 'etag') {\n changes.push({\n action: 'CHANGED',\n keyName: key,\n });\n }\n }\n });\n return changes;\n}", "function schemaDiff(comparison) {\n\t// TODO\n\t// TODO\n}", "stripIfExcludedOrgType(types, schema) {\n return Joi.when(Joi.ref('organisationType'), {\n is: Joi.exist().valid(...types),\n then: Joi.any().strip(),\n otherwise: schema,\n });\n }", "getPossibleTypes() {\n const seenTypes = new Set;\n function process(obj) {\n seenTypes.add(obj);\n for (const child of obj.getChildSchemas()) {\n if (seenTypes.has(child)) continue;\n // we know Base.key is SchemaRef\n process(child);\n }\n }\n process(this);\n return Array.from(seenTypes);\n }", "function myProductsWithoutDescription(products) {\n\tlet newArray = [];\n\tfor (const product of products) {\n\t\tdelete product.description;\n\t\tnewArray.push(product);\n\t}\n\treturn newArray;\n}", "function diff(first, second) {\n const a = new Set(first);\n const b = new Set(second);\n \n return [\n ...first.filter(x => !b.has(x)),\n ...second.filter(x => !a.has(x))\n ];\n}", "removeMissingIfTypeMismatch() {\n const typeMismatches = this.failures.filter(x => x.type === 'TypeMismatch');\n const missings = [];\n for (const typeMismatch of typeMismatches) {\n missings.push(this.failures.filter(x => x.property === typeMismatch.property && x.type === 'MissingProperty')[0]);\n this.failures = this.failures.filter(x => !missings.includes(x));\n }\n }", "function diffFacts(a,b,category){var diff;// look for changes and removals\nfor(var aKey in a){if(aKey===STYLE_KEY||aKey===EVENT_KEY||aKey===ATTR_KEY||aKey===ATTR_NS_KEY){var subDiff=diffFacts(a[aKey],b[aKey]||{},aKey);if(subDiff){diff=diff||{};diff[aKey]=subDiff;}continue;}// remove if not in the new facts\nif(!(aKey in b)){diff=diff||{};diff[aKey]=typeof category==='undefined'?typeof a[aKey]==='string'?'':null:category===STYLE_KEY?'':category===EVENT_KEY||category===ATTR_KEY?undefined:{namespace:a[aKey].namespace,value:undefined};continue;}var aValue=a[aKey];var bValue=b[aKey];// reference equal, so don't worry about it\nif(aValue===bValue&&aKey!=='value'||category===EVENT_KEY&&equalEvents(aValue,bValue)){continue;}diff=diff||{};diff[aKey]=bValue;}// add new stuff\nfor(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey];}}return diff;}", "schemafy(keys, schema) {\n return keys\n .concat(schema.required || [])\n .filter(key => this.isNotHidden(key, schema) || this.appGlobalsService.adminMode)\n .concat(schema.alwaysShow || [])\n .sort((a, b) => this.compareKeysBySchemaService.compare(a, b, schema))\n .toOrderedSet();\n }", "fixOptionalChoiceNot(jsonSchema, node) {\n const originalOneOf = new JsonSchemaFile();\n originalOneOf.oneOf = jsonSchema.oneOf.slice(0);\n jsonSchema.anyOf.push(originalOneOf);\n const theOptionalPart = new JsonSchemaFile();\n jsonSchema.oneOf.forEach(function(option, index, array) {\n const notSchema = new JsonSchemaFile();\n notSchema.not = option;\n theOptionalPart.allOf.push(notSchema);\n });\n jsonSchema.anyOf.push(theOptionalPart);\n jsonSchema.oneOf = [];\n }", "static filterUnexpectedData(orig, startingData, schema) {\n const data = Object.assign({}, startingData);\n Object.keys(schema.describe().children).forEach(key => {\n data[key] = orig[key];\n });\n return data;\n }", "clearChanges() {\n const me = this,\n {\n changes\n } = me;\n me.remove(me.added.values, true);\n me.modified.forEach(r => r.clearChanges(false)); // TODO: removed records should be restored\n\n me.added.clear();\n me.modified.clear();\n me.removed.clear();\n me.trigger('change', {\n action: 'clearchanges',\n changes\n });\n }", "buildDeleteFields(patchContext, origContext, schema){\n var deleteFields = [];\n // must remove nulls from the orig copy to sync with patchContext\n var origCopy = object.deepClone(origContext);\n origCopy = removeNulls(origCopy);\n var userGroups = JWT.getUserGroups();\n _.keys(origCopy).forEach((field, index) => {\n // if patchContext already has a value (such as admin edited\n // import_items fields), don't overwrite\n if(!isValueNull(patchContext[field])){\n return;\n }\n if(schema.properties[field]){\n var fieldSchema = object.getNestedProperty(schema, ['properties', field], true);\n if (!fieldSchema){\n return;\n }\n // skip calculated properties and exclude_from fields\n if (fieldSchema.calculatedProperty && fieldSchema.calculatedProperty === true){\n return;\n }\n if (fieldSchema.exclude_from && (_.contains(fieldSchema.exclude_from,'FFedit-create') || fieldSchema.exclude_from == 'FFedit-create')){\n return;\n }\n // if the user is admin, they already have these fields available;\n // only register as removed if admin did it intentionally\n if (fieldSchema.permission && fieldSchema.permission == \"import_items\"){\n if(_.contains(userGroups, 'admin')) deleteFields.push(field);\n return;\n }\n // check round two fields if the parameter roundTwo is set\n if(fieldSchema.ff_flag && fieldSchema.ff_flag == 'second round'){\n if(this.state.roundTwo) deleteFields.push(field);\n return;\n }\n // if we're here, the submission field was legitimately deleted\n if(!this.state.roundTwo) deleteFields.push(field);\n }\n });\n return deleteFields;\n }", "function diff(a, b) {\n return [...new Set(a.filter(i => !new Set(b).has(i)))];\n}", "function patchSchema(data) {\n data.properties.upload_type.enum = data.properties.upload_type.type.enum;\n data.properties.upload_type.type = \"string\";\n data.properties.publication_type.enum =\n data.properties.publication_type.type.enum;\n data.properties.publication_type.type = \"string\";\n data.properties.image_type.enum = data.properties.image_type.type.enum;\n data.properties.image_type.type = \"string\";\n return data;\n}", "function cleanDiscriminatorSchema(schema) {\n const copy = { ...schema };\n if (copy.format === '') {\n delete copy.format;\n }\n return copy;\n}", "arrayDiff(newArray, oldArray) {\n var diffArray = [], difference = [];\n for (var i = 0; i < newArray.length; i++) {\n diffArray[newArray[i]] = true;\n }\n for (var j = 0; j < oldArray.length; j++) {\n if (diffArray[oldArray[j]]) {\n delete diffArray[oldArray[j]];\n } else {\n diffArray[oldArray[j]] = true;\n }\n }\n for (var key in diffArray) {\n difference.push(key);\n }\n return difference;\n }", "function getSchemaOptions(discriminatorSchemas, componentSchemas) {\n const options = [];\n\n Object.keys(discriminatorSchemas).forEach(dsKey => {\n const discSchema = discriminatorSchemas[dsKey];\n Object.keys(componentSchemas).forEach(componentKey => {\n if (deepEquals(cleanDiscriminatorSchema(discSchema), componentSchemas[componentKey])) {\n options.push({\n label: componentKey,\n value: componentKey,\n });\n }\n });\n });\n\n return options;\n}", "function deDupeDiagnostics(buildDiagnostics, otherDiagnostics) {\n const buildDiagnosticsLines = buildDiagnostics.map((x) => x.range.start.line);\n return otherDiagnostics.filter((x) => buildDiagnosticsLines.indexOf(x.range.start.line) === -1);\n}", "function collectEnumsFromApis(apis) {\n var enumTypes = {};\n for (var i in apis)\n for (var dataTypeName in apis[i].datatypes)\n if (apis[i].datatypes[dataTypeName].isenum)\n enumTypes[dataTypeName] = apis[i].datatypes[dataTypeName];\n return enumTypes;\n}", "function repairStatusChange()\r\n {\r\n // if claim type is non-warranty remove ra-requested option\r\n if ($claimType == 'Non-Warranty')\r\n {\r\n var $nonWarrantyOptions = \"<option value=\\\"Created\\\">Created</option> <option value=\\\"Shipped\\\">Shipped</option> <option value=\\\"Complete\\\">Complete</option> <option value=\\\"Cancelled\\\">Cancelled</option>\";\r\n\r\n $('#claimdetails-claimstatus-select').html($nonWarrantyOptions);\r\n }\r\n else if ($claimType == 'Warranty')\r\n {\r\n var $warrantyOptions = \"<option value=\\\"Created\\\">Created</option> <option value=\\\"RA Requested\\\">RA Requested</option> <option value=\\\"Shipped\\\">Shipped</option> <option value=\\\"Complete\\\">Complete</option> <option value=\\\"Cancelled\\\">Cancelled</option>\";\r\n\r\n $('#claimdetails-claimstatus-select').html($warrantyOptions);\r\n }\r\n }", "clearChanges() {\n const me = this;\n\n me.remove(me.added.values, true);\n me.modified.forEach((r) => r.clearChanges(false));\n\n // TODO: removed records should be restored\n me.added.clear();\n me.modified.clear();\n me.removed.clear();\n\n me.trigger('change', { action: 'clearchanges' });\n }", "function diff(expected, received) {\n var i\n , results = received.slice(0);\n for(i = 0;i < results.length;i++) {\n if(~expected.indexOf(results[i])) {\n results.splice(i, 1);\n i--;\n } \n }\n // no additional fields found\n if(results.length === 0) {\n return false;\n }\n // return diff array\n return results;\n}", "function markListOperations(schemas) {\n _.each(schemas, function(schema) {\n if (schema.list) {\n if (_.isEmpty(schema.list.parameters)) {\n schema.list.dxFilterMode = dx.core.constants.LIST_TYPES.NONE;\n } else {\n var missingMapsTo = false;\n _.any(schema.list.parameters, function(param) {\n if (!param.mapsTo) {\n missingMapsTo = true;\n return true;\n }\n });\n schema.list.dxFilterMode = missingMapsTo ? dx.core.constants.LIST_TYPES.CUSTOM :\n dx.core.constants.LIST_TYPES.UBER;\n }\n }\n });\n}", "function diffUserCategories(){\n let diff = [];\n\n if( $scope.categories && $scope.user && $scope.originalUser && $scope.originalUser.Key_id ){\n\n // Only care about names..\n let current_role_names = $scope.user.Roles.map(r => r.Name);\n let original_role_names = $scope.originalUser.Roles.map(r => r.Name);\n\n // Categories are based on roles, so we'll diff the roles before we look at cats\n let roles_added = current_role_names.find( r => !original_role_names.includes(r));\n let roles_removed = original_role_names.find( r => !current_role_names.includes(r));\n\n if( roles_added || roles_removed ){\n // Roles are different, so categories are different\n let new_categories = $filter('userCategories')($scope.categories, $scope.user);\n let original_categories = $filter('userCategories')($scope.categories, $scope.originalUser);\n\n // list all 'current' categories, flagging those which are newly-added (i.e. not present in original)\n // Merge this with original categories which were removed, flagging those as well\n // flag is an integer:\n // -1: removed\n // 0: unchanged\n // 1: added\n diff = new_categories.map( c => {\n let diff_val = original_categories.includes(c.Name) ? 0 : 1;\n return new CategoryDiff(c, diff_val);\n });\n }\n }\n\n $scope.userCategoryDiff = diff;\n }", "static remove(tokens, toremove ){\n for( var i=tokens.length-1; i>=0; i-- ) if( toremove.indexOf(tokens[i].type) >= 0 ) tokens.remove(i)\n return tokens\n }", "function difference(a, b) {\n return Object.keys(a).filter(function(k) {\n return !b.hasOwnProperty(k);\n });\n }", "function diffArray (arr1, arr2) {\n var newArr = []\n .concat(\n arr1.filter(\n el1 => arr2.every(\n el2 => el2 !== el1))) // if ANY element of arr2 is equal to el1, el1 doesn't pass the filter.\n .concat(\n arr2.filter(\n el2 => arr1.every(\n el1 => el1 !== el2))); // if ANY element of arr1 is equal to el2, el2 doesn't pass the filter.\n console.log(newArr);\n\n return newArr;\n // Same, same; but different.\n}", "function difference(arr, other) {\n var index = arrayToIndex(other);\n return arr.filter(function(el) {\n return !Object.prototype.hasOwnProperty.call(index, el);\n });\n }", "function diffArray(arr1, arr2) {\n \n let newArr = [];\n\n newArr = arr1.filter(x => ! new Set(arr2).has(x));\n\n const additional = arr2.filter(x => ! new Set(arr1).has(x));\n \n // combine these items\n newArr.push(...additional);\n \n return newArr;\n \n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "_checkSchema() {\n if(!this._data['topics']) {\n throw new Error('Schema Error, expected root array named topics');\n }\n let cleaned = [];\n this._data['topics'].map((value, index) => {\n if(!this._itemConformsToSchema(value, this._itemSchema)) {\n if(!this._ignoreBadItems) {\n throw new Error('Schema Error, item: ' + index + ' does not conform to schema');\n } else {\n console.warn('Item: ' + index + ' does not conform to schema, Ignoring', value);\n }\n } else if(this._ignoreBadItems) {\n cleaned.push(value);\n }\n return value;\n });\n\n if(this._ignoreBadItems) {\n this._data['topics'] = cleaned;\n }\n\n return cleaned;\n }", "function patternsToUnrelate(oldArray, newArray) {\n console.log('oldArray');\n console.log(oldArray);\n console.log('newArray');\n console.log(newArray);\n\n\n // var ids2Unrelate = oldArray.filter(elem => !newArray.includes(elem.padroes_id));\n var ids2Unrelate = oldArray;\n for(let i=0; i<oldArray.length; i++) {\n for (let j=0; j<newArray.length; j++) {\n console.log('Olha so')\n console.log(typeof oldArray[i].padroes_id);\n console.log(oldArray[i].padroes_id);\n console.log('com');\n console.log(typeof newArray[j]);\n console.log(newArray[j]);\n if (oldArray[i].padroes_id === Number(newArray[j])) oldArray.splice(i, 1);\n }\n }\n\n\n console.log('Ids to unrelate');\n console.log(ids2Unrelate);\n return ids2Unrelate;\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function revertChanges() {\n return manager.rejectChanges();\n }", "_actualRemovesOfPassage (passage: Object) {\n if (!passage.type) return undefined;\n if (passage.actualRemoves) {\n const removes = passage.actualRemoves.get(this._fieldName);\n if (removes && removes.length) {\n return this._emitter.getEngine().getVrappers(removes, { state: passage.previousState });\n }\n } else if (passage.type === \"DESTROYED\") {\n // TODO(iridian): .get is getting called twice, redundantly, in\n // the DESTROYED branch. The first call in createFieldUpdate is\n // useless as no actualAdds get made.\n // TODO(iridian): The non-pure kueries should be replaced with\n // pure kueries?\n const value = this._emitter.do(this._fieldName, { state: passage.previousState });\n if (value) return arrayFromAny(value);\n }\n return undefined;\n }", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function diffStyles(before, after) {\n\treturn diffJSONStyles(toJSON(before), toJSON(after))\n}", "function arrayDiff(a, b) {\n let arr = [...a];\n b.forEach(d => {\n arr = arr.filter(x => x != d);\n });\n return arr;\n}", "changedAttributes() {\n let changes = this._super();\n Object.assign(changes, {type: [undefined, this.get('type')]});\n switch (this.get('type')) {\n case 'posix':\n Object.assign(changes, {posixValue: [undefined, this.get('posixValue')]});\n break;\n case 'acl':\n Object.assign(changes, {aclValue: [undefined, this.get('aclValue')]});\n break;\n default:\n break;\n }\n return changes;\n }", "function diffArray(arr1, arr2) {\r\n\tvar newArr = [];\r\n\r\n\tif (arr1.length === 0 || arr2.legth === 0) {\r\n\t\treturn arr1.length !== 0 ? arr1 : arr2;\r\n\t}\r\n\r\n\tnewArr = (arr1.filter(function (value) {\r\n\t\t\treturn arr2.indexOf(value) < 0;\r\n\t\t}));\r\n\r\n\tnewArr = newArr.concat(arr2.filter(function (value) {\r\n\t\t\t\treturn arr1.indexOf(value) < 0;\r\n\t\t\t}));\r\n\r\n\treturn newArr;\r\n}", "static difference(a, b) {\n const differenceSet = new XSet(a);\n for (const bValue of b) {\n if (a.has(bValue)) {\n differenceSet.delete(bValue);\n }\n }\n return differenceSet;\n }", "fixDisabled(schema) {\n if (schema.items) {\n schema.items.disabled = true;\n }\n else if (schema.properties) {\n Object.keys(schema.properties)\n .forEach(prop => {\n schema.properties[prop].disabled = true;\n });\n }\n return schema;\n }", "difference(otherSet) {\n const differenceSet = new mySet()\n const firstSet = this.values()\n\n firstSet.forEach(e => {\n if (!otherSet.has(e)) {\n differenceSet.add(e)\n }\n })\n return differenceSet\n }", "function array_diff(a, b) {\r\n let finalArr = a.filter(function(a) {\r\n return !b.includes(a)});\r\n return finalArr;\r\n }", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "static finalizeStyles(styles2) {\n const elementStyles = [];\n if (Array.isArray(styles2)) {\n const set = new Set(styles2.flat(Infinity).reverse());\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s));\n }\n } else if (styles2 !== void 0) {\n elementStyles.push(getCompatibleStyle(styles2));\n }\n return elementStyles;\n }", "function patch(old, diff) {\n var out = [];\n var i = 0;\n while (i < diff.length) {\n if (diff[i]) {\n // matching\n Array.prototype.push.apply(\n out,\n old.slice(out.length, out.length + diff[i])\n );\n }\n i++;\n if (i < diff.length && diff[i]) {\n // mismatching\n Array.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n i += diff[i];\n }\n i++;\n }\n return out;\n}", "function arrayDiff(a, b) {\n return a.filter((el) => !b.includes(el));\n}", "function diff(left, right) {\n const result = [];\n _.each(left, (leftObject) => {\n const rightObject = _.find(right, (rightObject) => _.isEqual(rightObject[exports.options.uniqueKey], leftObject[exports.options.uniqueKey]));\n if (!rightObject) {\n return;\n }\n const ret = {\n missingKeys: { inLeftButNotRight: [], inRightButNotLeft: [] },\n differentValues: [],\n inLeftButNotRight: [],\n inRightButNotLeft: [],\n left: {},\n right: {}\n };\n const missingKeys = checkMissingKeys(leftObject, rightObject);\n if (!_.isEmpty(missingKeys.inLeftButNotRight) ||\n !_.isEmpty(missingKeys.inRightButNotLeft)) {\n ret.missingKeys = missingKeys;\n }\n const differentValues = checkDifferentValues(leftObject, rightObject);\n if (!_.isEmpty(differentValues)) {\n ret.differentValues = differentValues;\n }\n if (!_.isEmpty(ret)) {\n result.push(_.extend(ret, { left: leftObject, right: rightObject }));\n }\n });\n return result;\n}", "function pruneSchema(resources /*, fullFhirSchema?: Schema*/) {\n return __awaiter(this, void 0, void 0, function () {\n var fullFhirSchema, newSchema, definitionNames, oneOf;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, getFullSchema()];\n case 1:\n fullFhirSchema = _a.sent();\n newSchema = {\n $schema: \"http://json-schema.org/draft-07/schema#\",\n $id: \"https://smarthealth.cards/schema/fhir-schema.json\",\n oneOf: [{\n $ref: \"#/definitions/Bundle\"\n }],\n definitions: {\n ResourceList: {\n oneOf: []\n }\n }\n };\n definitionNames = [];\n oneOf = newSchema.definitions.ResourceList.oneOf || [];\n // for each required resource, find all the child definitions\n // definitionNames will fill with all the required child-definitions\n resources.forEach(function (resource) { return findChildRefs(fullFhirSchema, resource, definitionNames); });\n definitionNames.sort();\n definitionNames.forEach(function (name) {\n var def = fullFhirSchema.definitions[name];\n newSchema.definitions[name] = def;\n // If this def is a Resource type, add a $ref to the oneOf collection\n if (def.properties && def.properties.resourceType && def.properties.resourceType.const) {\n oneOf.push({ \"$ref\": \"#/definitions/\" + def.properties.resourceType.const });\n }\n });\n // Schema validation of the Bundle.entries will happen separately. We'll replace the ResourceList type\n // with a generic object to prevent further validation here.\n // The reason is that if the entry items have bad schema, we will get dozens of errors as the bad-schema object\n // fails to match any of the possible Resources. So instead, we validate the entries individually against\n // the resource type specified in its resourceType field.\n newSchema.definitions['Bundle_Entry'].properties.resource = { \"type\": \"object\" };\n return [2 /*return*/, newSchema];\n }\n });\n });\n}", "getFields() {\n this.schema = this.props.collection._c2._simpleSchema._schema; // Using the provided Collection object, get the simpleSchema object\n\n if(this.props.useFields) // If we're selecting which fields to use\n {\n Object.keys(this.schema).filter((fieldName) => { // Filter (ie remove) this field from the schema by returning boolean\n if(this.props.useFields.indexOf(fieldName) === -1) // If this fieldName does not exist in the useFields array\n {\n delete this.schema[fieldName]; // We remove it from the forum schema\n }\n });\n }\n }", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isObjectType\"])(type) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isInterfaceType\"])(type)) {\n var possibleFieldNames = Object.keys(type.getFields());\n return Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n\n return [];\n}", "function arrDiff(a1, a2) {\n var a = [], diff = [];\n\n for (var i = 0; i < a1.length; i++) {\n a[a1[i]] = true;\n }\n\n for (var i = 0; i < a2.length; i++) {\n if (a[a2[i]]) {\n delete a[a2[i]];\n } else {\n a[a2[i]] = true;\n }\n }\n\n for (var k in a) {\n diff.push(k);\n }\n\n return diff;\n }", "function patch(old, diff) {\n\tvar out = [];\n\tvar i = 0;\n\twhile (i < diff.length) {\n\t\tif (diff[i]) { // matching\n\t\t\tArray.prototype.push.apply(out, old.slice(out.length, out.length + diff[i]));\n\t\t}\n\t\ti++;\n\t\tif (i < diff.length && diff[i]) { // mismatching\n\t\t\tArray.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n\t\t\ti += diff[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn out;\n}", "function patch(old, diff) {\n\tvar out = [];\n\tvar i = 0;\n\twhile (i < diff.length) {\n\t\tif (diff[i]) { // matching\n\t\t\tArray.prototype.push.apply(out, old.slice(out.length, out.length + diff[i]));\n\t\t}\n\t\ti++;\n\t\tif (i < diff.length && diff[i]) { // mismatching\n\t\t\tArray.prototype.push.apply(out, diff.slice(i + 1, i + 1 + diff[i]));\n\t\t\ti += diff[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn out;\n}", "function fixRefinements(code, refinements = []) {\n if (code === 'br') {\n return refinements.filter(\n ({ label }) => label.toLowerCase() !== 'promotion'\n )\n }\n return refinements\n}" ]
[ "0.7888479", "0.77966124", "0.7791469", "0.7791469", "0.7784727", "0.77698714", "0.7019526", "0.701425", "0.6918426", "0.6918426", "0.68979543", "0.68979543", "0.68916214", "0.6875969", "0.682712", "0.675889", "0.67334795", "0.66772974", "0.654103", "0.654103", "0.6487319", "0.6456379", "0.62519336", "0.62519336", "0.62519336", "0.62519336", "0.6251843", "0.6236039", "0.61541265", "0.61541265", "0.6132718", "0.6091187", "0.6091187", "0.6091187", "0.60270435", "0.5877917", "0.5826999", "0.5826999", "0.5294189", "0.5274498", "0.5098747", "0.49396998", "0.48664013", "0.48388588", "0.47795162", "0.4743961", "0.47163984", "0.47069907", "0.46298367", "0.46126664", "0.45733613", "0.45727587", "0.45597106", "0.45493138", "0.45403814", "0.45003763", "0.44805846", "0.4472645", "0.44689322", "0.44271636", "0.4391187", "0.43728817", "0.4370188", "0.43550444", "0.43507487", "0.4322609", "0.43221042", "0.43083823", "0.4307405", "0.4296234", "0.4295218", "0.42900744", "0.42862776", "0.42736396", "0.42736396", "0.42607427", "0.4251864", "0.42443305", "0.42297485", "0.42206603", "0.4215067", "0.4210507", "0.42047036", "0.4203093", "0.42004043", "0.42003742", "0.4195811", "0.4195811", "0.41937354", "0.41933063", "0.41924676", "0.41842636", "0.4176567", "0.41755173", "0.41716698", "0.41656768", "0.41636434", "0.41636434", "0.41626915" ]
0.7840628
2
Given two schemas, returns an Array containing descriptions of any dangerous changes in the newSchema related to adding values to an enum type.
function findValuesAddedToEnums(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var valuesAddedToEnums = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) { return; } var valuesInOldEnum = Object.create(null); oldType.getValues().forEach(function (value) { valuesInOldEnum[value.name] = true; }); newType.getValues().forEach(function (value) { if (!valuesInOldEnum[value.name]) { valuesAddedToEnums.push({ type: DangerousChangeType.VALUE_ADDED_TO_ENUM, description: value.name + ' was added to enum type ' + typeName + '.' }); } }); }); return valuesAddedToEnums; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInNewEnum = Object.create(null);\n var _iteratorNormalCompletion7 = true;\n var _didIteratorError7 = false;\n var _iteratorError7 = undefined;\n\n try {\n for (var _iterator7 = newType.getValues()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {\n var value = _step7.value;\n valuesInNewEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError7 = true;\n _iteratorError7 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion7 && _iterator7.return != null) {\n _iterator7.return();\n }\n } finally {\n if (_didIteratorError7) {\n throw _iteratorError7;\n }\n }\n }\n\n var _iteratorNormalCompletion8 = true;\n var _didIteratorError8 = false;\n var _iteratorError8 = undefined;\n\n try {\n for (var _iterator8 = oldType.getValues()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {\n var _value = _step8.value;\n\n if (!valuesInNewEnum[_value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: \"\".concat(_value.name, \" was removed from enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError8 = true;\n _iteratorError8 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion8 && _iterator8.return != null) {\n _iterator8.return();\n }\n } finally {\n if (_didIteratorError8) {\n throw _iteratorError8;\n }\n }\n }\n }\n\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesRemovedFromEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n var valuesInNewEnum = Object.create(null);\n newType.getValues().forEach(function (value) {\n valuesInNewEnum[value.name] = true;\n });\n oldType.getValues().forEach(function (value) {\n if (!valuesInNewEnum[value.name]) {\n valuesRemovedFromEnums.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: value.name + ' was removed from enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesRemovedFromEnums;\n}", "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var valuesRemovedFromEnums = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n\t return;\n\t }\n\t var valuesInNewEnum = Object.create(null);\n\t newType.getValues().forEach(function (value) {\n\t valuesInNewEnum[value.name] = true;\n\t });\n\t oldType.getValues().forEach(function (value) {\n\t if (!valuesInNewEnum[value.name]) {\n\t valuesRemovedFromEnums.push({\n\t type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n\t description: value.name + ' was removed from enum type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return valuesRemovedFromEnums;\n\t}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr2 = Object.keys(oldTypeMap);\n\n for (var _i2 = 0; _i2 < _arr2.length; _i2++) {\n var typeName = _arr2[_i2];\n\n if (!newTypeMap[typeName]) {\n continue;\n }\n\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (oldType.constructor !== newType.constructor) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: \"\".concat(typeName, \" changed from \") + \"\".concat(typeKindName(oldType), \" to \").concat(typeKindName(newType), \".\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_REMOVED,\n\t description: typeName + ' was removed.'\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: typeName + ' was removed.'\n });\n }\n });\n return breakingChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema));\n}", "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n\n var _arr = Object.keys(oldTypeMap);\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var typeName = _arr[_i];\n\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: \"\".concat(typeName, \" was removed.\")\n });\n }\n }\n\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n return;\n }\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof newType.constructor)) {\n breakingChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n });\n }\n });\n return breakingChanges;\n}", "function findTypesThatChangedKind(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t if (!newTypeMap[typeName]) {\n\t return;\n\t }\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof newType.constructor)) {\n\t breakingChanges.push({\n\t type: BreakingChangeType.TYPE_CHANGED_KIND,\n\t description: typeName + ' changed from ' + (typeKindName(oldType) + ' to ' + typeKindName(newType) + '.')\n\t });\n\t }\n\t });\n\t return breakingChanges;\n\t}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInOldUnion = Object.create(null);\n var _iteratorNormalCompletion5 = true;\n var _didIteratorError5 = false;\n var _iteratorError5 = undefined;\n\n try {\n for (var _iterator5 = oldType.getTypes()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {\n var type = _step5.value;\n typeNamesInOldUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError5 = true;\n _iteratorError5 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion5 && _iterator5.return != null) {\n _iterator5.return();\n }\n } finally {\n if (_didIteratorError5) {\n throw _iteratorError5;\n }\n }\n }\n\n var _iteratorNormalCompletion6 = true;\n var _didIteratorError6 = false;\n var _iteratorError6 = undefined;\n\n try {\n for (var _iterator6 = newType.getTypes()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {\n var _type2 = _step6.value;\n\n if (!typeNamesInOldUnion[_type2.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: \"\".concat(_type2.name, \" was added to union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError6 = true;\n _iteratorError6 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion6 && _iterator6.return != null) {\n _iterator6.return();\n }\n } finally {\n if (_didIteratorError6) {\n throw _iteratorError6;\n }\n }\n }\n }\n\n return typesAddedToUnion;\n}", "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesAddedToUnion = [];\n Object.keys(newTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInOldUnion = Object.create(null);\n oldType.getTypes().forEach(function (type) {\n typeNamesInOldUnion[type.name] = true;\n });\n newType.getTypes().forEach(function (type) {\n if (!typeNamesInOldUnion[type.name]) {\n typesAddedToUnion.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: type.name + ' was added to union type ' + typeName + '.'\n });\n }\n });\n });\n return typesAddedToUnion;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n\t return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema));\n\t}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesRemovedFromUnion = [];\n\n var _arr10 = Object.keys(oldTypeMap);\n\n for (var _i10 = 0; _i10 < _arr10.length; _i10++) {\n var typeName = _arr10[_i10];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isUnionType\"])(newType)) {\n continue;\n }\n\n var typeNamesInNewUnion = Object.create(null);\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = newType.getTypes()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var type = _step3.value;\n typeNamesInNewUnion[type.name] = true;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = oldType.getTypes()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _type = _step4.value;\n\n if (!typeNamesInNewUnion[_type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: \"\".concat(_type.name, \" was removed from union type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n\n return typesRemovedFromUnion;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges, findValuesAddedToEnums(oldSchema, newSchema), findInterfacesAddedToObjectTypes(oldSchema, newSchema), findTypesAddedToUnions(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).dangerousChanges);\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType || oldType instanceof _definition.GraphQLInputObjectType) || !(newType instanceof oldType.constructor)) {\n\t return;\n\t }\n\n\t var oldTypeFieldsDef = oldType.getFields();\n\t var newTypeFieldsDef = newType.getFields();\n\t Object.keys(oldTypeFieldsDef).forEach(function (fieldName) {\n\t // Check if the field is missing on the type in the new schema.\n\t if (!(fieldName in newTypeFieldsDef)) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_REMOVED,\n\t description: typeName + '.' + fieldName + ' was removed.'\n\t });\n\t } else {\n\t // Check if the field's type has changed in the new schema.\n\t var oldFieldType = (0, _definition.getNamedType)(oldTypeFieldsDef[fieldName].type);\n\t var newFieldType = (0, _definition.getNamedType)(newTypeFieldsDef[fieldName].type);\n\t if (oldFieldType && newFieldType && oldFieldType.name !== newFieldType.name) {\n\t breakingFieldChanges.push({\n\t type: BreakingChangeType.FIELD_CHANGED_KIND,\n\t description: typeName + '.' + fieldName + ' changed type from ' + (oldFieldType.name + ' to ' + newFieldType.name + '.')\n\t });\n\t }\n\t }\n\t });\n\t });\n\t return breakingFieldChanges;\n\t}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n var dangerousChanges = [];\n\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLObjectType || oldType instanceof _definition.GraphQLInterfaceType) || !(newType instanceof oldType.constructor)) {\n return;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n Object.keys(oldTypeFields).forEach(function (fieldName) {\n if (!newTypeFields[fieldName]) {\n return;\n }\n\n oldTypeFields[fieldName].args.forEach(function (oldArgDef) {\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = newArgs.find(function (arg) {\n return arg.name === oldArgDef.name;\n });\n\n // Arg not present\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' was removed')\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed type from ') + (oldArgDef.type.toString() + ' to ' + newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: oldType.name + '.' + fieldName + ' arg ' + (oldArgDef.name + ' has changed defaultValue')\n });\n }\n }\n });\n // Check if a non-null arg was added to the field\n newTypeFields[fieldName].args.forEach(function (newArgDef) {\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = oldArgs.find(function (arg) {\n return arg.name === newArgDef.name;\n });\n if (!oldArgDef && newArgDef.type instanceof _definition.GraphQLNonNull) {\n breakingChanges.push({\n type: BreakingChangeType.NON_NULL_ARG_ADDED,\n description: 'A non-null arg ' + newArgDef.name + ' on ' + (newType.name + '.' + fieldName + ' was added')\n });\n }\n });\n });\n });\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var typesRemovedFromUnion = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n return;\n }\n var typeNamesInNewUnion = Object.create(null);\n newType.getTypes().forEach(function (type) {\n typeNamesInNewUnion[type.name] = true;\n });\n oldType.getTypes().forEach(function (type) {\n if (!typeNamesInNewUnion[type.name]) {\n typesRemovedFromUnion.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: type.name + ' was removed from union type ' + typeName + '.'\n });\n }\n });\n });\n return typesRemovedFromUnion;\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findFieldsThatChangedType(oldSchema, newSchema) {\n return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema));\n}", "function findTypesRemovedFromUnions(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var typesRemovedFromUnion = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = newTypeMap[typeName];\n\t if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) {\n\t return;\n\t }\n\t var typeNamesInNewUnion = Object.create(null);\n\t newType.getTypes().forEach(function (type) {\n\t typeNamesInNewUnion[type.name] = true;\n\t });\n\t oldType.getTypes().forEach(function (type) {\n\t if (!typeNamesInNewUnion[type.name]) {\n\t typesRemovedFromUnion.push({\n\t type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n\t description: type.name + ' was removed from union type ' + typeName + '.'\n\t });\n\t }\n\t });\n\t });\n\t return typesRemovedFromUnion;\n\t}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedType(oldSchema, newSchema), findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema));\n}", "function findBreakingChanges(oldSchema, newSchema) {\n return [].concat(findRemovedTypes(oldSchema, newSchema), findTypesThatChangedKind(oldSchema, newSchema), findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema).breakingChanges, findTypesRemovedFromUnions(oldSchema, newSchema), findValuesRemovedFromEnums(oldSchema, newSchema), findArgChanges(oldSchema, newSchema).breakingChanges, findInterfacesRemovedFromObjectTypes(oldSchema, newSchema), findRemovedDirectives(oldSchema, newSchema), findRemovedDirectiveArgs(oldSchema, newSchema), findAddedNonNullDirectiveArgs(oldSchema, newSchema), findRemovedDirectiveLocations(oldSchema, newSchema));\n}", "function findArgChanges(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var breakingChanges = [];\n var dangerousChanges = [];\n\n var _arr3 = Object.keys(oldTypeMap);\n\n for (var _i3 = 0; _i3 < _arr3.length; _i3++) {\n var typeName = _arr3[_i3];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(oldType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(oldType)) || !(Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isObjectType\"])(newType) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isInterfaceType\"])(newType)) || newType.constructor !== oldType.constructor) {\n continue;\n }\n\n var oldTypeFields = oldType.getFields();\n var newTypeFields = newType.getFields();\n\n var _arr4 = Object.keys(oldTypeFields);\n\n for (var _i4 = 0; _i4 < _arr4.length; _i4++) {\n var fieldName = _arr4[_i4];\n\n if (!newTypeFields[fieldName]) {\n continue;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var oldArgDef = _step.value;\n var newArgs = newTypeFields[fieldName].args;\n var newArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(newArgs, function (arg) {\n return arg.name === oldArgDef.name;\n }); // Arg not present\n\n if (!newArgDef) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" was removed\")\n });\n } else {\n var isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldArgDef.type, newArgDef.type);\n\n if (!isSafe) {\n breakingChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed type from \") + \"\".concat(oldArgDef.type.toString(), \" to \").concat(newArgDef.type.toString())\n });\n } else if (oldArgDef.defaultValue !== undefined && oldArgDef.defaultValue !== newArgDef.defaultValue) {\n dangerousChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: \"\".concat(oldType.name, \".\").concat(fieldName, \" arg \") + \"\".concat(oldArgDef.name, \" has changed defaultValue\")\n });\n }\n }\n };\n\n for (var _iterator = oldTypeFields[fieldName].args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n _loop();\n } // Check if arg was added to the field\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n var _loop2 = function _loop2() {\n var newArgDef = _step2.value;\n var oldArgs = oldTypeFields[fieldName].args;\n var oldArgDef = Object(_polyfills_find__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(oldArgs, function (arg) {\n return arg.name === newArgDef.name;\n });\n\n if (!oldArgDef) {\n var argName = newArgDef.name;\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isRequiredArgument\"])(newArgDef)) {\n breakingChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: \"A required arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n } else {\n dangerousChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: \"An optional arg \".concat(argName, \" on \") + \"\".concat(typeName, \".\").concat(fieldName, \" was added\")\n });\n }\n }\n };\n\n for (var _iterator2 = newTypeFields[fieldName].args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n _loop2();\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n }\n\n return {\n breakingChanges: breakingChanges,\n dangerousChanges: dangerousChanges\n };\n}", "function findDangerousChanges(oldSchema, newSchema) {\n return [].concat(findArgChanges(oldSchema, newSchema).dangerousChanges);\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "function findDangerousChanges(oldSchema, newSchema) {\n var dangerousChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in DangerousChangeType;\n });\n return dangerousChanges;\n}", "fixAnyOf(schema) {\n const anyOf = schema.anyOf;\n // find existence count of all enum properties in anyOf elements\n // the reason of this, a field could be enum type for some and not for some other anyOf element\n const enumPropCount = {};\n anyOf.forEach(anyOfElement => {\n Object.keys(anyOfElement.properties)\n .filter(prop => anyOfElement.properties[prop].enum)\n .forEach(prop => {\n if (!enumPropCount[prop]) {\n enumPropCount[prop] = 0;\n }\n enumPropCount[prop]++;\n });\n });\n // combine all enum arrays in anyOf elements\n const enums = {};\n Object.keys(enumPropCount)\n .forEach(prop => {\n anyOf.forEach(anyOfElement => {\n if (!enums[prop]) {\n enums[prop] = [];\n }\n const enumValues = anyOfElement.properties[prop].enum;\n // check if current field is enum for current anyOf element\n if (enumValues) {\n enums[prop] = enums[prop].concat(enumValues);\n }\n });\n });\n const fixedSchema = anyOf[0];\n // shallow cleaning of format and pattern\n Object.keys(fixedSchema.properties)\n .forEach(prop => {\n delete fixedSchema.properties[prop].format;\n delete fixedSchema.properties[prop].pattern;\n });\n Object.keys(enumPropCount)\n .forEach(prop => {\n const uniqueEnumValues = Array.from(new Set(enums[prop]));\n // if a field enum for all anyOf elements\n if (enumPropCount[prop] === anyOf.length) {\n // merge all enum values into one\n fixedSchema.properties[prop].enum = uniqueEnumValues;\n // if a field enum for some of anyOf elements\n }\n else {\n // create a autocomplete config so that it will allow any values\n // but autocomplete from enum values from where the field is defined as enum\n delete fixedSchema.properties[prop].enum;\n fixedSchema.properties[prop].autocompletionConfig = {\n source: uniqueEnumValues,\n size: 7\n };\n }\n });\n // copy disabled attribute inside fixedSchema because it\n // is outside anyOf element and is ignored\n if (schema.disabled) {\n fixedSchema.disabled = true;\n }\n return fixedSchema;\n }", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function findBreakingChanges(oldSchema, newSchema) {\n var breakingChanges = findSchemaChanges(oldSchema, newSchema).filter(function (change) {\n return change.type in BreakingChangeType;\n });\n return breakingChanges;\n}", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function getDiffs(oldDoc, newDoc) {\n const changes = new Array();\n const flatOld = flattenObject(oldDoc);\n const flatNew = flattenObject(newDoc);\n // find deleted nodes\n Object.keys(flatOld).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatNew, key)) {\n changes.push({\n action: 'DELETED',\n keyName: key,\n });\n }\n });\n // find added nodes\n Object.keys(flatNew).forEach(key => {\n if (!Object.prototype.hasOwnProperty.call(flatOld, key)) {\n changes.push({\n action: 'ADDED',\n keyName: key,\n });\n }\n });\n // find updated nodes\n Object.keys(flatOld).forEach(key => {\n let oldValue = flatOld[key];\n if (Array.isArray(oldValue)) {\n oldValue = oldValue.join(', ');\n }\n let newValue = flatNew[key];\n if (newValue) {\n if (Array.isArray(newValue)) {\n newValue = newValue.join(', ');\n }\n if (newValue !== oldValue && key !== 'revision' && key !== 'etag') {\n changes.push({\n action: 'CHANGED',\n keyName: key,\n });\n }\n }\n });\n return changes;\n}", "function schemaDiff(comparison) {\n\t// TODO\n\t// TODO\n}", "function patchSchema(data) {\n data.properties.upload_type.enum = data.properties.upload_type.type.enum;\n data.properties.upload_type.type = \"string\";\n data.properties.publication_type.enum =\n data.properties.publication_type.type.enum;\n data.properties.publication_type.type = \"string\";\n data.properties.image_type.enum = data.properties.image_type.type.enum;\n data.properties.image_type.type = \"string\";\n return data;\n}", "getPossibleTypes() {\n const seenTypes = new Set;\n function process(obj) {\n seenTypes.add(obj);\n for (const child of obj.getChildSchemas()) {\n if (seenTypes.has(child)) continue;\n // we know Base.key is SchemaRef\n process(child);\n }\n }\n process(this);\n return Array.from(seenTypes);\n }", "function extendSchema(schema, documentAST) {\n\t (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n\t (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n\t // Collect the type definitions and extensions found in the document.\n\t var typeDefinitionMap = {};\n\t var typeExtensionsMap = {};\n\n\t // New directives and types are separate because a directives and types can\n\t // have the same name. For example, a type named \"skip\".\n\t var directiveDefinitions = [];\n\n\t for (var i = 0; i < documentAST.definitions.length; i++) {\n\t var def = documentAST.definitions[i];\n\t switch (def.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t // Sanity check that none of the defined types conflict with the\n\t // schema's existing types.\n\t var typeName = def.name.value;\n\t if (schema.getType(typeName)) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n\t }\n\t typeDefinitionMap[typeName] = def;\n\t break;\n\t case _kinds.TYPE_EXTENSION_DEFINITION:\n\t // Sanity check that this type extension exists within the\n\t // schema's existing types.\n\t var extendedTypeName = def.definition.name.value;\n\t var existingType = schema.getType(extendedTypeName);\n\t if (!existingType) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n\t }\n\t if (!(existingType instanceof _definition.GraphQLObjectType)) {\n\t throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n\t }\n\t var extensions = typeExtensionsMap[extendedTypeName];\n\t if (extensions) {\n\t extensions.push(def);\n\t } else {\n\t extensions = [def];\n\t }\n\t typeExtensionsMap[extendedTypeName] = extensions;\n\t break;\n\t case _kinds.DIRECTIVE_DEFINITION:\n\t var directiveName = def.name.value;\n\t var existingDirective = schema.getDirective(directiveName);\n\t if (existingDirective) {\n\t throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n\t }\n\t directiveDefinitions.push(def);\n\t break;\n\t }\n\t }\n\n\t // If this document contains no new types, extensions, or directives then\n\t // return the same unmodified GraphQLSchema instance.\n\t if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n\t return schema;\n\t }\n\n\t // A cache to use to store the actual GraphQLType definition objects by name.\n\t // Initialize to the GraphQL built in scalars and introspection types. All\n\t // functions below are inline so that this type def cache is within the scope\n\t // of the closure.\n\t var typeDefCache = {\n\t String: _scalars.GraphQLString,\n\t Int: _scalars.GraphQLInt,\n\t Float: _scalars.GraphQLFloat,\n\t Boolean: _scalars.GraphQLBoolean,\n\t ID: _scalars.GraphQLID,\n\t __Schema: _introspection.__Schema,\n\t __Directive: _introspection.__Directive,\n\t __DirectiveLocation: _introspection.__DirectiveLocation,\n\t __Type: _introspection.__Type,\n\t __Field: _introspection.__Field,\n\t __InputValue: _introspection.__InputValue,\n\t __EnumValue: _introspection.__EnumValue,\n\t __TypeKind: _introspection.__TypeKind\n\t };\n\n\t // Get the root Query, Mutation, and Subscription object types.\n\t var queryType = getTypeFromDef(schema.getQueryType());\n\n\t var existingMutationType = schema.getMutationType();\n\t var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n\t var existingSubscriptionType = schema.getSubscriptionType();\n\t var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n\t // Iterate through all types, getting the type definition for each, ensuring\n\t // that any type not directly referenced by a field will get created.\n\t var typeMap = schema.getTypeMap();\n\t var types = Object.keys(typeMap).map(function (typeName) {\n\t return getTypeFromDef(typeMap[typeName]);\n\t });\n\n\t // Do the same with new types, appending to the list of defined types.\n\t Object.keys(typeDefinitionMap).forEach(function (typeName) {\n\t types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n\t });\n\n\t // Then produce and return a Schema with these types.\n\t return new _schema.GraphQLSchema({\n\t query: queryType,\n\t mutation: mutationType,\n\t subscription: subscriptionType,\n\t types: types,\n\t directives: getMergedDirectives()\n\t });\n\n\t // Below are functions used for producing this schema that have closed over\n\t // this scope and have access to the schema, cache, and newly defined types.\n\n\t function getMergedDirectives() {\n\t var existingDirectives = schema.getDirectives();\n\t (0, _invariant2.default)(existingDirectives, 'schema must have default directives');\n\n\t var newDirectives = directiveDefinitions.map(function (directiveAST) {\n\t return getDirective(directiveAST);\n\t });\n\t return existingDirectives.concat(newDirectives);\n\t }\n\n\t function getTypeFromDef(typeDef) {\n\t var type = _getNamedType(typeDef.name);\n\t (0, _invariant2.default)(type, 'Missing type from schema');\n\t return type;\n\t }\n\n\t function getTypeFromAST(astNode) {\n\t var type = _getNamedType(astNode.name.value);\n\t if (!type) {\n\t throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n\t }\n\t return type;\n\t }\n\n\t function getObjectTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n\t return type;\n\t }\n\n\t function getInterfaceTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n\t return type;\n\t }\n\n\t function getInputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n\t return type;\n\t }\n\n\t function getOutputTypeFromAST(astNode) {\n\t var type = getTypeFromAST(astNode);\n\t (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n\t return type;\n\t }\n\n\t // Given a name, returns a type from either the existing schema or an\n\t // added type.\n\t function _getNamedType(typeName) {\n\t var cachedTypeDef = typeDefCache[typeName];\n\t if (cachedTypeDef) {\n\t return cachedTypeDef;\n\t }\n\n\t var existingType = schema.getType(typeName);\n\t if (existingType) {\n\t var typeDef = extendType(existingType);\n\t typeDefCache[typeName] = typeDef;\n\t return typeDef;\n\t }\n\n\t var typeAST = typeDefinitionMap[typeName];\n\t if (typeAST) {\n\t var _typeDef = buildType(typeAST);\n\t typeDefCache[typeName] = _typeDef;\n\t return _typeDef;\n\t }\n\t }\n\n\t // Given a type's introspection result, construct the correct\n\t // GraphQLType instance.\n\t function extendType(type) {\n\t if (type instanceof _definition.GraphQLObjectType) {\n\t return extendObjectType(type);\n\t }\n\t if (type instanceof _definition.GraphQLInterfaceType) {\n\t return extendInterfaceType(type);\n\t }\n\t if (type instanceof _definition.GraphQLUnionType) {\n\t return extendUnionType(type);\n\t }\n\t return type;\n\t }\n\n\t function extendObjectType(type) {\n\t return new _definition.GraphQLObjectType({\n\t name: type.name,\n\t description: type.description,\n\t interfaces: function interfaces() {\n\t return extendImplementedInterfaces(type);\n\t },\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t isTypeOf: type.isTypeOf\n\t });\n\t }\n\n\t function extendInterfaceType(type) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: type.name,\n\t description: type.description,\n\t fields: function fields() {\n\t return extendFieldMap(type);\n\t },\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendUnionType(type) {\n\t return new _definition.GraphQLUnionType({\n\t name: type.name,\n\t description: type.description,\n\t types: type.getTypes().map(getTypeFromDef),\n\t resolveType: type.resolveType\n\t });\n\t }\n\n\t function extendImplementedInterfaces(type) {\n\t var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n\t // If there are any extensions to the interfaces, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.interfaces.forEach(function (namedType) {\n\t var interfaceName = namedType.name.value;\n\t if (interfaces.some(function (def) {\n\t return def.name === interfaceName;\n\t })) {\n\t throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n\t }\n\t interfaces.push(getInterfaceTypeFromAST(namedType));\n\t });\n\t });\n\t }\n\n\t return interfaces;\n\t }\n\n\t function extendFieldMap(type) {\n\t var newFieldMap = {};\n\t var oldFieldMap = type.getFields();\n\t Object.keys(oldFieldMap).forEach(function (fieldName) {\n\t var field = oldFieldMap[fieldName];\n\t newFieldMap[fieldName] = {\n\t description: field.description,\n\t deprecationReason: field.deprecationReason,\n\t type: extendFieldType(field.type),\n\t args: (0, _keyMap2.default)(field.args, function (arg) {\n\t return arg.name;\n\t }),\n\t resolve: field.resolve\n\t };\n\t });\n\n\t // If there are any extensions to the fields, apply those here.\n\t var extensions = typeExtensionsMap[type.name];\n\t if (extensions) {\n\t extensions.forEach(function (extension) {\n\t extension.definition.fields.forEach(function (field) {\n\t var fieldName = field.name.value;\n\t if (oldFieldMap[fieldName]) {\n\t throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n\t }\n\t newFieldMap[fieldName] = {\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t type: buildOutputFieldType(field.type),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t });\n\t }\n\n\t return newFieldMap;\n\t }\n\n\t function extendFieldType(typeDef) {\n\t if (typeDef instanceof _definition.GraphQLList) {\n\t return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n\t }\n\t if (typeDef instanceof _definition.GraphQLNonNull) {\n\t return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n\t }\n\t return getTypeFromDef(typeDef);\n\t }\n\n\t function buildType(typeAST) {\n\t switch (typeAST.kind) {\n\t case _kinds.OBJECT_TYPE_DEFINITION:\n\t return buildObjectType(typeAST);\n\t case _kinds.INTERFACE_TYPE_DEFINITION:\n\t return buildInterfaceType(typeAST);\n\t case _kinds.UNION_TYPE_DEFINITION:\n\t return buildUnionType(typeAST);\n\t case _kinds.SCALAR_TYPE_DEFINITION:\n\t return buildScalarType(typeAST);\n\t case _kinds.ENUM_TYPE_DEFINITION:\n\t return buildEnumType(typeAST);\n\t case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n\t return buildInputObjectType(typeAST);\n\t }\n\t throw new TypeError('Unknown type kind ' + typeAST.kind);\n\t }\n\n\t function buildObjectType(typeAST) {\n\t return new _definition.GraphQLObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t interfaces: function interfaces() {\n\t return buildImplementedInterfaces(typeAST);\n\t },\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t }\n\t });\n\t }\n\n\t function buildInterfaceType(typeAST) {\n\t return new _definition.GraphQLInterfaceType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildFieldMap(typeAST);\n\t },\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildUnionType(typeAST) {\n\t return new _definition.GraphQLUnionType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t types: typeAST.types.map(getObjectTypeFromAST),\n\t resolveType: cannotExecuteExtendedSchema\n\t });\n\t }\n\n\t function buildScalarType(typeAST) {\n\t return new _definition.GraphQLScalarType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t serialize: function serialize(id) {\n\t return id;\n\t },\n\t // Note: validation calls the parse functions to determine if a\n\t // literal value is correct. Returning null would cause use of custom\n\t // scalars to always fail validation. Returning false causes them to\n\t // always pass validation.\n\t parseValue: function parseValue() {\n\t return false;\n\t },\n\t parseLiteral: function parseLiteral() {\n\t return false;\n\t }\n\t });\n\t }\n\n\t function buildEnumType(typeAST) {\n\t return new _definition.GraphQLEnumType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n\t return v.name.value;\n\t }, function () {\n\t return {};\n\t })\n\t });\n\t }\n\n\t function buildInputObjectType(typeAST) {\n\t return new _definition.GraphQLInputObjectType({\n\t name: typeAST.name.value,\n\t description: (0, _buildASTSchema.getDescription)(typeAST),\n\t fields: function fields() {\n\t return buildInputValues(typeAST.fields);\n\t }\n\t });\n\t }\n\n\t function getDirective(directiveAST) {\n\t return new _directives.GraphQLDirective({\n\t name: directiveAST.name.value,\n\t locations: directiveAST.locations.map(function (node) {\n\t return node.value;\n\t }),\n\t args: directiveAST.arguments && buildInputValues(directiveAST.arguments)\n\t });\n\t }\n\n\t function buildImplementedInterfaces(typeAST) {\n\t return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n\t }\n\n\t function buildFieldMap(typeAST) {\n\t return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n\t return field.name.value;\n\t }, function (field) {\n\t return {\n\t type: buildOutputFieldType(field.type),\n\t description: (0, _buildASTSchema.getDescription)(field),\n\t args: buildInputValues(field.arguments)\n\t };\n\t });\n\t }\n\n\t function buildInputValues(values) {\n\t return (0, _keyValMap2.default)(values, function (value) {\n\t return value.name.value;\n\t }, function (value) {\n\t var type = buildInputFieldType(value.type);\n\t return {\n\t type: type,\n\t description: (0, _buildASTSchema.getDescription)(value),\n\t defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n\t };\n\t });\n\t }\n\n\t function buildInputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildInputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getInputTypeFromAST(typeAST);\n\t }\n\n\t function buildOutputFieldType(typeAST) {\n\t if (typeAST.kind === _kinds.LIST_TYPE) {\n\t return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n\t }\n\t if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n\t var nullableType = buildOutputFieldType(typeAST.type);\n\t (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n\t return new _definition.GraphQLNonNull(nullableType);\n\t }\n\t return getOutputTypeFromAST(typeAST);\n\t }\n\t}", "changedAttributes() {\n let changes = this._super();\n Object.assign(changes, {type: [undefined, this.get('type')]});\n switch (this.get('type')) {\n case 'posix':\n Object.assign(changes, {posixValue: [undefined, this.get('posixValue')]});\n break;\n case 'acl':\n Object.assign(changes, {aclValue: [undefined, this.get('aclValue')]});\n break;\n default:\n break;\n }\n return changes;\n }", "function extendSchema(schema, documentAST, options) {\n Object(_type_schema__WEBPACK_IMPORTED_MODULE_8__[\"assertSchema\"])(schema);\n !(documentAST && documentAST.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DOCUMENT) ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'Must provide valid Document AST') : void 0;\n\n if (!options || !(options.assumeValid || options.assumeValidSDL)) {\n Object(_validation_validate__WEBPACK_IMPORTED_MODULE_7__[\"assertValidSDLExtension\"])(documentAST, schema);\n } // Collect the type definitions and extensions found in the document.\n\n\n var typeDefs = [];\n var typeExtsMap = Object.create(null); // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n\n var directiveDefs = [];\n var schemaDef; // Schema extensions are collected which may add additional operation types.\n\n var schemaExts = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = documentAST.definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_DEFINITION) {\n schemaDef = def;\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].SCHEMA_EXTENSION) {\n schemaExts.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeDefinitionNode\"])(def)) {\n typeDefs.push(def);\n } else if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_14__[\"isTypeExtensionNode\"])(def)) {\n var extendedTypeName = def.name.value;\n var existingTypeExts = typeExtsMap[extendedTypeName];\n typeExtsMap[extendedTypeName] = existingTypeExts ? existingTypeExts.concat([def]) : [def];\n } else if (def.kind === _language_kinds__WEBPACK_IMPORTED_MODULE_13__[\"Kind\"].DIRECTIVE_DEFINITION) {\n directiveDefs.push(def);\n }\n } // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n if (Object.keys(typeExtsMap).length === 0 && typeDefs.length === 0 && directiveDefs.length === 0 && schemaExts.length === 0 && !schemaDef) {\n return schema;\n }\n\n var schemaConfig = schema.toConfig();\n var astBuilder = new _buildASTSchema__WEBPACK_IMPORTED_MODULE_6__[\"ASTDefinitionBuilder\"](options, function (typeName) {\n var type = typeMap[typeName];\n !type ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, \"Unknown type: \\\"\".concat(typeName, \"\\\".\")) : void 0;\n return type;\n });\n var typeMap = Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(typeDefs, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildType(node);\n });\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = schemaConfig.types[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var existingType = _step2.value;\n typeMap[existingType.name] = extendNamedType(existingType);\n } // Get the extended root operation types.\n\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n\n var operationTypes = {\n query: schemaConfig.query && schemaConfig.query.name,\n mutation: schemaConfig.mutation && schemaConfig.mutation.name,\n subscription: schemaConfig.subscription && schemaConfig.subscription.name\n };\n\n if (schemaDef) {\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = schemaDef.operationTypes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref2 = _step3.value;\n var operation = _ref2.operation;\n var type = _ref2.type;\n operationTypes[operation] = type.name.value;\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n } // Then, incorporate schema definition and all schema extensions.\n\n\n var _arr = schemaExts;\n\n for (var _i = 0; _i < _arr.length; _i++) {\n var schemaExt = _arr[_i];\n\n if (schemaExt.operationTypes) {\n var _iteratorNormalCompletion4 = true;\n var _didIteratorError4 = false;\n var _iteratorError4 = undefined;\n\n try {\n for (var _iterator4 = schemaExt.operationTypes[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n var _ref4 = _step4.value;\n var _operation = _ref4.operation;\n var _type = _ref4.type;\n operationTypes[_operation] = _type.name.value;\n }\n } catch (err) {\n _didIteratorError4 = true;\n _iteratorError4 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion4 && _iterator4.return != null) {\n _iterator4.return();\n }\n } finally {\n if (_didIteratorError4) {\n throw _iteratorError4;\n }\n }\n }\n }\n } // Support both original legacy names and extended legacy names.\n\n\n var allowedLegacyNames = schemaConfig.allowedLegacyNames.concat(options && options.allowedLegacyNames || []); // Then produce and return a Schema with these types.\n\n return new _type_schema__WEBPACK_IMPORTED_MODULE_8__[\"GraphQLSchema\"]({\n // Note: While this could make early assertions to get the correctly\n // typed values, that would throw immediately while type system\n // validation with validateSchema() will produce more actionable results.\n query: getMaybeTypeByName(operationTypes.query),\n mutation: getMaybeTypeByName(operationTypes.mutation),\n subscription: getMaybeTypeByName(operationTypes.subscription),\n types: Object(_polyfills_objectValues__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeMap),\n directives: getMergedDirectives(),\n astNode: schemaDef || schemaConfig.astNode,\n extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExts),\n allowedLegacyNames: allowedLegacyNames\n }); // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function replaceType(type) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isListType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLList\"](replaceType(type.ofType));\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isNonNullType\"])(type)) {\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLNonNull\"](replaceType(type.ofType));\n }\n\n return replaceNamedType(type);\n }\n\n function replaceNamedType(type) {\n return typeMap[type.name];\n }\n\n function getMaybeTypeByName(typeName) {\n return typeName ? typeMap[typeName] : null;\n }\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives().map(extendDirective);\n !existingDirectives ? Object(_jsutils_invariant__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(0, 'schema must have default directives') : void 0;\n return existingDirectives.concat(directiveDefs.map(function (node) {\n return astBuilder.buildDirective(node);\n }));\n }\n\n function extendNamedType(type) {\n if (Object(_type_introspection__WEBPACK_IMPORTED_MODULE_9__[\"isIntrospectionType\"])(type) || Object(_type_scalars__WEBPACK_IMPORTED_MODULE_10__[\"isSpecifiedScalarType\"])(type)) {\n // Builtin types are not extended.\n return type;\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isScalarType\"])(type)) {\n return extendScalarType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isObjectType\"])(type)) {\n return extendObjectType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInterfaceType\"])(type)) {\n return extendInterfaceType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isUnionType\"])(type)) {\n return extendUnionType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isEnumType\"])(type)) {\n return extendEnumType(type);\n } else if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_11__[\"isInputObjectType\"])(type)) {\n return extendInputObjectType(type);\n } // Not reachable. All possible types have been considered.\n\n /* istanbul ignore next */\n\n\n throw new Error(\"Unexpected type: \\\"\".concat(Object(_jsutils_inspect__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(type), \"\\\".\"));\n }\n\n function extendDirective(directive) {\n var config = directive.toConfig();\n return new _type_directives__WEBPACK_IMPORTED_MODULE_12__[\"GraphQLDirective\"](_objectSpread({}, config, {\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.args, extendArg)\n }));\n }\n\n function extendInputObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInputObjectType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, function (field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type)\n });\n }), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (field) {\n return field.name.value;\n }, function (field) {\n return astBuilder.buildInputField(field);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendEnumType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[type.name] || [];\n var valueNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.values || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLEnumType\"](_objectSpread({}, config, {\n values: _objectSpread({}, config.values, Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(valueNodes, function (value) {\n return value.name.value;\n }, function (value) {\n return astBuilder.buildEnumValue(value);\n })),\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendScalarType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLScalarType\"](_objectSpread({}, config, {\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendObjectType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var interfaceNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.interfaces || [];\n });\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLObjectType\"](_objectSpread({}, config, {\n interfaces: function interfaces() {\n return [].concat(type.getInterfaces().map(replaceNamedType), interfaceNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendInterfaceType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var fieldNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.fields || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLInterfaceType\"](_objectSpread({}, config, {\n fields: function fields() {\n return _objectSpread({}, Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(config.fields, extendField), Object(_jsutils_keyValMap__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(fieldNodes, function (node) {\n return node.name.value;\n }, function (node) {\n return astBuilder.buildField(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendUnionType(type) {\n var config = type.toConfig();\n var extensions = typeExtsMap[config.name] || [];\n var typeNodes = Object(_polyfills_flatMap__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(extensions, function (node) {\n return node.types || [];\n });\n return new _type_definition__WEBPACK_IMPORTED_MODULE_11__[\"GraphQLUnionType\"](_objectSpread({}, config, {\n types: function types() {\n return [].concat(type.getTypes().map(replaceNamedType), typeNodes.map(function (node) {\n return astBuilder.getNamedType(node);\n }));\n },\n extensionASTNodes: config.extensionASTNodes.concat(extensions)\n }));\n }\n\n function extendField(field) {\n return _objectSpread({}, field, {\n type: replaceType(field.type),\n args: Object(_jsutils_mapValue__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(field.args, extendArg)\n });\n }\n\n function extendArg(arg) {\n return _objectSpread({}, arg, {\n type: replaceType(arg.type)\n });\n }\n}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function extendSchema(schema, documentAST) {\n !(schema instanceof _schema.GraphQLSchema) ? (0, _invariant2.default)(0, 'Must provide valid GraphQLSchema') : void 0;\n\n !(documentAST && documentAST.kind === Kind.DOCUMENT) ? (0, _invariant2.default)(0, 'Must provide valid Document AST') : void 0;\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = Object.create(null);\n var typeExtensionsMap = Object.create(null);\n\n // New directives and types are separate because a directives and types can\n // have the same name. For example, a type named \"skip\".\n var directiveDefinitions = [];\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n case Kind.INTERFACE_TYPE_DEFINITION:\n case Kind.ENUM_TYPE_DEFINITION:\n case Kind.UNION_TYPE_DEFINITION:\n case Kind.SCALAR_TYPE_DEFINITION:\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case Kind.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n case Kind.DIRECTIVE_DEFINITION:\n var directiveName = def.name.value;\n var existingDirective = schema.getDirective(directiveName);\n if (existingDirective) {\n throw new _GraphQLError.GraphQLError('Directive \"' + directiveName + '\" already exists in the schema. It ' + 'cannot be redefined.', [def]);\n }\n directiveDefinitions.push(def);\n break;\n }\n }\n\n // If this document contains no new types, extensions, or directives then\n // return the same unmodified GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0 && directiveDefinitions.length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n directives: getMergedDirectives(),\n astNode: schema.astNode\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getMergedDirectives() {\n var existingDirectives = schema.getDirectives();\n !existingDirectives ? (0, _invariant2.default)(0, 'schema must have default directives') : void 0;\n\n var newDirectives = directiveDefinitions.map(function (directiveNode) {\n return getDirective(directiveNode);\n });\n return existingDirectives.concat(newDirectives);\n }\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n !type ? (0, _invariant2.default)(0, 'Missing type from schema') : void 0;\n return type;\n }\n\n function getTypeFromAST(node) {\n var type = _getNamedType(node.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + node.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [node]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLObjectType) ? (0, _invariant2.default)(0, 'Must be Object type.') : void 0;\n return type;\n }\n\n function getInterfaceTypeFromAST(node) {\n var type = getTypeFromAST(node);\n !(type instanceof _definition.GraphQLInterfaceType) ? (0, _invariant2.default)(0, 'Must be Interface type.') : void 0;\n return type;\n }\n\n function getInputTypeFromAST(node) {\n return (0, _definition.assertInputType)(getTypeFromAST(node));\n }\n\n function getOutputTypeFromAST(node) {\n return (0, _definition.assertOutputType)(getTypeFromAST(node));\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeNode = typeDefinitionMap[typeName];\n if (typeNode) {\n var _typeDef = buildType(typeNode);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n var name = type.name;\n var extensionASTNodes = type.extensionASTNodes;\n if (typeExtensionsMap[name]) {\n extensionASTNodes = extensionASTNodes.concat(typeExtensionsMap[name]);\n }\n\n return new _definition.GraphQLObjectType({\n name: name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n extensionASTNodes: extensionASTNodes,\n isTypeOf: type.isTypeOf\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n astNode: type.astNode,\n resolveType: type.resolveType\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = Object.create(null);\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n astNode: field.astNode,\n resolve: field.resolve\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n description: (0, _buildASTSchema.getDescription)(field),\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeNode) {\n switch (typeNode.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeNode);\n case Kind.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeNode);\n case Kind.UNION_TYPE_DEFINITION:\n return buildUnionType(typeNode);\n case Kind.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeNode);\n case Kind.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeNode);\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeNode);\n }\n throw new TypeError('Unknown type kind ' + typeNode.kind);\n }\n\n function buildObjectType(typeNode) {\n return new _definition.GraphQLObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeNode);\n },\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode\n });\n }\n\n function buildInterfaceType(typeNode) {\n return new _definition.GraphQLInterfaceType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildFieldMap(typeNode);\n },\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildUnionType(typeNode) {\n return new _definition.GraphQLUnionType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n types: typeNode.types.map(getObjectTypeFromAST),\n astNode: typeNode,\n resolveType: cannotExecuteExtendedSchema\n });\n }\n\n function buildScalarType(typeNode) {\n return new _definition.GraphQLScalarType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n astNode: typeNode,\n serialize: function serialize(id) {\n return id;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeNode) {\n return new _definition.GraphQLEnumType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n values: (0, _keyValMap2.default)(typeNode.values, function (enumValue) {\n return enumValue.name.value;\n }, function (enumValue) {\n return {\n description: (0, _buildASTSchema.getDescription)(enumValue),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(enumValue),\n astNode: enumValue\n };\n }),\n astNode: typeNode\n });\n }\n\n function buildInputObjectType(typeNode) {\n return new _definition.GraphQLInputObjectType({\n name: typeNode.name.value,\n description: (0, _buildASTSchema.getDescription)(typeNode),\n fields: function fields() {\n return buildInputValues(typeNode.fields);\n },\n astNode: typeNode\n });\n }\n\n function getDirective(directiveNode) {\n return new _directives.GraphQLDirective({\n name: directiveNode.name.value,\n description: (0, _buildASTSchema.getDescription)(directiveNode),\n locations: directiveNode.locations.map(function (node) {\n return node.value;\n }),\n args: directiveNode.arguments && buildInputValues(directiveNode.arguments),\n astNode: directiveNode\n });\n }\n\n function buildImplementedInterfaces(typeNode) {\n return typeNode.interfaces && typeNode.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeNode) {\n return (0, _keyValMap2.default)(typeNode.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n description: (0, _buildASTSchema.getDescription)(field),\n args: buildInputValues(field.arguments),\n deprecationReason: (0, _buildASTSchema.getDeprecationReason)(field),\n astNode: field\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n description: (0, _buildASTSchema.getDescription)(value),\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type),\n astNode: value\n };\n });\n }\n\n function buildInputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeNode);\n }\n\n function buildOutputFieldType(typeNode) {\n if (typeNode.kind === Kind.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeNode.type));\n }\n if (typeNode.kind === Kind.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeNode.type);\n !!(nullableType instanceof _definition.GraphQLNonNull) ? (0, _invariant2.default)(0, 'Must be nullable') : void 0;\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeNode);\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function healSchema(schema) {\n heal(schema);\n return schema;\n function heal(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n var originalTypeMap_1 = type.getTypeMap();\n var actualNamedTypeMap_1 = Object.create(null);\n // If any of the .name properties of the GraphQLNamedType objects in\n // schema.getTypeMap() have changed, the keys of the type map need to\n // be updated accordingly.\n each(originalTypeMap_1, function (namedType, typeName) {\n if (typeName.startsWith('__')) {\n return;\n }\n var actualName = namedType.name;\n if (actualName.startsWith('__')) {\n return;\n }\n if (hasOwn.call(actualNamedTypeMap_1, actualName)) {\n throw new Error(\"Duplicate schema type name \" + actualName);\n }\n actualNamedTypeMap_1[actualName] = namedType;\n // Note: we are deliberately leaving namedType in the schema by its\n // original name (which might be different from actualName), so that\n // references by that name can be healed.\n });\n // Now add back every named type by its actual name.\n each(actualNamedTypeMap_1, function (namedType, typeName) {\n originalTypeMap_1[typeName] = namedType;\n });\n // Directive declaration argument types can refer to named types.\n each(type.getDirectives(), function (decl) {\n if (decl.args) {\n each(decl.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n each(originalTypeMap_1, function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n heal(namedType);\n }\n });\n updateEachKey(originalTypeMap_1, function (namedType, typeName) {\n // Dangling references to renamed types should remain in the schema\n // during healing, but must be removed now, so that the following\n // invariant holds for all names: schema.getType(name).name === name\n if (!typeName.startsWith('__') &&\n !hasOwn.call(actualNamedTypeMap_1, typeName)) {\n return null;\n }\n });\n }\n else if (type instanceof graphql_1.GraphQLObjectType) {\n healFields(type);\n each(type.getInterfaces(), function (iface) { return heal(iface); });\n }\n else if (type instanceof graphql_1.GraphQLInterfaceType) {\n healFields(type);\n }\n else if (type instanceof graphql_1.GraphQLInputObjectType) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n });\n }\n else if (type instanceof graphql_1.GraphQLScalarType) {\n // Nothing to do.\n }\n else if (type instanceof graphql_1.GraphQLUnionType) {\n updateEachKey(type.getTypes(), function (t) { return healType(t); });\n }\n else if (type instanceof graphql_1.GraphQLEnumType) {\n // Nothing to do.\n }\n else {\n throw new Error(\"Unexpected schema type: \" + type);\n }\n }\n function healFields(type) {\n each(type.getFields(), function (field) {\n field.type = healType(field.type);\n if (field.args) {\n each(field.args, function (arg) {\n arg.type = healType(arg.type);\n });\n }\n });\n }\n function healType(type) {\n // Unwrap the two known wrapper types\n if (type instanceof graphql_1.GraphQLList) {\n type = new graphql_1.GraphQLList(healType(type.ofType));\n }\n else if (type instanceof graphql_1.GraphQLNonNull) {\n type = new graphql_1.GraphQLNonNull(healType(type.ofType));\n }\n else if (graphql_1.isNamedType(type)) {\n // If a type annotation on a field or an argument or a union member is\n // any `GraphQLNamedType` with a `name`, then it must end up identical\n // to `schema.getType(name)`, since `schema.getTypeMap()` is the source\n // of truth for all named schema types.\n var namedType = type;\n var officialType = schema.getType(namedType.name);\n if (officialType && namedType !== officialType) {\n return officialType;\n }\n }\n return type;\n }\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function getSchemaOptions(discriminatorSchemas, componentSchemas) {\n const options = [];\n\n Object.keys(discriminatorSchemas).forEach(dsKey => {\n const discSchema = discriminatorSchemas[dsKey];\n Object.keys(componentSchemas).forEach(componentKey => {\n if (deepEquals(cleanDiscriminatorSchema(discSchema), componentSchemas[componentKey])) {\n options.push({\n label: componentKey,\n value: componentKey,\n });\n }\n });\n });\n\n return options;\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function UniqueOperationTypesRule(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n var _node$operationTypes;\n\n // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];\n\n for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {\n var operationType = operationTypesNodes[_i2];\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type for \".concat(operation, \" already defined in the schema. It cannot be redefined.\"), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one \".concat(operation, \" type in schema.\"), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n\n return false;\n }\n}", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "schemafy(keys, schema) {\n return keys\n .concat(schema.required || [])\n .filter(key => this.isNotHidden(key, schema) || this.appGlobalsService.adminMode)\n .concat(schema.alwaysShow || [])\n .sort((a, b) => this.compareKeysBySchemaService.compare(a, b, schema))\n .toOrderedSet();\n }", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if ((0, _definition.isEnumType)(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "function UniqueEnumValueNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var _node$values;\n\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];\n var valueNames = knownValueNames[typeName];\n\n for (var _i2 = 0; _i2 < valueNodes.length; _i2++) {\n var valueDef = valueNodes[_i2];\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if ((0, _definition.isEnumType)(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Enum value \\\"\".concat(typeName, \".\").concat(valueName, \"\\\" can only be defined once.\"), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n\n return false;\n }\n}", "getAdditionalSchemas() {\n const additionalSchemas = this.schemas.join('\\n');\n return additionalSchemas;\n }", "function PossibleTypeExtensions(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = context.getDocument().definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_4__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema && schema.getType(typeName);\n\n if (defNode) {\n var expectedKind = defKindToExtKind[defNode.kind];\n\n if (expectedKind !== node.kind) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingDifferentTypeKindMessage(typeName, extensionKindToTypeName(expectedKind)), [defNode, node]));\n }\n } else if (existingType) {\n var _expectedKind = typeToExtKind(existingType);\n\n if (_expectedKind !== node.kind) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingDifferentTypeKindMessage(typeName, extensionKindToTypeName(_expectedKind)), node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeName, allTypeNames);\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](extendingUnknownTypeMessage(typeName, suggestedTypes), node.name));\n }\n }\n}", "function collectEnumsFromApis(apis) {\n var enumTypes = {};\n for (var i in apis)\n for (var dataTypeName in apis[i].datatypes)\n if (apis[i].datatypes[dataTypeName].isenum)\n enumTypes[dataTypeName] = apis[i].datatypes[dataTypeName];\n return enumTypes;\n}", "addQueryBuilders(schema, query) {\n _.each(schema, function (field) {\n const fieldType = self.fieldTypes[field.type];\n if (query[field.name]) {\n return;\n }\n if (fieldType.addQueryBuilder) {\n fieldType.addQueryBuilder(field, query);\n }\n });\n }", "fixOptionalChoiceNot(jsonSchema, node) {\n const originalOneOf = new JsonSchemaFile();\n originalOneOf.oneOf = jsonSchema.oneOf.slice(0);\n jsonSchema.anyOf.push(originalOneOf);\n const theOptionalPart = new JsonSchemaFile();\n jsonSchema.oneOf.forEach(function(option, index, array) {\n const notSchema = new JsonSchemaFile();\n notSchema.not = option;\n theOptionalPart.allOf.push(notSchema);\n });\n jsonSchema.anyOf.push(theOptionalPart);\n jsonSchema.oneOf = [];\n }", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isObjectType\"])(type) || Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isInterfaceType\"])(type)) {\n var possibleFieldNames = Object.keys(type.getFields());\n return Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(fieldName, possibleFieldNames);\n } // Otherwise, must be a Union type, which does not define fields.\n\n\n return [];\n}", "addValidationSchema(schema) {\n const validationMetadatas = new _validation_schema_ValidationSchemaToMetadataTransformer__WEBPACK_IMPORTED_MODULE_0__[\"ValidationSchemaToMetadataTransformer\"]().transform(schema);\n validationMetadatas.forEach(validationMetadata => this.addValidationMetadata(validationMetadata));\n }", "function UniqueEnumValueNames(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownValueNames = Object.create(null);\n return {\n EnumTypeDefinition: checkValueUniqueness,\n EnumTypeExtension: checkValueUniqueness\n };\n\n function checkValueUniqueness(node) {\n var typeName = node.name.value;\n\n if (!knownValueNames[typeName]) {\n knownValueNames[typeName] = Object.create(null);\n }\n\n if (node.values) {\n var valueNames = knownValueNames[typeName];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = node.values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var valueDef = _step.value;\n var valueName = valueDef.name.value;\n var existingType = existingTypeMap[typeName];\n\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(existingType) && existingType.getValue(valueName)) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](existedEnumValueNameMessage(typeName, valueName), valueDef.name));\n } else if (valueNames[valueName]) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](duplicateEnumValueNameMessage(typeName, valueName), [valueNames[valueName], valueDef.name]));\n } else {\n valueNames[valueName] = valueDef.name;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n return false;\n }\n}", "function UniqueOperationTypes(context) {\n var schema = context.getSchema();\n var definedOperationTypes = Object.create(null);\n var existingOperationTypes = schema ? {\n query: schema.getQueryType(),\n mutation: schema.getMutationType(),\n subscription: schema.getSubscriptionType()\n } : {};\n return {\n SchemaDefinition: checkOperationTypes,\n SchemaExtension: checkOperationTypes\n };\n\n function checkOperationTypes(node) {\n if (node.operationTypes) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (node.operationTypes || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var operationType = _step.value;\n var operation = operationType.operation;\n var alreadyDefinedOperationType = definedOperationTypes[operation];\n\n if (existingOperationTypes[operation]) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](existedOperationTypeMessage(operation), operationType));\n } else if (alreadyDefinedOperationType) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](duplicateOperationTypeMessage(operation), [alreadyDefinedOperationType, operationType]));\n } else {\n definedOperationTypes[operation] = operationType;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n return false;\n }\n}", "function mergeClientSchemas(...schemas) {\n\t// Merge types\n\tconst schema = mergeSchemas({ schemas });\n\n\t// Get the directives from each schema\n\tconst schemaDirectives = map(schemas, '_directives');\n\n\t// Merge directives by name (directives are ignored by mergeSchemas())\n\t/* eslint-disable-next-line no-underscore-dangle */\n\tschema._directives = uniqBy(concat(...schemaDirectives), 'name');\n\n\treturn schema;\n}", "function processSchema(schema, schemaKey, sourceSchemas, newSchemas, preserveUnneeded) {\n /*\n * Most schemas have a name. However, not all do. We must nevertheless expose those schemas as they have root\n * operations on them. Thus, we convert the key into a form that can be used to identify them.\n */\n schema.name = schemaKeyToTypeName(schemaKey, sourceSchemas);\n\n // If this schema has already been processed (see recursive call, below), return it\n if (newSchemas[schema.name]) {\n return newSchemas[schema.name];\n }\n\n newSchemas[schema.name] = schema;\n\n if (schema.root) {\n schema.rootTypeName = schema.name;\n }\n\n // Process the parent schema, if any. This assumes all extends schemas have just a $ref property.\n var parentSchema = schema.extends;\n if (parentSchema) {\n schema.parentSchema = processSchema(sourceSchemas[parentSchema.$ref], parentSchema.$ref,\n sourceSchemas, newSchemas);\n parentSchema.$ref = schemaKeyToTypeName(parentSchema.$ref, sourceSchemas);\n parentSchema = schema.parentSchema;\n\n if (!schema.rootTypeName) {\n schema.rootTypeName = parentSchema.rootTypeName;\n }\n\n schema.root = schema.root || parentSchema.root;\n }\n\n if (!preserveUnneeded) {\n delete schema.description;\n }\n\n processProperties(schema, parentSchema, sourceSchemas, preserveUnneeded);\n processOperations(schema, parentSchema, sourceSchemas);\n\n return schema;\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (!Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isAbstractType\"])(type)) {\n // Must be an Object type, which does not have possible fields.\n return [];\n }\n\n var suggestedTypes = new Set();\n var usageCount = Object.create(null);\n\n for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {\n var possibleType = _schema$getPossibleTy2[_i2];\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedTypes.add(possibleType);\n usageCount[possibleType.name] = 1;\n\n for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {\n var _usageCount$possibleI;\n\n var possibleInterface = _possibleType$getInte2[_i4];\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n suggestedTypes.add(possibleInterface);\n usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1;\n }\n }\n\n return Object(_polyfills_arrayFrom_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes).sort(function (typeA, typeB) {\n // Suggest both interface and object types based on how common they are.\n var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name];\n\n if (usageCountDiff !== 0) {\n return usageCountDiff;\n } // Suggest super types first followed by subtypes\n\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeA) && schema.isSubType(typeA, typeB)) {\n return -1;\n }\n\n if (Object(_type_definition_mjs__WEBPACK_IMPORTED_MODULE_4__[\"isInterfaceType\"])(typeB) && schema.isSubType(typeB, typeA)) {\n return 1;\n }\n\n return typeA.name.localeCompare(typeB.name);\n }).map(function (x) {\n return x.name;\n });\n}", "function extendSchema(schema, documentAST) {\n (0, _invariant2.default)(schema instanceof _schema.GraphQLSchema, 'Must provide valid GraphQLSchema');\n\n (0, _invariant2.default)(documentAST && documentAST.kind === _kinds.DOCUMENT, 'Must provide valid Document AST');\n\n // Collect the type definitions and extensions found in the document.\n var typeDefinitionMap = {};\n var typeExtensionsMap = {};\n\n for (var i = 0; i < documentAST.definitions.length; i++) {\n var def = documentAST.definitions[i];\n switch (def.kind) {\n case _kinds.OBJECT_TYPE_DEFINITION:\n case _kinds.INTERFACE_TYPE_DEFINITION:\n case _kinds.ENUM_TYPE_DEFINITION:\n case _kinds.UNION_TYPE_DEFINITION:\n case _kinds.SCALAR_TYPE_DEFINITION:\n case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n // Sanity check that none of the defined types conflict with the\n // schema's existing types.\n var typeName = def.name.value;\n if (schema.getType(typeName)) {\n throw new _GraphQLError.GraphQLError('Type \"' + typeName + '\" already exists in the schema. It cannot also ' + 'be defined in this type definition.', [def]);\n }\n typeDefinitionMap[typeName] = def;\n break;\n case _kinds.TYPE_EXTENSION_DEFINITION:\n // Sanity check that this type extension exists within the\n // schema's existing types.\n var extendedTypeName = def.definition.name.value;\n var existingType = schema.getType(extendedTypeName);\n if (!existingType) {\n throw new _GraphQLError.GraphQLError('Cannot extend type \"' + extendedTypeName + '\" because it does not ' + 'exist in the existing schema.', [def.definition]);\n }\n if (!(existingType instanceof _definition.GraphQLObjectType)) {\n throw new _GraphQLError.GraphQLError('Cannot extend non-object type \"' + extendedTypeName + '\".', [def.definition]);\n }\n var extensions = typeExtensionsMap[extendedTypeName];\n if (extensions) {\n extensions.push(def);\n } else {\n extensions = [def];\n }\n typeExtensionsMap[extendedTypeName] = extensions;\n break;\n }\n }\n\n // If this document contains no new types, then return the same unmodified\n // GraphQLSchema instance.\n if (Object.keys(typeExtensionsMap).length === 0 && Object.keys(typeDefinitionMap).length === 0) {\n return schema;\n }\n\n // A cache to use to store the actual GraphQLType definition objects by name.\n // Initialize to the GraphQL built in scalars and introspection types. All\n // functions below are inline so that this type def cache is within the scope\n // of the closure.\n var typeDefCache = {\n String: _scalars.GraphQLString,\n Int: _scalars.GraphQLInt,\n Float: _scalars.GraphQLFloat,\n Boolean: _scalars.GraphQLBoolean,\n ID: _scalars.GraphQLID,\n __Schema: _introspection.__Schema,\n __Directive: _introspection.__Directive,\n __DirectiveLocation: _introspection.__DirectiveLocation,\n __Type: _introspection.__Type,\n __Field: _introspection.__Field,\n __InputValue: _introspection.__InputValue,\n __EnumValue: _introspection.__EnumValue,\n __TypeKind: _introspection.__TypeKind\n };\n\n // Get the root Query, Mutation, and Subscription object types.\n var queryType = getTypeFromDef(schema.getQueryType());\n\n var existingMutationType = schema.getMutationType();\n var mutationType = existingMutationType ? getTypeFromDef(existingMutationType) : null;\n\n var existingSubscriptionType = schema.getSubscriptionType();\n var subscriptionType = existingSubscriptionType ? getTypeFromDef(existingSubscriptionType) : null;\n\n // Iterate through all types, getting the type definition for each, ensuring\n // that any type not directly referenced by a field will get created.\n var typeMap = schema.getTypeMap();\n var types = Object.keys(typeMap).map(function (typeName) {\n return getTypeFromDef(typeMap[typeName]);\n });\n\n // Do the same with new types, appending to the list of defined types.\n Object.keys(typeDefinitionMap).forEach(function (typeName) {\n types.push(getTypeFromAST(typeDefinitionMap[typeName]));\n });\n\n // Then produce and return a Schema with these types.\n return new _schema.GraphQLSchema({\n query: queryType,\n mutation: mutationType,\n subscription: subscriptionType,\n types: types,\n // Copy directives.\n directives: schema.getDirectives()\n });\n\n // Below are functions used for producing this schema that have closed over\n // this scope and have access to the schema, cache, and newly defined types.\n\n function getTypeFromDef(typeDef) {\n var type = _getNamedType(typeDef.name);\n (0, _invariant2.default)(type, 'Missing type from schema');\n return type;\n }\n\n function getTypeFromAST(astNode) {\n var type = _getNamedType(astNode.name.value);\n if (!type) {\n throw new _GraphQLError.GraphQLError('Unknown type: \"' + astNode.name.value + '\". Ensure that this type exists ' + 'either in the original schema, or is added in a type definition.', [astNode]);\n }\n return type;\n }\n\n function getObjectTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)(type instanceof _definition.GraphQLObjectType, 'Must be Object type.');\n return type;\n }\n\n function getInterfaceTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)(type instanceof _definition.GraphQLInterfaceType, 'Must be Interface type.');\n return type;\n }\n\n function getInputTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)((0, _definition.isInputType)(type), 'Must be Input type.');\n return type;\n }\n\n function getOutputTypeFromAST(astNode) {\n var type = getTypeFromAST(astNode);\n (0, _invariant2.default)((0, _definition.isOutputType)(type), 'Must be Output type.');\n return type;\n }\n\n // Given a name, returns a type from either the existing schema or an\n // added type.\n function _getNamedType(typeName) {\n var cachedTypeDef = typeDefCache[typeName];\n if (cachedTypeDef) {\n return cachedTypeDef;\n }\n\n var existingType = schema.getType(typeName);\n if (existingType) {\n var typeDef = extendType(existingType);\n typeDefCache[typeName] = typeDef;\n return typeDef;\n }\n\n var typeAST = typeDefinitionMap[typeName];\n if (typeAST) {\n var _typeDef = buildType(typeAST);\n typeDefCache[typeName] = _typeDef;\n return _typeDef;\n }\n }\n\n // Given a type's introspection result, construct the correct\n // GraphQLType instance.\n function extendType(type) {\n if (type instanceof _definition.GraphQLObjectType) {\n return extendObjectType(type);\n }\n if (type instanceof _definition.GraphQLInterfaceType) {\n return extendInterfaceType(type);\n }\n if (type instanceof _definition.GraphQLUnionType) {\n return extendUnionType(type);\n }\n return type;\n }\n\n function extendObjectType(type) {\n return new _definition.GraphQLObjectType({\n name: type.name,\n description: type.description,\n interfaces: function interfaces() {\n return extendImplementedInterfaces(type);\n },\n fields: function fields() {\n return extendFieldMap(type);\n }\n });\n }\n\n function extendInterfaceType(type) {\n return new _definition.GraphQLInterfaceType({\n name: type.name,\n description: type.description,\n fields: function fields() {\n return extendFieldMap(type);\n },\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function extendUnionType(type) {\n return new _definition.GraphQLUnionType({\n name: type.name,\n description: type.description,\n types: type.getTypes().map(getTypeFromDef),\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function extendImplementedInterfaces(type) {\n var interfaces = type.getInterfaces().map(getTypeFromDef);\n\n // If there are any extensions to the interfaces, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.interfaces.forEach(function (namedType) {\n var interfaceName = namedType.name.value;\n if (interfaces.some(function (def) {\n return def.name === interfaceName;\n })) {\n throw new _GraphQLError.GraphQLError('Type \"' + type.name + '\" already implements \"' + interfaceName + '\". ' + 'It cannot also be implemented in this type extension.', [namedType]);\n }\n interfaces.push(getInterfaceTypeFromAST(namedType));\n });\n });\n }\n\n return interfaces;\n }\n\n function extendFieldMap(type) {\n var newFieldMap = {};\n var oldFieldMap = type.getFields();\n Object.keys(oldFieldMap).forEach(function (fieldName) {\n var field = oldFieldMap[fieldName];\n newFieldMap[fieldName] = {\n description: field.description,\n deprecationReason: field.deprecationReason,\n type: extendFieldType(field.type),\n args: (0, _keyMap2.default)(field.args, function (arg) {\n return arg.name;\n }),\n resolve: cannotExecuteClientSchema\n };\n });\n\n // If there are any extensions to the fields, apply those here.\n var extensions = typeExtensionsMap[type.name];\n if (extensions) {\n extensions.forEach(function (extension) {\n extension.definition.fields.forEach(function (field) {\n var fieldName = field.name.value;\n if (oldFieldMap[fieldName]) {\n throw new _GraphQLError.GraphQLError('Field \"' + type.name + '.' + fieldName + '\" already exists in the ' + 'schema. It cannot also be defined in this type extension.', [field]);\n }\n newFieldMap[fieldName] = {\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n resolve: cannotExecuteClientSchema\n };\n });\n });\n }\n\n return newFieldMap;\n }\n\n function extendFieldType(typeDef) {\n if (typeDef instanceof _definition.GraphQLList) {\n return new _definition.GraphQLList(extendFieldType(typeDef.ofType));\n }\n if (typeDef instanceof _definition.GraphQLNonNull) {\n return new _definition.GraphQLNonNull(extendFieldType(typeDef.ofType));\n }\n return getTypeFromDef(typeDef);\n }\n\n function buildType(typeAST) {\n switch (typeAST.kind) {\n case _kinds.OBJECT_TYPE_DEFINITION:\n return buildObjectType(typeAST);\n case _kinds.INTERFACE_TYPE_DEFINITION:\n return buildInterfaceType(typeAST);\n case _kinds.UNION_TYPE_DEFINITION:\n return buildUnionType(typeAST);\n case _kinds.SCALAR_TYPE_DEFINITION:\n return buildScalarType(typeAST);\n case _kinds.ENUM_TYPE_DEFINITION:\n return buildEnumType(typeAST);\n case _kinds.INPUT_OBJECT_TYPE_DEFINITION:\n return buildInputObjectType(typeAST);\n }\n throw new TypeError('Unknown type kind ' + typeAST.kind);\n }\n\n function buildObjectType(typeAST) {\n return new _definition.GraphQLObjectType({\n name: typeAST.name.value,\n interfaces: function interfaces() {\n return buildImplementedInterfaces(typeAST);\n },\n fields: function fields() {\n return buildFieldMap(typeAST);\n }\n });\n }\n\n function buildInterfaceType(typeAST) {\n return new _definition.GraphQLInterfaceType({\n name: typeAST.name.value,\n fields: function fields() {\n return buildFieldMap(typeAST);\n },\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function buildUnionType(typeAST) {\n return new _definition.GraphQLUnionType({\n name: typeAST.name.value,\n types: typeAST.types.map(getObjectTypeFromAST),\n resolveType: cannotExecuteClientSchema\n });\n }\n\n function buildScalarType(typeAST) {\n return new _definition.GraphQLScalarType({\n name: typeAST.name.value,\n serialize: function serialize() {\n return null;\n },\n // Note: validation calls the parse functions to determine if a\n // literal value is correct. Returning null would cause use of custom\n // scalars to always fail validation. Returning false causes them to\n // always pass validation.\n parseValue: function parseValue() {\n return false;\n },\n parseLiteral: function parseLiteral() {\n return false;\n }\n });\n }\n\n function buildEnumType(typeAST) {\n return new _definition.GraphQLEnumType({\n name: typeAST.name.value,\n values: (0, _keyValMap2.default)(typeAST.values, function (v) {\n return v.name.value;\n }, function () {\n return {};\n })\n });\n }\n\n function buildInputObjectType(typeAST) {\n return new _definition.GraphQLInputObjectType({\n name: typeAST.name.value,\n fields: function fields() {\n return buildInputValues(typeAST.fields);\n }\n });\n }\n\n function buildImplementedInterfaces(typeAST) {\n return typeAST.interfaces && typeAST.interfaces.map(getInterfaceTypeFromAST);\n }\n\n function buildFieldMap(typeAST) {\n return (0, _keyValMap2.default)(typeAST.fields, function (field) {\n return field.name.value;\n }, function (field) {\n return {\n type: buildOutputFieldType(field.type),\n args: buildInputValues(field.arguments),\n resolve: cannotExecuteClientSchema\n };\n });\n }\n\n function buildInputValues(values) {\n return (0, _keyValMap2.default)(values, function (value) {\n return value.name.value;\n }, function (value) {\n var type = buildInputFieldType(value.type);\n return {\n type: type,\n defaultValue: (0, _valueFromAST.valueFromAST)(value.defaultValue, type)\n };\n });\n }\n\n function buildInputFieldType(typeAST) {\n if (typeAST.kind === _kinds.LIST_TYPE) {\n return new _definition.GraphQLList(buildInputFieldType(typeAST.type));\n }\n if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n var nullableType = buildInputFieldType(typeAST.type);\n (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getInputTypeFromAST(typeAST);\n }\n\n function buildOutputFieldType(typeAST) {\n if (typeAST.kind === _kinds.LIST_TYPE) {\n return new _definition.GraphQLList(buildOutputFieldType(typeAST.type));\n }\n if (typeAST.kind === _kinds.NON_NULL_TYPE) {\n var nullableType = buildOutputFieldType(typeAST.type);\n (0, _invariant2.default)(!(nullableType instanceof _definition.GraphQLNonNull), 'Must be nullable');\n return new _definition.GraphQLNonNull(nullableType);\n }\n return getOutputTypeFromAST(typeAST);\n }\n}", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function findExtendingTypes(schema, definitions) {\n \tif (!schema.$ref) {\n \t\treturn;\n \t}\n \tvar refToMatch = schema.$ref;\n \tvar matchingDefinitions = {};\n \tif (definitions.definitions) {\n \t\tfindExtendingTypesHelper(refToMatch, definitions.definitions, matchingDefinitions, null);\n \t}\n \tif (definitions['x-ibm-configuration'] && definitions['x-ibm-configuration'].targets) {\n \t\tObject.keys(definitions['x-ibm-configuration'].targets).forEach(function(targetName) {\n \t\t\tvar target = definitions['x-ibm-configuration'].targets[targetName];\n \t\t\tif (target.definitions) {\n \t\t\t\tfindExtendingTypesHelper(refToMatch, target.definitions, matchingDefinitions, null);\n \t\t\t}\n \t\t});\n \t}\n \treturn matchingDefinitions;\n }", "function diffFacts(a,b,category){var diff;// look for changes and removals\nfor(var aKey in a){if(aKey===STYLE_KEY||aKey===EVENT_KEY||aKey===ATTR_KEY||aKey===ATTR_NS_KEY){var subDiff=diffFacts(a[aKey],b[aKey]||{},aKey);if(subDiff){diff=diff||{};diff[aKey]=subDiff;}continue;}// remove if not in the new facts\nif(!(aKey in b)){diff=diff||{};diff[aKey]=typeof category==='undefined'?typeof a[aKey]==='string'?'':null:category===STYLE_KEY?'':category===EVENT_KEY||category===ATTR_KEY?undefined:{namespace:a[aKey].namespace,value:undefined};continue;}var aValue=a[aKey];var bValue=b[aKey];// reference equal, so don't worry about it\nif(aValue===bValue&&aKey!=='value'||category===EVENT_KEY&&equalEvents(aValue,bValue)){continue;}diff=diff||{};diff[aKey]=bValue;}// add new stuff\nfor(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey];}}return diff;}", "function modifySchemaTest2() {\n var sleep_schema_v3 = {\n className: \"Sleep\",\n fields: {\n sleep_quality : { // new field\n type: \"String\"\n },\n polyphasic : { // new field\n type: \"Boolean\"\n }\n }\n };\n XHR.PUT(SERVER_URL+'/schemas' + \"/\" + sleep_schema_v3.className, sleep_schema_v3)\n}", "function markListOperations(schemas) {\n _.each(schemas, function(schema) {\n if (schema.list) {\n if (_.isEmpty(schema.list.parameters)) {\n schema.list.dxFilterMode = dx.core.constants.LIST_TYPES.NONE;\n } else {\n var missingMapsTo = false;\n _.any(schema.list.parameters, function(param) {\n if (!param.mapsTo) {\n missingMapsTo = true;\n return true;\n }\n });\n schema.list.dxFilterMode = missingMapsTo ? dx.core.constants.LIST_TYPES.CUSTOM :\n dx.core.constants.LIST_TYPES.UBER;\n }\n }\n });\n}", "function _addEnum(en) {\n this.props._enums = [].slice(this.props._enums)\n .concat(_createEnum(en));\n}", "function PossibleTypeExtensionsRule(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if (Object(_language_predicates_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName);\n var expectedKind;\n\n if (defNode) {\n expectedKind = defKindToExtKind[defNode.kind];\n } else if (existingType) {\n expectedKind = typeToExtKind(existingType);\n }\n\n if (expectedKind) {\n if (expectedKind !== node.kind) {\n var kindStr = extensionKindToTypeName(node.kind);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_4__[\"GraphQLError\"](\"Cannot extend non-\".concat(kindStr, \" type \\\"\").concat(typeName, \"\\\".\"), defNode ? [defNode, node] : node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(typeName, allTypeNames);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_4__[\"GraphQLError\"](\"Cannot extend type \\\"\".concat(typeName, \"\\\" because it is not defined.\") + Object(_jsutils_didYouMean_mjs__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(suggestedTypes), node.name));\n }\n }\n}", "function PossibleTypeExtensionsRule(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if (Object(_language_predicates_mjs__WEBPACK_IMPORTED_MODULE_6__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName);\n var expectedKind;\n\n if (defNode) {\n expectedKind = defKindToExtKind[defNode.kind];\n } else if (existingType) {\n expectedKind = typeToExtKind(existingType);\n }\n\n if (expectedKind) {\n if (expectedKind !== node.kind) {\n var kindStr = extensionKindToTypeName(node.kind);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_4__[\"GraphQLError\"](\"Cannot extend non-\".concat(kindStr, \" type \\\"\").concat(typeName, \"\\\".\"), defNode ? [defNode, node] : node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList_mjs__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(typeName, allTypeNames);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_4__[\"GraphQLError\"](\"Cannot extend type \\\"\".concat(typeName, \"\\\" because it is not defined.\") + Object(_jsutils_didYouMean_mjs__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(suggestedTypes), node.name));\n }\n }\n}", "static filterUnexpectedData(orig, startingData, schema) {\n const data = Object.assign({}, startingData);\n Object.keys(schema.describe().children).forEach(key => {\n data[key] = orig[key];\n });\n return data;\n }", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function hasEncodingLoss(oldType, newType) {\n if (newType === 'complex64') {\n return false;\n }\n if (newType === 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'int32' && oldType !== 'float32' && oldType !== 'complex64') {\n return false;\n }\n if (newType === 'bool' && oldType === 'bool') {\n return false;\n }\n return true;\n}", "function changes2shorthand (changes) {\n return '{' + changes.reduce(function (s,c) { for(let i=0; i< c.count; i++) s += c.type; return s }, '') + '}'\n}", "convertSchemaToAjvFormat (schema) {\n if (schema === null) return\n\n if (schema.type === 'string') {\n schema.fjs_type = 'string'\n schema.type = ['string', 'object']\n } else if (\n Array.isArray(schema.type) &&\n schema.type.includes('string') &&\n !schema.type.includes('object')\n ) {\n schema.fjs_type = 'string'\n schema.type.push('object')\n }\n for (const property in schema) {\n if (typeof schema[property] === 'object') {\n this.convertSchemaToAjvFormat(schema[property])\n }\n }\n }", "function PossibleTypeExtensionsRule(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if ((0, _predicates.isTypeDefinitionNode)(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName);\n var expectedKind;\n\n if (defNode) {\n expectedKind = defKindToExtKind[defNode.kind];\n } else if (existingType) {\n expectedKind = typeToExtKind(existingType);\n }\n\n if (expectedKind) {\n if (expectedKind !== node.kind) {\n var kindStr = extensionKindToTypeName(node.kind);\n context.reportError(new _GraphQLError.GraphQLError(\"Cannot extend non-\".concat(kindStr, \" type \\\"\").concat(typeName, \"\\\".\"), defNode ? [defNode, node] : node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = (0, _suggestionList.default)(typeName, allTypeNames);\n context.reportError(new _GraphQLError.GraphQLError(\"Cannot extend type \\\"\".concat(typeName, \"\\\" because it is not defined.\") + (0, _didYouMean.default)(suggestedTypes), node.name));\n }\n }\n}", "function PossibleTypeExtensionsRule(context) {\n var schema = context.getSchema();\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if ((0, _predicates.isTypeDefinitionNode)(def)) {\n definedTypes[def.name.value] = def;\n }\n }\n\n return {\n ScalarTypeExtension: checkExtension,\n ObjectTypeExtension: checkExtension,\n InterfaceTypeExtension: checkExtension,\n UnionTypeExtension: checkExtension,\n EnumTypeExtension: checkExtension,\n InputObjectTypeExtension: checkExtension\n };\n\n function checkExtension(node) {\n var typeName = node.name.value;\n var defNode = definedTypes[typeName];\n var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName);\n var expectedKind;\n\n if (defNode) {\n expectedKind = defKindToExtKind[defNode.kind];\n } else if (existingType) {\n expectedKind = typeToExtKind(existingType);\n }\n\n if (expectedKind) {\n if (expectedKind !== node.kind) {\n var kindStr = extensionKindToTypeName(node.kind);\n context.reportError(new _GraphQLError.GraphQLError(\"Cannot extend non-\".concat(kindStr, \" type \\\"\").concat(typeName, \"\\\".\"), defNode ? [defNode, node] : node));\n }\n } else {\n var allTypeNames = Object.keys(definedTypes);\n\n if (schema) {\n allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap()));\n }\n\n var suggestedTypes = (0, _suggestionList.default)(typeName, allTypeNames);\n context.reportError(new _GraphQLError.GraphQLError(\"Cannot extend type \\\"\".concat(typeName, \"\\\" because it is not defined.\") + (0, _didYouMean.default)(suggestedTypes), node.name));\n }\n }\n}", "function fixupCompilerOptions(options, diagnostics) {\n // Lazily create this value to fix module loading errors.\n commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) {\n return typeof o.type === \"object\" && !ts.forEachProperty(o.type, function (v) { return typeof v !== \"number\"; });\n });\n options = ts.clone(options);\n var _loop_3 = function(opt) {\n if (!ts.hasProperty(options, opt.name)) {\n return \"continue\";\n }\n var value = options[opt.name];\n // Value should be a key of opt.type\n if (typeof value === \"string\") {\n // If value is not a string, this will fail\n options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics);\n }\n else {\n if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) {\n // Supplied value isn't a valid enum value.\n diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt));\n }\n }\n };\n for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) {\n var opt = commandLineOptionsStringToEnum_1[_i];\n _loop_3(opt);\n }\n return options;\n }", "function checkOldStructure() {\n \tvar actions = pref.getPref(\"actions\");\n\n \tif (Array.isArray(actions)) {\n \t\tvar newpref = {}\n \t\tactions.forEach(function (action) {\n \t\t\tnewpref[action.id] = {};\n \t\t\tnewpref[action.id].enabled = action.enabled;\n \t\t\tnewpref[action.id].exec = action.exec;\n \t\t\tnewpref[action.id].trigger = action.when;\n \t\t});\n\n \t\tpref.setPref(\"actions\", newpref);\n\n \t\tlog.warn(\"prefs:\",\n \t\t\t\"An old structure for actions detected and converted to new one.\"\n \t\t);\n \t}\n \telse if (Object.isObject(actions)) {\n \t\tvar changed = false;\n \t\tfor (var id in actions) {\n \t\t\tif (actions[id].when) {\n \t\t\t\tactions[id].trigger = actions[id].when;\n \t\t\t\tdelete actions[id].when;\n \t\t\t\tchanged = true;\n \t\t\t}\n \t\t}\n\n \t\tif (changed) {\n \t\t\tpref.setPref(\"actions\", actions);\n\n \t\t\tlog.warn(\"prefs:\",\n \t\t\t\t\"An old structure for actions detected and converted to new one.\"\n \t\t\t);\n \t\t}\n \t}\n }", "function mergeTypeDefs (typeDefs) {\n const documents = typeDefs.map((document) => {\n if (typeof document === 'string') {\n return parse(document)\n }\n return document\n })\n const definitions = []\n\n documents.forEach((document) => {\n document.definitions.forEach(definition => {\n switch (definition.kind) {\n case 'ObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'ObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.interfaces = mergeInterfaces(existingDefinition.interfaces, definition.interfaces)\n return\n }\n break\n }\n case 'InterfaceTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InterfaceTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeFields(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n case 'UnionTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'UnionTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.types = mergeUnionTypes(existingDefinition.types, definition.types)\n return\n }\n break\n }\n case 'EnumTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'EnumTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n existingDefinition.values = mergeEnumValues(existingDefinition.values, definition.values)\n return\n }\n break\n }\n case 'InputObjectTypeDefinition': {\n const existingDefinition = definitions.find((def) => {\n return def.kind === 'InputObjectTypeDefinition' && def.name.value === definition.name.value\n })\n if (existingDefinition) {\n existingDefinition.description = definition.description || existingDefinition.description\n existingDefinition.fields = mergeInputValues(existingDefinition.fields, definition.fields)\n existingDefinition.directives = mergeDirectives(existingDefinition.directives, definition.directives)\n return\n }\n break\n }\n }\n definitions.push(definition)\n })\n })\n\n return {\n kind: 'Document',\n definitions,\n }\n}", "function getSuggestedFieldNames(schema, type, fieldName) {\n if (type instanceof _definition.GraphQLObjectType || type instanceof _definition.GraphQLInterfaceType) {\n var possibleFieldNames = Object.keys(type.getFields());\n return (0, _suggestionList2.default)(fieldName, possibleFieldNames);\n }\n // Otherwise, must be a Union type, which does not define fields.\n return [];\n}", "fixOptionalChoicePropertyDependency(jsonSchema, node) {\n const originalOneOf = new JsonSchemaFile();\n originalOneOf.oneOf = Array.from(jsonSchema.oneOf);\n jsonSchema.anyOf.push(originalOneOf);\n const theOptionalPart = new JsonSchemaFile();\n jsonSchema.oneOf.forEach(function(option, index, array) {\n const dependencySchema = new JsonSchemaFile();\n dependencySchema.not = option;\n theOptionalPart.addPropertyDependency[option.name] = option;\n //theOptionalPart.allOf.push(notSchema);\n });\n jsonSchema.anyOf.push(theOptionalPart);\n jsonSchema.oneOf = [];\n }", "function getSuggestedTypeNames(schema, type, fieldName) {\n if (Object(_type_definition__WEBPACK_IMPORTED_MODULE_3__[\"isAbstractType\"])(type)) {\n var suggestedObjectTypes = [];\n var interfaceUsageCount = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = schema.getPossibleTypes(type)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var possibleType = _step.value;\n\n if (!possibleType.getFields()[fieldName]) {\n continue;\n } // This object type defines this field.\n\n\n suggestedObjectTypes.push(possibleType.name);\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = possibleType.getInterfaces()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var possibleInterface = _step2.value;\n\n if (!possibleInterface.getFields()[fieldName]) {\n continue;\n } // This interface type defines this field.\n\n\n interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n } // Suggest interface types based on how common they are.\n\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {\n return interfaceUsageCount[b] - interfaceUsageCount[a];\n }); // Suggest both interface and object types.\n\n return suggestedInterfaceTypes.concat(suggestedObjectTypes);\n } // Otherwise, must be an Object type, which does not have possible fields.\n\n\n return [];\n}", "function listSchemaTypes(){\n resultObj = {}\n var mainSchemes ={\n eng:['engFrameSchema', 'translationSchema', 'lexUnit'],\n //eng: [],\n heb: ['decisionSchema','hebFrameLUSchema', 'luSentenceSchema', 'hebsentenceSchema', 'hebFrameType']\n //heb: ['hebFrameLUSchema']\n }\n for (schema in mainSchemes){\n //console.log(schema)\n resultObj[schema] = {}\n for (name in mainSchemes[schema]){\n var results = []\n if (schema =='eng')test2(eng[mainSchemes[schema][name]].paths, \"\",results)\n if (schema =='heb')test2(heb[mainSchemes[schema][name]].paths, \"\",results)\n //console.log(name)\n resultObj[mainSchemes[schema][name]] =results;\n }\n\n }\n\n return resultObj;\n}", "function newTypesComplain(req, res) {\n\n}", "function visitSchema(schema, \n// To accommodate as many different visitor patterns as possible, the\n// visitSchema function does not simply accept a single instance of the\n// SchemaVisitor class, but instead accepts a function that takes the\n// current VisitableSchemaType object and the name of a visitor method and\n// returns an array of SchemaVisitor instances that implement the visitor\n// method and have an interest in handling the given VisitableSchemaType\n// object. In the simplest case, this function can always return an array\n// containing a single visitor object, without even looking at the type or\n// methodName parameters. In other cases, this function might sometimes\n// return an empty array to indicate there are no visitors that should be\n// applied to the given VisitableSchemaType object. For an example of a\n// visitor pattern that benefits from this abstraction, see the\n// SchemaDirectiveVisitor class below.\nvisitorSelector) {\n // Helper function that calls visitorSelector and applies the resulting\n // visitors to the given type, with arguments [type, ...args].\n function callMethod(methodName, type) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n visitorSelector(type, methodName).every(function (visitor) {\n var newType = visitor[methodName].apply(visitor, __spreadArrays([type], args));\n if (typeof newType === 'undefined') {\n // Keep going without modifying type.\n return true;\n }\n if (methodName === 'visitSchema' ||\n type instanceof graphql_1.GraphQLSchema) {\n throw new Error(\"Method \" + methodName + \" cannot replace schema with \" + newType);\n }\n if (newType === null) {\n // Stop the loop and return null form callMethod, which will cause\n // the type to be removed from the schema.\n type = null;\n return false;\n }\n // Update type to the new type returned by the visitor method, so that\n // later directives will see the new type, and callMethod will return\n // the final type.\n type = newType;\n return true;\n });\n // If there were no directives for this type object, or if all visitor\n // methods returned nothing, type will be returned unmodified.\n return type;\n }\n // Recursive helper function that calls any appropriate visitor methods for\n // each object in the schema, then traverses the object's children (if any).\n function visit(type) {\n if (type instanceof graphql_1.GraphQLSchema) {\n // Unlike the other types, the root GraphQLSchema object cannot be\n // replaced by visitor methods, because that would make life very hard\n // for SchemaVisitor subclasses that rely on the original schema object.\n callMethod('visitSchema', type);\n updateEachKey(type.getTypeMap(), function (namedType, typeName) {\n if (!typeName.startsWith('__')) {\n // Call visit recursively to let it determine which concrete\n // subclass of GraphQLNamedType we found in the type map. Because\n // we're using updateEachKey, the result of visit(namedType) may\n // cause the type to be removed or replaced.\n return visit(namedType);\n }\n });\n return type;\n }\n if (type instanceof graphql_1.GraphQLObjectType) {\n // Note that callMethod('visitObject', type) may not actually call any\n // methods, if there are no @directive annotations associated with this\n // type, or if this SchemaDirectiveVisitor subclass does not override\n // the visitObject method.\n var newObject = callMethod('visitObject', type);\n if (newObject) {\n visitFields(newObject);\n }\n return newObject;\n }\n if (type instanceof graphql_1.GraphQLInterfaceType) {\n var newInterface = callMethod('visitInterface', type);\n if (newInterface) {\n visitFields(newInterface);\n }\n return newInterface;\n }\n if (type instanceof graphql_1.GraphQLInputObjectType) {\n var newInputObject_1 = callMethod('visitInputObject', type);\n if (newInputObject_1) {\n updateEachKey(newInputObject_1.getFields(), function (field) {\n // Since we call a different method for input object fields, we\n // can't reuse the visitFields function here.\n return callMethod('visitInputFieldDefinition', field, {\n objectType: newInputObject_1,\n });\n });\n }\n return newInputObject_1;\n }\n if (type instanceof graphql_1.GraphQLScalarType) {\n return callMethod('visitScalar', type);\n }\n if (type instanceof graphql_1.GraphQLUnionType) {\n return callMethod('visitUnion', type);\n }\n if (type instanceof graphql_1.GraphQLEnumType) {\n var newEnum_1 = callMethod('visitEnum', type);\n if (newEnum_1) {\n updateEachKey(newEnum_1.getValues(), function (value) {\n return callMethod('visitEnumValue', value, {\n enumType: newEnum_1,\n });\n });\n }\n return newEnum_1;\n }\n throw new Error(\"Unexpected schema type: \" + type);\n }\n function visitFields(type) {\n updateEachKey(type.getFields(), function (field) {\n // It would be nice if we could call visit(field) recursively here, but\n // GraphQLField is merely a type, not a value that can be detected using\n // an instanceof check, so we have to visit the fields in this lexical\n // context, so that TypeScript can validate the call to\n // visitFieldDefinition.\n var newField = callMethod('visitFieldDefinition', field, {\n // While any field visitor needs a reference to the field object, some\n // field visitors may also need to know the enclosing (parent) type,\n // perhaps to determine if the parent is a GraphQLObjectType or a\n // GraphQLInterfaceType. To obtain a reference to the parent, a\n // visitor method can have a second parameter, which will be an object\n // with an .objectType property referring to the parent.\n objectType: type,\n });\n if (newField && newField.args) {\n updateEachKey(newField.args, function (arg) {\n return callMethod('visitArgumentDefinition', arg, {\n // Like visitFieldDefinition, visitArgumentDefinition takes a\n // second parameter that provides additional context, namely the\n // parent .field and grandparent .objectType. Remember that the\n // current GraphQLSchema is always available via this.schema.\n field: newField,\n objectType: type,\n });\n });\n }\n return newField;\n });\n }\n visit(schema);\n // Return the original schema for convenience, even though it cannot have\n // been replaced or removed by the code above.\n return schema;\n}" ]
[ "0.7961201", "0.7452213", "0.7186998", "0.7186998", "0.7143121", "0.6903845", "0.6899022", "0.68724793", "0.68724793", "0.68663436", "0.6860933", "0.6849344", "0.6849344", "0.68405265", "0.6779417", "0.67071426", "0.6547236", "0.65066653", "0.64276445", "0.63447815", "0.63329357", "0.63329357", "0.62842274", "0.62842274", "0.6282577", "0.6282577", "0.6257017", "0.62555844", "0.62555844", "0.6199938", "0.6194815", "0.6142901", "0.6044328", "0.6044328", "0.6044328", "0.6044328", "0.5635585", "0.55373716", "0.55373716", "0.55373716", "0.5489989", "0.49961865", "0.49438676", "0.49073005", "0.48649448", "0.4863976", "0.4798835", "0.47942862", "0.4737549", "0.4737549", "0.4711736", "0.4711736", "0.4687981", "0.46862453", "0.4654056", "0.4654056", "0.46437186", "0.46387625", "0.46387625", "0.4583827", "0.45796078", "0.45796078", "0.45762336", "0.45654166", "0.45412543", "0.45411864", "0.44983393", "0.44757405", "0.44684693", "0.44469824", "0.44252792", "0.4413311", "0.44067562", "0.44056296", "0.44056296", "0.43993506", "0.43937242", "0.43937242", "0.4391747", "0.43831208", "0.4381626", "0.4379626", "0.43769482", "0.43769482", "0.43583566", "0.43408403", "0.43408403", "0.43347895", "0.43108878", "0.43035844", "0.43035844", "0.42939818", "0.42922297", "0.42621285", "0.426004", "0.42583993", "0.4248276", "0.4246506", "0.42458436", "0.422773" ]
0.7793059
1
Create a lookup array where anything but characters in `chars` string and alphanumeric chars is percentencoded.
function getEncodeCache(exclude) { var i, ch, cache = encodeCache[exclude]; if (cache) { return cache; } cache = encodeCache[exclude] = []; for (i = 0; i < 128; i++) { ch = String.fromCharCode(i); if (/^[0-9a-z]$/i.test(ch)) { // always allow unencoded alphanumeric characters cache.push(ch); } else { cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); } } for (i = 0; i < exclude.length; i++) { cache[exclude.charCodeAt(i)] = exclude[i]; } return cache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encodeReserved(str) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n })\n .join(\"\");\n}", "function encodeReserved(str) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n })\n .join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function missingLetters() {}", "function charValuesRules(words){\n var string = \"\";\n var ASCIIchar;\n for (var n = 0; n < words.length; n++){\n for (var m = 0; m < words[n].length; m++){\n ASCIIchar = words[n].charAt(m).charCodeAt();\n\n string += getChar(ASCIIchar);\n }\n }\n\n return string;\n}", "function urlify2(charArray, trueLength) {\n if (Object.prototype.toString.call(charArray) !== \"[object Array]\") {\n throw new Error(\"You must pass an array\");\n }\n\n var extraChars = charArray.length - trueLength;\n for (var i = charArray.length - 1, o = extraChars; i >= 0; i--) {\n var characterToCopy = charArray[i - o];\n if (characterToCopy === \" \") {\n charArray[i] = \"0\";\n charArray[i-1] = \"2\";\n charArray[i-2] = \"%\";\n i -= 2;\n o -= 2;\n } else {\n charArray[i] = characterToCopy;\n }\n }\n\n return charArray.join(\"\");\n}", "function makeSpecialArray(){\n var specialArray = [];\n for(var i = 0; i < 15; i++){\n // first set of special characters have an ascii index of 33 - 47\n specialArray[i] = String.fromCharCode(33 + i);\n }\n for(var i = 15; i < 22; i++){\n // second set of special characters have an ascii index of 58 - 64\n specialArray[i] = String.fromCharCode(58 + (i-15));\n }\n for(var i = 22; i < 29; i++){\n // third set of special characters have an ascii index of 91 - 96\n specialArray[i] = String.fromCharCode(91 + (i-23));\n }\n for(var i = 29; i < 33; i++){\n // fourth set of special characters have an ascii index of 123 - 126\n specialArray[i] = String.fromCharCode(123 + (i-29));\n }\n return(specialArray);\n}", "function protect(str, chars) {\n let protectedStr = str;\n for (let c = 0; c < chars.length; c++) {\n const char = chars[c];\n protectedStr = protectedStr.replace(new RegExp(char, 'g'), '\\\\' + char);\n }\n return protectedStr;\n}", "function encodeProblemUrlChars(url) {\r\n if (!url)\r\n return \"\";\r\n\r\n var len = url.length;\r\n\r\n return url.replace(_problemUrlChars, function (match, offset) {\r\n if (match == \"@D\") // escape for dollar\r\n return \"%24\";\r\n if (match == \":\") {\r\n if (offset == len - 1 || /[0-9\\/]/.test(url.charAt(offset + 1)))\r\n return \":\"\r\n }\r\n return \"%\" + match.charCodeAt(0).toString(16);\r\n });\r\n }", "function getNotAlphabet(chars){\n\tvar newAlpha = \"\";\n\tfor(var i=0; i<alphabet.length; i++){\n\t\tif(chars.indexOf(alphabet[i]) == -1){\n\t\t\tnewAlpha += alphabet[i];\n\t\t}\n\t}\n if(chars.indexOf('_') == -1){\n\t\tnewAlpha += \"_\";\n }\n\treturn newAlpha;\n}", "function lettersWithStrings(arr, str) {\n var words = []\n for(var i = 0; i < arr.length; i++){\n if(arr[i].indexOf(\"!\") !== -1) {\n \n words.push(arr[i])\n }\n }\n return words\n}", "function encodeProblemUrlChars(url) {\r\n if (!url)\r\n return \"\";\r\n\r\n var len = url.length;\r\n\r\n return url.replace(_problemUrlChars, function (match, offset) {\r\n if (match == \"~D\") // escape for dollar\r\n return \"%24\";\r\n if (match == \":\") {\r\n if (offset == len - 1 || /[0-9\\/]/.test(url.charAt(offset + 1)))\r\n return \":\"\r\n }\r\n return \"%\" + match.charCodeAt(0).toString(16);\r\n });\r\n }", "function missingLetters (str) {\n\tlet compare = str.charCodeAt(0);\n\tlet missing;\n\n\tstr.split('').map((char, index) => {\n\t\tif (str.charCodeAt(index) == compare) {\n\t\t\t++compare;\n\t\t} else {\n\t\t\tmissing = String.fromCharCode(compare);\n\t\t}\n\t});\n\treturn missing;\n}", "function missingLetters(str) {\n // let compare = str.charCodeAt(0);\n // let missing; \n\n // str.split('').map((char, i) =>{\n // if(str.charCodeAt(i) === compare) {\n // ++compare;\n // }else{\n // missing = String.fromCharCode(compare)\n // }\n // });\n // return missing;\n}", "function missingLetters(str) {\r\n let compare = str.charCodeAt(0); \r\n let missing;\r\n\r\n str.split('').map((char, index) => {\r\n if(str.charCodeAt(index) == compare){\r\n compare++\r\n }else{\r\n missing = String.fromCharCode(compare)\r\n }\r\n })\r\n\r\n return missing\r\n}", "function missingLetters(str) {\n let compare = str.charCodeAt(0);\n let missing;\n \n str.split('').map((char, i) => {\n if (str.charCodeAt(i) == compare) {\n ++compare;\n } else {\n missing = String.fromCharCode(compare);\n }\n });\n \n return missing;\n }", "function lettersWithStrings(data, str) {\r\n let array = []\r\n for (let i = 0; i < data.length; i++){\r\n if (data[i].includes(str)){\r\n array.push(data[i])\r\n }\r\n } \r\n return array\r\n }", "function fixed_encode_URI_component(str)\n{\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c){\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "missingLetters(arr) {\n\t\tlet missing = [], \n\t\tunicode = arr.map((letter) => {\n\t\t\treturn letter.charCodeAt();\n\t\t});\n\n\t\tfor(let i = 0; i < unicode.length; i++){\n\t\t\tif(unicode[i + 1] - unicode[i] > 1){\n\t\t\t\tmissing.push(String.fromCharCode(unicode[i] + 1));\n\t\t\t}\n\t\t}\n\n\t\treturn missing\n\t}", "function collectAndSetChars() {\n var charsS = new Set();\n var charsA;\n var cc;\n dictionary.reset();\n println(\"collecting chars…\");\n while (!dictionary.eof()) {\n cc = dictionary.data[1].charCodeAt(dictionary.data[0]);\n if (cc === 45 || cc >= 65) {\n charsS.add(cc);\n }\n dictionary.data[0] += 1;\n }\n charsA = Array.from(charsS);\n charsA.sort((a, b) => a - b);\n charsA.forEach(function setChar(cc) {\n var c = String.fromCharCode(cc);\n var i = xint[cc];\n if (i === undefined) {\n if (c === c.toUpperCase()) {\n //c is upperCase -> try lowerCase\n i = xint[c.toLowerCase().charCodeAt(0)];\n } else if (c.toUpperCase().length === 1) { //test for length is necessary because \"ß\".toUpperCase() -> \"SS\"\n //c ist lowerCase -> try upperCase\n i = xint[c.toUpperCase().charCodeAt(0)];\n }\n if (i === undefined) {\n i = xext.push(c.toLowerCase()) - 1;\n xint[cc] = i;\n xclass[cc] = letter_class;\n } else {\n //other case already exists:\n xint[cc] = i;\n xclass[cc] = letter_class;\n }\n }\n });\n xdig = xext.slice(0, 10);\n cmax = xext.length - 1;\n cnum = xext.length;\n}", "function missingLetters(str) {\r\n let compare = str.charCodeAt(0)\r\n let missing = ''\r\n str.split('').map((char,i) =>{\r\n str.charCodeAt(i) == compare\r\n ? ++compare\r\n : missing = String.fromCharCode(compare)\r\n\r\n })\r\n return missing\r\n\r\n}", "function missingLetters(str) {\r\n let compare = str.charCodeAt(0) // start at the first charater code of the string. \r\n let missing;\r\n\r\n str.split('').map(function (char, i) {\r\n // if the charcter at that code is missing, it move to the next chartercter code. \r\n // using the indexs in the Charater code stored in compare\r\n if (str.charCodeAt(i) == compare) {\r\n ++compare;\r\n } else {\r\n missing = String.fromCharCode(compare)\r\n }\r\n })\r\n return missing\r\n}", "fillAlpha(arr) {\n\t\tconst alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''),\n\t\tstart = alpha.indexOf(arr[0]),\n\t\tend = alpha.indexOf(arr[arr.length-1]),\n\t\tfullAlpha = alpha.slice(start, end + 1);\t\t\n\n\t\treturn fullAlpha;\n\t}", "static fromAscii(value) {\n let trytes = \"\";\n for (let i = 0; i < value.length; i++) {\n const asciiValue = value.charCodeAt(i);\n const firstValue = asciiValue % 27;\n const secondValue = (asciiValue - firstValue) / 27;\n trytes += TrytesHelper.ALPHABET[firstValue] + TrytesHelper.ALPHABET[secondValue];\n }\n return trytes;\n }", "function replaceSpecialChars(value) {\n return value.replace(/[\\&\\:\\(\\)\\[\\\\\\/]/g, ' ').replace(/\\s{2,}/g, ' ').replace(/^\\s/, '').replace(/\\s$/, '').split(' ').join('*');\n }", "function url_encode(str) {\r\n var hex_chars = \"0123456789ABCDEF\";\r\n var noEncode = /^([a-zA-Z0-9\\_\\-\\.])$/;\r\n var n, strCode, hex1, hex2, strEncode = \"\";\r\n\r\n for(n = 0; n < str.length; n++) {\r\n if (noEncode.test(str.charAt(n))) {\r\n strEncode += str.charAt(n);\r\n } else {\r\n\t strCode = str.charCodeAt(n);\r\n\t hex1 = hex_chars.charAt(Math.floor(strCode / 16));\r\n\t hex2 = hex_chars.charAt(strCode % 16);\r\n\t strEncode += \"%\" + (hex1 + hex2);\r\n\t }\r\n\t}\r\n\treturn strEncode;\r\n}", "function oneOf(chars) {\n return function(input) {\n var match = new RegExp('[' + chars + ']');\n if(input.charAt(0).search(match) != -1) {\n return {rest: input.substr(1, input.length - 1),\n parsed: input.charAt(0),\n ast: input.charAt(0)};\n }\n else {\n return false;\n }\n };\n}", "function addCharDefs() {\n let stats = {\n simp: { count: 0, fixed: 0 },\n trad: { count: 0, fixed: 0 }\n };\n ['simp', 'trad'].forEach(lang => {\n Object.keys(dict[lang]).forEach(word => {\n if (word.length !== 2) throw Error('bad length for ' + word);\n for (let i = 0; i < word.length; i++) {\n const ch = word[i];\n if (!dict.chars[ch]) {\n dict.chars[ch] = repairCharDef(ch, stats[lang]);\n stats[lang].count++;\n }\n }\n });\n });\n console.log(\"CharDefs:\", JSON.stringify(stats)\n .replace(/(^{|\"|}$)/g, '')\n .replace(/([:,])/g, \"$1 \"));\n return dict;\n}", "function toTrytes(input) {\n\n // If input is not a string, return null\n if ( typeof input !== 'string' ) return null\n\n var TRYTE_VALUES = \"9ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var trytes = \"\";\n\n for (var i = 0; i < input.length; i++) {\n var char = input[i];\n var asciiValue = char.charCodeAt(0);\n\n // If not recognizable ASCII character, return null\n if (asciiValue > 255) {\n //asciiValue = 32\n return null;\n }\n\n var firstValue = asciiValue % 27;\n var secondValue = (asciiValue - firstValue) / 27;\n\n var trytesValue = TRYTE_VALUES[firstValue] + TRYTE_VALUES[secondValue];\n\n trytes += trytesValue;\n }\n\n return trytes;\n}", "function toTrytes(input) {\n\n // If input is not a string, return null\n if ( typeof input !== 'string' ) return null\n\n var TRYTE_VALUES = \"9ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n var trytes = \"\";\n\n for (var i = 0; i < input.length; i++) {\n var char = input[i];\n var asciiValue = char.charCodeAt(0);\n\n // If not recognizable ASCII character, return null\n if (asciiValue > 255) {\n //asciiValue = 32\n return null;\n }\n\n var firstValue = asciiValue % 27;\n var secondValue = (asciiValue - firstValue) / 27;\n\n var trytesValue = TRYTE_VALUES[firstValue] + TRYTE_VALUES[secondValue];\n\n trytes += trytesValue;\n }\n\n return trytes;\n}", "decode([...chars]) {\n return String.fromCharCode(...chars.map((char, i) =>\n ((char.charCodeAt(0) - ASCII_START) - (this.#keyShift[i % this.#keyShift.length]) + ASCII_LENGTH)\n % ASCII_LENGTH + ASCII_START))\n }", "function buildUseableCharactersArray() {\n var useableCharacters = [];\n var allLetters = [\n \"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\",\n \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\",\n \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\",\n \"y\", \"z\"\n ];\n var allSpecialCharacters = [\n \"!\", \"#\", \"$\", \"%\", \"&\", \"'\", \"(\", \")\",\n \"*\", \"+\", \",\", \"-\", \".\", \"/\", \":\", \";\",\n \"<\", \"=\", \">\", \"?\", \"@\", \"[\", \"]\", \"^\",\n \"_\", \"`\", \"{\", \"|\", \"}\", \"~\"\n ]\n\n // Adds lowercase letters to usable characters\n if (passwordOptions.useLowercase === true) {\n for (let i = 0; i < allLetters.length; i++) {\n useableCharacters.push(allLetters[i]);\n }\n }\n // Adds uppercase letters to usable characters\n if (passwordOptions.useUppercase === true) {\n for (let i = 0; i < allLetters.length; i++) {\n useableCharacters.push(allLetters[i].toUpperCase());\n }\n }\n // Adds numbers to usable characters\n if (passwordOptions.useNumbers === true) {\n for (let i = 0; i < 10; i++) {\n useableCharacters.push(0 + i);\n }\n }\n // Adds special characters to usable characters\n if (passwordOptions.useSpecialCharacters === true) {\n for (let i = 0; i < allSpecialCharacters.length; i++) {\n useableCharacters.push(allSpecialCharacters[i]);\n }\n }\n\n return useableCharacters;\n}", "function noneOf(chars) {\n return function(input) {\n var match = new RegExp('[^' + chars + ']');\n if(input.charAt(0).search(match) != -1) {\n return {rest: input.substr(1, input.length - 1),\n parsed: input.charAt(0),\n ast: input.charAt(0)};\n }\n else {\n return false;\n }\n };\n}", "function getEncodeCache(exclude) {\n var i,\n ch,\n cache = encodeCache[exclude];\n\n if (cache) {\n return cache;\n }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n} // Encode unsafe characters with percent-encoding, skipping already", "function PreencheMapaDiacriticals() {\n for (var i = 0; i < defaultDiacriticsRemovalap.length; i++) {\n var letters = defaultDiacriticsRemovalap[i].letters;\n for (var j=0; j < letters.length ; j++){\n diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base;\n }\n }\n}", "function getEncodeCache(exclude) {\n var i,\n ch,\n cache = encodeCache[exclude];\n\n if (cache) {\n return cache;\n }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n } // Encode unsafe characters with percent-encoding, skipping already", "encode(chars) {\n const bytes = [];\n for (let i = 0; i < chars.length; i += 1) {\n const char = chars[i];\n if (char === 96) {\n bytes.push(char);\n bytes.push(char);\n } else if (char === 10) {\n bytes.push(char);\n } else if (char >= 32 && char <= 126) {\n bytes.push(char);\n } else {\n let str = '';\n if (char >= 0 && char <= 31) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 127 && char <= 255) {\n str += `\\`x${ascii[char]}`;\n } else if (char >= 0x100 && char <= 0xffff) {\n str += `\\`u${ascii[(char >> 8) & mask[8]]}${ascii[char & mask[8]]}`;\n } else if (char >= 0x10000 && char <= 0xffffffff) {\n str += '`u{';\n const digit = (char >> 24) & mask[8];\n if (digit > 0) {\n str += ascii[digit];\n }\n str += `${ascii[(char >> 16) & mask[8]] + ascii[(char >> 8) & mask[8]] + ascii[char & mask[8]]}}`;\n } else {\n throw new Error('escape.encode(char): char > 0xffffffff not allowed');\n }\n const buf = Buffer.from(str);\n buf.forEach((b) => {\n bytes.push(b);\n });\n }\n }\n return Buffer.from(bytes);\n }", "function makeLetters(charCodes) {\n return charCodes.map(function(c) {\n return String.fromCharCode(c);\n }).join('');\n }", "function createAlphabet() {\n if (alphabets.length > 0) {\n alphabets = [];\n }\n\n var strings = document.getElementById(\"patterns\").value.split(\",\");\n\n for (str = 0; str < strings.length; str++) {\n var chars = strings[str].split(\"\");\n for (char = 0; char < chars.length; char++) {\n if (alphabets.indexOf(chars[char]) === -1) {\n alphabets.push(chars[char]);\n }\n }\n }\n\n document.getElementById(\"alphabets\").value = alphabets;\n createTable();\n}", "function containsForbiddenChars(str) {\n var chars = ['<script>', '</script>', '<script', 'script>', '</script', '<audio>', '</audio>', '<audio', 'audio>', '</audio', '$', '{', '}', '%'];\n for (var i = 0; i < chars.length; i++) {\n if (str.includes(chars[i])) return true;\n }\n return false;\n}", "function escapeCssUrlChar(ch) {\n return cssUrlChars[ch]\n || (cssUrlChars[ch] = (ch < '\\x10' ? '%0' : '%')\n + ch.charCodeAt(0).toString(16));\n }", "function escapeCssUrlChar(ch) {\n return cssUrlChars[ch]\n || (cssUrlChars[ch] = (ch < '\\x10' ? '%0' : '%')\n + ch.charCodeAt(0).toString(16));\n }", "function letterCheck() {\n unknown.forEach((x, i) => {\n if (guess.localeCompare(unknown[i], \"en\", { sensitivity: \"base\" }) == 0) {\n underscores[i] = unknown[i];\n }\n document.getElementById(\"mysteryWord\").innerHTML = underscores.join(\"\");\n });\n}", "getLettersToBeGuessed() {\r\n let uniqueLetters = new Array();\r\n for (let i = 0; i < this.text.length; i++) {\r\n if (!uniqueLetters.includes(this.text.charAt(i)) && Utilities.alphabet.includes(this.text.charAt(i).toLowerCase())) {\r\n uniqueLetters.push(this.text.charAt(i));\r\n }\r\n }\r\n uniqueLetters.sort();\r\n return uniqueLetters;\r\n }", "function generateUrlGlyphs(glyphs) {\n var url = [];\n\n for (var g in glyphs) {\n if (glyphs[g]) {\n url.push(glyphs[g].uid);\n }\n }\n\n return url.join(':');\n }", "getCharacter() {\n let characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%';\n return characters;\n }", "function urlify(str) {\n let chars = str.split('');\n let numSpaces = 0;\n for (let i=0; i<chars.length; i++) {\n if (chars[i] === ' ') numSpaces++;\n }\n for (let j=chars.length+(numSpaces*2)-1, k=chars.length-1; j>=0 && k>=0; j--) {\n if (chars[k] === ' ') {\n chars[j] = '0';\n chars[j-1] = '2';\n chars[j-2] = '%';\n j = j-2;\n } else {\n chars[j] = chars[k];\n }\n k--;\n }\n return chars.join('');\n}", "function remove_accent(str) {\n\t\t\t\tvar map={'À':'A','Á':'A','Â':'A','Ã':'A','Ä':'A','Å':'A','Æ':'AE','Ç':'C','È':'E','É':'E','Ê':'E','Ë':'E','Ì':'I','Í':'I','Î':'I','Ï':'I','Ð':'D','Ñ':'N','Ò':'O','Ó':'O','Ô':'O','Õ':'O','Ö':'O','Ø':'O','Ù':'U','Ú':'U','Û':'U','Ü':'U','Ý':'Y','ß':'s','à':'a','á':'a','â':'a','ã':'a','ä':'a','å':'a','æ':'ae','ç':'c','è':'e','é':'e','ê':'e','ë':'e','ì':'i','í':'i','î':'i','ï':'i','ñ':'n','ò':'o','ó':'o','ô':'o','õ':'o','ö':'o','ø':'o','ù':'u','ú':'u','û':'u','ü':'u','ý':'y','ÿ':'y','A':'A','a':'a','A':'A','a':'a','A':'A','a':'a','C':'C','c':'c','C':'C','c':'c','C':'C','c':'c','C':'C','c':'c','D':'D','d':'d','Ð':'D','d':'d','E':'E','e':'e','E':'E','e':'e','E':'E','e':'e','E':'E','e':'e','E':'E','e':'e','G':'G','g':'g','G':'G','g':'g','G':'G','g':'g','G':'G','g':'g','H':'H','h':'h','H':'H','h':'h','I':'I','i':'i','I':'I','i':'i','I':'I','i':'i','I':'I','i':'i','I':'I','i':'i','?':'IJ','?':'ij','J':'J','j':'j','K':'K','k':'k','L':'L','l':'l','L':'L','l':'l','L':'L','l':'l','?':'L','?':'l','L':'L','l':'l','N':'N','n':'n','N':'N','n':'n','N':'N','n':'n','?':'n','O':'O','o':'o','O':'O','o':'o','O':'O','o':'o','Œ':'OE','œ':'oe','R':'R','r':'r','R':'R','r':'r','R':'R','r':'r','S':'S','s':'s','S':'S','s':'s','S':'S','s':'s','Š':'S','š':'s','T':'T','t':'t','T':'T','t':'t','T':'T','t':'t','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','W':'W','w':'w','Y':'Y','y':'y','Ÿ':'Y','Z':'Z','z':'z','Z':'Z','z':'z','Ž':'Z','ž':'z','?':'s','ƒ':'f','O':'O','o':'o','U':'U','u':'u','A':'A','a':'a','I':'I','i':'i','O':'O','o':'o','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','U':'U','u':'u','?':'A','?':'a','?':'AE','?':'ae','?':'O','?':'o'};\n\t\t\t\tvar res='';\n\t\t\t\tfor (var i=0;i<str.length;i++){c=str.charAt(i);res+=map[c]||c;}\n\t\t\t\t\n\t\t\t\t\t//--Remove the code postal\n\t\t\t\tres=res.substring(0,res.length-6);\t\t\n\t\t\t\treturn res;\n\t\t\t}", "function urlifyWithoutLen(str){\n let strArr = str.trim().split('');\n for(let v in strArr){\n if(strArr[v] === \" \"){\n strArr[v] = \"%20\";\n }\n }\n return strArr.join(\"\")\n}", "function filterAllowedChars(str) {\n\t\tvar allowedChars = \"_-\";\n\t\tvar n = str.length;\n\t\tvar returnStr = \"\";\n\t\tvar i = 0;\n\t\tvar _char;\n\t\tvar z;\n\t\tfor (i; i < n; i++) {\n\t\t\t_char = str.charAt(i).toLowerCase(); //convert to lowercase\n\t\t\tif (_char == \"\\\\\") _char = \"/\";\n\t\t\tz = getCharCode(_char);\t\t\t\n\t\t\tif ((z >= getCharCode(\"a\") && z <= getCharCode(\"z\")) || (z >= getCharCode(\"0\") && z <= getCharCode(\"9\")) || allowedChars.indexOf(_char) >= 0) {\n\t\t\t\t//only accepted characters (this will remove the spaces as well)\n\t\t\t\treturnStr += _char;\n\t\t\t}\n\t\t}\n\t\treturn returnStr;\n\t}", "function areValidChars(char){\n for(var i=0; i<char.length; i++){\n if(alphabet.indexOf(char[i]) == -1 && char[i] != '_' && char[i] != '\\\\'){\n return char[i];\n }\n }\n return true;\n}", "function regexOneCharStringsWith(frequentChars) {\n var matches = [];\n for (var i = 0; i < POTENTIAL_MATCHES; ++i) {\n matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()));\n }\n return matches;\n}", "function regexOneCharStringsWith(frequentChars) {\n var matches = [];\n for (var i = 0; i < POTENTIAL_MATCHES; ++i) {\n matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()));\n }\n return matches;\n}", "function regexOneCharStringsWith(frequentChars) {\n var matches = [];\n for (var i = 0; i < POTENTIAL_MATCHES; ++i) {\n matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()));\n }\n return matches;\n}", "function regexOneCharStringsWith(frequentChars) {\n var matches = [];\n for (var i = 0; i < POTENTIAL_MATCHES; ++i) {\n matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()));\n }\n return matches;\n}", "function regexOneCharStringsWith(frequentChars) {\n var matches = [];\n for (var i = 0; i < POTENTIAL_MATCHES; ++i) {\n matches.push(rnd(8) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode()));\n }\n return matches;\n}", "encode([...chars]) {\n return String.fromCharCode(...chars.map((char, i) =>\n ((char.charCodeAt(0) - ASCII_START) + (this.#keyShift[i % this.#keyShift.length]))\n % ASCII_LENGTH + ASCII_START))\n }", "function validateSpecialChars(root, id, errorMsg) {\r\n\tvar strData = $(root+':'+id).value;\t\r\n\tvar errorObj = $(errorMsg);\r\n\tvar iCount, iDataLen;\r\n\tvar strCompare = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \";\r\n\tiDataLen = strData.length;\r\n\t\r\n\tif (iDataLen > 0) {\t\r\n\t\tfor (iCount=0; iCount < iDataLen; iCount+=1) {\r\n\t\t\tvar cData = strData.charAt(iCount);\r\n\t\t\r\n\t\t\tif (strCompare.indexOf(cData) < 0 ){\r\n\t\t\t\terrorObj.innerHTML=\"Character \"+cData+\" not allowed.\";\t\t\t\t\r\n\t\t\t\treturn false;\r\n\t\t\t} \r\n\t\t}\r\n\t\t\r\n\t\terrorObj.innerHTML=\"\";\r\n\t\treturn true;\r\n\t}\r\n\telse {\r\n\t\terrorObj.innerHTML=\"\";\r\n\t}\r\n}", "function replaceForbiddenChars(string) {\r\n var newStr = '', i = 0, l = string.length;\r\n for (i; i < l; i++) {\r\n\r\n switch (string.charCodeAt(i)) {\r\n case 32:\r\n newStr += '-';\r\n break;\r\n case 34:\r\n break;\r\n default:\r\n newStr += string.charAt(i);\r\n }\r\n }\r\n return newStr;\r\n }", "function o(text){\n\tconst un = ['%22','%20','%27','%C3%A9','%C3%A0','%C3%A8','%C3%AA','%C3%AB','%C3%A7','%C3%A2','%C3%A4','%C3%AF','%C3%AE','%C3%B9','%C3%BB'];\n\tconst deux = ['\"',' ', \"'\",\"é\",\"à\",\"è\",\"ê\",\"ë\",\"ç\",\"â\",\"ä\",\"ï\",\"î\",\"ù\",\"û\"]; \n\tfor (var i = un.length - 1; i >= 0; i--) {\n\t\ttext = text.split(un[i]).join(deux[i]);\n\t}\n\treturn text;\n}", "function URLify(str, len) {\n let index = str.length\n let res = str.split(\"\")\n\n for (let i = len - 1; i >= 0; i--) {\n if (str[i] === \" \") {\n res[index - 1] = \"0\"\n res[index - 2] = \"2\"\n res[index - 3] = \"%\"\n index = index - 3\n } else {\n res[index - 1] = res[i]\n index--;\n }\n }\n\n return res.join(\"\")\n}", "function decodeURL1(url){\r\n var u = url;\r\n while (u.indexOf(\"%25\") >= 0)\r\n u = u.replace(\"%25\", \"%\");\r\n return u;\r\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16)\n })\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16)\n })\n}", "function unique3(str) {\n\n if (!str) {\n return \"please provide valid string as input\";\n }\n\n var charMap = new Array(26); // 26 elements\n var len = str.length;\n var charMapIndex;\n\n for (var i=0; i<len; i++) {\n charMapIndex = str[i].charCodeAt(0) - 'a'.charCodeAt(0);\n if (charMap[charMapIndex]) {\n return false;\n }\n charMap[charMapIndex] = true;\n }\n\n return true;\n}", "function cleanGetValue(inputStr){\n var returnStr = encodeURIComponent(inputStr);\n returnStr = returnStr.replace(/%(.*?){1,3}/g,\"a\");\n returnStr = returnStr.replace('.','b');\n return returnStr;\n}", "function nonComparisonSortStrings(arr){\n let sortedArr = arr.slice();\n\n for (let i = arr.length - 1; i > - 1; i-- ){\n let buckets = new Array(26).fill(0).map(() => new Array());\n\n sortedArr.forEach(function(word) {\n let letter = word[i];\n let letterNum = letter.charCodeAt(0) - 97\n buckets[letterNum].push(word);\n })\n\n let updatingArr = []\n\n buckets.forEach(function(bucket) {\n bucket.forEach(function(word) {\n updatingArr.push(word)\n })\n })\n\n sortedArr = updatingArr;\n }\n\n return sortedArr;\n}", "function getRandomString(chars) {\r\n var text = new Array(chars);\r\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\r\n for (var i = 0; i < chars; i++) {\r\n text[i] = possible.charAt(Math.floor(Math.random() * possible.length));\r\n }\r\n return text.join(\"\");\r\n}", "function uri_encodeOne_(ch) {\n var n = ch.charCodeAt(0);\n return '%' + '0123456789ABCDEF'.charAt((n >> 4) & 0xf) +\n '0123456789ABCDEF'.charAt(n & 0xf);\n}", "function fnStringContains(str, chars){\n let result = false;\n\n chars.forEach((char) => {\n if (char.length === 1){\n result = (str.includes(char)) ? true : result;\n }\n else {\n str.split(\"\").forEach((c) => {\n result = (c.charCodeAt(0) >= char.charCodeAt(0) && c.charCodeAt(0) <= char.charCodeAt(1)) ? true : result;\n });\n }\n });\n\n return result;\n}", "function gen_special_char() {\r\n ref_list = '`~!#$%^*()_-+=[{]{|:;\"<,>./?';\r\n idx = Math.floor(Math.random() * ref_list.length);\r\n return ref_list[idx];\r\n}", "function validateSpecialChars(input_val) {\n var re = /[\\/\\\\#,+!^()$~%.\":*?<>{}]/g;\n return re.test(input_val);\n}", "function sol(chars) {\n let indexRes = 0;\n let index = 0;\n while (index < chars.length) {\n const cur = chars[index];\n let count = 1;\n while (index + 1 < chars.length && chars[index + 1] === cur) {\n index++;\n count++;\n }\n chars[indexRes] = cur;\n indexRes++;\n index++;\n if (count === 1) continue;\n for (let c of String(count).split(\"\")) {\n chars[indexRes] = c;\n indexRes++;\n }\n }\n return indexRes;\n}", "function missingLetters(str) {\n // highest possible sum from actual gives us missing code\n // increment the compare to see if it equals compare\n // there will be an offset if it does not\n let compare = str.charCodeAt(0);\n let missing;\n str\n .split(\"\")\n .map((char, i) =>\n str.charCodeAt(i) == compare\n ? ++compare\n : (missing = String.fromCharCode(compare))\n );\n return !str.includes(\"a\") ? \"a\" : missing;\n}", "function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}", "function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "processChars(chars) { \n for (let c of chars) {\n this.charProcFunc(c);\n }\n }", "function buildEntitiesLookup(items, radix) {\n\t\tvar i, chr, entity, lookup = {};\n\n\t\tif (items) {\n\t\t\titems = items.split(',');\n\t\t\tradix = radix || 10;\n\n\t\t\t// Build entities lookup table\n\t\t\tfor (i = 0; i < items.length; i += 2) {\n\t\t\t\tchr = String.fromCharCode(parseInt(items[i], radix));\n\n\t\t\t\t// Only add non base entities\n\t\t\t\tif (!baseEntities[chr]) {\n\t\t\t\t\tentity = '&' + items[i + 1] + ';';\n\t\t\t\t\tlookup[chr] = entity;\n\t\t\t\t\tlookup[entity] = chr;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn lookup;\n\t\t}\n\t}", "function buildEntitiesLookup(items, radix) {\n\t\tvar i, chr, entity, lookup = {};\n\n\t\tif (items) {\n\t\t\titems = items.split(',');\n\t\t\tradix = radix || 10;\n\n\t\t\t// Build entities lookup table\n\t\t\tfor (i = 0; i < items.length; i += 2) {\n\t\t\t\tchr = String.fromCharCode(parseInt(items[i], radix));\n\n\t\t\t\t// Only add non base entities\n\t\t\t\tif (!baseEntities[chr]) {\n\t\t\t\t\tentity = '&' + items[i + 1] + ';';\n\t\t\t\t\tlookup[chr] = entity;\n\t\t\t\t\tlookup[entity] = chr;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn lookup;\n\t\t}\n\t}", "function buildEntitiesLookup(items, radix) {\n\t\tvar i, chr, entity, lookup = {};\n\n\t\tif (items) {\n\t\t\titems = items.split(',');\n\t\t\tradix = radix || 10;\n\n\t\t\t// Build entities lookup table\n\t\t\tfor (i = 0; i < items.length; i += 2) {\n\t\t\t\tchr = String.fromCharCode(parseInt(items[i], radix));\n\n\t\t\t\t// Only add non base entities\n\t\t\t\tif (!baseEntities[chr]) {\n\t\t\t\t\tentity = '&' + items[i + 1] + ';';\n\t\t\t\t\tlookup[chr] = entity;\n\t\t\t\t\tlookup[entity] = chr;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn lookup;\n\t\t}\n\t}", "function encodeCharacter (chr) {\r\n\t var\r\n\t result = '',\r\n\t octets = utf8.encode(chr),\r\n\t octet,\r\n\t index;\r\n\t for (index = 0; index < octets.length; index += 1) {\r\n\t octet = octets.charCodeAt(index);\r\n\t result += '%' + (octet < 0x10 ? '0' : '') + octet.toString(16).toUpperCase();\r\n\t }\r\n\t return result;\r\n\t }", "function removeSpecialChar (string) {\n string.replace(/[/\\%]/g, \"\"); \n}", "function DeleteIllegalCharacters(myAry)\n{\n\tvar retval = '';\n\tfor(var k=0;k<myAry.length;k++)\n\t{\n\t\tif(myAry.charAt(k)==\"%\" && myAry.charAt(k+1)==\"0\" &&\n\t\t (myAry.charAt(k+2)==\"A\" || myAry.charAt(k+2)==\"D\"))\n\t\t{\n\t\t\tk = k+2;\n\t\t\t// PT 127924 cariage return should be replaced by a space\n\t\t\t// also, ES01.1 should not remove trailing spaces of each line\n\t\t\t// retval += '';\n\t\t\tretval += ' ';\n\t\t}\n\t\telse\n\t\t\tretval += myAry.charAt(k);\n\t}\n\treturn retval;\n}", "function getRandomString(chars) {\n var text = new Array(chars);\n for (var i = 0; i < chars; i++) {\n text[i] = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".charAt(Math.floor(Math.random() * 62));\n }\n return text.join(\"\");\n}", "function fixedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "_rfc3986(str){\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n }", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n }", "function specialCheck(check){\n \n for(let a=0; a<check.length; a++){\n \n let char_num = check.charCodeAt(a);\n\n if(char_num >= 33 && char_num <= 47 || char_num >= 58 && char_num <= 64 || char_num >= 91 && <= 96 || char_num >= 123 && char_num <= 126){\n return true;\n }\n\n }\n return false;\n\n\n}", "findRawChars(node, text, location, regexp) {\n let match;\n do {\n match = regexp.exec(text);\n if (match) {\n const char = match[0];\n /* In relaxed mode & only needs to be encoded if it is ambiguous,\n * however this rule will only match either non-ambiguous ampersands or\n * ampersands part of a character reference. Whenever it is a valid\n * character reference or not not checked by this rule */\n if (this.relaxed && char === \"&\") {\n continue;\n }\n /* determine replacement character and location */\n const replacement = replacementTable.get(char);\n const charLocation = sliceLocation(location, match.index, match.index + 1);\n /* report as error */\n this.report(node, `Raw \"${char}\" must be encoded as \"${replacement}\"`, charLocation);\n }\n } while (match);\n }" ]
[ "0.5715229", "0.5715229", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.52993435", "0.5293197", "0.52926946", "0.52698267", "0.5252457", "0.52500165", "0.52387434", "0.522893", "0.5154662", "0.5095348", "0.5050064", "0.5024439", "0.50101686", "0.49766856", "0.49686053", "0.49435958", "0.4936879", "0.49297926", "0.49251807", "0.49118605", "0.48974964", "0.48841316", "0.48732677", "0.4853378", "0.4852617", "0.48283377", "0.48283377", "0.48039898", "0.47932425", "0.47849718", "0.47843826", "0.4776594", "0.47653615", "0.47517988", "0.4750647", "0.47462064", "0.4740161", "0.47359973", "0.47359973", "0.47040254", "0.4701383", "0.4689055", "0.46850765", "0.4684638", "0.4681679", "0.4677651", "0.46707994", "0.4663363", "0.46486345", "0.46486345", "0.46486345", "0.46486345", "0.46486345", "0.4642632", "0.4637761", "0.46255648", "0.4604935", "0.46039963", "0.46027824", "0.4597188", "0.4597188", "0.4589463", "0.45871708", "0.45805556", "0.45790583", "0.45787835", "0.45780078", "0.45762122", "0.45731503", "0.45661104", "0.4558571", "0.4552585", "0.4552585", "0.4552265", "0.45485651", "0.4537096", "0.4537096", "0.4537096", "0.45340154", "0.453373", "0.45303386", "0.4525868", "0.45220098", "0.45217514", "0.45190725", "0.45169172", "0.4495941" ]
0.0
-1
Encode unsafe characters with percentencoding, skipping already encoded sequences. string string to encode exclude list of characters to ignore (in addition to azAZ09) keepEscaped don't encode '%' in a correct escape sequence (default: true)
function encode(string, exclude, keepEscaped) { var i, l, code, nextCode, cache, result = ''; if (typeof exclude !== 'string') { // encode(string, keepEscaped) keepEscaped = exclude; exclude = encode.defaultChars; } if (typeof keepEscaped === 'undefined') { keepEscaped = true; } cache = getEncodeCache(exclude); for (i = 0, l = string.length; i < l; i++) { code = string.charCodeAt(i); if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { result += string.slice(i, i + 3); i += 2; continue; } } if (code < 128) { result += cache[code]; continue; } if (code >= 0xD800 && code <= 0xDFFF) { if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { nextCode = string.charCodeAt(i + 1); if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { result += encodeURIComponent(string[i] + string[i + 1]); i++; continue; } } result += '%EF%BF%BD'; continue; } result += encodeURIComponent(string[i]); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode(string, exclude, keepEscaped) {\n var i,\n l,\n code,\n nextCode,\n cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25\n /* % */\n && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}", "function encode(string, exclude, keepEscaped) {\n var i,\n l,\n code,\n nextCode,\n cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25\n /* % */\n && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escape)\n .replace(/\\*/g, \"%2A\");\n}", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escape)\n .replace(/\\*/g, \"%2A\");\n}", "function encode$2(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache, result = \"\";\n if (typeof exclude !== \"string\") {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode$2.defaultChars;\n }\n if (typeof keepEscaped === \"undefined\") {\n keepEscaped = true;\n }\n cache = getEncodeCache(exclude);\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n if (keepEscaped && code === 37 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n if (code < 128) {\n result += cache[code];\n continue;\n }\n if (code >= 55296 && code <= 57343) {\n if (code >= 55296 && code <= 56319 && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 56320 && nextCode <= 57343) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += \"%EF%BF%BD\";\n continue;\n }\n result += encodeURIComponent(string[i]);\n }\n return result;\n }", "function encode$1(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache, result = '';\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode$1.defaultChars;\n }\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n cache = getEncodeCache(exclude);\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n if (code < 128) {\n result += cache[code];\n continue;\n }\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n result += encodeURIComponent(string[i]);\n }\n return result;\n}", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string).replace(/[!'()*]/g, escape);\n}", "function encode(string, exclude, keepEscaped) {\n\t var i, l, code, nextCode, cache,\n\t result = '';\n\t\n\t if (typeof exclude !== 'string') {\n\t // encode(string, keepEscaped)\n\t keepEscaped = exclude;\n\t exclude = encode.defaultChars;\n\t }\n\t\n\t if (typeof keepEscaped === 'undefined') {\n\t keepEscaped = true;\n\t }\n\t\n\t cache = getEncodeCache(exclude);\n\t\n\t for (i = 0, l = string.length; i < l; i++) {\n\t code = string.charCodeAt(i);\n\t\n\t if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n\t if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n\t result += string.slice(i, i + 3);\n\t i += 2;\n\t continue;\n\t }\n\t }\n\t\n\t if (code < 128) {\n\t result += cache[code];\n\t continue;\n\t }\n\t\n\t if (code >= 0xD800 && code <= 0xDFFF) {\n\t if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n\t nextCode = string.charCodeAt(i + 1);\n\t if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n\t result += encodeURIComponent(string[i] + string[i + 1]);\n\t i++;\n\t continue;\n\t }\n\t }\n\t result += '%EF%BF%BD';\n\t continue;\n\t }\n\t\n\t result += encodeURIComponent(string[i]);\n\t }\n\t\n\t return result;\n\t}", "function encode(string, exclude, keepEscaped) {\n\t var i, l, code, nextCode, cache,\n\t result = '';\n\t\n\t if (typeof exclude !== 'string') {\n\t // encode(string, keepEscaped)\n\t keepEscaped = exclude;\n\t exclude = encode.defaultChars;\n\t }\n\t\n\t if (typeof keepEscaped === 'undefined') {\n\t keepEscaped = true;\n\t }\n\t\n\t cache = getEncodeCache(exclude);\n\t\n\t for (i = 0, l = string.length; i < l; i++) {\n\t code = string.charCodeAt(i);\n\t\n\t if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n\t if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n\t result += string.slice(i, i + 3);\n\t i += 2;\n\t continue;\n\t }\n\t }\n\t\n\t if (code < 128) {\n\t result += cache[code];\n\t continue;\n\t }\n\t\n\t if (code >= 0xD800 && code <= 0xDFFF) {\n\t if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n\t nextCode = string.charCodeAt(i + 1);\n\t if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n\t result += encodeURIComponent(string[i] + string[i + 1]);\n\t i++;\n\t continue;\n\t }\n\t }\n\t result += '%EF%BF%BD';\n\t continue;\n\t }\n\t\n\t result += encodeURIComponent(string[i]);\n\t }\n\t\n\t return result;\n\t}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16)\n })\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16)\n })\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, escape);\n }", "function encode$1(string, exclude, keepEscaped) {\n var i, l, code, nextCode, cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode$1.defaultChars;\n }\n\n if (typeof keepEscaped === 'undefined') {\n keepEscaped = true;\n }\n\n cache = getEncodeCache(exclude);\n\n for (i = 0, l = string.length; i < l; i++) {\n code = string.charCodeAt(i);\n\n if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {\n if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {\n result += string.slice(i, i + 3);\n i += 2;\n continue;\n }\n }\n\n if (code < 128) {\n result += cache[code];\n continue;\n }\n\n if (code >= 0xD800 && code <= 0xDFFF) {\n if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {\n nextCode = string.charCodeAt(i + 1);\n if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {\n result += encodeURIComponent(string[i] + string[i + 1]);\n i++;\n continue;\n }\n }\n result += '%EF%BF%BD';\n continue;\n }\n\n result += encodeURIComponent(string[i]);\n }\n\n return result;\n}", "function fixedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "function fixedEncodeURIComponent (str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, \"%2A\");\n}", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, \"%2A\");\n}", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, \"%2A\");\n}", "function strictEncodeURIComponent(string) {\n \t // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n \t return encodeURIComponent(string)\n \t .replace(/[!'()*]/g, escapeForDumbFirefox36)\n \t .replace(/\\*/g, '%2A');\n \t }", "function urlEncodeIfNecessary(s) {\n\t\tvar regex = /[\\\\\\\"<>\\.;]/;\n\t\tvar hasBadChars = regex.exec(s) != null;\n\t\treturn hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n\t}", "function urlEncodeIfNecessary(s) {\n\t\tvar regex = /[\\\\\\\"<>\\.;]/;\n\t\tvar hasBadChars = regex.exec(s) != null;\n\t\treturn hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n\t}", "function urlEncodeIfNecessary(s) {\n\t\tvar regex = /[\\\\\\\"<>\\.;]/;\n\t\tvar hasBadChars = regex.exec(s) != null;\n\t\treturn hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n\t}", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function urlEncodeIfNecessary(s) {\n var regex = /[\\\\\\\"<>\\.;]/;\n var hasBadChars = regex.exec(s) !== null;\n return hasBadChars && typeof encodeURIComponent !== UNDEF ? encodeURIComponent(s) : s;\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function strictEncodeURIComponent(string) {\n // see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent\n return encodeURIComponent(string)\n .replace(/[!'()*]/g, escapeForDumbFirefox36)\n .replace(/\\*/g, '%2A');\n }", "function extendedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n}", "function extendedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n}", "function extendedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n}", "function extendedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n}", "function extendedEncodeURIComponent(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n}", "function urlEncodeIfNecessary(s) {\n var regex = /[\\\\\\\"<>\\.;]/;\n var hasBadChars = regex.exec(s) != null;\n return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n }", "function urlEncodeIfNecessary(s) {\n var regex = /[\\\\\\\"<>\\.;]/;\n var hasBadChars = regex.exec(s) != null;\n return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n }", "function urlEncodeIfNecessary(s) {\n var regex = /[\\\\\\\"<>\\.;]/;\n var hasBadChars = regex.exec(s) != null;\n return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\n }", "function urlEncodeIfNecessary(s) {\n\t\tvar regex = /[\\\\\\\"<>\\.;]/;\n\t\tvar hasBadChars = regex.exec(s) != null;\n\t\treturn hasBadChars && (typeof encodeURIComponent === \"undefined\" ? \"undefined\" : _typeof(encodeURIComponent)) != UNDEF ? encodeURIComponent(s) : s;\n\t}", "function escape(text) {\n return encodeURIComponent(text)\n .replace(/%2F/g, \"/\") // Don't escape for \"/\"\n .replace(/'/g, \"%27\") // Escape for \"'\"\n .replace(/\\+/g, \"%20\")\n .replace(/%25/g, \"%\"); // Revert encoded \"%\"\n}", "function escape(text) {\n return encodeURIComponent(text)\n .replace(/%2F/g, \"/\") // Don't escape for \"/\"\n .replace(/'/g, \"%27\") // Escape for \"'\"\n .replace(/\\+/g, \"%20\")\n .replace(/%25/g, \"%\"); // Revert encoded \"%\"\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}", "function encodeReserved(str) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n })\n .join(\"\");\n}", "function encodeReserved(str) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n })\n .join(\"\");\n}", "function ajax_escape(text)\n{\n\ttext = escape(text).replace(/(\\%)/g, \"%25\");\n\treturn text.replace(/(\\+)/g, \"%2b\");\n}", "function getEncodeCache(exclude) {\n var i,\n ch,\n cache = encodeCache[exclude];\n\n if (cache) {\n return cache;\n }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n } // Encode unsafe characters with percent-encoding, skipping already", "function getEncodeCache(exclude) {\n var i,\n ch,\n cache = encodeCache[exclude];\n\n if (cache) {\n return cache;\n }\n\n cache = encodeCache[exclude] = [];\n\n for (i = 0; i < 128; i++) {\n ch = String.fromCharCode(i);\n\n if (/^[0-9a-z]$/i.test(ch)) {\n // always allow unencoded alphanumeric characters\n cache.push(ch);\n } else {\n cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));\n }\n }\n\n for (i = 0; i < exclude.length; i++) {\n cache[exclude.charCodeAt(i)] = exclude[i];\n }\n\n return cache;\n} // Encode unsafe characters with percent-encoding, skipping already", "function escape(str) {\r\n return encodeURIComponent(str)\r\n .replace(/!/g, '%21')\r\n .replace(/'/g, '%27')\r\n .replace(/\\(/g, '%28')\r\n .replace(/\\)/g, '%29')\r\n .replace(/\\*/g, '%2A')\r\n .replace(/%20/g, '+');\r\n }", "function strictEncodeURL(indata)\n{\n indata = encodeURIComponent(indata);\n indata = indata.replace(/\\//g, '%2F');\n return indata;\n}", "function cleanGetValue(inputStr){\n var returnStr = encodeURIComponent(inputStr);\n returnStr = returnStr.replace(/%(.*?){1,3}/g,\"a\");\n returnStr = returnStr.replace('.','b');\n return returnStr;\n}", "_rfc3986(str){\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return '%' + c.charCodeAt(0).toString(16);\n });\n }", "function encodeProblemUrlChars(url) {\r\n if (!url)\r\n return \"\";\r\n\r\n var len = url.length;\r\n\r\n return url.replace(_problemUrlChars, function (match, offset) {\r\n if (match == \"@D\") // escape for dollar\r\n return \"%24\";\r\n if (match == \":\") {\r\n if (offset == len - 1 || /[0-9\\/]/.test(url.charAt(offset + 1)))\r\n return \":\"\r\n }\r\n return \"%\" + match.charCodeAt(0).toString(16);\r\n });\r\n }", "function fixed_encode_URI_component(str)\n{\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c){\n return '%' + c.charCodeAt(0).toString(16);\n });\n}", "function urlEncode(inStr) {\n\tinStr = new String(inStr);\n\toutStr=' '; //not '' for a NS bug!\n\tfor (i=0; i < inStr.length; i++) {\n\t\taChar=inStr.substring (i, i+1);\n\t\tswitch(aChar){\ncase '%': outStr += \"%25\"; break; case ',': outStr += \"%2C\"; break;\ncase '/': outStr += \"%2F\"; break; case ':': outStr += \"%3A\"; break;\ncase '~': outStr += \"%7E\"; break; case '!': outStr += \"%21\"; break;\ncase '\"': outStr += \"%22\"; break; case '#': outStr += \"%23\"; break;\ncase '$': outStr += \"%24\"; break; case \"'\": outStr += \"%27\"; break;\ncase '`': outStr += \"%60\"; break; case '^': outStr += \"%5E\"; break;\ncase '&': outStr += \"%26\"; break; case '(': outStr += \"%28\"; break;\ncase ')': outStr += \"%29\"; break; case '+': outStr += \"%2B\"; break;\ncase '{': outStr += \"%7B\"; break; case '|': outStr += \"%7C\"; break;\ncase '}': outStr += \"%7D\"; break; case ';': outStr += \"%3B\"; break;\ncase '<': outStr += \"%3C\"; break; case '=': outStr += \"%3D\"; break;\ncase '>': outStr += \"%3E\"; break; case '?': outStr += \"%3F\"; break;\ncase '[': outStr += \"%5B\"; break; case '\\\\': outStr += \"%5C\"; break;\ncase ']': outStr += \"%5D\"; break; case ' ': outStr += \"+\"; break;\ndefault: outStr += aChar;\n\t\t}\n}\nreturn outStr.substring(1, outStr.length);\n}", "function encodeProblemUrlChars(url) {\r\n if (!url)\r\n return \"\";\r\n\r\n var len = url.length;\r\n\r\n return url.replace(_problemUrlChars, function (match, offset) {\r\n if (match == \"~D\") // escape for dollar\r\n return \"%24\";\r\n if (match == \":\") {\r\n if (offset == len - 1 || /[0-9\\/]/.test(url.charAt(offset + 1)))\r\n return \":\"\r\n }\r\n return \"%\" + match.charCodeAt(0).toString(16);\r\n });\r\n }", "function strictEncodeUri(str) {\n if (typeof str != String) {\n str = str.toString();\n }\n let encodedStr = encodeURIComponent(str);\n //Need to be more strict to adhere to RFC 3986\n let strictUri = encodedStr.replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16);\n });\n\n return strictUri;\n}", "function UrlEscape(str) {\n var ret = \"\",\n strSpecial = \",/?:@&=+$#\",\n strEscaped = \"%2C%2F%3F%3A%40%26%3D%2B%24%23\";\n\n for (var i = 0; i < str.length; i++) {\n var chr = str.charAt(i),\n c = chr.charCodeAt(0);\n\n if (strSpecial.indexOf(chr) != -1) {\n ret += \"%\" + c.toString(16);\n } else {\n ret += chr;\n }\n }\n\n return ret;\n}", "function encodeRFC5987ValueChars (str) {\n return encodeURIComponent(str).\n // Note that although RFC3986 reserves \"!\", RFC5987 does not,\n // so we do not need to escape it\n replace(/['()]/g, escape). // i.e., %27 %28 %29\n replace(/\\*/g, '%2A').\n // The following are not required for percent-encoding per RFC5987,\n // so we can allow for a little better readability over the wire: |`^\n replace(/%(?:7C|60|5E)/g, unescape);\n}", "function prepareUnicodeEncode(str) {\n return encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {\n return String.fromCharCode(`0x${p1}`)\n })\n}", "function rawurlencode(str) {\r\n\r\n str = (str + '').toString();\r\n return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\\(/g, '%5B').replace(/\\)/g, '%5D').replace(/\\*/g, '%2A');\r\n}", "function URLencode(str) {\n var re;\n\n /* ibiencodeURIComponent */\n str=escape(str);\n str=str.replace(/%u/g,'%25u').replace(/%([89A-F])/g,'%25u00$1');\n str=unescape(str);\n str=encodeURIComponent(str);\n re = new RegExp(\"'\",\"g\");\n str = str.replace(re,'%27');\n return str;\n}", "function encodeString(str) {\n return encodeURIComponent(str).replace(/\\*/g, '%2A');\n}", "function url_encode(str) {\r\n var hex_chars = \"0123456789ABCDEF\";\r\n var noEncode = /^([a-zA-Z0-9\\_\\-\\.])$/;\r\n var n, strCode, hex1, hex2, strEncode = \"\";\r\n\r\n for(n = 0; n < str.length; n++) {\r\n if (noEncode.test(str.charAt(n))) {\r\n strEncode += str.charAt(n);\r\n } else {\r\n\t strCode = str.charCodeAt(n);\r\n\t hex1 = hex_chars.charAt(Math.floor(strCode / 16));\r\n\t hex2 = hex_chars.charAt(strCode % 16);\r\n\t strEncode += \"%\" + (hex1 + hex2);\r\n\t }\r\n\t}\r\n\treturn strEncode;\r\n}", "function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}", "function utf8PercentEncodeCodePointInternal(codePoint, percentEncodePredicate) {\n const bytes = utf8Encode(codePoint);\n let output = \"\";\n for (const byte of bytes) {\n // Our percentEncodePredicate operates on bytes, not code points, so this is slightly different from the spec.\n if (!percentEncodePredicate(byte)) {\n output += String.fromCharCode(byte);\n } else {\n output += percentEncode(byte);\n }\n }\n\n return output;\n}", "function containsForbiddenChars(str) {\n var chars = ['<script>', '</script>', '<script', 'script>', '</script', '<audio>', '</audio>', '<audio', 'audio>', '</audio', '$', '{', '}', '%'];\n for (var i = 0; i < chars.length; i++) {\n if (str.includes(chars[i])) return true;\n }\n return false;\n}", "function UrlEncode(sStr) {\r\n return escape(sStr).\r\n replace(/\\+/g, '%2B').\r\n replace(/\\\"/g,'%22').\r\n replace(/\\'/g, '%27').\r\n replace(/\\//g,'%2F');\r\n}", "function encodeRfc3986(urlEncodedString) {\n return urlEncodedString.replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase();\n });\n}" ]
[ "0.70509595", "0.7022723", "0.69763297", "0.69763297", "0.6932053", "0.69195807", "0.69184864", "0.6918012", "0.6918012", "0.685554", "0.685554", "0.68133795", "0.67973626", "0.6783974", "0.6783863", "0.6750289", "0.674726", "0.674726", "0.674726", "0.67047244", "0.669837", "0.669837", "0.669837", "0.66575915", "0.6648897", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6637211", "0.6629276", "0.6629276", "0.6629276", "0.6629276", "0.6629276", "0.6607103", "0.6607103", "0.6607103", "0.6505076", "0.64670426", "0.64670426", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64623374", "0.64516914", "0.64516914", "0.644816", "0.6330542", "0.63251173", "0.62893325", "0.62749803", "0.61793756", "0.6171978", "0.6141809", "0.6129782", "0.6125566", "0.6092658", "0.6088062", "0.6072178", "0.60212755", "0.60031086", "0.5994493", "0.59536916", "0.5949365", "0.59453666", "0.5913929", "0.5913929", "0.5885182", "0.5880025", "0.58665776" ]
0.6875842
21
Helper function to produce an HTML tag.
function tag(name, attrs, selfclosing) { if (this.disableTags > 0) { return; } this.buffer += ('<' + name); if (attrs && attrs.length > 0) { var i = 0; var attrib; while ((attrib = attrs[i]) !== undefined) { this.buffer += (' ' + attrib[0] + '="' + attrib[1] + '"'); i++; } } if (selfclosing) { this.buffer += ' /'; } this.buffer += '>'; this.lastOut = '>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateTagHTML (tag){//generates HTML for a given tag\n return `<li class='tag'><div class='tag-box'>${tag}</div></li>`;\n}", "function makeTag (tagName, strValue) {\n return \"<\"+tagName+\">\"+strValue+\"</\"+tagName+\">\"\n}", "function construct_tag(tag_name){\n render_tag = '<li class=\"post__tag\"><a class=\"post__link post__tag_link\">' + tag_name + '</a> </li>'\n return render_tag\n}", "function GenerateTagHTML(tags) {\r\n \r\n var html = '<div class=\"tags\">';\r\n \r\n // Generate the html for each of the tags and return it\r\n $.each(tags, function(key, tag) { html += '<span>' + tag + '</span>' });\r\n return html + '</div>';\r\n \r\n }", "function tag(name, attrs, selfclosing) {\n var result = '<' + name;\n if(attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n result += ' ' + attrib[0] + '=\"' + this.esc(attrib[1]) + '\"';\n i++;\n }\n }\n if(selfclosing) {\n result += ' /';\n }\n result += '>';\n return result;\n}", "function tag(name, attrs, selfclosing) {\n var result = '<' + name;\n if(attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n result += ' ' + attrib[0] + '=\"' + this.esc(attrib[1]) + '\"';\n i++;\n }\n }\n if(selfclosing) {\n result += ' /';\n }\n result += '>';\n return result;\n}", "function buildHTML(tag, html, attrs) {\n\n var element = document.createElement(tag);\n // if custom html passed in, append it\n if (html) element.innerHTML = html;\n\n // set each individual attribute passed in\n for (attr in attrs) {\n if (attrs[attr] === false) continue;\n element.setAttribute(attr, attrs[attr]);\n }\n\n return element;\n }", "function createHtml(o){\n var b = '',\n attr,\n val,\n key,\n cn;\n\n if(typeof o == \"string\"){\n b = o;\n } else if (Ambow.isArray(o)) {\n for (var i=0; i < o.length; i++) {\n if(o[i]) {\n b += createHtml(o[i]);\n }\n };\n } else {\n b += '<' + (o.tag = o.tag || 'div');\n for (attr in o) {\n val = o[attr];\n if(!confRe.test(attr)){\n if (typeof val == \"object\") {\n b += ' ' + attr + '=\"';\n for (key in val) {\n b += key + ':' + val[key] + ';';\n };\n b += '\"';\n }else{\n b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '=\"' + val + '\"';\n }\n }\n };\n // Now either just close the tag or try to add children and close the tag.\n if (emptyTags.test(o.tag)) {\n b += '/>';\n } else {\n b += '>';\n if ((cn = o.children || o.cn)) {\n b += createHtml(cn);\n } else if(o.html){\n b += o.html;\n }\n b += '</' + o.tag + '>';\n }\n }\n return b;\n }", "function createHtml(o){\n var b = '',\n attr,\n val,\n key,\n keyVal,\n cn;\n\n if(typeof o == \"string\"){\n b = o;\n } else if (Ext.isArray(o)) {\n for (var i=0; i < o.length; i++) {\n if(o[i]) {\n b += createHtml(o[i]);\n }\n };\n } else {\n b += '<' + (o.tag = o.tag || 'div');\n for (attr in o) {\n val = o[attr];\n if(!confRe.test(attr)){\n if (typeof val == \"object\") {\n b += ' ' + attr + '=\"';\n for (key in val) {\n b += key + ':' + val[key] + ';';\n };\n b += '\"';\n }else{\n b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '=\"' + val + '\"';\n }\n }\n };\n // Now either just close the tag or try to add children and close the tag.\n if (emptyTags.test(o.tag)) {\n b += '/>';\n } else {\n b += '>';\n if ((cn = o.children || o.cn)) {\n b += createHtml(cn);\n } else if(o.html){\n b += o.html;\n }\n b += '</' + o.tag + '>';\n }\n }\n return b;\n }", "function buildNametagHTML (nametag) {\n // TODO: Your code goes here.\n return `\n <div class=\"card\">\n <div class=\"card-header\" style=\"text-align: center; background-color: blue; color: white;\">\n Hello, my name is:\n </div>\n <div class=\"card-body\" style=\"text-align: center;\">\n <h5 class=\"card-title\">${nametag}</h5>\n </div>\n </div>\n `\n }", "function html_tag(tag)\n{\n\t function wrap_text( msg )\n\t {\n\t\t console.log( '<' + tag + '>' + msg + '</' + tag + '>' ) \n\t }\n\n\t return wrap_text\n}", "function BeenJamminBuildTag(options) {\r\n var tag = document.createElement(options.tagName);\r\n\r\n if (options.cssClass)\r\n tag.setAttribute('class', options.cssClass);\r\n\r\n if (options.text)\r\n tag.appendChild(document.createTextNode(options.text));\r\n\r\n for (var attr in options.attributes) {\r\n tag.setAttribute(attr, options.attributes[attr]);\r\n }\r\n\r\n return tag;\r\n}", "tagMaker() {\n const isHtmlNode = () => {\n return true;\n };\n const isAttribMap = () => {\n return true;\n };\n var notEmpty = (x) => {\n if ((typeof x === 'undefined') ||\n (x === null) ||\n x.length === 0) {\n return false;\n }\n return true;\n };\n var maker = (name, defaultAttribs = {}) => {\n var tagFun= (attribs, children) => {\n let node = '<';\n\n // case 1. one argument, first may be attribs or content, but attribs if object.\n if (typeof children === 'undefined') {\n if (typeof attribs === 'object' &&\n ! (attribs instanceof Array) &&\n isAttribMap(attribs)) {\n if (Object.keys(attribs).length === 0) {\n node += name;\n } else {\n const tagAttribs = this.attribsToString(this.mergeAttribs(attribs, defaultAttribs));\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n }\n node += '>';\n // case 2. arity 1, is undefined\n } else if (typeof attribs === 'undefined') {\n const tagAttribs = this.attribsToString(defaultAttribs);\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n node += '>';\n // case 3: arity 1, is content\n } else if (isHtmlNode(attribs)) {\n const tagAttribs = this.attribsToString(defaultAttribs);\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n node += '>' + this.renderChildren(attribs);\n }\n // case 4. arity 2 - atribs + content\n } else if (isAttribMap(attribs) && isHtmlNode(children)) {\n if (Object.keys(attribs).length === 0) {\n node += name;\n } else {\n const tagAttribs = this.attribsToString(this.mergeAttribs(attribs, defaultAttribs));\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n }\n node += '>' + this.renderChildren(children);\n }\n node += '</' + name + '>';\n return node;\n };\n return tagFun;\n };\n return maker;\n }", "function $t (tag) {\n\ttag = tag || 'div';\n\treturn $('<'+tag+'/>');\n}", "function tagOpen(tag) {\n return '<%@ class=\"%@\">'.fmt(tag.tagName.toLowerCase(), tag.className);\n}", "function generateHTML(node) {\n\n if (node.name === 'h4') {\n\n html = h4(lib, node)\n\n } else if (node.name === 'h5') {\n\n html = h5(lib, node)\n\n } else if (node.name === 'img') {\n\n html = img(lib, node)\n\n } else {\n\n html = '<' + node.name + ' not-yet-supported/>'\n }\n\n debug('generate <%s> --> %s', node.name, html)\n\n return html\n}", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n }", "function _escTag(s){ return s.replace(\"<\",\"&lt;\").replace(\">\",\"&gt;\");}", "function _escTag(s){ return s.replace(\"<\",\"&lt;\").replace(\">\",\"&gt;\");}", "function tag(name, attrs, selfclosing) {\n if (this.disableTags > 0) {\n return;\n }\n\n this.buffer += '<' + name;\n\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n\n while ((attrib = attrs[i]) !== undefined) {\n this.buffer += ' ' + attrib[0] + '=\"' + attrib[1] + '\"';\n i++;\n }\n }\n\n if (selfclosing) {\n this.buffer += ' /';\n }\n\n this.buffer += '>';\n this.lastOut = '>';\n }", "function createTagElement(tid, skillString) {\n\t\tvar div = document.createElement('div');\n\t\tdiv.textContent = skillString;\n\t\tdiv.setAttribute('class', 'tag');\n\t\tdiv.setAttribute('id', tid);\n\t\treturn div;\n\t}", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n}", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n}", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "render() {\n return html ``;\n }", "function wrap(xhtml, tag) {\n var e = document.createElement('div');\n e.innerHTML = xhtml;\n return e;\n}", "function createEl(tag, value) {\r\n\t\tvar el = document.createElement(tag);\r\n\t\tel.innerHTML = value;\r\n\t\treturn el;\r\n\t}", "function html(tagName, attributes, ...children) {\n // create the element\n const r = document.createElement(tagName);\n // add the attributes\n for (const key in attributes) {\n // special case for booleans\n if (typeof attributes[key] === \"boolean\") {\n if (attributes[key]) {\n r.setAttribute(key, \"\");\n }\n }\n else {\n r.setAttribute(key, attributes[key]);\n }\n }\n // add the children\n children.forEach(child => {\n // special case for strings\n if (typeof child === \"string\") {\n r.appendChild(document.createTextNode(child));\n }\n else {\n r.appendChild(child);\n }\n });\n return r;\n}", "function createContent() {\n var bCSS = \"font: bolder 12px Arial\";\n return '<b style=\"' + bCSS + '\">Tag Legend</b>' +\n '<ul style=\"margin-left: 10px\">' +\n '<li>@location</li>' +\n '<li>+project</li>' +\n '<li>general category</li>' +\n '</ul>'\n ;\n }", "function createHTMLString(item) {\r\n return `\r\n <li class=\"item\">\r\n <img src=\"${item.image}\" alt=\"${item.type}\" class=\"item__thumbnnail\">\r\n <span class=\"item__desctiption\">${item.gender}, ${item.size}</span>\r\n </li>\r\n `;\r\n}", "function createHTMLString(item) {\n return `\n <li class=\"content\">\n <img src=\"${item.image}\" alt=\"${item.type}\" class=\"item__thumbnail>\n <p class=\"item_description>${item.gender}, ${item.size} size</p>\n `;\n}", "function endTag(tag) {\n return \"</\" + tag + \">\";\n}", "createHTML(){\n return '<li class=\"ListItem\">' + '<h2>' + this.name + '</h2>' + '<span class=\"venueType\" id=\"venueType1\">' + this.type + '</span>' + '</li>'\n }", "function tag(name, attrs, ...content) {\n\tlet el = document.createElement(name);\n\tfor(let a in attrs) {\n\t\tel.setAttribute(a, attrs[a]);\n\t}\n\tfor(let c of content) {\n\t\tif(typeof c === 'string') {\n\t\t\tel.appendChild(document.createTextNode(c));\n\t\t}\n\t\telse if(c) {\n\t\t\tel.appendChild(c);\n\t\t}\n\t\telse {\n\t\t\t/* Ignore falsey stuff */\n\t\t}\n\t}\n\treturn el;\n}", "function makeHTML([title, rating, index]) {\n return `\n <li id=\"${index}\">\n ${title}: ${rating} \n <button class=\"remove\">\n REMOVE\n </button>\n </li>\n `\n}", "render() {\n return html`\n <article>\n ${this.label}\n </article>`;\n }", "function html(h, ...values){ return h.join('');}", "function codigohtml (dato) {\n\tvar html=\"<article>\";\n\t\thtml=\"<div>\"+dato+\"</div>\";\n\thtml+=\"</article>\";\n\treturn html;\n}", "function format(value) {\r\n return '<div>' + value + '</div>';\r\n }", "function generateEndTag(startTag) {\n\t\t\n\t\tif (startTag.charAt(startTag.length-2) !== '/') {\n\t\t\t\n\t\t\tif (startTag.indexOf(' ') > -1) {\n\t\t\t\t// delete parameters of startTag\n\t\t\t\treturn \"</\"+startTag.substring(1, startTag.indexOf(' '))+\">\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn \"</\"+startTag.substring(1, startTag.length);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// if the tag is self-closing (e.g. \"<mprescripts/>\"), the endTag is the startTag\n\t\t\treturn startTag;\n\t\t}\n\t}", "tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }", "function renderTag(tag, offset=5) {\n let tagName = tag.tagName.toLowerCase();\n let content = '';\n let space = '&nbsp'.repeat(offset);\n \n if (tag.children.length) {\n for (let i = 0; i < tag.children.length; i++){ \n content += renderTag(tag.children[i], offset*2); \n } \n } else {\n content = space.repeat(2) + tag.textContent;\n }\n\n result = `${space}&lt${tagName}&gt<br>${content}<br>${space}&lt/${tagName}&gt<br>`;\n return result;\n}", "function displayMemberTagsCard(member) {\n\n return `\n <div class=\"card\">\n <div class=\"card-header\">\n Tags\n </div>\n <div class=\"card-body\">\n <ul>\n ${member.tags ? tags(member.tags) : \"\"}\n </ul> \n </div>\n </div>\n `;\n\n}", "function toString() {\n return static_1.html(this, this.options);\n}", "get outerHTML() {\n let html = '<my-' + this.kind + this.classList.asAttribute + this.getAttributes() + '>';\n for (let child of this.childNodes) {\n html += child.outerHTML;\n }\n html += '</my-' + this.kind + '>';\n return html;\n }", "function createTag(tagName){\n return document.createElement(tagName);\n }", "generateHTML() {\n return `<nav>${this.generateMenu(this.data)}</nav>`;\n }", "function tagClose(tag) {\n return '</%@>'.fmt(tag.tagName.toLowerCase());\n}", "render(){\n\n //retorna el template usando el html del tag del template, crea los elementos en el dom\n return html`\n <div>Hello Word!!</div>\n `;\n }", "createElement (text) {\n this.text = text\n return html`<h1>${text}</h1>`\n }", "generateHTML(type, classes, parent = app, text = \"\", id = \"\") {\n const element = document.createElement(type);\n element.classList = (classes);\n element.innerText = (text);\n element.id = (id);\n parent.appendChild(element);\n return element;\n }", "function el(e) {\n return function(body) {\n return \"<\"+e+\">\"+body+\"</\"+e+\">\"\n }\n }", "tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }", "function $Tag(tagName,args){\n // cl\n var $i = null\n var elt = null\n var elt = $DOMNode(document.createElement(tagName))\n elt.parent = this\n if(args!=undefined && args.length>0){\n $start = 0\n $first = args[0]\n // if first argument is not a keyword, it's the tag content\n if(!isinstance($first,$Kw)){\n $start = 1\n if(isinstance($first,[str,int,float])){\n txt = document.createTextNode($first.toString())\n elt.appendChild(txt)\n } else if(isinstance($first,$TagSum)){\n for($i=0;$i<$first.children.length;$i++){\n elt.appendChild($first.children[$i])\n }\n } else {\n try{elt.appendChild($first)}\n catch(err){throw ValueError('wrong element '+$first)}\n }\n }\n // attributes\n for($i=$start;$i<args.length;$i++){\n // keyword arguments\n $arg = args[$i]\n if(isinstance($arg,$Kw)){\n if($arg.name.toLowerCase().substr(0,2)===\"on\"){ // events\n eval('elt.'+$arg.name.toLowerCase()+'=function(){'+$arg.value+'}')\n }else if($arg.name.toLowerCase()==\"style\"){\n elt.set_style($arg.value)\n } else {\n if($arg.value!==false){\n // option.selected=false sets it to true :-)\n try{\n elt.setAttribute($arg.name.toLowerCase(),$arg.value)\n }catch(err){\n throw ValueError(\"can't set attribute \"+$arg.name)\n }\n }\n }\n }\n }\n }\n return elt\n}", "function createMarkup(data) {\n return { __html: data };\n}", "function construct_html(href, title, describe,tags) {\n url1 = '<article class=\"post tag-sync_sulab post__wrapper\" data-cols=\"4\">' + '<div class=\"post__wrapper_helper post__wrapper_helper--notloaded el__transition post__wrapper_helper--hover\">' + '<div class=\"post__preview el__transition\">' + '<header class=\"post__header\">' + '<h2 class=\"post__title\">' + '<a href='\n\n url2 = ' class=\"post__link post__title_link\"><span>'\n\n url3 = '</span></a></h2></header><p class=\"post__excerpt\"><a href='\n url4 = ' class=\"post__link post__readmore\">'\n\n url5 = '</a></p></div><footer class=\"post__meta\"><ul class=\"post__tags\">'\n url6 = '</ul></footer></div></article>'\n html = url1 + href + url2 + title + url3 + href + url4 + describe + url5\n for(var i=0; i < tags.length; i++) {\n if (tags[i] != 'sync_sulab') { // skip internal sync_sulab tag\n html += construct_tag(tags[i]);\n }\n };\n html += url6;\n return html\n}", "function make(tag, options) {\n var keys, i,\n element = document.createElement(tag);\n if (options === undefined) {\n return element;\n }\n if ('parent' in options) {\n options.parent.appendChild(element);\n delete options.parent;\n }\n keys = Object.keys(options);\n for (i = keys.length - 1; i >= 0; --i) {\n element[keys[i]] = options[keys[i]];\n }\n return element;\n }", "toString() {\n return \"<\" + this.toStringInner() + \">\";\n }", "function genFinalHtml() {\r\n ` </div> \r\n\r\n </body>\r\n </html`;\r\n}", "toHTML ( theMode, sigDigs , params) {}", "function valueToHTML(value) {\n var valueType = typeof value;\n\n var output = \"\";\n if (value == null) {\n output += decorateWithSpan('null', 'null');\n } else if (value && value.constructor == Array) {\n output += arrayToHTML(value);\n } else if (valueType == 'object') {\n output += objectToHTML(value);\n } else if (valueType == 'number') {\n output += decorateWithSpan(value, 'num');\n } else if (valueType == 'string') {\n if (/^(http|https):\\/\\/[^\\s]+$/.test(value)) {\n value = htmlEncode(value);\n output += '<a href=\"' + value + '\">' + value + '</a>';\n } else {\n output += decorateWithSpan('\"' + value + '\"', 'string');\n }\n } else if (valueType == 'boolean') {\n output += decorateWithSpan(value, 'bool');\n }\n\n return output;\n }", "function createHTML(item) {\n return '<li class=\"item\" >\\n' +\n ' <img src=\"'+item.image+'\" alt=\"image\" class=\"itemPoint\" data-key=\"image\" data-value=\"'+item.image+'\">' +\n ' <span class=\"itemDetail\">'\n +item.gender+' / '+item.size+' / '+item.color+\n '</span>\\n' +\n ' </li>';\n}", "getMatchingElementTemplate() {\n const tagName = this.element || 'div';\n const classAttr = this.classNames.length > 0 ? ` class=\"${this.classNames.join(' ')}\"` : '';\n let attrs = '';\n for (let i = 0; i < this.attrs.length; i += 2) {\n const attrName = this.attrs[i];\n const attrValue = this.attrs[i + 1] !== '' ? `=\"${this.attrs[i + 1]}\"` : '';\n attrs += ` ${attrName}${attrValue}`;\n }\n return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` :\n `<${tagName}${classAttr}${attrs}></${tagName}>`;\n }", "getMatchingElementTemplate() {\n const tagName = this.element || 'div';\n const classAttr = this.classNames.length > 0 ? ` class=\"${this.classNames.join(' ')}\"` : '';\n let attrs = '';\n for (let i = 0; i < this.attrs.length; i += 2) {\n const attrName = this.attrs[i];\n const attrValue = this.attrs[i + 1] !== '' ? `=\"${this.attrs[i + 1]}\"` : '';\n attrs += ` ${attrName}${attrValue}`;\n }\n return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` :\n `<${tagName}${classAttr}${attrs}></${tagName}>`;\n }", "getMatchingElementTemplate() {\n const tagName = this.element || 'div';\n const classAttr = this.classNames.length > 0 ? ` class=\"${this.classNames.join(' ')}\"` : '';\n let attrs = '';\n for (let i = 0; i < this.attrs.length; i += 2) {\n const attrName = this.attrs[i];\n const attrValue = this.attrs[i + 1] !== '' ? `=\"${this.attrs[i + 1]}\"` : '';\n attrs += ` ${attrName}${attrValue}`;\n }\n return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` :\n `<${tagName}${classAttr}${attrs}></${tagName}>`;\n }", "getMatchingElementTemplate() {\n const tagName = this.element || 'div';\n const classAttr = this.classNames.length > 0 ? ` class=\"${this.classNames.join(' ')}\"` : '';\n let attrs = '';\n for (let i = 0; i < this.attrs.length; i += 2) {\n const attrName = this.attrs[i];\n const attrValue = this.attrs[i + 1] !== '' ? `=\"${this.attrs[i + 1]}\"` : '';\n attrs += ` ${attrName}${attrValue}`;\n }\n return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` :\n `<${tagName}${classAttr}${attrs}></${tagName}>`;\n }", "function wrapWith(tagname, el, attribs) {\n var tag = document.createElement(tagname);\n for (var key in attribs) {\n tag.setAttribute(key, attribs[key]);\n }\n tag.appendChild(el);\n return tag;\n }", "buildTemplateHtmlString() {\n const minValue = this.filterProperties.hasOwnProperty('minValue') ? this.filterProperties.minValue : DEFAULT_MIN_VALUE;\n const maxValue = this.filterProperties.hasOwnProperty('maxValue') ? this.filterProperties.maxValue : DEFAULT_MAX_VALUE;\n const defaultValue = this.filterParams.hasOwnProperty('sliderStartValue') ? this.filterParams.sliderStartValue : minValue;\n const step = this.filterProperties.hasOwnProperty('valueStep') ? this.filterProperties.valueStep : DEFAULT_STEP;\n return `<input type=\"range\" name=\"${this._elementRangeInputId}\"\n defaultValue=\"${defaultValue}\" min=\"${minValue}\" max=\"${maxValue}\" step=\"${step}\"\n class=\"form-control slider-filter-input range compound-slider ${this._elementRangeInputId}\" />`;\n }", "render(){return html``}", "function makeTemplate() {\n return html`\n\n <div class=\"display-div\"> </div>\n\n `;\n}", "render(createElement){\n return createElement('h1','你好')\n }", "getHTML() {\n const endIndex = this.strings.length - 1;\n let html = '';\n for (let i = 0; i < endIndex; i++) {\n const s = this.strings[i];\n // This exec() call does two things:\n // 1) Appends a suffix to the bound attribute name to opt out of special\n // attribute value parsing that IE11 and Edge do, like for style and\n // many SVG attributes. The Template class also appends the same suffix\n // when looking up attributes to create Parts.\n // 2) Adds an unquoted-attribute-safe marker for the first expression in\n // an attribute. Subsequent attribute expressions will use node markers,\n // and this is safe since attributes with multiple expressions are\n // guaranteed to be quoted.\n const match = lastAttributeNameRegex.exec(s);\n if (match) {\n // We're starting a new bound attribute.\n // Add the safe attribute suffix, and use unquoted-attribute-safe\n // marker.\n html += s.substr(0, match.index) + match[1] + match[2] +\n boundAttributeSuffix + match[3] + marker;\n }\n else {\n // We're either in a bound node, or trailing bound attribute.\n // Either way, nodeMarker is safe to use.\n html += s + nodeMarker;\n }\n }\n return html + this.strings[endIndex];\n }", "get html() {\n let html = '<div style=\"background: #fff; border: solid 1px #000; border-radius: 5px; font-weight: bold; margin-bottom: 1em; overflow: hidden;\">';\n html += '<div style=\"background: #000; color: #fff; text-align: center;\">' + this._header + '</div>';\n html += '<div style=\"padding: 5px;\">' + this._content + '</div>';\n html += '</div>';\n return html;\n }", "function wrap(x, el)\n {\n return \"<\" + el + \">\" + x + \"</\" + el + \">\"\n }", "function createEl(tag){\n return document.createElement(tag);\n}", "function mk( elementName, attrObj, parent, appendChild) {\n\treturn mkHTML( elementName, attrObj, parent, appendChild);\n}", "toString(indent, indentChar, level) {\n var self = this,\n empty = self.empty,\n tagName = self.tagName,\n attrs = self.attributes,\n indent = isNum(indent) ? indent : 0,\n level = isNum(level) ? level : 0,\n indentString = indent > 0 ? new Array((indent * level)+1).join(indentChar || \" \") : \"\",\n s = \"<\" + tagName,\n x;\n for (x in attrs) {\n if (attrs[x] !== undefined) {\n if (BOOLEAN_PROPERTIES.indexOf(x) > -1) {\n s += ` ${x}`;\n } else {\n s += ` ${x}=\"${attrs[x]}\"`;\n }\n }\n }\n if (empty) {\n s += \" />\";\n if (indent > 0) {\n // add the indent at the beginning of the string\n s = indentString + s + \"\\n\";\n }\n return s;\n }\n s += \">\";\n var children = self.children;\n if (indent > 0 && children.length) {\n s += \"\\n\";\n }\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n if (!child) continue;\n // support HTML fragments\n if (typeof child == \"string\") {\n s += (indentString + child + \"\\n\");\n } else {\n if (!child.hidden) {\n s += child.toString(indent, indentChar, level + 1);\n }\n }\n }\n if (children && children.length) {\n s += (indentString + `</${tagName}>`);\n } else {\n s += `</${tagName}>`;\n }\n if (indent > 0) {\n // add the indent at the beginning of the string\n s = indentString + s + \"\\n\";\n }\n return s;\n }", "function $n(tag,on) {\r\n var e = document.createElement(tag);\r\n if (on) on.appendChild(e);\r\n return e;\r\n}", "function createTagElement(tagId) {\n var tagsDiv = document.getElementById('business-tags-header');\n var content = \n ` <button type=\"button\" class=\"no-fill-chip bd-subheader-padding-top inline-block-child\">${tagId}</button> `;\n tagsDiv.innerHTML = tagsDiv.innerHTML + content + \"\\n\"; \n}", "function metaTag(tagName, value) {\n return mustache.render('<dc:{{tagName}}>{{value}}</dc:{{tagName}}>', {\n tagName: tagName,\n value: value\n });\n}", "function coauthors_create_author_tag( author ) {\n\n\t\tvar $tag = jQuery( '<span></span>' )\n\t\t\t\t\t\t\t.text( decodeURIComponent( author.name ) )\n\t\t\t\t\t\t\t.attr( 'title', coAuthorsPlusStrings.input_box_title )\n\t\t\t\t\t\t\t.addClass( 'coauthor-tag' )\n\t\t\t\t\t\t\t// Add Click event to edit\n\t\t\t\t\t\t\t.click( coauthors_edit_onclick );\n\t\treturn $tag;\n\t}", "showHTML() { \n return `\n <div class='showRecipes'>\n <div>\n <h3>${this.recipeTitle}</h3> \n </div> \n <div>\n ${'Time: ' + this.recipeTime}\n </div>\n <div>\n ${this.recipeIngredients}\n </div>\n <div>\n ${this.recipeAllergies}</li>\n </div>\n </div>`\n }", "function HTMLFormat(line){\r\n var openTag, closeTag, content;\r\n if(line[0] === '@'){\r\n openTag = '<h4>';\r\n closeTag = '</h4>';\r\n content = line.charAt(1).toUpperCase() + line.slice(2);\r\n }else if(line[0] === '*'){\r\n openTag = '<b>';\r\n closeTag = '</b>';\r\n content = line.charAt(3).toUpperCase() + line.slice(4);\r\n }else if(line[0] === '-'){\r\n openTag = '<li>';\r\n closeTag = '</li>';\r\n content = line.slice(1);\r\n }else {\r\n openTag = '<li>';\r\n closeTag = '</li>';\r\n content = line;\r\n }\r\n return openTag + content + closeTag;\r\n}", "function createTag(tagJSON){\r\n const div = document.createElement('div');\r\n div.setAttribute('class', 'tag');\r\n const span = document.createElement('span');\r\n span.innerHTML = tagJSON.name;\r\n // the <i></i> elems are being used as the close button for some reason\r\n const closeBtn = document.createElement('i');\r\n closeBtn.setAttribute('class', 'material-icons');\r\n closeBtn.setAttribute('data-item', tagJSON.name);\r\n \r\n // this adds the ID of the subject to the tag's metadata\r\n // if the subject is new (not in DB) then the value is 'new' and is parsed out server-side\r\n closeBtn.setAttribute('data-id', tagJSON.id);\r\n \r\n closeBtn.innerHTML = 'close';\r\n\r\n div.appendChild(span);\r\n div.appendChild(closeBtn);\r\n return div;\r\n}", "function wrapNode(n, v) {\n var thisValue = typeof v !== \"undefined\" ? v : \"\";\n return \"<\" + n + \">\" + thisValue + \"</\" + n + \">\";\n }", "function createTag({id, name, color}) {\n return `\n <input type=\"checkbox\" name=\"tags\" id=\"tags-${id}\" value=\"${id}\">\n <label for=\"tags-${id}\" class=\"checkbox-label-tag\">\n <svg width=\"25\" height=\"25\" viewBox=\"0 0 25 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"1.25\" y=\"1.25\" width=\"22.5\" height=\"22.5\" rx=\"3.75\" stroke=\"${color}\" stroke-width=\"2.5\"/>\n <path d=\"M7 11.75L10.913 17.77C11.2013 18.2135 11.8584 18.1893 12.1133 17.7259L18.425 6.25\" stroke=\"${color}\" stroke-opacity=\"0\" stroke-width=\"2.5\" stroke-linecap=\"round\"/>\n </svg>\n </label>`\n }", "function createNavItemHTML(id, name){\n const itemHTML = `<a class =\"menu__link\" data-id=\"${id}\">${name}</a>`;\n return itemHTML;\n}", "_generateMarkup() {\n // console.log(this._data); // data is in the form of an array. We want to return one of the below html elements for each of the elements in that array\n\n return this._data.map(this._generateMarkupPreview).join('');\n }", "function createAnimalTradingCardHTML(animal) {\n const cardHTML = `<div class=\"card\"> \n <h3 class=\"name\"> ${animal.name} </h3> \n <img src=\"${animal.name}.jpg\" alt=\"${animal.name}\" class=\"picture\">\n <div class=\"description\">\n <p class=\"fact\"> ${animal.fact} </p>\n <ul class=\"details\">\n <li><span class=\"bold\">Scientific Name</span>: ${animal.scientificName} </li>\n <li><span class=\"bold\">Average Lifespan</span>: ${animal.lifespan} </li>\n <li><span class=\"bold\">Average Speed</span>: ${animal.speed} </li>\n <li><span class=\"bold\">Diet</span>: ${animal.diet} </li>\n </ul>\n <p class=\"brief\"> ${animal.summary} </p>\n </div>`\n </div>;\n\n return cardHTML;\n}", "function render(name, age) {\n return `\n <div class=\"person\">\n <div class=\"name\">${name}</div>\n <div class=\"age\">${age}</div>\n </div>\n `;\n}", "function renderToString($, indent, level) {\n return Tools.format(Tools.esc($.text), indent, level);\n}", "function generateTag(newTag){\n var tag = $(\"<li> </li>\");\n tag.addClass(\"list-inline-item\");\n tag.addClass(\"w-25\");\n tag.addClass(\"mb-2\");\n\n var link = $(\"<a>\" + newTag + \"</a>\");\n link.addClass(\"tagList_tag\");\n\n tag.append(link);\n\n return tag;\n}", "function nameFunc(name){\n\tconst html = `<p>hello ${name}</p>`\n\treturn html\n}", "function elem(tag, content){ \n\t\tvar ret = document.createElement(tag); \n\t\tret.innerHTML = content; \n\t\treturn ret;\n\t}", "buildHTML() {\n\n let attribs = '';\n\n if(this.autoplay == true) {\n attribs += 'autoplay ';\n }\n\n if(this.controls == true) {\n attribs += 'controls ';\n }\n\n if(this.loop == true) {\n attribs += 'loop ';\n }\n\n attribs = attribs.trim();\n\n\n return `<video poster=\"${this.poster}\" ${attribs} class=\"responsive-video\">\n <source src=\"${this.src}\" type=\"video/mp4\">\n Your browser does not support the video tag.\n </video>`;\n\n }", "function renderToString($, indent, level) {\n let attrs = getAttrs($.node.props);\n let s1 = `<${$.node.type}${renderAttrsToString(attrs)}>`;\n if (Tools.isVoidElement($.node.type)) {\n return Tools.format(s1, indent, level);\n }\n let s3 = `</${$.node.type}>`;\n if ($.node.children.length === 0) {\n return Tools.format(s1 + s3, indent, level);\n }\n let s2;\n if ($.node.children.length === 1 && $.node.children[0].type === \"#\") {\n s2 = $.childWraps[0].renderToString(0, 0);\n return Tools.format(s1 + s2 + s3, indent, level);\n }\n s1 = Tools.format(s1, indent, level);\n s2 = $.childWraps.map(x => x.renderToString(indent, level + 1)).join(\"\");\n s3 = Tools.format(s3, indent, level);\n return s1 + s2 + s3;\n}" ]
[ "0.7636893", "0.7044232", "0.6863288", "0.6822727", "0.6554763", "0.6554763", "0.65362567", "0.652912", "0.64953357", "0.6466779", "0.6429916", "0.64055514", "0.64045453", "0.6374015", "0.63322645", "0.6286156", "0.624827", "0.62282234", "0.62282234", "0.62115824", "0.61249346", "0.60929525", "0.60929525", "0.60718817", "0.60718817", "0.60718817", "0.60718817", "0.6064743", "0.60482794", "0.60322595", "0.6031121", "0.602259", "0.6004031", "0.59795105", "0.593738", "0.59263706", "0.59223926", "0.588165", "0.5881639", "0.5876218", "0.5864354", "0.58601403", "0.584676", "0.58394086", "0.5825675", "0.5790719", "0.57773036", "0.57768005", "0.5765794", "0.57639605", "0.576017", "0.57564956", "0.57444197", "0.57428205", "0.5732757", "0.5730874", "0.5730145", "0.57282305", "0.5719943", "0.57145065", "0.5707659", "0.5704614", "0.57029396", "0.56984395", "0.5686298", "0.56792986", "0.56792986", "0.56792986", "0.56792986", "0.56728417", "0.5671619", "0.5671516", "0.5667406", "0.56535125", "0.5651866", "0.564822", "0.5644619", "0.56382525", "0.56318164", "0.5626411", "0.56191164", "0.56178534", "0.56109375", "0.55996704", "0.559842", "0.5590443", "0.558761", "0.5582087", "0.55796903", "0.55779535", "0.55746335", "0.5563135", "0.5561755", "0.55515766", "0.5544693", "0.553803", "0.5535592", "0.55324537", "0.5530013" ]
0.63478655
15
Helper function to produce an XML tag.
function tag(name, attrs, selfclosing) { var result = '<' + name; if(attrs && attrs.length > 0) { var i = 0; var attrib; while ((attrib = attrs[i]) !== undefined) { result += ' ' + attrib[0] + '="' + this.esc(attrib[1]) + '"'; i++; } } if(selfclosing) { result += ' /'; } result += '>'; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTag (tagName, strValue) {\n return \"<\"+tagName+\">\"+strValue+\"</\"+tagName+\">\"\n}", "function generateTagHTML (tag){//generates HTML for a given tag\n return `<li class='tag'><div class='tag-box'>${tag}</div></li>`;\n}", "function tag(name, attrs, selfclosing) {\n if (this.disableTags > 0) {\n return;\n }\n this.buffer += ('<' + name);\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n this.buffer += (' ' + attrib[0] + '=\"' + attrib[1] + '\"');\n i++;\n }\n }\n if (selfclosing) {\n this.buffer += ' /';\n }\n this.buffer += '>';\n this.lastOut = '>';\n}", "function tag(name, attrs, selfclosing) {\n if (this.disableTags > 0) {\n return;\n }\n this.buffer += ('<' + name);\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n while ((attrib = attrs[i]) !== undefined) {\n this.buffer += (' ' + attrib[0] + '=\"' + attrib[1] + '\"');\n i++;\n }\n }\n if (selfclosing) {\n this.buffer += ' /';\n }\n this.buffer += '>';\n this.lastOut = '>';\n}", "function tag(name, attrs, selfclosing) {\n if (this.disableTags > 0) {\n return;\n }\n\n this.buffer += '<' + name;\n\n if (attrs && attrs.length > 0) {\n var i = 0;\n var attrib;\n\n while ((attrib = attrs[i]) !== undefined) {\n this.buffer += ' ' + attrib[0] + '=\"' + attrib[1] + '\"';\n i++;\n }\n }\n\n if (selfclosing) {\n this.buffer += ' /';\n }\n\n this.buffer += '>';\n this.lastOut = '>';\n }", "function toXML() {\n // TODO: Implement\n return \"\";\n}", "function BeenJamminBuildTag(options) {\r\n var tag = document.createElement(options.tagName);\r\n\r\n if (options.cssClass)\r\n tag.setAttribute('class', options.cssClass);\r\n\r\n if (options.text)\r\n tag.appendChild(document.createTextNode(options.text));\r\n\r\n for (var attr in options.attributes) {\r\n tag.setAttribute(attr, options.attributes[attr]);\r\n }\r\n\r\n return tag;\r\n}", "tagMaker() {\n const isHtmlNode = () => {\n return true;\n };\n const isAttribMap = () => {\n return true;\n };\n var notEmpty = (x) => {\n if ((typeof x === 'undefined') ||\n (x === null) ||\n x.length === 0) {\n return false;\n }\n return true;\n };\n var maker = (name, defaultAttribs = {}) => {\n var tagFun= (attribs, children) => {\n let node = '<';\n\n // case 1. one argument, first may be attribs or content, but attribs if object.\n if (typeof children === 'undefined') {\n if (typeof attribs === 'object' &&\n ! (attribs instanceof Array) &&\n isAttribMap(attribs)) {\n if (Object.keys(attribs).length === 0) {\n node += name;\n } else {\n const tagAttribs = this.attribsToString(this.mergeAttribs(attribs, defaultAttribs));\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n }\n node += '>';\n // case 2. arity 1, is undefined\n } else if (typeof attribs === 'undefined') {\n const tagAttribs = this.attribsToString(defaultAttribs);\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n node += '>';\n // case 3: arity 1, is content\n } else if (isHtmlNode(attribs)) {\n const tagAttribs = this.attribsToString(defaultAttribs);\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n node += '>' + this.renderChildren(attribs);\n }\n // case 4. arity 2 - atribs + content\n } else if (isAttribMap(attribs) && isHtmlNode(children)) {\n if (Object.keys(attribs).length === 0) {\n node += name;\n } else {\n const tagAttribs = this.attribsToString(this.mergeAttribs(attribs, defaultAttribs));\n node += [name, tagAttribs].filter(notEmpty).join(' ');\n }\n node += '>' + this.renderChildren(children);\n }\n node += '</' + name + '>';\n return node;\n };\n return tagFun;\n };\n return maker;\n }", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n }", "function makeXml(key,value){\n return \"<update><\"+key+\">\"+value+\"</\"+key+\"></update>\";\n}", "function formatXmlString(value)\n{\n if(!isNaN(value)) return value;\n \n var xmlString = \"\";\n \n for(var i=0; i < value.length; i++)\n {\n switch(value[i])\n {\n case '&':\n xmlString += '&amp;';\n break;\n \n case '<':\n xmlString += '&lt;';\n break;\n \n case '>':\n xmlString += '&gt;';\n break;\n \n case '\"':\n xmlString += '&quot;';\n break;\n \n case \"'\":\n xmlString += '&apos;';\n break;\n \n default:\n xmlString += value[i];\n break;\n }\n }\n \n return xmlString;\n}", "function construct_tag(tag_name){\n render_tag = '<li class=\"post__tag\"><a class=\"post__link post__tag_link\">' + tag_name + '</a> </li>'\n return render_tag\n}", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n}", "function openTag(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n}", "function tag(name, attrs, ...content) {\n\tlet el = document.createElement(name);\n\tfor(let a in attrs) {\n\t\tel.setAttribute(a, attrs[a]);\n\t}\n\tfor(let c of content) {\n\t\tif(typeof c === 'string') {\n\t\t\tel.appendChild(document.createTextNode(c));\n\t\t}\n\t\telse if(c) {\n\t\t\tel.appendChild(c);\n\t\t}\n\t\telse {\n\t\t\t/* Ignore falsey stuff */\n\t\t}\n\t}\n\treturn el;\n}", "function createEl(tag, value) {\r\n\t\tvar el = document.createElement(tag);\r\n\t\tel.innerHTML = value;\r\n\t\treturn el;\r\n\t}", "function createTagElement(tid, skillString) {\n\t\tvar div = document.createElement('div');\n\t\tdiv.textContent = skillString;\n\t\tdiv.setAttribute('class', 'tag');\n\t\tdiv.setAttribute('id', tid);\n\t\treturn div;\n\t}", "function endTag(tag) {\n return \"</\" + tag + \">\";\n}", "function buildNode(tagName, attributes, children) {\n var node = document.createElement(tagName);\n\n /* Apply attributes */\n if (attributes) {\n for (var attribute in attributes) {\n if (attributes.hasOwnProperty(attribute)) {\n node[attribute] = attributes[attribute];\n }\n }\n }\n\n /* Append children */\n if (children) {\n if (typeof children === 'string') {\n node.appendChild(document.createTextNode(children));\n } else if (children.tagName) {\n node.appendChild(children);\n } else if (children.length) {\n for (var i = 0, length = children.length; i < length; ++i) {\n var child = children[i];\n\n if (typeof child === 'string') {\n child = document.createTextNode(child);\n }\n\n node.appendChild(child);\n }\n }\n }\n\n return node;\n }", "function createElementHelper(tagName, opt_bag) {\n // Allow passing in ownerDocument to create in a different document.\n var doc;\n if (opt_bag && opt_bag.ownerDocument)\n doc = opt_bag.ownerDocument;\n else\n doc = app.doc;\n return doc.createElement(tagName);\n }", "function wrapNode(n, v) {\n var thisValue = typeof v !== \"undefined\" ? v : \"\";\n return \"<\" + n + \">\" + thisValue + \"</\" + n + \">\";\n }", "function createTag(tag,objAttr){\t\n\t\t\t\tvar oTag = document.createElementNS(svgNS , tag);\t\n\t\t\t\tfor(var attr in objAttr){\n\t\t\t\t\toTag.setAttribute(attr , objAttr[attr]);\n\t\t\t\t}\t\n\t\t\t\treturn oTag;\t\n\t\t\t}", "function createElement(param) {\n var element = document.createElementNS(svgns, param.name);\n element.id = param.name + \"_\" + param.id;\n\n if (param.text !== undefined)\n element.innerText = element.textContent = param.text;\n\n addOptions.call(element, param.options);\n addActions.call(element, param.actions);\n return element;\n }", "function quickElement() {\r\n var obj = document.createElement(arguments[0]);\r\n if (arguments[2] != '' && arguments[2] != null) {\r\n var textNode = document.createTextNode(arguments[2]);\r\n obj.appendChild(textNode);\r\n }\r\n var len = arguments.length;\r\n for (var i = 3; i < len; i += 2) {\r\n obj.setAttribute(arguments[i], arguments[i+1]);\r\n }\r\n arguments[1].appendChild(obj);\r\n return obj;\r\n}", "function startTag(tag, attr) {\n let attrStr = \"\";\n if (attr) {\n attrStr = \" \" + Object.keys(attr).map(function(k) { \n return k + ' = \"' + attr[k] + '\"';\n }).join(\" \");\n }\n return \"<\" + tag + attrStr + \">\";\n}", "function $n(tag,on) {\r\n var e = document.createElement(tag);\r\n if (on) on.appendChild(e);\r\n return e;\r\n}", "function wrap(x, el)\n {\n return \"<\" + el + \">\" + x + \"</\" + el + \">\"\n }", "function quickElement() {\n var obj = document.createElement(arguments[0]);\n if (arguments[2] != '' && arguments[2] != null) {\n var textNode = document.createTextNode(arguments[2]);\n obj.appendChild(textNode);\n }\n var len = arguments.length;\n for (var i = 3; i < len; i += 2) {\n obj.setAttribute(arguments[i], arguments[i+1]);\n }\n arguments[1].appendChild(obj);\n return obj;\n}", "function writeXmlFileHead()\r\n{ \r\n var string = \"\";\r\n string += \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"\r\n string += \"<root>\\n\"\r\n writeString (string)\r\n}", "function writeXmlFileHead()\r\n{ \r\n var string = \"\";\r\n string += \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"\r\n string += \"<root>\\n\"\r\n writeString (string)\r\n}", "function xml(dom) {\n var options = tslib_1.__assign(tslib_1.__assign({}, this._options), { xmlMode: true });\n return render(this, dom, options);\n}", "function writeTagToOutput(stream, tag) {\n stream.print(\"<\" + tag.name);\n var attributes = tag.attributes;\n for (var i in attributes) {\n if (attributes.hasOwnProperty(i)) {\n stream.print(\" \" + i + \"=\\\"\" + stream.encodeEntities(attributes[i]) + \"\\\"\");\n }\n }\n if (tag.isSelfClosing) {\n if (stream._streamer.opts.formatting.spaceBeforeSelfClosingTag) {\n stream.print(\" \");\n }\n stream.print(\"/\");\n }\n stream.print(\">\");\n}", "function xml(dom) {\n var options = tslib_1.__assign(tslib_1.__assign({}, this._options), {\n xmlMode: true\n });\n\n return render(this, dom, options);\n}", "createXmlRepresentationOfEndTagPart(part, rootElem) {\r\n const xElem = rootElem.ownerDocument.createElement('x');\r\n const tagMapping = new tag_mapping_1.TagMapping();\r\n const idAttrib = tagMapping.getCloseTagPlaceholderName(part.tagName());\r\n const ctypeAttrib = 'x-' + part.tagName();\r\n xElem.setAttribute('id', idAttrib);\r\n xElem.setAttribute('ctype', ctypeAttrib);\r\n return xElem;\r\n }", "function xml(dom) {\n const options = { ...this._options, xmlMode: true };\n return static_render(this, dom, options);\n}", "function createTag(tagName){\n return document.createElement(tagName);\n }", "function createTag({id, name, color}) {\n return `\n <input type=\"checkbox\" name=\"tags\" id=\"tags-${id}\" value=\"${id}\">\n <label for=\"tags-${id}\" class=\"checkbox-label-tag\">\n <svg width=\"25\" height=\"25\" viewBox=\"0 0 25 25\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"1.25\" y=\"1.25\" width=\"22.5\" height=\"22.5\" rx=\"3.75\" stroke=\"${color}\" stroke-width=\"2.5\"/>\n <path d=\"M7 11.75L10.913 17.77C11.2013 18.2135 11.8584 18.1893 12.1133 17.7259L18.425 6.25\" stroke=\"${color}\" stroke-opacity=\"0\" stroke-width=\"2.5\" stroke-linecap=\"round\"/>\n </svg>\n </label>`\n }", "function $Tag(tagName,args){\n // cl\n var $i = null\n var elt = null\n var elt = $DOMNode(document.createElement(tagName))\n elt.parent = this\n if(args!=undefined && args.length>0){\n $start = 0\n $first = args[0]\n // if first argument is not a keyword, it's the tag content\n if(!isinstance($first,$Kw)){\n $start = 1\n if(isinstance($first,[str,int,float])){\n txt = document.createTextNode($first.toString())\n elt.appendChild(txt)\n } else if(isinstance($first,$TagSum)){\n for($i=0;$i<$first.children.length;$i++){\n elt.appendChild($first.children[$i])\n }\n } else {\n try{elt.appendChild($first)}\n catch(err){throw ValueError('wrong element '+$first)}\n }\n }\n // attributes\n for($i=$start;$i<args.length;$i++){\n // keyword arguments\n $arg = args[$i]\n if(isinstance($arg,$Kw)){\n if($arg.name.toLowerCase().substr(0,2)===\"on\"){ // events\n eval('elt.'+$arg.name.toLowerCase()+'=function(){'+$arg.value+'}')\n }else if($arg.name.toLowerCase()==\"style\"){\n elt.set_style($arg.value)\n } else {\n if($arg.value!==false){\n // option.selected=false sets it to true :-)\n try{\n elt.setAttribute($arg.name.toLowerCase(),$arg.value)\n }catch(err){\n throw ValueError(\"can't set attribute \"+$arg.name)\n }\n }\n }\n }\n }\n }\n return elt\n}", "function OutputXML(props) {\n return <button onClick = {props.onClick}>Output XML</button>;\n}", "function XML () {\n\n}", "function createEl(tag){\n return document.createElement(tag);\n}", "function result_element(tag, num_attrs)\n{\n var node = new PlainXMLNode(tag);\n\n var k = 2;\n while(--num_attrs >= 0)\n {\n // skip attributes such as Mathvariant - nickf 12/13/2011\n //\n // if(arguments[k+1] != null) {\n // node.attrs[arguments[k]] = arguments[k+1];\n // }\n\n k += 2;\n }\n\n for(; k < arguments.length; k++) {\n if(arguments[k] != null)\n node.content.push(arguments[k]); // expand array of content\n }\n\n return node;\n}", "function create(doc, tag, ns) {\n\t return ns ? doc.createElementNS(ns, tag) : doc.createElement(tag);\n\t}", "function make(tag, options) {\n var keys, i,\n element = document.createElement(tag);\n if (options === undefined) {\n return element;\n }\n if ('parent' in options) {\n options.parent.appendChild(element);\n delete options.parent;\n }\n keys = Object.keys(options);\n for (i = keys.length - 1; i >= 0; --i) {\n element[keys[i]] = options[keys[i]];\n }\n return element;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "_hashTag(tag, attrs, isVoid) {\n const start = `<${tag}`;\n const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join('');\n const end = isVoid ? '/>' : `></${tag}>`;\n return start + strAttrs + end;\n }", "function emitTagName(name) {\n if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) {\n write('\"');\n emit(name);\n write('\"');\n }\n else {\n emit(name);\n }\n }", "function generateEndTag(startTag) {\n\t\t\n\t\tif (startTag.charAt(startTag.length-2) !== '/') {\n\t\t\t\n\t\t\tif (startTag.indexOf(' ') > -1) {\n\t\t\t\t// delete parameters of startTag\n\t\t\t\treturn \"</\"+startTag.substring(1, startTag.indexOf(' '))+\">\";\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn \"</\"+startTag.substring(1, startTag.length);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// if the tag is self-closing (e.g. \"<mprescripts/>\"), the endTag is the startTag\n\t\t\treturn startTag;\n\t\t}\n\t}", "function _escTag(s){ return s.replace(\"<\",\"&lt;\").replace(\">\",\"&gt;\");}", "function _escTag(s){ return s.replace(\"<\",\"&lt;\").replace(\">\",\"&gt;\");}", "function makeElt(name, attrs, appendTo)\n{\n var element = document.createElementNS(\"http://www.w3.org/2000/svg\", name);\n if (attrs === undefined)\n attrs = {};\n for (var key in attrs) {\n element.setAttributeNS(null, key, attrs[key]);\n }\n if (appendTo) {\n appendTo.appendChild(element);\n }\n return element;\n}", "function XNode(type, content) {\n\t\tthis.node = document.createElement(type);\n\n\t\tif (content !== undefined)\n\t\t\tthis.node.innerHTML = content;\n\t}", "function $t (tag) {\n\ttag = tag || 'div';\n\treturn $('<'+tag+'/>');\n}", "function wrapWith(tagname, el, attribs) {\n var tag = document.createElement(tagname);\n for (var key in attribs) {\n tag.setAttribute(key, attribs[key]);\n }\n tag.appendChild(el);\n return tag;\n }", "function elt(name, attributes) {\n var node = document.createElement(name);\n if (attributes) {\n for (var attr in attributes)\n if (attributes.hasOwnProperty(attr))\n node.setAttribute(attr, attributes[attr]);\n }\n for (var i = 2; i < arguments.length; i++) {\n var child = arguments[i];\n if (typeof child == 'string')\n child = document.createTextNode(child);\n node.appendChild(child);\n }\n return node;\n}", "function elt(name, attributes) {\n var node = document.createElement(name);\n if (attributes) {\n for (var attr in attributes)\n if (attributes.hasOwnProperty(attr))\n node.setAttribute(attr, attributes[attr]);\n }\n for (var i = 2; i < arguments.length; i++) {\n var child = arguments[i];\n if (typeof child == \"string\")\n child = document.createTextNode(child);\n node.appendChild(child);\n }\n return node;\n}", "function elt(name, attributes) {\n var node = document.createElement(name);\n if (attributes) {\n for (var attr in attributes)\n if (attributes.hasOwnProperty(attr))\n node.setAttribute(attr, attributes[attr]);\n }\n for (var i = 2; i < arguments.length; i++) {\n var child = arguments[i];\n if (typeof child == \"string\")\n child = document.createTextNode(child);\n node.appendChild(child);\n }\n return node;\n}", "function formatXmlName(value, replacement)\n{\n var xmlName = value;\n \n if(!isNaN(value)) xmlName = \"_\" + value.toString();\n else if(!isNaN(value[0])) xmlName = \"_\" + value; //XML element names cannot start with a number, so add a \"_\" to the start of the name\n \n if(xmlName.length >= 3)\n {\n if(xmlName.toLowerCase().indexOf(\"xml\") === 0)\n {\n xmlName = \"_\" + xmlName; //XML element names cannot start with \"XML\" so add an underscore to the front\n }\n }\n \n xmlName = xmlName.replace(/[^a-zA-Z0-9\\-\\_]/gm, replacement); //Replace non-alphanumeric, dash, underscore, or period chars with an underscore\n \n if(xmlName.search(/[a-zA-Z\\_]/g) > 0)\n {\n xmlName = \"_\" + xmlName; //XML element names must start with a letter or underscore, so add an underscore to the front\n }\n \n return xmlName;\n}", "function tagOpen(tag) {\n return '<%@ class=\"%@\">'.fmt(tag.tagName.toLowerCase(), tag.className);\n}", "function nodeCreate(tag)\n{\n\treturn document.createElement(tag);\t\n}", "static ToXML(tagCompound) {\n\t\tlet xml = \"\";\n\n\t\tif (\n\t\t\ttagCompound instanceof Tag.TagCompound ||\n\t\t\ttagCompound instanceof Tag.TagList\n\t\t) {\n\t\t\tlet tag = Enum.TagType.GetClass(tagCompound.meta(\"Type\")).name;\n\t\t\txml += `<${tag} key=\"${tagCompound.meta(\"Key\")}\" ordinality=\"${tagCompound.prop(\"Ordinality\")}\"${\n\t\t\t\ttagCompound instanceof Tag.TagList\n\t\t\t\t\t? ` content-type=\"${\n\t\t\t\t\t\t\tEnum.TagType.GetClass(tagCompound.ContentType)\n\t\t\t\t\t\t\t\t.name\n\t\t\t\t\t\t}\"`\n\t\t\t\t\t: \"\"\n\t\t\t}>`;\n\t\t\tlet tags = tagCompound.prop(\"Value\");\n\t\t\tfor (let i in tags) {\n\t\t\t\tlet x = Transformer.ToXML(tags[i]);\n\t\t\t\txml += x;\n\t\t\t}\n\t\t\txml += `</${tag}>`;\n\t\t} else if (tagCompound instanceof Tag.ATag) {\n\t\t\tlet tag = Enum.TagType.GetClass(tagCompound.meta(\"Type\")).name,\n\t\t\t\tvalues = \"\";\n\n\t\t\tfor (let i in tagCompound.prop(\"Value\")) {\n\t\t\t\tvalues += `<Value>${tagCompound.prop(\"Value\")[i]}</Value>`;\n\t\t\t}\n\n\t\t\txml += `<${tag} key=\"${tagCompound.meta(\"Key\")}\" ordinality=\"${tagCompound.prop(\"Ordinality\")}\">${values}</${tag}>`;\n\t\t}\n\n\t\treturn xml;\n\t}", "function addNodeToXML(node) {\n var nodeXMLContent = \"<node\";\n if (node.nodeXMLType) {\n nodeXMLContent += \" type='\" + node.nodeXMLType + \"'\"\n }\n nodeXMLContent += \">\";\n if (node.nodeXMLValue) {\n nodeXMLContent += node.nodeXMLValue;\n }\n nodeXMLContent += \"</node>\\n\";\n return nodeXMLContent;\n}", "function generateXML(){\n var xml = \"<WearML><Package>com.android.webview</Package><Language>en_GB</Language><UniqueIdentifier id=\\\"web_app\\\"/> \";\n\n for (var i = 0, n = wearMLElements.length; i < n; i++)\n {\n var command = wearMLElements[i].tag;\n var styleId = wearMLElements[i].styleId\n xml += \"<View \";\n xml += \"id=\\\"\" + wearMLElements[i].id + \"\\\" \";\n\n var style = getStyle(styleId)\n\n if(style != undefined){\n\t\t\txml += wearMLParser(style, wearMLElements[i]);\n }\n\n if(command != undefined){\n xml += \"speech_command=\\\"\"+ command + \"\\\" \";\n }\n\n xml += \"/> \";\n }\n\n xml += \"</WearML>\";\n return window.btoa(xml);\n}", "tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }", "function xml(hljs) {\n // Element names can contain letters, digits, hyphens, underscores, and periods\n const TAG_NAME_RE = concat$3(/[A-Z_]/, optional(/[A-Z0-9_.-]+:/), /[A-Z0-9_.-]*/);\n const XML_IDENT_RE = /[A-Za-z0-9._:-]+/;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [{\n className: 'meta-keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'meta-string'\n });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {\n className: 'meta-string'\n });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /</,\n relevance: 0,\n contains: [{\n className: 'attr',\n begin: XML_IDENT_RE,\n relevance: 0\n }, {\n begin: /=\\s*/,\n relevance: 0,\n contains: [{\n className: 'string',\n endsParent: true,\n variants: [{\n begin: /\"/,\n end: /\"/,\n contains: [XML_ENTITIES]\n }, {\n begin: /'/,\n end: /'/,\n contains: [XML_ENTITIES]\n }, {\n begin: /[^\\s\"'=<>`]+/\n }]\n }]\n }]\n };\n return {\n name: 'HTML, XML',\n aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],\n case_insensitive: true,\n contains: [{\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n relevance: 10,\n contains: [XML_META_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE, XML_META_PAR_KEYWORDS, {\n begin: /\\[/,\n end: /\\]/,\n contains: [{\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n contains: [XML_META_KEYWORDS, XML_META_PAR_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE]\n }]\n }]\n }, hljs.COMMENT(/<!--/, /-->/, {\n relevance: 10\n }), {\n begin: /<!\\[CDATA\\[/,\n end: /\\]\\]>/,\n relevance: 10\n }, XML_ENTITIES, {\n className: 'meta',\n begin: /<\\?xml/,\n end: /\\?>/,\n relevance: 10\n }, {\n className: 'tag',\n\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n '<style' as a single word, followed by a whitespace or an\n ending braket. The '$' is needed for the lexeme to be recognized\n by hljs.subMode() that tests lexemes outside the stream.\n */\n begin: /<style(?=\\s|>)/,\n end: />/,\n keywords: {\n name: 'style'\n },\n contains: [TAG_INTERNALS],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n }, {\n className: 'tag',\n // See the comment in the <style tag about the lookahead pattern\n begin: /<script(?=\\s|>)/,\n end: />/,\n keywords: {\n name: 'script'\n },\n contains: [TAG_INTERNALS],\n starts: {\n end: /<\\/script>/,\n returnEnd: true,\n subLanguage: ['javascript', 'handlebars', 'xml']\n }\n }, // we need this for now for jSX\n {\n className: 'tag',\n begin: /<>|<\\/>/\n }, // open tag\n {\n className: 'tag',\n begin: concat$3(/</, lookahead$2(concat$3(TAG_NAME_RE, // <tag/>\n // <tag>\n // <tag ...\n either(/\\/>/, />/, /\\s/)))),\n end: /\\/?>/,\n contains: [{\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0,\n starts: TAG_INTERNALS\n }]\n }, // close tag\n {\n className: 'tag',\n begin: concat$3(/<\\//, lookahead$2(concat$3(TAG_NAME_RE, />/))),\n contains: [{\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0\n }, {\n begin: />/,\n relevance: 0\n }]\n }]\n };\n}", "function GenerateTagHTML(tags) {\r\n \r\n var html = '<div class=\"tags\">';\r\n \r\n // Generate the html for each of the tags and return it\r\n $.each(tags, function(key, tag) { html += '<span>' + tag + '</span>' });\r\n return html + '</div>';\r\n \r\n }", "function createElement(tag, content, className) {\n let tagName = document.createElement(tag);\n let elementContent = document.createTextNode(content);\n tagName.appendChild(elementContent);\n tagName.className = className;\n return tagName;\n }", "createXmlRepresentationOfStartTagPart(part, rootElem) {\r\n const xElem = rootElem.ownerDocument.createElement('x');\r\n const tagMapping = new tag_mapping_1.TagMapping();\r\n const idAttrib = tagMapping.getStartTagPlaceholderName(part.tagName(), part.idCounter());\r\n const ctypeAttrib = tagMapping.getCtypeForTag(part.tagName());\r\n const equivTextAttr = '<' + part.tagName() + '>';\r\n xElem.setAttribute('id', idAttrib);\r\n xElem.setAttribute('ctype', ctypeAttrib);\r\n xElem.setAttribute('equiv-text', equivTextAttr);\r\n return xElem;\r\n }", "function JSXClosingElement(node, print) {\n\t this.push(\"</\");\n\t print.plain(node.name);\n\t this.push(\">\");\n\t}", "function JSXClosingElement(node, print) {\n\t this.push(\"</\");\n\t print.plain(node.name);\n\t this.push(\">\");\n\t}", "function createElement(el){\n\tvar element;\n\tif(el == \"Text\")\n\t\telement = document.createTextNode(arguments[1]);\n\telse{\n\t\telement = document.createElement(el);\n\t\tif(arguments.length > 1){\n\t\t\tfor(var i = 1; i < arguments.length; i++){\n\t\t\t\tif(typeof arguments[i] === 'string'){\n\t\t\t\t\telement.innerHTML += arguments[i];\n\t\t\t\t}else\n\t\t\t\t\telement.setAttribute(arguments[i][0], arguments[i][1]);\n\t\t\t}\n\t\t}\n\t}\n\treturn element;\n}", "function entag(tag, attributes, content) {\n // (2) This function lets us intelligently stick some content into a tag\n // with a given set of attributes without having to go through the node\n // creation manually each time.\n //\n // Generating a table, there are a lot of times we want to wrap some\n // content in a particular type of tag with a particular set of attributes\n //\n // Generalizing this lets us avoid walking through this loop each time and\n // just think about what element we want to end up with.\n\n var element = document.createElement(tag);\n for (var key in attributes) {\n element.setAttribute(key, attributes[key]);\n }\n\n smartInsert(content, element);\n\n return element;\n}", "function create(doc, tag, ns) {\n return ns ? doc.createElementNS(ns, tag) : doc.createElement(tag);\n}", "function create(doc, tag, ns) {\n return ns ? doc.createElementNS(ns, tag) : doc.createElement(tag);\n}", "toString(indent, indentChar, level) {\n var self = this,\n empty = self.empty,\n tagName = self.tagName,\n attrs = self.attributes,\n indent = isNum(indent) ? indent : 0,\n level = isNum(level) ? level : 0,\n indentString = indent > 0 ? new Array((indent * level)+1).join(indentChar || \" \") : \"\",\n s = \"<\" + tagName,\n x;\n for (x in attrs) {\n if (attrs[x] !== undefined) {\n if (BOOLEAN_PROPERTIES.indexOf(x) > -1) {\n s += ` ${x}`;\n } else {\n s += ` ${x}=\"${attrs[x]}\"`;\n }\n }\n }\n if (empty) {\n s += \" />\";\n if (indent > 0) {\n // add the indent at the beginning of the string\n s = indentString + s + \"\\n\";\n }\n return s;\n }\n s += \">\";\n var children = self.children;\n if (indent > 0 && children.length) {\n s += \"\\n\";\n }\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n if (!child) continue;\n // support HTML fragments\n if (typeof child == \"string\") {\n s += (indentString + child + \"\\n\");\n } else {\n if (!child.hidden) {\n s += child.toString(indent, indentChar, level + 1);\n }\n }\n }\n if (children && children.length) {\n s += (indentString + `</${tagName}>`);\n } else {\n s += `</${tagName}>`;\n }\n if (indent > 0) {\n // add the indent at the beginning of the string\n s = indentString + s + \"\\n\";\n }\n return s;\n }", "function createTagElement(tagId) {\n var tagsDiv = document.getElementById('business-tags-header');\n var content = \n ` <button type=\"button\" class=\"no-fill-chip bd-subheader-padding-top inline-block-child\">${tagId}</button> `;\n tagsDiv.innerHTML = tagsDiv.innerHTML + content + \"\\n\"; \n}", "function xCreateElement(sTag)\r\n{\r\n if (document.createElement) return document.createElement(sTag);\r\n else return null;\r\n}", "function xml(hljs) {\n // Element names can contain letters, digits, hyphens, underscores, and periods\n const TAG_NAME_RE = concat(/[A-Z_]/, optional(/[A-Z0-9_.-]+:/), /[A-Z0-9_.-]*/);\n const XML_IDENT_RE = '[A-Za-z0-9\\\\._:-]+';\n const XML_ENTITIES = {\n className: 'symbol',\n begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;'\n };\n const XML_META_KEYWORDS = {\n begin: '\\\\s',\n contains: [\n {\n className: 'meta-keyword',\n begin: '#?[a-z_][a-z1-9_-]+',\n illegal: '\\\\n'\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: '\\\\(',\n end: '\\\\)'\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'meta-string'\n });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {\n className: 'meta-string'\n });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /</,\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: XML_IDENT_RE,\n relevance: 0\n },\n {\n begin: /=\\s*/,\n relevance: 0,\n contains: [\n {\n className: 'string',\n endsParent: true,\n variants: [\n {\n begin: /\"/,\n end: /\"/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /'/,\n end: /'/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /[^\\s\"'=<>`]+/\n }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n contains: [\n {\n className: 'meta',\n begin: '<![a-z]',\n end: '>',\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [\n {\n className: 'meta',\n begin: '<![a-z]',\n end: '>',\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n '<!--',\n '-->',\n {\n relevance: 10\n }\n ),\n {\n begin: '<!\\\\[CDATA\\\\[',\n end: '\\\\]\\\\]>',\n relevance: 10\n },\n XML_ENTITIES,\n {\n className: 'meta',\n begin: /<\\?xml/,\n end: /\\?>/,\n relevance: 10\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n '<style' as a single word, followed by a whitespace or an\n ending braket. The '$' is needed for the lexeme to be recognized\n by hljs.subMode() that tests lexemes outside the stream.\n */\n begin: '<style(?=\\\\s|>)',\n end: '>',\n keywords: {\n name: 'style'\n },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: '</style>',\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the <style tag about the lookahead pattern\n begin: '<script(?=\\\\s|>)',\n end: '>',\n keywords: {\n name: 'script'\n },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/script>/,\n returnEnd: true,\n subLanguage: [\n 'javascript',\n 'handlebars',\n 'xml'\n ]\n }\n },\n // we need this for now for jSX\n {\n className: 'tag',\n begin: /<>|<\\/>/\n },\n // open tag\n {\n className: 'tag',\n begin: concat(\n /</,\n lookahead(concat(\n TAG_NAME_RE,\n // <tag/>\n // <tag>\n // <tag ...\n either(/\\/>/, />/, /\\s/)\n ))\n ),\n end: /\\/?>/,\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0,\n starts: TAG_INTERNALS\n }\n ]\n },\n // close tag\n {\n className: 'tag',\n begin: concat(\n /<\\//,\n lookahead(concat(\n TAG_NAME_RE, />/\n ))\n ),\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0\n },\n {\n begin: />/,\n relevance: 0\n }\n ]\n }\n ]\n };\n}", "function xml(hljs) {\n // Element names can contain letters, digits, hyphens, underscores, and periods\n const TAG_NAME_RE = concat(/[A-Z_]/, optional(/[A-Z0-9_.-]+:/), /[A-Z0-9_.-]*/);\n const XML_IDENT_RE = '[A-Za-z0-9\\\\._:-]+';\n const XML_ENTITIES = {\n className: 'symbol',\n begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;'\n };\n const XML_META_KEYWORDS = {\n begin: '\\\\s',\n contains: [\n {\n className: 'meta-keyword',\n begin: '#?[a-z_][a-z1-9_-]+',\n illegal: '\\\\n'\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: '\\\\(',\n end: '\\\\)'\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'meta-string'\n });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {\n className: 'meta-string'\n });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /</,\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: XML_IDENT_RE,\n relevance: 0\n },\n {\n begin: /=\\s*/,\n relevance: 0,\n contains: [\n {\n className: 'string',\n endsParent: true,\n variants: [\n {\n begin: /\"/,\n end: /\"/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /'/,\n end: /'/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /[^\\s\"'=<>`]+/\n }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n contains: [\n {\n className: 'meta',\n begin: '<![a-z]',\n end: '>',\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [\n {\n className: 'meta',\n begin: '<![a-z]',\n end: '>',\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n '<!--',\n '-->',\n {\n relevance: 10\n }\n ),\n {\n begin: '<!\\\\[CDATA\\\\[',\n end: '\\\\]\\\\]>',\n relevance: 10\n },\n XML_ENTITIES,\n {\n className: 'meta',\n begin: /<\\?xml/,\n end: /\\?>/,\n relevance: 10\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n '<style' as a single word, followed by a whitespace or an\n ending braket. The '$' is needed for the lexeme to be recognized\n by hljs.subMode() that tests lexemes outside the stream.\n */\n begin: '<style(?=\\\\s|>)',\n end: '>',\n keywords: {\n name: 'style'\n },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: '</style>',\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the <style tag about the lookahead pattern\n begin: '<script(?=\\\\s|>)',\n end: '>',\n keywords: {\n name: 'script'\n },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/script>/,\n returnEnd: true,\n subLanguage: [\n 'javascript',\n 'handlebars',\n 'xml'\n ]\n }\n },\n // we need this for now for jSX\n {\n className: 'tag',\n begin: /<>|<\\/>/\n },\n // open tag\n {\n className: 'tag',\n begin: concat(\n /</,\n lookahead(concat(\n TAG_NAME_RE,\n // <tag/>\n // <tag>\n // <tag ...\n either(/\\/>/, />/, /\\s/)\n ))\n ),\n end: /\\/?>/,\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0,\n starts: TAG_INTERNALS\n }\n ]\n },\n // close tag\n {\n className: 'tag',\n begin: concat(\n /<\\//,\n lookahead(concat(\n TAG_NAME_RE, />/\n ))\n ),\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0\n },\n {\n begin: />/,\n relevance: 0\n }\n ]\n }\n ]\n };\n}", "function closeTag(tag) {\n return '</' + tag + '>';\n}", "function closeTag(tag) {\n return '</' + tag + '>';\n}", "function eyeParam(name,value,nocode) {\n\tmyValue = new String(value);\n\tif(!nocode) {\n\t\tmyValue = myValue.replace(/\\</g,\"&lt;\");\n\t\tmyValue = myValue.replace(/\\>/g,\"&gt;\");\n\t}\n\treturn '<'+name+'>'+myValue+'</'+name+'>';\n}", "function buildHTML(tag, html, attrs) {\n\n var element = document.createElement(tag);\n // if custom html passed in, append it\n if (html) element.innerHTML = html;\n\n // set each individual attribute passed in\n for (attr in attrs) {\n if (attrs[attr] === false) continue;\n element.setAttribute(attr, attrs[attr]);\n }\n\n return element;\n }", "function JSXOpeningElement(node, print) {\n\t this.push(\"<\");\n\t print.plain(node.name);\n\t if (node.attributes.length > 0) {\n\t this.push(\" \");\n\t print.join(node.attributes, { separator: \" \" });\n\t }\n\t this.push(node.selfClosing ? \" />\" : \">\");\n\t}", "function JSXOpeningElement(node, print) {\n\t this.push(\"<\");\n\t print.plain(node.name);\n\t if (node.attributes.length > 0) {\n\t this.push(\" \");\n\t print.join(node.attributes, { separator: \" \" });\n\t }\n\t this.push(node.selfClosing ? \" />\" : \">\");\n\t}", "function serializeElement (node, context, eventTarget) {\n var c, i, l;\n var name = node.nodeName.toLowerCase();\n\n // opening tag\n var r = '<' + name;\n\n // attributes\n for (i = 0, c = node.attributes, l = c.length; i < l; i++) {\n r += ' ' + exports.serializeAttribute(c[i]);\n }\n\n r += '>';\n\n // child nodes\n r += exports.serializeNodeList(node.childNodes, context, null, eventTarget);\n\n // closing tag, only for non-void elements\n if (!voidElements[name]) {\n r += '</' + name + '>';\n }\n\n return r;\n}", "toString() {\n return \"<\" + this.toStringInner() + \">\";\n }", "function createElement(tag,attrs,parent)\n{\n\tattrs = attrs || { };\n\tvar ele = document.createElement( tag );\n\tsetAttributes( ele, attrs);\n\tif ( parent ) \n\t\tparent.appendChild( ele );\n\treturn ele;\n}", "function serializeElement(node, context, eventTarget) {\n var c, i, l;\n var name = node.nodeName.toLowerCase();\n\n // opening tag\n var r = '<' + name;\n\n // attributes\n for (i = 0, c = node.attributes, l = c.length; i < l; i++) {\n r += ' ' + exports.serializeAttribute(c[i]);\n }\n\n r += '>';\n\n // child nodes\n r += exports.serializeNodeList(node.childNodes, context, null, eventTarget);\n\n // closing tag, only for non-void elements\n if (!voidElements[name]) {\n r += '</' + name + '>';\n }\n\n return r;\n}", "function createElement(tag, content, attributes) {\n var el = document.createElement(tag);\n if(content) {\n el.innerHTML = content;\n }\n\n _.each(attributes, function(val, attr) {\n el.setAttribute(attr, val);\n });\n\n return el;\n }", "constructor(parser) { super(JXONAttribute.TAG, parser) }", "function createXml(rxtFile){\n\t\tvar content=rxtFile.content.toString();\n\t\t\n\t\t\n\t\tvar fixedContent=content.replace('<xml version=\"1.0\"?>',EMPTY)\t\t\n\t\t\t\t\t .replace('</xml>',EMPTY);\n\t\treturn new XML(fixedContent);\n\t}", "static createContainerXML() {\n let content = '';\n content += '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\\n';\n content += '<container version=\"1.0\" xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\">\\n';\n content += ' <rootfiles>\\n';\n content += ' <rootfile full-path=\"OEBPS/content.opf\" media-type=\"application/oebps-package+xml\"/>\\n';\n content += ' </rootfiles>\\n';\n content += '</container>\\n';\n return content;\n }", "function XMLWriter( encoding, version ){\n\tif( encoding )\n\t\tthis.encoding = encoding;\n\tif( version )\n\t\tthis.version = version;\n}", "function createSVGElement(tag,attributes,appendTo) {\n\t\tvar element = document.createElementNS('http://www.w3.org/2000/svg',tag);\n\t\tattr(element,attributes);\n\t\tif (appendTo) {\n\t\t\tappendTo.appendChild(element);\n\t\t}\n\t\treturn element;\n\t}", "function createElementNsOptional(namespace, tagName) {\n if (namespace === \"\") {\n return document.createElement(tagName);\n } else {\n return document.createElementNS(namespace, tagName);\n }\n }", "tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }" ]
[ "0.68416274", "0.6388546", "0.6172389", "0.6172389", "0.6143003", "0.6018994", "0.6016187", "0.59621674", "0.5952655", "0.5907922", "0.5903759", "0.58211493", "0.58099604", "0.58099604", "0.5798369", "0.5760406", "0.57307625", "0.57222605", "0.5701785", "0.5634361", "0.5619803", "0.5590141", "0.55681276", "0.55680245", "0.55381364", "0.55304074", "0.5520908", "0.55113894", "0.5506724", "0.5506724", "0.5493324", "0.5461581", "0.54525065", "0.54437006", "0.5439235", "0.5435829", "0.54331386", "0.5433021", "0.5419134", "0.54112345", "0.5409471", "0.5390608", "0.53847253", "0.5384168", "0.5370412", "0.5370412", "0.5370412", "0.5370412", "0.5367069", "0.53667843", "0.53656584", "0.53656584", "0.53601223", "0.534083", "0.5338615", "0.5311137", "0.53062886", "0.5305797", "0.5305797", "0.53052485", "0.5299971", "0.5299861", "0.52987695", "0.5283598", "0.5271399", "0.52712935", "0.52557844", "0.52555454", "0.5251622", "0.52496856", "0.5247156", "0.5247156", "0.5245707", "0.5239327", "0.5236961", "0.5236961", "0.5228315", "0.522247", "0.52224684", "0.5219533", "0.5219533", "0.52185804", "0.52185804", "0.52059823", "0.5204725", "0.519904", "0.519904", "0.5197254", "0.5196561", "0.51894486", "0.5182961", "0.518266", "0.5176686", "0.516943", "0.5164154", "0.51632845", "0.5154585", "0.5151216", "0.5150826" ]
0.6426543
2
Hint: it may be helpful to get the height of your BST
function isBalanced(root) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BSTHeight(tree) {\n if (!tree.key) return 0;\n \n let left = 0, right = 0;\n\n if (!tree.left && !tree.right) {\n return 1;\n }\n \n if (tree.left) {\n left = BSTHeight(tree.left);\n }\n\n if (tree.right) {\n right = BSTHeight(tree.right);\n }\n\n return Math.max(left, right) + 1;\n}", "heightOfTree(root) {\n if (root === null) {\n return 0;\n }\n let leftHeight = this.heightOfTree(root.left);\n let rightHeight = this.heightOfTree(root.right);\n return 1 + Math.max(leftHeight, rightHeight)\n\n }", "function getHeight(root) {}", "function heightoftree(tree) {\n if (tree.left && tree.right)\n return Math.max(heightoftree(tree.left), heightoftree(tree.right)) + 1;\n if (tree.left) return heightoftree(tree.left) + 1;\n if (tree.right) return heightoftree(tree.right) + 1;\n return 1;\n}", "function getTreeHeight(){\r\n\t\tvar res = 0;\r\n\t\tvar addingHeight = 1;\r\n\t\tif(this.name == \"\")\r\n\t\t\taddingHeight = 0;\r\n\t\t\r\n\t\tif(this.expanded){\r\n\t\t\tfor(var i = 0; i < this.childCount; i++){\r\n\t\t\t\tvar tmp = this.child[i].getHeight();\r\n\t\t\t\tif(tmp > res)\r\n\t\t\t\t\tres = tmp\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn res + addingHeight;\r\n\t\t\r\n\t}", "function bstHeight(bst, left = 0, right = 0) {\n if (bst.key === null) {\n return 0;\n }\n\n if (!bst.left && !bst.right) {\n return 1;\n }\n if (bst.left) {\n left = 1 + bstHeight(bst.left, left, right);\n }\n if (bst.right) {\n right = 1 + bstHeight(bst.right, left, right);\n }\n return left > right ? left : right;\n}", "function height(bst) {\n //if current node is null\n if(!bst) {\n return 0;\n } else {\n // traverse through left and right nodes until you reach null \n if (bst.left && !bst.right) {\n return 1 + height(bst.left);\n } else if (bst.right && !bst.left) {\n return 1 + height(bst.right);\n } else if (!bst.right && !bst.left) {\n return 1;\n } else {\n return 1 + max(height(bst.left), height(bst.right));\n }\n }\n}", "getHeight(){\n let maxHeight = 0;\n const stack = [{node: this, height: 0}];\n while(stack.length){\n const next = stack.pop();\n if(next.height > maxHeight){\n maxHeight = next.height;\n }\n if(next.node.left){\n stack.push({node: next.node.left, height: next.height + 1});\n }\n if(next.node.right){\n stack.push({node: next.node.right, height: next.height + 1});\n }\n }\n return maxHeight;\n }", "calculateHeightH(node) {\n if (node.key === \"null\") return 0\n else {\n var left = this.calculateHeightH(node.left);\n var right = this.calculateHeightH(node.right);\n this.treedpth = Math.max(left, right) + 1;\n } \n }", "height(node)\n {\n //your code here\n if(node==null)\n return 0\n else{\n return 1+Math.max(this.height(node.left), this.height(node.right))\n }\n }", "function height(tree) {\n if (!tree.value) {\n return \"not found\"\n\n }\n hLeft = [],\n hRigth = []\n\n\n function hRigthfnc() {\n if (tree.right) {\n height(tree.right),\n hRigth++\n }\n\n if (hRigth > hLeft) {\n return hRigth - 1\n }\n }\n\n\n function hLeftfnc() {\n if (tree.left) {\n height(tree.left),\n hLeft++\n }\n\n if (hLeft > hRigth) {\n return hLeft - 1\n }\n }\n return \" melhor percorrimento pela direita: \" + hRigthfnc() + \" melhor percorrimento pela esquerda: \" + hLeftfnc()\n // if (hRigthfnc() > hLeftfnc()) {\n // return hRigthfnc() + \" Rota pela direita\"\n // }\n // else {\n // return hLeftfnc() + \" Rota pela Esquerda\"\n // }\n}", "function findHeight(tree) {\n //returns the height (0) if tree is empty\n if (!tree) {\n return -1;\n }\n\n //check if there's a left tree\n //check if there's a right tree\n //if there's neither, return 1\n if (!tree.left && !tree.right) {\n return 0;\n }\n //set initial value of height for comparison\n let height = 0;\n\n //if there's a left tree\n if (tree.left) {\n //define leftHeight as the value of all occurrences of this function\n //this value increments by one each time the function runs\n let leftHeight = 1 + findHeight(tree.left);\n leftHeight > height && (height = leftHeight);\n }\n if (tree.right) {\n //define rightHeight as the value of all occurrences of this function\n //this value increments by one each time the function runs\n let rightHeight = 1 + findHeight(tree.right);\n rightHeight > height && (height = rightHeight);\n }\n return height;\n}", "function heightOf(tree, count=0){\n if (!tree){\n return count;\n } else {\n count++;\n }\n return Math.max(\n heightOf(tree.left, count),\n heightOf(tree.right, count)\n );\n}", "function heightOfBST(bst) {\n let leftHeight = 0;\n let rightHeight = 0;\n\n if(!bst) {\n return 0;\n }\n else {\n leftHeight = heightOfBST(bst.left);\n rightHeight = heightOfBST(bst.right);\n if (leftHeight > rightHeight) {\n return leftHeight++;\n }\n else {\n return rightHeight++;\n }\n }\n}", "height(currentNode) {\n // Default currentNode to root\n currentNode = currentNode || this.root;\n var heightRight = -1;\n var heightLeft = -1;\n if(currentNode.right) {\n heightRight = this.height(currentNode.right);\n }\n if(currentNode.left) {\n heightLeft = this.height(currentNode.left);\n }\n if(heightRight > heightLeft) {\n heightRight++;\n return heightRight;\n }\n else {\n heightLeft++;\n return heightLeft;\n }\n }", "function bstHeight(bst) {\n if (bst === null) {\n return 0;\n } else {\n let heightL = bstHeight(bst.left);\n let heightR = bstHeight(bst.right);\n if (heightL > heightR) {\n return heightL + 1;\n } else {\n return heightR + 1;\n }\n }\n}", "function find_height(root) \n{\n let result = dfs(root);\n return result;\n}", "function getHeight(node) {\n if (node === null) {\n return -1;\n }\n let left = 1 + getHeight(node.left);\n let right = 1 + getHeight(node.right);\n return Math.max(left, right);\n}", "function BinarySearchTree() {\n this.insert = function(root, data) {\n if (root === null) {\n this.root = new Node(data);\n \n return this.root;\n }\n \n if (data <= root.data) {\n if (root.left) {\n this.insert(root.left, data);\n } else {\n root.left = new Node(data);\n }\n } else {\n if (root.right) {\n this.insert(root.right, data);\n } else {\n root.right = new Node(data);\n }\n }\n \n return this.root;\n };\n\nthis.getHeight = function(root) {\n\n // Add your code here\n let rightCount = 0;\n let leftCount = 0;\n \n function searchRight(node){\n let currentNode;\n\n if(node.right){\n rightCount++;\n currentNode = node.right;\n searchRight(currentNode);\n } else if(node.left){\n rightCount++;\n currentNode = node.left;\n searchRight(currentNode);\n }\n }\n\n function searchLeft(node){\n let currentNode;\n \n if(node.left){\n leftCount++;\n currentNode = node.left;\n searchLeft(currentNode);\n } else if(node.right){\n leftCount++;\n currentNode = node.right;\n searchLeft(currentNode);\n }\n }\n \n searchRight(root);\n searchLeft(root);\n \n if(leftCount > rightCount) {\n return leftCount;\n } else {\n return rightCount;\n }\n}\n\n}", "height() {\n return this.heightVisitor(this.root)\n }", "get height() {\n return Math.max(this.leftSubtreeHeight, this.rightSubtreeHeight);\n }", "height(node) {\n if (node == null) return 0;\n return node.height;\n }", "function treeHeight(node) {\n\n if (!node) {\n return 0;\n }\n\n return 1 + Math.max(treeHeight(node.left), treeHeight(node.right));\n}", "getHeight(node) {\n if (node == null) return -1;\n return Math.max(this.getHeight(node.left), this.getHeight(node.right)) + 1;\n }", "function height(node) {\n if (node == null) {\n return 0;\n }\n return 1 + Math.max(height(node.left), height(node.right));\n }", "GetTreeHeight() {\n return this.m_contactManager.m_broadPhase.GetTreeHeight();\n }", "function findHeight(node, counter = 0) {\n // console.log(currentNode);\n // console.log(bst);\n if (!node) {\n return counter;\n }\n //if has both\n if (node.right) {\n findHeight(node.right, counter++);\n }\n\n if (node.left) {\n findHeight(node.left, counter++);\n }\n\n return counter + 1;\n}", "function findHeightTwo(tree) {\n if (tree === null) {\n return -1;\n }\n let parent = tree.parent;\n let left = findHeightTwo(tree.left);\n let right = findHeightTwo(tree.right);\n\n if (left > right) {\n return left + 1;\n } else {\n return right + 1;\n }\n}", "function heightOfABinaryTree(tree) {\n const stack = [];\n const recursive = (tree, count) => {\n if(!tree) return null;\n if(!tree.left && !tree.right) {\n stack.push(count);\n }\n !!tree.left && recursive(tree.left, count+1);\n !!tree.right && recursive(tree.right, count+1);\n }\n recursive(tree, 0);\n return Math.max.apply(null, stack);\n}", "function getMaxHeight(root) {\n if (!root) return -1; // 1) base case if there's no root, height = -1\n return Math.max(getMaxHeight(root.left), getMaxHeight(root.right)) + 1; // 2) recursive call. \"+ 1\" is the height of the current root nodes height\n}", "getHeight(curr){\n if(curr == null){\n return 0;\n }else{\n let leftHeight = getHeight(curr.left);\n let rightHeight = getHeight(curr.right);\n\n if(leftHeight > rightHeight){\n return leftHeight+1;\n }else{\n return rightHeight+1;\n }\n }\n }", "function diameterOfBinaryTree(root) {\n let longest = 0\n getHeight(root)\n return longest\n\n function getHeight(root) {\n if (root) {\n let left = getHeight(root.left)\n let right = getHeight(root.right)\n longest = Math.max(longest, left + right) \n return Math.max(left, right) + 1\n } else {return 0}\n }\n\n}", "function heightOfTree(root) {\n let depth = 0;\n\n const dfs = (node, levels) => {\n if (!node) return 0;\n if (levels > depth) depth = levels;\n for (let child of node.children) {\n dfs(child, levels + 1)\n }\n\n return levels;\n }\n\n dfs(root, 0)\n return depth;\n}", "findMinHeight(node = this.root){\n if (node == null){\n return 0;\n }\n \n if (node.left == null && node.right == null){\n return 1;\n }\n\n if (node.left == null){\n return this.findMinHeight(node.right) + 1;\n }\n\n if (node.right == null){\n return this.findMinHeight(node.left) + 1;\n }\n return Math.min(this.findMinHeight(node.left),this.findMinHeight(node.right)) +1;\n }", "get height(): number {\n return this._height(this.root);\n }", "function maxHeightOfTree(element) {\n\t\tvar height = element.outerHeight(true);\n\t\telement.children().each(function () {\n\t\t\tvar curHeight = maxHeightOfTree($(this));\n\t\t\tif (curHeight > height) {\n\t\t\t\theight = curHeight;\n\t\t\t}\n\t\t});\n\t\treturn height;\n\t}", "function BSTMax(){\n var walker = this.root;\n while (walker.right != null){\n walker = walker.right;\n }\n return walker.val;\n }", "function Btnode(val){\n this.val = val;\n this.left = null;\n this.right = null;\n this.parent = null;\n this.height = function(){\n if(this.left){\n var lHeight = this.left.height();\n } else{\n var lHeight = 0;\n }\n if(this.right){\n var rHeight = this.right.height();\n } else{\n var rHeight = 0;\n }\n return 1 + Math.max(lHeight, rHeight);\n }\n}", "function getMaxTree(node) {}", "get height()\n\t{\n\t\tlet height = Math.max(this._height, this.minHeight);\n\n\t\tif (this.tree.theme.hasGridBehavior)\n\t\t{\n\t\t\tlet step = this.tree.theme.gridSize;\n\t\t\theight = Math.ceil(height / step) * step;\n\t\t}\n\n\t\treturn height;\n\t}", "maxDepth () {\n\t\tif (this.root === null) return 0;\n\n\t\tconst longest = (node) => {\n\t\t\tif (node.left === null && node.right === null) return 1;\n\t\t\tif (node.left === null) return longest(node.right) + 1;\n\t\t\tif (node.right === null) return longest(node.left) + 1;\n\t\t\treturn Math.max(longest(node.left), longest(node.right)) + 1;\n\t\t};\n\n\t\treturn longest(this.root);\n\t}", "function minHeightBst(array) {\n // Write your code here.\n return constructTree(array, 0, array.length - 1);\n}", "function minHeightBst(array) {\n // Write your code here.\n return buildTree(array, null, 0, array.length - 1);\n}", "height() {\n return this.heightHelper(this.root, 0)\n }", "maxDepth() {\n // check if root exists. \n if (!this.root) return 0;\n\n function minDepthLeftHelper(node) {\n // is leaf node?\n if (node.left === null && node.right === null) return 1;\n if (node.left !== null) return minDepthLeftHelper(node.left) + 1; \n }\n\n function minDepthRightHelper(node) {\n // is leaf node?\n if (node.left === null && node.right === null) return 1;\n if (node.right !== null) return minDepthLeftHelper(node.right) + 1; \n }\n\n let leftNodes = minDepthLeftHelper(this.root);\n let rightNodes = minDepthRightHelper(this.root);\n\n return Math.max(leftNodes, rightNodes);\n }", "size() {\n let _size = node => node === null ? 0 : 1 + _size(node.left) + _size(node.right)\n return _size(this.root)\n }", "function main() {\n let numArr = [3, 1, 4, 6, 9, 2, 5, 7];\n let result = insertNumBst(numArr);\n // tree(result); \n console.log(height(result));\n\n let fakeTree ={key: 3, left:{key: 5}};\n console.log(bstChecker(result));\n bstChecker(fakeTree)\n\n let letterArr = ['E', 'A', 'S', 'Y', 'Q', 'U', 'E', 'S', 'T', 'I', 'O', 'N'];\n insertLettersBst(letterArr);\n}", "maxDepth() {\n if (this.root === null) return 0;\n let depth = 1;\n let nodesToVisit = [this.root];\n\n while (nodesToVisit.length){\n\n let current = nodesToVisit.pop();\n if ((current.left !== null) || current.right !== null){\n depth++;\n }\n\n if (current.left !== null){\n nodesToVisit.push(current.left);\n }\n if (current.right !== null){\n nodesToVisit.push(current.right);\n }\n }\n return depth;\n }", "function maxLevel(node,height=0){\n\tvar sum=0;\n\tif('children' in node) {\n\t\tfor(var i=0,tot=node.children.length;i<tot;i++){\n\t\t\tsum = sum+maxLevel(node.children[i],height)\n\t\t}\n\t\tsum=sum+height;\n\t}\n\treturn sum+height;\n}", "height() {\n return this.root ? this.root.height() : 0;\n }", "maxSum() {\n if (this.root === null) return 0;\n let sum = this.root.val;\n let nodesToVisit = [this.root];\n\n while (nodesToVisit.length){\n\n let current = nodesToVisit.pop();\n\n if ((current.left === null) && (current.right === null)){\n sum = sum;\n }\n\n else if ((current.left !== null) && (current.right === null)){\n sum = sum + current.left.val;\n nodesToVisit.push(current.left)\n }\n\n else if ((current.left === null) && (current.right !== null)){\n sum = sum + current.right.val;\n nodesToVisit.push(current.right) \n }\n\n else if (current.left.val > current.right.val){\n sum = sum + current.left.val;\n nodesToVisit.push(current.left)\n }\n\n else {\n sum = sum + current.right.val;\n nodesToVisit.push(current.right)\n }\n }\n return sum;\n }", "function getSlot(i,a){var slot=i>>5*a.height;while(a.lengths[slot]<=i){slot++;}return slot;}// Recursively creates a tree with a given height containing", "findMaxValue() {\n\n let current = this.root;\n\n const findMax = (node) => {\n if (node === null) {\n return;\n }\n\n let actualMax = node.value;\n let leftSideMax = findMax(node.left);\n let rightSideMax = findMax(node.right);\n\n if (leftSideMax > actualMax) {\n actualMax = leftSideMax;\n }\n\n if (rightSideMax > actualMax) {\n actualMax = rightSideMax;\n }\n\n return actualMax;\n };\n\n return findMax(current);\n }", "get minHeight()\n\t{\n\t\treturn Math.max(this.tree.theme.nodeMinHeight,\n\t\t\tthis.tree.theme.nodeHeaderSize + this.input.height) + 3;\n\t}", "checkHeightCorrect () {\n if (!Object.prototype.hasOwnProperty.call(this, 'key')) { return } // Empty tree\n\n if (this.left && this.left.height === undefined) { throw new Error('Undefined height for node ' + this.left.key) }\n if (this.right && this.right.height === undefined) { throw new Error('Undefined height for node ' + this.right.key) }\n if (this.height === undefined) { throw new Error('Undefined height for node ' + this.key) }\n\n const leftH = this.left ? this.left.height : 0\n const rightH = this.right ? this.right.height : 0\n\n if (this.height !== 1 + Math.max(leftH, rightH)) { throw new Error('Height constraint failed for node ' + this.key) }\n if (this.left) { this.left.checkHeightCorrect() }\n if (this.right) { this.right.checkHeightCorrect() }\n }", "maxDepth() {\n if (!this.root) {\n return 0;\n }\n\n const solver = (node) => {\n if (node.left === null && node.right === null) {\n return 1;\n }\n if (node.left === null) {\n return solver(node.right) + 1;\n }\n if (node.right === null) {\n return solver(node.left) + 1;\n }\n return Math.max(solver(node.left), solver(node.right)) + 1;\n };\n return solver(this.root);\n }", "function heightBalanced(root) {\n if (!root) {\n return true\n }\n let leftHeight = height(root.left)\n console.log(leftHeight)\n let rightHeight = height(root.right)\n console.log(rightHeight)\n if (Math.abs(leftHeight - rightHeight) <= 1 && heightBalanced(root.left) && heightBalanced(root.right)) {\n return true\n } else {\n return false\n }\n}", "getBalancedBST() {\r\n const balancedBST = new BST(\r\n this.rootX,\r\n this.rootY,\r\n this.rootDeltaX,\r\n this.rootDeltaY\r\n );\r\n const inorderNodes = this.inorderNodes();\r\n let n = inorderNodes.length;\r\n if (!n > 0) return;\r\n\r\n const q = [];\r\n let lo = 0;\r\n let hi = n - 1;\r\n q.push([lo, hi]);\r\n\r\n while (q.length !== 0) {\r\n [lo, hi] = q.shift();\r\n if (lo <= hi) {\r\n const mid = lo + Math.floor((hi - lo) / 2);\r\n const midNode = inorderNodes[mid];\r\n\r\n balancedBST.put(midNode.key, midNode.value);\r\n q.push([lo, mid - 1]);\r\n q.push([mid + 1, hi]);\r\n }\r\n }\r\n return balancedBST;\r\n }", "function calculateHeights() {\n\t var _this7 = this;\n\n\t var maxRTT = max(this.rootToTipLengths());\n\t this.nodeList.forEach(function (node) {\n\t return node._height = _this7.origin - _this7.offset - (maxRTT - _this7.rootToTipLength(node));\n\t });\n\t this.heightsKnown = true;\n\t this.treeUpdateCallback();\n\t}", "minDepth() {\n\n // check if root exists. \n if (!this.root) return 0;\n\n function minDepthLeftHelper(node) {\n // is leaf node?\n if (node.left === null && node.right === null) return 1;\n if (node.left !== null) return minDepthLeftHelper(node.left) + 1; \n }\n\n function minDepthRightHelper(node) {\n // is leaf node?\n if (node.left === null && node.right === null) return 1;\n if (node.right !== null) return minDepthLeftHelper(node.right) + 1; \n }\n\n let leftNodes = minDepthLeftHelper(this.root);\n let rightNodes = minDepthRightHelper(this.root);\n\n return Math.min(leftNodes, rightNodes);\n }", "max(){\r\n if(this.isEmpty()){\r\n console.log(\"Tree is empty!\");\r\n return null;\r\n }\r\n let runner = this.root;\r\n while(runner.right != null){\r\n runner = runner.right;\r\n }\r\n return runner.value;\r\n }", "function diameterBST(tree) {\n let diameter = 0;\n\n function maxDepth(tree) {\n if (tree === null) return 0;\n\n let left = maxDepth(tree.left);\n let right = maxDepth(tree.right);\n\n diameter = Math.max(diameter, left + right);\n return Math.max(left, right) + 1;\n }\n\n maxDepth(tree);\n\n return diameter;\n}", "minDepth() {\n\n if (this.root === null) return 0;\n let depth = 1;\n let nodesToVisit = [this.root];\n let leafFound = false;\n\n while (!leafFound){\n\n let current = nodesToVisit.shift();\n\n if ((current.left === null) && (current.right === null)){\n leafFound = true;\n }\n\n else{\n depth++;\n nodesToVisit.push(current.left);\n nodesToVisit.push(current.right);\n }\n }\n\n return depth;\n }", "testBlackHeightProperty(node) {\n let height = 0;\n let heightLeft = 0;\n let heightRight = 0;\n if (node.color == RB_TREE_COLOR_BLACK) {\n height++;\n }\n if (node.left != this.nil_node) {\n heightLeft = this.testBlackHeightProperty(node.left);\n }\n else {\n heightLeft = 1;\n }\n if (node.right != this.nil_node) {\n heightRight = this.testBlackHeightProperty(node.right);\n }\n else {\n heightRight = 1;\n }\n if (heightLeft != heightRight) {\n throw new Error('Red-black height property violated');\n }\n height += heightLeft;\n return height;\n }", "heightSelection(nodes) {\n return this.state.heightGr + nodes.length * 30 \n }", "findMax() {\n\n // It will keep the last data until current right is null\n let current = this.root;\n while (current.right !== null) {\n current = current.right;\n }\n\n return current.data;\n }", "numGreater(lowerBound) {\n let count = 0;\n if (this.root === null){\n return count;\n }\n const stack = [this.root];\n while (stack.length){\n const currentNode = stack.pop();\n if (currentNode.val > lowerBound){\n count++;\n }\n for (let child of currentNode.children){\n stack.push(child);\n }\n }\n return count;\n }", "height(N) {\n if (N == null) return 0;\n\n return N.height;\n }", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n }", "minDepth() {\n if (!this.root) {\n return 0;\n }\n const solver = (node) => {\n if (node.left === null && node.right === null) {\n return 1;\n }\n if (node.left === null) {\n return solver(node.right) + 1;\n }\n if (node.right === null) {\n return solver(node.left) + 1;\n }\n return Math.min(solver(node.left), solver(node.right)) + 1;\n };\n return solver(this.root);\n }", "function computeHeight(revs) {\n\t var height = {};\n\t var edges = [];\n\t traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n\t var rev = pos + \"-\" + id;\n\t if (isLeaf) {\n\t height[rev] = 0;\n\t }\n\t if (prnt !== undefined) {\n\t edges.push({from: prnt, to: rev});\n\t }\n\t return rev;\n\t });\n\t\n\t edges.reverse();\n\t edges.forEach(function (edge) {\n\t if (height[edge.from] === undefined) {\n\t height[edge.from] = 1 + height[edge.to];\n\t } else {\n\t height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n\t }\n\t });\n\t return height;\n\t}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev$$1 = pos + \"-\" + id;\n if (isLeaf) {\n height[rev$$1] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev$$1});\n }\n return rev$$1;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev$$1 = pos + \"-\" + id;\n if (isLeaf) {\n height[rev$$1] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev$$1});\n }\n return rev$$1;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n merge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n merge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "computeMaxDepth() {\n let d = 0;\n for (const child of this.components) {\n d = Math.max(d + 1, child.children.computeMaxDepth());\n }\n return d;\n }", "function computeHeight(revs) {\n\t var height = {};\n\t var edges = [];\n\t traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n\t var rev$$1 = pos + \"-\" + id;\n\t if (isLeaf) {\n\t height[rev$$1] = 0;\n\t }\n\t if (prnt !== undefined) {\n\t edges.push({from: prnt, to: rev$$1});\n\t }\n\t return rev$$1;\n\t });\n\n\t edges.reverse();\n\t edges.forEach(function (edge) {\n\t if (height[edge.from] === undefined) {\n\t height[edge.from] = 1 + height[edge.to];\n\t } else {\n\t height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n\t }\n\t });\n\t return height;\n\t}", "getHeight() {\n return this.$node.innerHeight();\n }", "function height(n) {\n if (n !== null) {\n return n.h;\n } else {\n return 0;\n }\n}", "function computeHeight(revs) {\n var height = {};\n var edges = [];\n pouchdbMerge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {\n var rev = pos + \"-\" + id;\n if (isLeaf) {\n height[rev] = 0;\n }\n if (prnt !== undefined) {\n edges.push({from: prnt, to: rev});\n }\n return rev;\n });\n\n edges.reverse();\n edges.forEach(function (edge) {\n if (height[edge.from] === undefined) {\n height[edge.from] = 1 + height[edge.to];\n } else {\n height[edge.from] = Math.min(height[edge.from], 1 + height[edge.to]);\n }\n });\n return height;\n}", "function BSTMin(){\n var walker = this.root;\n while (walker.left != null){\n walker = walker.left;\n }\n return walker.val;\n }", "function findBottomLeftValue(root) {\n let queue = [root];\n let results = [];\n while (queue.length > 0) {\n let qSize = queue.length;\n let level = [];\n for (let i = 0; i < qSize; i++) {\n let curr = queue.shift();\n if (curr.left) {\n queue.push(curr.left);\n }\n if (curr.right) {\n queue.push(curr.right);\n }\n level.push(curr.val);\n }\n results.push(level);\n }\n return results[results.length - 1][0];\n}", "findMax() {\n let current = this.root;\n // Loop until the rightmost node (no right subtree).\n while (current.right !== null) {\n current = current.right;\n }\n return current.data;\n }", "function heightestChild(elem)\r\n{\r\n\tvar t=0;\r\n\tvar t_elem;\r\n\t$J(\"*\",elem).each(function () {\r\n\t if ( $J(this).outerHeight(true) > t ) {\r\n\t t_elem=$J(this);\r\n\t t=t_elem.outerHeight(true);\r\n\t }\r\n\t});\r\n\t// we care about the heighest\r\n\tif (elem.outerHeight(true) > t)\r\n\t{\r\n\t\tt = elem.outerHeight(true);\r\n\t}\r\n\r\n\t//return elem.outerHeight(true);\r\n\treturn t+3; // hotfix\r\n}", "function Bst(){\n this.root = null;\n \n //make an isEmpty function to use throughout the other methods\n this.isEmpty = function(){\n if(this.root){\n return false;\n } else{\n return true;\n }\n }\n \n //make an add function to add new UNIQUE nodes to the bst\n this.add = function(val){\n nNode = new Btnode(val);\n \n //check if the bst is empty, if it is, then set the root to the new node\n if(this.isEmpty()){\n this.root = nNode;\n return this;\n }\n \n //set a runner variable to the root of the bst\n var r = this.root; \n while(r){\n if(nNode.val < r.val && r.left == null){\n nNode.parent = r;\n r.left = nNode;\n return this;\n }\n else if(nNode.val > r.val && r.right == null){\n nNode.parent = r;\n r.right = nNode;\n return this;\n }\n else if(nNode.val == r.val){\n return this;\n }\n else if(nNode.val < r.val){\n r = r.left;\n }\n else{\n r = r.right;\n }\n }\n return false;\n }\n \n //check the bst to see if it contains the given value\n this.contains = function(val){\n var r = this.root;\n while(r){\n if(val == r.val){\n return true;\n }\n else if(val < r.val){\n r = r.left;\n }\n else{\n r = r.right;\n }\n }\n return false;\n }\n \n //add get min method\n this.min = function(){\n if(this.isEmpty()){\n return false;\n }\n var r = this.root;\n while(r.left){\n r = r.left;\n }\n return r.val;\n }\n \n //add get max method\n this.max = function(){\n if(this.isEmpty()){\n return false;\n }\n var r = this.root;\n while(r.right){\n r = r.right;\n }\n return r.val;\n }\n \n //add isValid method using recursion\n this.isValid = function(r){\n if(r === undefined){ var r = this.root; }\n if(r === null){ return true; }\n if(( r.left === null || r.left.val < r.val ) &&( r.right === null || r.right.val > r.val )){\n return this.isValid(r.left) && this.isValid(r.right);\n } else {\n return false;\n }\n }\n \n //add size method using recursion\n this.size = function(r){\n if(r === undefined){ var r = this.root; }\n if(r === null){ return 0; }\n return this.size(r.left) + this.size(r.right) + 1;\n }\n \n this.remove = function(value){\n //if the bst doesn't contain the value, return the bst and don't remove anything\n if(!this.contains(value)){\n return this;\n }\n var r = this.root;\n while(r){\n //if r is the value we want to remove\n if(r.val == value){\n //if r is the value and r has no connection and we are at the root (avoid pulling val from null)\n if(r.left === null && r.right === null && r.parent == null){\n this.root = null;\n return this;\n }\n //if r is the value and r has no connection and is not parent\n else if(r.left === null && r.right === null){\n if(r.parent.val > r.val){\n r.parent.left = null;\n } else{\n r.parent.right = null;\n }\n return this;\n }\n //if r is the value and r has a right connection\n else if(r.left === null){\n if(r.parent.val > r.val){\n r.parent.left = r.right;\n } else{\n r.parent.right = r.right;\n }\n return this;\n }\n //if r is the value and r has a left connection\n else if(r.right === null){\n if(r.parent.val > r.val){\n r.parent.left = r.left;\n } else{\n r.parent.right = r.left;\n }\n return this;\n }\n //if r is the value and has both a left and right connection, search the left side for the maximum and swap values\n else{\n var max = r.left;\n //find max on the left side of r\n while(max){\n if(max.right){\n var temp = max;\n max = max.right;\n max.parent = temp;\n }\n }\n r.val = max.val;\n if(max.parent.right == max){\n max.parent.right = null;\n }\n return this;\n }\n }\n //r doesn't match so go left if it's too big\n else if(r.val > value){\n r.left.parent = r;\n r = r.left;\n }\n //r doesn't match so go right if it's too small\n else{\n r.right.parent = r;\n r = r.right;\n }\n }\n }\n \n //using the BstNode height function, we can find out the longest branch from the tree root\n this.height = function(){\n if(this.root === null){\n return 0;\n }\n return this.root.height();\n }\n \n //checking balance based on the definition that a 'balanced' tree has a branch (left and right) that are within 1 height increment away from eachother\n this.balanced = function(){\n if(this.root === null){\n return true;\n }\n if(Math.abs(this.root.left.height() - this.root.right.height()) <= 1){\n return true;\n } else{\n return false;\n }\n }\n}", "max() {\n let current = this.root\n if (current == null)\n return null\n while (current.right != null)\n current = current.right\n return current.content\n }", "function minHeightTree(arr = []) {\n const mid = Math.floor((arr.length - 1) / 2);\n const root = new Node(arr[mid]);\n\n const leftArr = arr.slice(0, mid);\n if (leftArr.length > 0) {\n root.left = minHeightTree(leftArr);\n }\n\n const rightArr = arr.slice(mid + 1, arr.length);\n if (rightArr.length > 0) {\n root.right = minHeightTree(rightArr);\n }\n\n return root;\n}", "minDepth () {\n\t\tif (this.root === null) return 0;\n\n\t\tconst shortest = (node) => {\n\t\t\tif (node.left === null && node.right === null) return 1;\n\t\t\tif (node.left === null) return shortest(node.right) + 1;\n\t\t\tif (node.right === null) return shortest(node.left) + 1;\n\t\t\treturn Math.min(shortest(node.left), shortest(node.right)) + 1;\n\t\t};\n\n\t\treturn shortest(this.root);\n\t}", "numGreater(lowerBound) {\n let count = 0;\n if ([this.root][0] === null) return 0;\n const totalValues = [this.root];\n while (totalValues.length) {\n let current = totalValues.pop();\n if (current.val > lowerBound) {\n count = count + 1;\n }\n if (current.children) {\n for (let child of current.children) {\n totalValues.push(child);\n }\n }\n } return count;\n }", "getLevelHeight() {\n return this.level.tilesHigh;\n }", "get nodeSize() {\n return this.isLeaf ? 1 : 2 + this.content.size;\n }", "max() {\n let currentNode = this.root;\n // continue traversing right until no more children\n while(currentNode.right) {\n currentNode = currentNode.right;\n }\n return currentNode.value;\n }", "get height() {}", "get balanceFactor() {\n return this.leftSubtreeHeight - this.rightSubtreeHeight;\n }", "height() {\n return this.headPos().y - this.rootMesh.getAbsolutePosition().y;\n }" ]
[ "0.79384416", "0.7804322", "0.7765133", "0.7689893", "0.7654854", "0.76354414", "0.7625294", "0.75867087", "0.75360733", "0.7525977", "0.75185895", "0.7499543", "0.7476348", "0.74641347", "0.7440004", "0.74331814", "0.7379618", "0.735894", "0.7308425", "0.7269455", "0.72486943", "0.7241533", "0.722225", "0.72005886", "0.71449214", "0.71217835", "0.70940936", "0.7055415", "0.70077026", "0.7002095", "0.7000184", "0.6982669", "0.68981487", "0.6885494", "0.6865383", "0.6852922", "0.68027025", "0.67944914", "0.6741239", "0.66881555", "0.6684218", "0.66794527", "0.66765964", "0.66422606", "0.6627949", "0.660812", "0.65830594", "0.65616465", "0.65606093", "0.6513198", "0.64275336", "0.64273447", "0.64145064", "0.6412595", "0.6394886", "0.6363721", "0.63613975", "0.63519275", "0.6339544", "0.6336786", "0.6320986", "0.6319754", "0.62991583", "0.62842727", "0.6233624", "0.623287", "0.621883", "0.62037927", "0.61980295", "0.6179327", "0.6179049", "0.61722684", "0.61722684", "0.61722684", "0.61722684", "0.61722684", "0.61722684", "0.6171562", "0.6171562", "0.61678463", "0.61678463", "0.61614394", "0.61603475", "0.6130306", "0.6122895", "0.6120811", "0.6108534", "0.61021006", "0.6070885", "0.60620975", "0.6061154", "0.60608345", "0.60530347", "0.6034654", "0.6029665", "0.60242635", "0.6023743", "0.60210776", "0.6020346", "0.60182357", "0.60108376" ]
0.0
-1
If the subscription(s) have been received, render the page, otherwise show a loading icon.
render() { return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showLoading() {\n if (loadingMessageId === null) {\n loadingMessageId = rcmail.display_message('loading', 'loading');\n }\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Fetching Data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return this.props.ready ? (\n this.renderPage()\n ) : (\n <Loader active>Getting data</Loader>\n );\n }", "render() {\n return (this.props.ready && this.props.ready2) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting Vendor</Loader>;\n }", "function renderLoader() {\n $('.schedule-page__content', scheduled.$el).empty().html(scheduled.template.loadingTemplate());\n }", "function pageLoading(){\n $(document).ajaxStart(function(){\n $(\"#loadingMessage\").show();\n });\n $(document).ajaxComplete(function(event, request){\n $(\"#loadingMessage\").hide();\n });\n }", "render() {\n return ((this.props.ready && this.props.ready2 && this.props.ready3)) ? this.renderPage() :\n <Loader active>Getting data</Loader>;\n }", "render() {\n return (this.props.ready1 && this.props.ready2) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "function subscribe() {\n $rootScope.$on('loaded', function() {\n self.loading = false;\n });\n }", "showLoading() {\n if (!this.props.loading || 0 < _.size(this.props.usersList)) {\n return false;\n }\n return (\n <div><p>Loading</p></div>\n );\n }", "function loadingShow() {\n $(\"#divLoading\").html(\n '<div class=\"loadingPage\">' +\n '<img src=\"/static/images/loader.gif\" class=\"loadingImage\"/>' +\n '</div>'\n );\n}", "function showLoadingScreen () {\n const chatContainerDom = document.getElementById('chatReadSection');\n const loadingDom = document.createElement('div');\n loadingDom.setAttribute('class', 'loading-screen');\n loadingDom.innerHTML = 'Loading Wishes...';\n chatContainerDom.appendChild(loadingDom);\n }", "function displayLoadingPage(afficher) {\n afficher = (!afficher) ? false \n : afficher;\n\tif (afficher) {\n // -- Affichier le progress bar -- //\n NProgress.start();\n // -- Afficher le frame de chargelent -- //\n $('#frame_chargement').show();\n\t} else {\n // -- Finaliser le chargement du progress bar -- //\n NProgress.done();\n // -- Cacher le frae de chargement -- //\n $('#frame_chargement').hide();\n\t}\n}", "function handleAPILoaded()\n{\n requestSubscriptionList();\n}", "function displayLoading() {\n console.log(\"Loading...\");\n }", "function showSubLoading() {\n _updateState(hotelStates.SHOW_SUB_LOADING);\n }", "render() {\n return (this.props.tickets) ? this.renderPage() : <Loader active>Getting data</Loader>;\n }", "renderContentLoading() { return <Loading /> }", "setPageLoading() {\n this.pageReady = false\n }", "function showSuccessPage() {\n $.get('/checkout/successful', function(data) {\n if(data){\n // Update Shopping Cart Badge\n $('#contentData').html(data);\n\n // Empty Shopping Cart\n $('#cartBadge').html(0);\n\n }\n });\n}", "function _showSubscribersView() {\n\t\tif (RELAY_USER.isSuperAdmin()) {\n\t\t\t_subscriberProcessingStart();\n\t\t\t$('#subscribersView').fadeIn();\n\n\t\t\t// Pull entire list of subscribers (past and present)\n\t\t\t$.when(SUBSCRIBERS.getSubscribersXHR()).done(function (orgs) {\n\t\t\t\tvar tblBody = '';\n\t\t\t\t$.each(orgs, function (index, orgObj) {\n\t\t\t\t\t// `active` parameter\n\t\t\t\t\tvar $dropDownAccess = $('#tblDropdownTemplate').clone();\n\t\t\t\t\tswitch (orgObj.active) {\n\t\t\t\t\t\tcase \"1\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Aktiv');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnDeactivateOrgAccess\" data-org=\"' + orgObj.org + '\">Steng tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-success');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Stengt');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnActivateOrgAccess\" data-org=\"' + orgObj.org + '\">Aktiver tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-danger');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// `affiliation_access` parameter\n\t\t\t\t\tvar $dropDownAffiliation = $('#tblDropdownTemplate').clone();\n\t\t\t\t\t$dropDownAffiliation.find('.currentValue').text(orgObj.affiliation_access);\n\t\t\t\t\tswitch (orgObj.affiliation_access) {\n\t\t\t\t\t\tcase \"employee\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-info');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnAddOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Legg til studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"member\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-primary');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnRemoveOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Fjern studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add row to table\n\t\t\t\t\ttblBody += '<tr>' +\n\t\t\t\t\t\t'<td>' + orgObj.org + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.affiliation_access + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAffiliation.html() + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.active + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAccess.html() + '</td>' +\n\t\t\t\t\t\t'<td class=\"text-center\"><button class=\"btnDeleteOrg btn-link uninett-fontColor-red\" type=\"button\" data-org=\"' + orgObj.org + '\"><span class=\"glyphicon glyphicon-remove\"></span></button></td>' +\n\t\t\t\t\t\t'</tr>';\n\t\t\t\t});\n\t\t\t\t$('#tblSubscribers').find('tbody').html(tblBody);\n\t\t\t\t//\n\t\t\t\t_subscriberProcessingEnd()\n\t\t\t});\n\t\t}\n\t}", "function showLoading() {\n\n\t$chatlogs.append($('#loadingGif'));\n\t$(\"#loadingGif\").show();\n\t$('.chat-form').css('visibility', 'hidden');\n}", "render(){\n return (this.data.dataLoaded) ? this.getContent() : <div><Loader /></div>\n }", "function showPageLoading() {\n $(\"div.loading-page\").css(\"display\", \"block\");\n $(\".main-page-core\").css(\"opacity\", \"1\");\n $(\".loading-icon\").css(\"display\", \" none\");\n}", "showPageLoadingIndicator() {\n\t\tgetComponentElementById(this,\"DataListLoading\").html('<div class=\"dx-loading\"></div>').show();\n\t}", "renderLoadingIcon() {}", "function Procesando() {\n $(\"#divLoading\").show();\n }", "function showLoading() {\n _updateState(hotelStates.SHOW_LOADING);\n }", "async function showLoadingView() {\n $('button').html('Loading..');\n $('#loading').append('<i class=\"fas fa-spinner fa-spin icon-large\"></i>');\n}", "displayFavorites() {\n this.enableStickerSelection = false;\n this.moreGifs = false;\n this.loader = true;\n this.favoriteService.getFavorites().subscribe((result) => {\n this.gifs = result;\n this.loader = false;\n });\n }", "render() {\n //indicate gifs are loading while state is set in component mount, gifs array is empty\n return (\n <div>\n <MyFaveGifs getGifs={this.getMyGifs}/>\n {\n !this.state.trendingGifs.length ? (\n <div className=\"spinner\"></div>\n ) : (\n <main>\n <ul className=\"card-container\">\n {this.renderCards.call(this, this.state.trendingGifs)}\n </ul>\n { this.state.startAt < 20 ? <LoadMoreButton onClick={this.handleLoadMoreClick} />\n : <PageEnd /> }\n </main>\n )\n }\n </div>\n )\n }", "renderBusyContent() {\n return (\n <Fragment>\n <h1>One moment <span>please...</span></h1>\n\n <p>I'm currently busy chatting with lots of other people. I'll be ready in a few minutes, so try again soon.</p>\n\n { this.renderActions() }\n </Fragment>\n );\n }", "function showLoading(selector) {\r\n var html = \"<div class = 'text-center'>\";\r\n html += \" <img src = 'images/ajax-loader.gif'></div>\";\r\n insertHtml(selector, html);\r\n }", "function showLoadingView() {\n $loader.css(\"display\", \"block\");\n }", "showLoadingView() {\n $('#start').empty();\n document.getElementById('start').innerHTML = 'Loading! ';\n $('#start').append($('<i class=\"fas fa-spinner fa-pulse\"></i>'))\n $('#load-screen').append($('<i id=\"loading\" class=\"mt-4 fas fa-spinner fa-pulse\"></i>'))\n }", "function requestSubs() {\n loadingProgress(1);\n buildServerRequest(\"/subscriptions\", {\"maxResults\": config.maxSimSubLoad})\n .then(processRequestSubs);\n}", "function showLoadingView() {\n\n}", "render() {\n this.previousState = StateManager.CopyState();\n\n let loading = \"\";\n if (StateManager.State().UI.IsLoading) {\n loading = (\n <div className={FormatCssClass(\"loading\")}>\n Loading\n </div>\n );\n }\n\n return loading;\n\n }", "render() {\n const status = this.props.status;\n\n if(status== 'Loading'){\n return (\n <div className=\"spinner-border\" role=\"status\">\n <span className=\"sr-only\">Loading...</span>\n </div>\n );\n }\n // Can't return nothing, and html comments seems not ok\n return (<div></div>)\n }", "render() {\n const { isLoaded, streamsApiData } = this.state;\n\n if (!isLoaded) {\n return (\n <div id=\"preloader-overlay\">\n <div id=\"preloader-spinner\"></div>\n </div>\n );\n } else if (streamsApiData.length === 0) {\n return this.createDivForNoStream();\n } else {\n let streams = [];\n for (let i = 0; i < streamsApiData.length; i++)\n streams.push(this.renderStream(streamsApiData, i));\n\n return <div>{ streams }</div>;\n }\n }", "render() {\n return (\n myutils.renderLoadingstate()\n );\n }", "function showLoading() {\n loading.classList.add(\"show\");\n setTimeout(callData, 2000);\n }", "function doSomethingAfterRendering(){\n displayLoading() // 로딩화면 보여주기\n fetchServer(); // 서버에서 데이터 가져오기\n }", "render() {\n return (\n <LoadingPage/>\n );\n }", "function getCustomers() {\n $.ajax({\n type: 'GET',\n url: 'customers',\n beforeSend: function () {\n // this is where we append a loading image\n },\n success: function (data) {\n // successful request; do something with the data\n var content = '<li>צפה בכל הלקוחות</li> <span class=\"fa fa-angle-left\"></span><li><a href=\"dashboard\"> &nbsp; הבית </a></li>';\n $('#page_path').html(content);\n $('.content-area').html(data);\n },\n error: function (data) {\n // failed request; give feedback to user\n notif({\n msg: \"<b>Oops:</b> שגיאה. נסה שוב מאוחר יותר..\",\n position: \"center\",\n time: 10000\n });\n }\n });\n}", "renderContentConditional() {\n if (this.props.loading) {\n return this.renderContentLoading()\n } else {\n return this.renderContent()\n }\n }", "function loadingGif(){\n $(document).ajaxSend(function(){\n $(\".cssload-container\").css(\"display\",\"block\");\n });\n $(document).ajaxComplete(function(){\n $(\".cssload-container\").css(\"display\",\"none\");\n });\n }", "function updateSubscribeUIStatus() {\n all_comic_data = settings.get('comic');\n if (all_comic_data == undefined) {\n all_comic_data = {};\n settings.set('comic', all_comic_data);\n }\n search_viewcontroller.updateSubscribeUI(all_comic_data);\n favorite_viewcontroller.updateSubscribeUI(all_comic_data, hasSubscription());\n read_viewcontroller.updateSubscribeUI(all_comic_data);\n translate_viewcontroller.translate();\n\n var page_idx = read_viewcontroller.getCurrentPageIdx();\n var titlekey = read_viewcontroller.getCurTitleKey();\n var host = read_viewcontroller.getCurHost();\n // console.log(page_idx + \":\" + titlekey + \":\" + host); \n if (host && titlekey && page_idx != 0) {\n all_comic_data[host][titlekey].lastpage = page_idx;\n settings.set('comic', all_comic_data);\n }\n}", "function renderArticles() {\n $('#articles').empty().html(current.template.loadingTemplate());\n fetchArticles(fetchArticlesSuccess, fetchArticlesError);\n }", "function showLoading()\n{\n\t$chatlogs.append($('#loadingGif'));\n\t$(\"#loadingGif\").show();\n\n\t// $('#submit').css('visibility', 'hidden');\n\t// $('input').css('visibility', 'hidden');\n\n\t$('.chat-form').css('visibility', 'hidden');\n }", "function showDataIsLoaded() {\n let loadingIndicator = document.getElementById(\"loadingIndicator\");\n loadingIndicator.innerHTML = \"Data loaded!\";\n setTimeout(() => loadingIndicator.style.display = \"none\", 1000);\n}", "function showQuiosqueLoad(){\n $(\"#myloadingDiv\" ).show();\n }", "function render() {\n if (!store.started) {\n if(store.filtered === false){\n $(\"main\").html(template.startPage());\n const html = template.generateBookmarkStrings(store.items);\n $('#bookmarkResults').html(html);\n } else{\n $(\"main\").html(template.startPage());\n $('#minimumRating').val(store.minimum);\n const filter = store.items.filter(bookmark => {\n return bookmark.rating >= store.minimum;\n \n })\n const html = template.generateBookmarkStrings(filter);\n $('#bookmarkResults').html(html);\n }\n \n \n } else {\n $(\"main\").html(template.newBookmarkTemp());\n }\n}", "function notifyLoadingRequest() {\n\tloadingRequests++;\n\tcheckLoading();\n\treturn true;\n}", "function ajaxLoadingSignalOn()\n{\n indicator = document.getElementById(loadingSignalId);\n if (indicator)\n indicator.style.visibility = \"visible\";\n}", "function renderUpdateComplete() {\n exportData.renderUpdateRunning = false;\n $loadingBar.css('opacity', 0);\n }", "function alreadyRegisteredPage() {\r\n app.getView().render('subscription/emarsys_alreadyregistered');\r\n}", "function Loading() {\n return (\n <div class=\"spinner-border load\" role=\"status\">\n <span class=\"sr-only\">Loading...</span>\n </div>\n )\n}", "function showLoading() {\n\twindow.status = \"Obtendo informações\";\n\n\tmainContent.style.display = \"none\";\n\tloading.style.display = \"block\";\n}", "function showLoadingAjax () {\n\treplaceHTMLOfElement(contentDiv, '');\n\tshowProgressBar();\n}", "function addLoadingIndicator(){\n\tlet template = document.importNode(templateLoadingIndicator.content, true);\n\tclearContainerHTML(htmlProducts);\n\thtmlProducts.appendChild(template);\n }" ]
[ "0.6480619", "0.6350569", "0.6349684", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6243007", "0.6243007", "0.6243007", "0.6243007", "0.62422377", "0.62412745", "0.61397916", "0.6128012", "0.60392493", "0.59955424", "0.5964248", "0.59292483", "0.592554", "0.5916828", "0.5914855", "0.58417475", "0.5823805", "0.5818887", "0.58056414", "0.5769396", "0.5763185", "0.5762191", "0.57527226", "0.57465166", "0.5745685", "0.5722875", "0.5721372", "0.57074326", "0.5701146", "0.56878924", "0.56850797", "0.5675432", "0.5675126", "0.5669583", "0.56604654", "0.56551254", "0.5649666", "0.56469166", "0.5589864", "0.55832356", "0.55768305", "0.55693394", "0.55681753", "0.5567222", "0.55396444", "0.55386555", "0.553205", "0.5529981", "0.55112934", "0.551059", "0.54964703", "0.54960436", "0.5495292", "0.5475887", "0.5473275", "0.5458143", "0.5456462", "0.5455099", "0.54485995", "0.54445076", "0.5442546", "0.5441964", "0.5414582", "0.54094505" ]
0.629345
36
Render the page once subscriptions have been received.
renderPage() { const shows = Anime.collection.find({}).fetch(); return ( <div className="gray-background"> <Container> <Header as="h2" textAlign="center">AniMoo List</Header> <Table celled> <Table.Header> <Table.Row> <Table.HeaderCell>Title</Table.HeaderCell> <Table.HeaderCell>Image</Table.HeaderCell> <Table.HeaderCell>Summary</Table.HeaderCell> <Table.HeaderCell>Episodes</Table.HeaderCell> <Table.HeaderCell>Rating</Table.HeaderCell> <Table.HeaderCell>Add To Favorites</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> {this.props.anime.slice((this.state.activePage - 1) * 25, this.state.activePage * 25).map((show) => <AnimeItem key={show._id} anime={show} />)} </Table.Body> </Table> <Pagination activePage={this.activePage} totalPages={Math.ceil(shows.length / 25)} firstItem={{ content: <Icon name='angle double left'/>, icon: true }} lastItem={{ content: <Icon name='angle double right'/>, icon: true }} prevItem={{ content: <Icon name='angle left'/>, icon: true }} nextItem={{ content: <Icon name='angle right'/>, icon: true }} onPageChange={this.handlePageChange} /> </Container> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleAPILoaded()\n{\n requestSubscriptionList();\n}", "function _render(){\n\t\tinfo = {\n\t\t\t\tpublishers_array: publishers_array\n\t\t}\n\t\t$element.html(Mustache.render(template, info))\n\t}", "function dataSubmittedPage() {\r\n app.getView().render('subscription/emarsys_datasubmitted');\r\n}", "function _showSubscribersView() {\n\t\tif (RELAY_USER.isSuperAdmin()) {\n\t\t\t_subscriberProcessingStart();\n\t\t\t$('#subscribersView').fadeIn();\n\n\t\t\t// Pull entire list of subscribers (past and present)\n\t\t\t$.when(SUBSCRIBERS.getSubscribersXHR()).done(function (orgs) {\n\t\t\t\tvar tblBody = '';\n\t\t\t\t$.each(orgs, function (index, orgObj) {\n\t\t\t\t\t// `active` parameter\n\t\t\t\t\tvar $dropDownAccess = $('#tblDropdownTemplate').clone();\n\t\t\t\t\tswitch (orgObj.active) {\n\t\t\t\t\t\tcase \"1\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Aktiv');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnDeactivateOrgAccess\" data-org=\"' + orgObj.org + '\">Steng tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-success');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"0\":\n\t\t\t\t\t\t\t$dropDownAccess.find('.currentValue').text('Stengt');\n\t\t\t\t\t\t\t$dropDownAccess.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnActivateOrgAccess\" data-org=\"' + orgObj.org + '\">Aktiver tilgang</a></li>');\n\t\t\t\t\t\t\t$dropDownAccess.find('.btn').addClass('btn-danger');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// `affiliation_access` parameter\n\t\t\t\t\tvar $dropDownAffiliation = $('#tblDropdownTemplate').clone();\n\t\t\t\t\t$dropDownAffiliation.find('.currentValue').text(orgObj.affiliation_access);\n\t\t\t\t\tswitch (orgObj.affiliation_access) {\n\t\t\t\t\t\tcase \"employee\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-info');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnAddOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Legg til studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"member\":\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.btn').addClass('btn-primary');\n\t\t\t\t\t\t\t$dropDownAffiliation.find('.dropdown-menu').append('<li style=\"cursor: pointer;\"><a class=\"btn-link btnRemoveOrgStudentAccess\" data-org=\"' + orgObj.org + '\">Fjern studenttilgang</a></li>');\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add row to table\n\t\t\t\t\ttblBody += '<tr>' +\n\t\t\t\t\t\t'<td>' + orgObj.org + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.affiliation_access + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAffiliation.html() + '</td>' +\n\t\t\t\t\t\t//'<td>' + orgObj.active + '</td>' +\n\t\t\t\t\t\t'<td>' + $dropDownAccess.html() + '</td>' +\n\t\t\t\t\t\t'<td class=\"text-center\"><button class=\"btnDeleteOrg btn-link uninett-fontColor-red\" type=\"button\" data-org=\"' + orgObj.org + '\"><span class=\"glyphicon glyphicon-remove\"></span></button></td>' +\n\t\t\t\t\t\t'</tr>';\n\t\t\t\t});\n\t\t\t\t$('#tblSubscribers').find('tbody').html(tblBody);\n\t\t\t\t//\n\t\t\t\t_subscriberProcessingEnd()\n\t\t\t});\n\t\t}\n\t}", "function alreadyRegisteredPage() {\r\n app.getView().render('subscription/emarsys_alreadyregistered');\r\n}", "function render() {\n let bigString;\n console.log('render fxn ran')\n if (store.view === 'landing') {\n bigString = generateTitleTemplate(store);\n\n }\n else if (store.view === 'question') {\n bigString = generateQuestionTemplate(store);\n\n }\n else if (store.view === 'feedback') {\n bigString = generateFeedbackTemplate(store)\n\n }\n else if (store.view === 'results') {\n bigString = generateResultsTemplate(store);\n\n }\n $('main').html(bigString);\n\n //attach event listeners\n\n\n}", "render() {\n this.eventBusCollector.on(NEWPULLREQUEST.render, this._onRender.bind(this));\n this.eventBus.emit(REPOSITORY.getInfo, {});\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "function renderArticles() {\n $('#articles').empty().html(current.template.loadingTemplate());\n fetchArticles(fetchArticlesSuccess, fetchArticlesError);\n }", "render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }", "async function fetchData() {\n const channels = await getChannels();\n\n const data = {\n title: 'ChatX',\n content: component,\n state: {\n rooms: channels, // preload existing rooms\n messages: [],\n signedIn: req.session.user ? true : false\n }\n };\n\n res.status(200);\n res.render('index', data);\n }", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "subscriptions () {\r\n events.on(\"url-change\", (data) => {\r\n if (data.state && data.state.selector) {\r\n const target = document.querySelector(data.state.selector);\r\n\r\n this.toggleActivePages(target);\r\n this.toggleActiveSubnav(data.state.index);\r\n }\r\n });\r\n }", "function render() {\n if (!store.started) {\n if(store.filtered === false){\n $(\"main\").html(template.startPage());\n const html = template.generateBookmarkStrings(store.items);\n $('#bookmarkResults').html(html);\n } else{\n $(\"main\").html(template.startPage());\n $('#minimumRating').val(store.minimum);\n const filter = store.items.filter(bookmark => {\n return bookmark.rating >= store.minimum;\n \n })\n const html = template.generateBookmarkStrings(filter);\n $('#bookmarkResults').html(html);\n }\n \n \n } else {\n $(\"main\").html(template.newBookmarkTemp());\n }\n}", "function render() { \n\n $body.append(templates['container']({'id':_uid}))\n $j('#' + _uid).append(templates['heading-no-links']({'title':'Countdown Promotion'}));\n $j('#' + _uid).append(templates['countdown-promo']({'id':_uid}));\n \n chtLeaderboard = new CHART.CountdownLeaderboard(_uid + '-charts-promo-leaderboard', _models.promo.getData('all'), _models.promo.getTargetSeries(20000));\n tblLeaderboard = new TABLE.CountdownLeaderboard(_uid + '-tables-promo-leaderboard', _models.promo.groupByOwner('all', 20000), _models.promo.getTotal('all', 180000)); \n chtLastWeek = new CHART.CountdownLeaderboard(_uid + '-charts-promo-lastweek', _models.promo.getData('lastweek'), _models.promo.getTargetSeries(1540));\n tblLastWeek = new TABLE.CountdownLeaderboard(_uid + '-tables-promo-lastweek', _models.promo.groupByOwner('lastweek', 1540), _models.promo.getTotal('lastweek', 13860)); \n chtWeeklySales = new CHART.CountdownWeeklySales(_uid + '-charts-promo-weeklysales', _models.promo.getData('all'));\n\n }", "function updateSubscribeUIStatus() {\n all_comic_data = settings.get('comic');\n if (all_comic_data == undefined) {\n all_comic_data = {};\n settings.set('comic', all_comic_data);\n }\n search_viewcontroller.updateSubscribeUI(all_comic_data);\n favorite_viewcontroller.updateSubscribeUI(all_comic_data, hasSubscription());\n read_viewcontroller.updateSubscribeUI(all_comic_data);\n translate_viewcontroller.translate();\n\n var page_idx = read_viewcontroller.getCurrentPageIdx();\n var titlekey = read_viewcontroller.getCurTitleKey();\n var host = read_viewcontroller.getCurHost();\n // console.log(page_idx + \":\" + titlekey + \":\" + host); \n if (host && titlekey && page_idx != 0) {\n all_comic_data[host][titlekey].lastpage = page_idx;\n settings.set('comic', all_comic_data);\n }\n}", "function requestSubs() {\n loadingProgress(1);\n buildServerRequest(\"/subscriptions\", {\"maxResults\": config.maxSimSubLoad})\n .then(processRequestSubs);\n}", "function subscriber() {\n const { count } = store.getState();\n document.getElementById('count').textContent = count.value;\n}", "subscribe() {\n this.subscriptionID = this.client.subscribe(this.channel, this.onNewData)\n this.currencyCollection.subscribe(this.render)\n this.currencyCollection.subscribe(this.drawInitialSparkLine)\n this.currencyCollection.subscribeToSparkLineEvent(this.drawSparkLine)\n }", "function render() {\n //zarejdame si templeitite i im zakachame event\n ctx.partial('./templates/welcome.hbs')\n .then(attachEvents);\n }", "function render() {\n let html = generateHeader();\n\n if (store.error) {\n generateError();\n }\n\n // check if form displayed\n if (store.adding) {\n html += generateBookmarkForm();\n }\n\n html += generateAllBookmarkCards();\n\n $('main').html(html);\n }", "function handleRender() {\n\t view._isRendered = true;\n\t triggerDOMRefresh();\n\t }", "_handleChange() {\n if (this._renderType == SERVER) {\n // We don't need to trigger any subscription callback at server. We'll\n // render twice and we're only interested in the HTML string.\n return;\n }\n\n var timestamp = this._getTimestamp();\n var state = this._store.getState();\n if (this._previousState.state == null) {\n // If no change, no need to trigger callbacks.\n this._setPreviousState(state, timestamp);\n return;\n }\n\n // Assume comparison is cheaper than re-rendering. We do way more comparison\n // when we compare each piece, with the benefits of not doing unnecessary\n // re-rendering.\n var segmentName, segment, segmentState, prevSegmentState, segmentSubscribers,\n queryId, querySubscribers, subscriberId, segmentPiece, shouldUpdate;\n for (segmentName in this._segments) {\n if (!this._segments.hasOwnProperty(segmentName)) continue;\n segment = this._segments[segmentName];\n segmentSubscribers = this._subscribers[segmentName];\n segmentState = state[segmentName];\n prevSegmentState = this._previousState.state[segmentName];\n for (queryId in segmentSubscribers) {\n if (!segmentSubscribers.hasOwnProperty(queryId)) continue;\n querySubscribers = segmentSubscribers[queryId];\n // If segmentState is previously null, then this is a new query call.\n // First getState() method call should already return the initialized\n // object, so we don't need to call update.\n // TODO: This assumption/design seems to be flawed, null to existence is a change, and we should notify listeners.\n shouldUpdate = false;\n if (prevSegmentState != null) {\n segmentPiece = segment._comparePiece(prevSegmentState, segmentState, queryId);\n shouldUpdate = segmentPiece != null;\n }\n if (shouldUpdate) {\n // Segment piece has changed, call all registered subscribers.\n for (subscriberId in querySubscribers) {\n if (!querySubscribers.hasOwnProperty(subscriberId)) continue;\n querySubscribers[subscriberId](segmentPiece[0]);\n }\n }\n }\n }\n\n // Update previous state.\n this._setPreviousState(state, timestamp);\n }", "function renderPage() {\n\n if (STORE.view === 'start') {\n if (game1.sessionToken) {\n $('start-button').attr('disabled', false);\n }\n $('.page').html(renderStartView());\n }\n if (STORE.view === 'questions') {\n console.log('about to render');\n $('.page').html(renderQuestionView());\n }\n if (STORE.view === 'feedback' && STORE.showFeedback === true) {\n $('.page').html(renderFeedbackView());\n }\n if (STORE.view === 'results') {\n $('.page').html(renderResultsView());\n }\n}", "renderPage() {\t\t\n\t\tswitch (this.props.data.active) {\n\t\t\tcase 'user': \n\t\t\t\treturn this.renderUserInfo(this.props.data.body);\t\t\t\n\t\t\tcase 'repos': \n\t\t\t\treturn this.renderRepos(this.props.data.body);\n\t\t\tcase 'about': \n\t\t\t\treturn this.renderAbout();\t\t\t\t\t\n\t\t}\n\t}", "function getSubscriptionList() {\n _debug(\"Getting subscription list\");\n\n $('.sources ul').empty(); // empty the sources list\n\n $.ajax({\n url: \"/get/subscription-list\",\n type: 'GET',\n beforeSend: function(r) {\n r.setRequestHeader(\"Auth_token\", sessvars.Auth_token);\n },\n error: function(e) {\n spinner.stop();\n miniSpinner.stop();\n\n if (e.status === 401 || e.status === 400) {\n console.log('We should refresh token');\n window.location.href = \"/auth/google\"; // TODO: refresh token\n }\n\n throw new Error('Error ' + e.status + \":\" + e);\n },\n success: function(res) {\n\n miniSpinner.stop();\n $('.sources ul').append('<li id=\"allfeeds\"><div><a href=\"#\">All unread items</a><span>0</span></div></li>');\n $.each(res.subscriptions, function(i,obj) {\n\n var\n url = obj.htmlUrl,\n name = obj.title,\n id = sanitize(obj.id);\n\n sources[id] = obj.id;\n\n $('.sources ul').append('<li id=\"' + id + '\"><div><a href=\"#\">' + name + '</a><span>0</span></div></li>');\n $('li#' + id + ' div a').truncate({ width: 200 });\n });\n\n showSources();\n\n //Get the counters for the unread articles\n $.ajax({\n url: '/get/unread-count',\n type: 'GET',\n beforeSend: function(r) {\n r.setRequestHeader(\"Auth_token\", sessvars.Auth_token);\n miniSpinner.spin(miniTarget);\n },\n success: function(resc) {\n miniSpinner.stop();\n\n var re = new RegExp(/\\/state\\/com\\.google\\/reading-list/);\n\n $.each(resc.unreadcounts, function(i, obj) {\n\n if (obj.id.match(re)) {\n totalCount = obj.count;\n updateTotalCounter(totalCount);\n } else {\n unreadCounters[obj.id] = obj.count;\n updateCount(obj.id);\n }\n\n });\n\n setFeed('all', 't');\n setSelected('allfeeds');\n }\n });\n\n $('.sources div.wrap').addClass(\"scroll-pane\");\n $('.scroll-pane').jScrollPane();\n }\n });\n}", "async initSubscriptions() {\n\n }", "static get observers(){return[\"_render(html)\"]}", "renderPage() {}", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "function filter_sub() {\n recipe_wrapper.innerHTML = \"\";\n var currentPage = window.location.href;\n var http = new XMLHttpRequest();\n http.open('GET', `${currentPage}/subscribed`, true);\n\n http.onreadystatechange = function() {\n if (http.readyState == 4 && http.status == 200) {\n subs = this.responseText.split(\"|||\");\n for (var i = 0; i < subs.length; i++) {\n if (subs[i] != \"\") {\n new_tile = create_recipe_tile(subs[i]);\n recipe_wrapper.appendChild(new_tile);\n }\n }\n format_recipe_description_for_web();\n }\n }\n\n http.send();\n}", "_renderCurrentPage() {\n this._clearRenderedCards();\n\n this._displayedCards.forEach(card => this._renderCard(card));\n this._evaluateControllers();\n }", "render() {\n\t\t\t\tif (shouldSubscribe && !this.unsubscribeStore_) {\n\t\t\t\t\tthis.unsubscribeStore_ = this.getStore().subscribe(\n\t\t\t\t\t\tthis.handleStoreChange_.bind(this)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn <WrappedComponent {...this.getChildProps_()} />;\n\t\t\t}", "function render() {\n\tconsole.log(\"Re-rendering\")\n\tif (selectedTopicID != \"\" && selectedTopicID != null) {\n\t\tdocument.title = \"Work Log - \" + topicsDictionary[selectedTopicID].name;\n\t\t$(\"#time-elapsed-header\").html(formatCounter(topicsDictionary[selectedTopicID].time));\n\t}\n\trenderTopics();\n\trenderEvents();\n}", "function render() {\r\n //does nothing if there is not a current error\r\n renderError();\r\n\r\n let html = '';\r\n\r\n//view state changes if user has chosen to add a new bookmark\r\n if (store.adding === true) {\r\n html = addBookmark()\r\n }\r\n //if the value of error has changed state from its initial value of null displayError will inject the msg into the html\r\n else if (store.error != null) {\r\n html = displayError()\r\n }\r\n \r\n //finally, if no errors are present the initial view of the app will render\r\n else { html = generateInitialView(generateBookmarkString) }\r\n $('main').html(html)\r\n store.filter = 0\r\n}", "_renderStorage() {\n this._messageChecker();\n this.listCollection.forEach((list) => this._renderListPreviewMarkup(list));\n }", "static publish() {\r\n ViewportService.subscribers.forEach(el => {el.callback();});\r\n }", "function subscribe(){\n performance.mark('subscribing');\n client.subscribe('payload/empty', function (err) {});\n performance.mark('subscribed');\n performance.measure('subscribing to subscribed', 'subscribing', 'subscribed');\n}", "function loadAndRenderItems() {\n pageData().then(render)\n }", "async initSubscriptions() {\n const instance = this;\n for (let i = 0; i < this.subscriptions.length; i += 1) {\n const subscription = this.subscriptions[i];\n if (subscription === \"mapData\") {\n instance.stateManager.subscribe(subscription,\n async d => {\n instance[subscription] = d;\n console.log(d);\n await instance.#renderTable();\n });\n }\n }\n}", "handleSubscribe() {\n // Callback invoked whenever a new event message is received\n const messageCallback = (response) => {\n console.log(\"New Component Update message received: \", JSON.stringify(response.data.payload));\n this.doDemoComponentRefresh();\n }\n\n subscribe(this.channelName, -1, messageCallback).then((response) => {\n // Response contains the subscription information on subscribe call\n console.log(`Subscription request sent to: ${JSON.stringify(response.channel)}`);\n console.log(`Subscription request Response: ${JSON.stringify(response)}`);\n this.subscription = response;\n this.isSubscriptionRequested = false;\n this.isSubscribed = true;\n });\n }", "function processRequestSubs(response) {\n // If there is another page of subs request it.\n if ((\"undefined\" !== typeof response.nextPageToken) && (null !== response.nextPageToken)) {\n loadingProgress(1);\n buildServerRequest(\"/subscriptions\", {\"maxResults\": config.maxSimSubLoad, \"pageToken\": response.nextPageToken})\n .then(processRequestSubs);\n }\n // Create subs from the api response.\n response.items.forEach((item) => {\n if (-1 === subs.findIndex((x) => item.snippet.resourceId.channelId === x.id)) {\n subs.push(new Subscription(item.snippet));\n }\n });\n loadingProgress(-1);\n}", "function render(){\n let html='';\n if (store.quizStarted === false){\n html = generateStartPage();\n }else if (store.giveFeedback === true){\n html = generateQuestionsPage();\n } else if (store.giveFeedback === false && store.questionNumber === store.questions.length -1){\n html = generateLastPage();\n }\n else {\n html= generateRightWrong();\n }\n \n $('main').html(html);\n}", "render() {\n this.eventBusCollector.on(COMMITSPAGE.render, this._onRender.bind(this));\n this.eventBus.emit(COMMITSPAGE.getBranchList, {});\n }", "function processCheckedSubs(response) {\n // No longer subscribed\n if (0 === response.pageInfo.totalResults) {\n loadingProgress(-1, true);\n return;\n }\n // Create subs from the api response.\n response.items.forEach((item) => {\n subs.push(new Subscription(item.snippet));\n });\n loadingProgress(-1, true);\n}", "function thankYouPage() {\r\n app.getView().render('subscription/emarsys_thankyou');\r\n}", "render() {\n // If we have no articles, we will return this.renderEmpty() which in turn returns some HTML\n if (!this.state.savedArticles) {\n return this.renderEmpty();\n }\n // If we have articles, return this.renderContainer() which in turn returns all saves articles\n return this.renderContainer();\n }", "function getSubscriptions(callback, screen) {\n if(screen !== null) {\n $.ajax({\n type: \"POST\",\n url: host+\"api/tags.getSubscriptions\",\n contentType: \"application/json\",\n success: function(data) {\n callback(data, screen);\n },\n dataType: \"JSON\"\n });\n } else {\n // No screen has been passed\n console.warn(\"No screen has been passed\");\n }\n}", "render(...args) {\n if (this._render) {\n this.__notify(EV.BEFORE_RENDER);\n this._render(...args);\n this.__notify(EV.RENDERED);\n }\n\n this.rendered = true;\n }", "function getPage(filter){\nconsole.log('inside getPage');\n return function(page, model) {\n model.subscribe('todos', function () {\n\tif(filter =='active')\n\t{\n\tmodel.set('_page.newTodo', 'rajesh active');\n\t\tconsole.log('inside regtpage to render');\n\t\t}\n page.render();\n });\n }\n}", "handleSubscribe() {\n try {\n alert('Thank you for your Changes. Your posting will appear after approval.');\n history.push('/consultants');\n } catch (error) {\n alert('There seems to be a problem!');\n }\n }", "function renderPage() {\n // set up any necessary events\n Main.addClickEventToElement(document.getElementById(\"homeOptP\"), function () {\n Main.changeHash(Main.pageHashes.home);\n });\n Main.addClickEventToElement(document.getElementById(\"infoOptP\"), function () {\n Main.changeHash(Main.pageHashes.info);\n });\n Main.addClickEventToElement(document.getElementById(\"quizOptP\"), function () {\n Main.changeHash(Main.pageHashes.quiz);\n });\n Main.addClickEventToElement(document.getElementById(\"econ\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Economy\");\n _loadPlatformSection(_platformSections.economy);\n });\n Main.addClickEventToElement(document.getElementById(\"immigration\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Immigration\");\n _loadPlatformSection(_platformSections.immigration);\n });\n Main.addClickEventToElement(document.getElementById(\"domSoc\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Domestic Policy\");\n _loadPlatformSection(_platformSections.domestic);\n });\n Main.addClickEventToElement(document.getElementById(\"foreignPol\"), function () {\n Main.sendAnalyticsEvent(\"UX\", \"click\", \"Foreign Policy\");\n _loadPlatformSection(_platformSections.foreign);\n });\n\n // show page\n Main.sendPageview(Main.analyticPageTitles.platform);\n Main.showPage(Main.pageContainers.partyPlatformContainer);\n }", "function displayPage( response, context ) {\n var html = messageCompiled.render( context );\n response.html( html );\n}", "function renderDestinationScreen(){\r\n getTemplateAjax('./templates/destination.handlebars', function(template) {\r\n destinationData =\r\n {destinationTitle: \"Destination Screen Worked\", destinationMessage: \"Now get to work.\"}\r\n jqueryNoConflict('#destinationScreen').html(template(destinationData));\r\n })\r\n }", "function initPage() {\n $.get('/api/headlines?saved=true').done((data) => {\n articleContainer.empty();\n\n if (data && data.length > 0) {\n renderArticles(data);\n\n // Activate tooltips for the action buttons.\n $('[data-toggle=\"tooltip\"]').tooltip();\n } else {\n renderEmpty();\n }\n });\n }", "connectedCallback() {\n render(this.template(), this.shadowRoot);\n }", "function renderCvtPage(data) { \n // get cvt data from API call...\n $.getJSON(\"api/cvt\", function(data) {\n // generate the proper HTML...\n generateAllCvtHTML(data);\n\n var page = $('.cvt-report');\n page.addClass('visible'); \n });\n }", "function _setSubscriptions() {\n /**\n * Watch for changes in the area index\n * and reset the area form view model.\n */\n AreaActionObservable.subscribe((areaId) => {\n _initializeForm(areaId);\n });\n\n }", "function init() {\n if ($('.scheduled-page').length > 0) {\n setPageUrl();\n bindEvents();\n renderSwitcher();\n renderActions();\n switchPage(scheduled.currentView);\n }\n }", "function catalogueStats() {\n jQuery.ajax({\n url: \"/backend/modules/pricing/catalogues/catalogue_stats\",\n type: \"GET\",\n success: function (data) {\n $('#catalogue_stats').html(data);\n }\n });\n }", "async _handleSubscribeButtonClick() {\n if (this.state.userHasSubscribedToChair) {\n const unsubscribeRequest = await chairService.unsubscribeFromChair(\n this.props.chairId\n );\n\n if (unsubscribeRequest.status === 200) {\n this.setState({\n userHasSubscribedToChair: false,\n unsubscribeModalOpen: true\n });\n this.props.removeSubscription({ pageId: this.props.chairId });\n } else {\n }\n } else {\n const subscriptionRequest = await chairService.subscribeToChair(\n this.props.chairId\n );\n\n if (subscriptionRequest.status === 200) {\n this.setState({\n userHasSubscribedToChair: true,\n subscribeModalOpen: true\n });\n this.props.addSubscription({ pageId: this.props.chairId });\n } else {\n }\n }\n }", "render () {\n const { refetch, username } = this.state;\n return (\n <div>\n <Subscription\n subscription={subscribeToNewMessages}\n >\n {\n ({data, error, loading}) => {\n if (error || (data && data.message === null)) {\n console.error(error || `Unexpected response: ${data}`);\n return \"Error\";\n }\n if (refetch) {\n refetch();\n }\n return null;\n }\n }\n </Subscription>\n <ChatWrapper\n refetch={refetch}\n setRefetch={this.setRefetch}\n userId={this.props.userId}\n username={username}\n />\n <footer className=\"App-footer\">\n <div className=\"hasura-logo\">\n <img src=\"https://graphql-engine-cdn.hasura.io/img/powered_by_hasura_black.svg\" onClick={() => window.open(\"https://hasura.io\")} alt=\"Powered by Hasura\"/>\n &nbsp; | &nbsp;\n <a href=\"/console\" target=\"_blank\" rel=\"noopener noreferrer\">\n Backend\n </a>\n &nbsp; | &nbsp;\n <a href=\"https://github.com/hasura/graphql-engine/tree/master/community/sample-apps/realtime-chat\" target=\"_blank\" rel=\"noopener noreferrer\">\n Source\n </a>\n &nbsp; | &nbsp;\n <a href=\"https://blog.hasura.io/building-a-realtime-chat-app-with-graphql-subscriptions-d68cd33e73f\" target=\"_blank\" rel=\"noopener noreferrer\">\n Blogpost\n </a>\n </div>\n <div className=\"footer-small-text\"><span>(The database resets every 24 hours)</span></div>\n </footer>\n </div>\n );\n }", "render(){\n\t\treturn(\n\t\t\t<div>\n\t\t\t\t<h2> Our Current Clients Page </h2>\n\t\t\t\t<ClientLogos/>\n\t\t\t\t<ClientDescription/> \n\t\t\t</div>\n\t\t)\n\t}", "function subscribe() {\n $rootScope.$on('loaded', function() {\n self.loading = false;\n });\n }", "function notifySubscribers() {\n var eventPayload = {\n routeObj: getCurrentRoute(), // { route:, data: }\n fragment: getURLFragment()\n };\n\n _subject.onNext(eventPayload);\n }", "function render(response){\n checkTodos(response)\n console.log(todosPending)\n console.log(todosCompleted)\n var pending = template(todosPending)\n // var pending = template(response)\n $(\"#todo-pendientes\").html(pending)\n var completed = template(todosCompleted)\n $(\"#todo-completados\").html(completed)\n bindEvents()\n}", "static renderGlobalView() {\n GestionPages.gestionPages(\"dashboard\");\n let contenu = `\n <h5><em>Production Dashboard</em></h5>\n <div id=\"dash\">\n <div id=\"stateorders\">\n <p>State of orders</p>\n </div>\n\n <div id=\"statemachines\">\n <p>State of Machines</p>\n </div>\n\n <div id=\"statistics\">\n <p>Statistics</p>\n </div>\n </div>`;\n document.querySelector(\"#dashboard\").innerHTML = contenu;\n\n //Display page \"state of orders\"\n $(\"#stateorders\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateOrders();\n });\n\n //Display page \"state of machines\"\n $(\"#statemachines\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateMachines();\n });\n\n //Display page \"statistics\"\n $(\"#statistics\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStatistics();\n });\n }", "function initPage() {\n $.get('/api/headlines?saved=false').done((data) => {\n articleContainer.empty();\n if (data && data.length > 0) {\n renderArticles(data);\n\n // Activate tooltips for the action buttons.\n $('[data-toggle=\"tooltip\"]').tooltip();\n } else {\n renderEmpty();\n }\n });\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader active>Getting Vendor</Loader>;\n }", "function render(){ \n console.log('`render function` ran');\n const createdHtml = generateHtml(STORE); \n $('main').html(createdHtml);\n}", "render() {\n\t\treturn this.renderRegisterPage();\n\t}", "handleSubscribe() {\n // Callback invoked whenever a new event message is received\n const messageCallback = (response) => {\n console.log('Segment Membership PE fired: ', JSON.stringify(response));\n // Response contains the payload of the new message received\n this.notifier = JSON.stringify(response);\n this.refresh = true;\n // refresh LWC\n if(response.data.payload.Category__c == 'Segmentation') {\n this.getData();\n }\n \n\n\n };\n\n // Invoke subscribe method of empApi. Pass reference to messageCallback\n subscribe(this.channelName, -1, messageCallback).then(response => {\n // Response contains the subscription information on subscribe call\n console.log('Subscription request sent to: ', JSON.stringify(response.channel));\n this.subscription = response;\n this.toggleSubscribeButton(true);\n });\n }", "function _render() {\n DOM.$p\n .empty()\n .text(`People: ${people.length}`)\n .appendTo(DOM.$stats);\n }", "function eventsInitialRender() {\n //remove selection if it's there\n localStorage.setItem(\"mainContentCalendarSelectedCrn\", \"\");\n\n //manageClasses page\n if (document.getElementById(\"mc_manageClasses_input_crn\")) {\n manageClasses_eventsInitialRender();\n }\n\n //assign professors page\n\tif (document.getElementById(\"mc_assingProfessors_section\")) {\n assignProfessors_eventsInitialRender();\n }\n \n //scheduleRegistration\n if (document.getElementById(\"mc_scheduleRegistration_classTable\")) {\n scheduleRegistration_eventsInitialRender();\n }\n\n //TODO: handle other pages\n}", "updatePage() {\r\n\t\tvar htmlString = '';\r\n\r\n\t\tfor ( var key in this.data ) {\r\n\t\t\thtmlString = htmlString + '<li>' + this.data[key] + '</li>';\r\n\t\t}\r\n\r\n\t\tthis._dataEl.innerHTML = htmlString;\r\n\t}", "function pageInitalize(){\n\n articleContainer.empty();//Empties article container.//\n $.get(\"/api/headlines?saved=false\").then(function(data){//Runs AJAX request for unsaved\n if (data && data.length) {//Renders found headlines to the page.//\n renderArticles(data);\n }else{\n renderEmpty();//Renders no articles message.//\n }\n });\n }", "constructor() {\n super();\n\n this.state = {\n subscription: {\n budgets: Meteor.subscribe(\"userBudgets\")\n }\n };\n }", "function render() {\n\n const renderedString = createRenderString(store);\n\n // insert html into DOM\n $('main').html(renderedString);\n}", "function doSomethingAfterRendering(){\n displayLoading() // 로딩화면 보여주기\n fetchServer(); // 서버에서 데이터 가져오기\n }", "function render(){\n var state = store.getState();\n\n console.log(state);\n\n\n root.innerHTML = `\n ${Navigation(state[state.active])}\n ${Header(state)}\n ${Content(state)}\n ${Footer(state)}\n `;\n greeter.render(root);\n \n document\n .querySelector('h1')\n .addEventListener('click', (event) => {\n var animation = tween({\n 'from': {\n 'color': '#fff100',\n 'fontSize': '100%'\n },\n 'to': {\n 'color': '#fff000',\n 'fontSize': '200%'\n },\n 'duration': 750\n });\n \n var title = styler(event.target);\n \n animation.start((value) => title.set(value));\n });\n \n router.updatePageLinks();\n}", "function render(html) {\n response.renderHTML(html);\n console.log('rendering done!');\n if (\n loggedInUser &&\n loggedInUser.id &&\n !reqParams.after &&\n !reqParams.before\n )\n analytics.addVisit(loggedInUser, request.url);\n }", "function render() {\n if (store.quizStarted === false) {\n $('main').html(generateWelcome());\n return;\n }\n else if (store.questionNumber < store.questions.length) {\n let html = '';\n html = generateQuestion();\n html += generateQuestionNumberAndScore();\n $('main').html(html);\n }\n else {\n $('main').html(generateResultsScreen());\n }\n}", "function render() {\n\n isRendered = true;\n\n renderSource();\n\n }", "function refetchEvents() { // can be called as an API method\n\t\t\tfetchAndRenderEvents();\n\t\t}", "connectedCallback () {\n this.template.render(this.attrs, this)\n .then(template => {\n this.shadowRoot.appendChild(template);\n return this._subTemplates();\n })\n .then(() => {\n if(typeof this.afterConnected === 'function')\n this.afterConnected();\n });\n }", "function refreshViewers() {\n\t\tjQuery.ajax( {\n\t\t\turl: options.restAPIEndpoint + page,\n\t\t\tmethod: 'GET',\n\t\t\tbeforeSend: function( xhr ) {\n\t\t\t\txhr.setRequestHeader( 'X-WP-Nonce', options.restAPINonce );\n\t\t\t}\n\t\t} ).done( function( response ) {\n\t\t\tcurrentlyViewing = response;\n\t\t\tmaybeDisplay();\n\t\t} );\n\t}", "componentDidMount() {\n this.getSubscriptions()\n }", "function render() {\r\n let content = '';\r\n if (STORE.view === 'home') {\r\n $('main').html(welcomePage());\r\n }\r\n else if (STORE.view === 'question') {\r\n content = questionAsked();\r\n content += generateAnswers();\r\n content += questionAndScoreStanding();\r\n $('main').html(`<form>${content}</form>`);\r\n } else if (STORE.view === 'feedback') {\r\n answerFeedback();\r\n } else if (STORE.view === 'score') {\r\n finalScore();\r\n }\r\n}", "show(req, res, next) {\n var subscriptionId = req.params.id;\n\n Subscription.findById(subscriptionId, function(err, subscription) {\n if (err) return next(err);\n if (!subscription) return perf.ProcessResponse(res).send(401);\n perf.ProcessResponse(res).send(subscription);\n });\n }", "render() {\r\n document.body.insertBefore(this.element, document.querySelector('script'));\r\n\r\n this.append(this.PageContent.element, [this.NewsList, this.Footer]);\r\n this.append(this.Sidebar.element, [this.SidebarTitle, this.SourcesList]);\r\n this.append(this.element, [this.Spinner, this.PageContent, this.Sidebar, this.ToggleBtn]);\r\n }", "function printLoggedInPage(userKey, userName, newsLetter) {\n main.innerHTML = \"\";\n const loggedInPageContainer = document.createElement('section');\n main.appendChild(loggedInPageContainer);\n loggedInPageContainer.id = \"loggedInPageContainer\";\n loggedInPageContainer.setAttribute(\"class\", \"loggedin-page-container\");\n\n let newsLetterText;\n let subscribeText;\n\n if (newsLetter == true) {\n newsLetterText = \"Du prenumererar på vårat nyhetsbrev!\";\n subscribeText = `<a href=\"#\" id=\"subscribeBtn\">Avregistrera här</a>`;\n } else {\n newsLetterText = \"Du prenumererar inte på vårat nyhetsbrev!\";\n subscribeText = `<a href=\"#\" id=\"subscribeBtn\">Registrera dig här!</a>`;\n };\n\n printLoggedInText(userName, newsLetterText, subscribeText);\n\n document.getElementById('subscribeBtn').addEventListener('click', () => {\n subscription(userKey, newsLetter);\n });\n}", "function createNewSubscription() {\n\t// grab the topic from the page form\n\tvar topic = document.getElementById(\"topic\").value.trim();\n\n\t// perform some basic sanity checking.\n\tif (topic.length === 0) {\n\t\treturn;\n\t}\n\n\tif (topic in subscriptions) {\n\t\tconsole.log(\"already have a sub with this topic\");\n\t\treturn;\n\t}\n\n\t// beyond the above, we rely of the sub call to fail if\n\t// the topic string is invalid.\n\n\tconsole.log(\"create new subscription: \" + topic);\n\n\t// issue the subscribe request to the server. Only update\n\t// the page and our data structure if the subscribe is\n\t// successful (do work in success callback).\n\tclientObj.subscribe(topic, {\n\t\tonFailure : function(responseObject) {\n\t\t\tconsole.log(\"Failed to subscribe: \" + responseObject.errorCode);\n\t\t\t// don't update the page\n\t\t},\n\n\t\tonSuccess : function(responseObject) {\n\t\t\t// grab the div on the page that houses the subs display items\n\t\t\tvar subsDiv = document.getElementById(\"subscriptions\");\n\t\t\t// ensure that it's not hidden (will be when there are no subs)\n\t\t\tsubsDiv.hidden = false;\n\n\t\t\t// create a new div to house the messages\n\t\t\tvar div = document.createElement(\"DIV\");\n\t\t\tdiv.id = \"subsection_\" + topic;\n\n\t\t\t// create the delete button\n\t\t\tvar nameRef = \"button/\" + topic;\n\t\t\tvar button = document.createElement(\"BUTTON\");\n\t\t\tbutton.id = nameRef;\n\t\t\tbutton.innerHTML = \"delete subscription\";\n\n\t\t\tbutton.onclick = function() {\t\t\t\t\n\t\t\t\tconsole.log(\"delete subscription: \" + topic);\n\n\t\t\t\t// do unsub\n\t\t\t\tclientObj.unsubscribe(topic);\n\t\t\t\t// remove row...\n\t\t\t\tsubsDiv.removeChild(subscriptions[topic].div);\n\t\t\t\tsubsDiv.removeChild(subscriptions[topic].spacing);\n\t\t\t\t// remove from data structure\n\t\t\t\tdelete subscriptions[topic];\n\t\t\t\tsubCount--;\n\n\t\t\t\tif (subCount === 0) {\n\t\t\t\t\tsubsDiv.hidden = true;\n\t\t\t\t}\n\t\t\t}\t\n\n\t\t\t// create a new table for the div\n\t\t\tvar table = document.createElement(\"TABLE\");\n\n\t\t\t// create header\n\t\t\tvar header = table.createTHead();\n\t\t\tvar hRow = header.insertRow(0);\n\t\t\tvar tCell = hRow.insertCell(0);\n\t\t\tvar bCell = hRow.insertCell(1);\n\n\t\t\ttCell.innerHTML = \"Topic: \" + topic;\n\t\t\tbCell.appendChild(button);\n\t\t\t\n\t\t\tvar textArea = document.createElement(\"TEXTAREA\");\n\t\t\ttextArea.readOnly = true;\n\t\t\ttextArea.cols = 150;\n\t\t\ttextArea.rows = 6;\n\n\t\t\tvar spacing = document.createElement(\"BR\");\n\n\t\t\tdiv.appendChild(table);\n\t\t\tdiv.appendChild(textArea);\t\t\t\n\n\t\t\t// add the div to the page\n\t\t\tsubsDiv.appendChild(div);\n\t\t\tsubsDiv.appendChild(spacing);\n\n\t\t\t// the object we will store in our subs map\n\t\t\tvar subObj = {\n\t\t\t\tdiv : div, // ref to the div (for easy deleting later)\n\t\t\t\ttext : textArea, // ref to the text area (to add msgs to)\n\t\t\t\tspacing : spacing, // ref to the <br> tag (for easy deleting)\n\t\t\t\tmsgCount : 0 // count of the messages currently displayed.\n\t\t\t};\t\t\t\n\n\t\t\t// store the obj and update our sub count\n\t\t\tsubscriptions[topic] = subObj;\t\n\t\t\tsubCount++;\n\t\t}\n\t});\n}", "function render() {\n\n\t\t\tisRendered = true;\n\n\t\t\trenderSource();\n\n\t\t}", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "function render() {\n if (STORE.view === 'start') {\n renderStartQuiz();\n $('.intro').show();\n $('.quiz').hide();\n $('.result').hide();\n $('.quizStatus').hide();\n } else if (STORE.view === 'quiz') {\n renderQuestionText();\n renderQuizStatusBar();\n $('.intro').hide();\n $('.quiz').show();\n $('.result').hide();\n $('.quizStatus').show();\n } else if (STORE.view === 'questionResult') {\n renderQuestionResult();\n renderQuizStatusBar();\n $('.intro').hide();\n $('.quiz').hide();\n $('.result').show();\n $('.quizStatus').show();\n } else if (STORE.view === 'finalResult') {\n renderFinalResult();\n $('.intro').hide();\n $('.quiz').hide();\n $('.result').show();\n $('.quizStatus').hide();\n }\n }" ]
[ "0.6166739", "0.6032917", "0.5972155", "0.5954931", "0.5884055", "0.583181", "0.57925886", "0.5769471", "0.5769471", "0.5769471", "0.56891847", "0.5639037", "0.5632166", "0.56310517", "0.56310517", "0.5630244", "0.5607981", "0.55974364", "0.55900705", "0.5580156", "0.5557037", "0.5556741", "0.5542636", "0.55395895", "0.5519016", "0.5514103", "0.5488994", "0.5470407", "0.54658186", "0.54619527", "0.54437643", "0.5435217", "0.5414592", "0.5413938", "0.540814", "0.5406047", "0.5401812", "0.5390952", "0.53906417", "0.5381136", "0.53809816", "0.53771967", "0.5364328", "0.535406", "0.5345423", "0.5343872", "0.5343788", "0.53410506", "0.5335789", "0.5327803", "0.53270143", "0.53200436", "0.5318153", "0.5310741", "0.53097934", "0.5307322", "0.53053385", "0.5302498", "0.53021866", "0.52973855", "0.5296592", "0.5290604", "0.5286029", "0.527926", "0.52711666", "0.52659124", "0.5258934", "0.5257479", "0.5255457", "0.525187", "0.5251023", "0.5250266", "0.5248", "0.5245884", "0.5245754", "0.5240281", "0.52388865", "0.5236496", "0.5235959", "0.5234187", "0.5230834", "0.5227272", "0.52261966", "0.5224764", "0.52196497", "0.5219318", "0.52165", "0.5213986", "0.5209477", "0.52078533", "0.5207303", "0.5204475", "0.5202507", "0.518981", "0.51891965", "0.518386", "0.51788956", "0.51788956", "0.51788956", "0.51788956", "0.5170913" ]
0.0
-1
Wait for the window to finish loading
function loadListener() { window.removeEventListener("load", loadListener, false); AlwaysReader.init(window); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function window_OnLoad() {\n await initialLoad();\n}", "function waitViewerToLoad() {\n\t\tif(!document.VLVChart)\n\t\t{\n\t\t\t// not loaded, try again in 200ms\n\t\t\tsetTimeout(waitViewerToLoad, 200);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// loaded. Poll events\n\t\t\tobjChart = document.VLVChart;\n\t\t\tPollEvent();\n\t\t\t// execute callback function\n\t\t\tif(cb) {\n\t\t\t\tcb(this);\n\t\t\t}\n\t\t}\n\t}", "function waitLoad(){\n while (createButton === false){\n console.log(\"Waiting for load.\")\n }\n if (createButton != undefined){\n console.log(\"Yo, that shit button is loaded.\");\n window.onload(console.log(\"Page Fully Loaded\"));\n }\n}", "function qodeOnWindowLoad() {\n\t qodeElementorInitProgressBarIcon();\n }", "function _WindowwOnLoad() {\r\n uuready.gone.win = 1;\r\n _DOMContentLoaded();\r\n win.xwin && win.xwin(uu); // window.xwin(uu) callback\r\n uulazyfire(\"canvas\");\r\n uulazyfire(\"audio\");\r\n uulazyfire(\"video\");\r\n}", "function startWait(){\n let loader = document.getElementsByClassName(\"loader\")[0];\n loader.style.display = 'block';\n document.getElementsByTagName(\"BODY\")[0].style.cursor = \"wait !important\"; \n nanobar.go( 30 );\n}", "waitLoading() {\n return new Promise((resolve, reject) => {\n const loadingText = 'Loading resources...\\nReceiving file...';\n G.rootStage.addChild(this.loadingBar = G.graphics.createText(loadingText, {}, (w, h, self) => ({\n x: 10,\n y: h - self.height - 10\n })));\n G.resource.load(this.resourceToLoad);\n renderLoop(() => {\n if (G.resource.remains <= 0) {\n G.rootStage.removeChild(this.loadingBar);\n resolve();\n return false;\n }\n this.updateLoadingBar();\n });\n });\n }", "function qodeOnWindowLoad() {\n qodeInitElementorCoverBoxes();\n }", "function DfoWait()\r\n{\r\n\tGlobal.DoSleep(2000);\r\n\r\n\tvar waitPane = Navigator.Find('//div[@id=\"ShellProcessingDiv\"]');\r\n\tif (!waitPane)\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tvar waitResult = Global.DoWaitForProperty(waitPane, '_DoDOMGetAttribute', 'display: none;', 300000, 'style');\r\n\treturn waitResult != false;\t\r\n}", "function WaitUntilTheMapAndDataAreLoaded(){\r\n\tstartLoadingIndicator();\r\n\t\r\n\tif(mapIsLoaded && dataIsLoaded){\r\n\t\t//setup the list view\r\n\t\tinitList();\r\n\t\t//setup the map view\r\n\t\tinitMap();\r\n\t\t\r\n\t\t//reset the loading flags\r\n\t\tdataIsLoaded = false;\r\n\t\tmapIsLoaded = false;\r\n\t\t\r\n\t\tstopLoadingIndicator();\r\n\t\r\n\t} else {\r\n\t\tsetTimeout(\"WaitUntilTheMapAndDataAreLoaded()\",250);\r\n\t}\r\n}", "function callLoad() {\n\t$('#confirmModal').hide();\n\t$('.modal1').show();\n\t$('#loader').show();\n\tmyVar = setTimeout(showFinal, 3000);\n\n}", "function loaded(){\n\t\tipcRenderer.send('asynchronous-message', {\"tag\":\"loaded\"});\n\t\t$( document ).tooltip();\n\t}", "function waitDone() {\n (function (initApplication) {\n initApplication($, Highcharts, window, document);\n })(function ($, Highcharts, window, document) {\n // load libraries\n ApmJqWidgets();\n APMRPM.Services = new APMRPM._Services();\n APMRPM.Components = new APMRPM._Components();\n APMRPM.Highcharts = new APMRPM._Highcharts();\n APMRPM.MainPanel = new APMRPM._MainPanel();\n\n // load jquery\n $(function () {\n APMRPM.MainPanel.adjustCSS();\n APMRPM.MainPanel.render();\n });\n });\n}", "function windowLoaded () {\n remote.getGlobal(\"share\").openFileDialog = openFileDialog;\n remote.getGlobal(\"share\").setAudioLogLin = setAudioLogLin;\n\n console.log(\"window loaded\");\n slidersInitialise(); // in sliders.js\n initialiseDragDrop (); // in dragdrop.js\n initialise_vis(); // in visualiser.js\n}", "waitFormainpageToLoad () {\n if(!this.cityNameInput.isVisible()){\n this.cityNameInput.waitForVisible(5000);\n }\n }", "function waitForLoad() {\n return new Promise(resolve => {\n image.addEventListener(\"load\", resolve);\n });\n }", "function waitingPlayersScreen() {\n loadSvg(\"Wait for others to finish...\");\n}", "function finishedLoad() {\n console.log('finishedLoad()');\n if (externalIsLoaded()) {\n init();\n }\n }", "function showBusyScreen()\r\n{\r\n\tif(!dialog_loading) dialog_loading = null;\r\n\tdialog_loading = new ModalDialog (\"#loading_dialog\");\r\n\t\r\n\tdialog_loading.show(5000);\r\n}", "function windowLostFocusEvent()\n{\n if(_loadingModels.done)\n showStartMenu();\n}", "setLoadingWindow() {\r\n this.loadingWindow = new BrowserWindow({\r\n width: 500,\r\n height: 300,\r\n frame: false\r\n });\r\n this.loadingWindow.loadURL(path.join(__dirname, \"public/loading.html\"));\r\n }", "async waitForPageToLoad(elementSelector) {\n browser.maximizeWindow();\n const selector = await $(elementSelector);\n await selector.waitForDisplayed();\n const isDisplayed = await selector.isDisplayed();\n if (!isDisplayed) {\n return await $(elementSelector).waitForDisplayed();\n }\n }", "function $w_completed() {\r\n\tconsole.log(\"$w_completed\");\r\n\tif ($d.addEventListener || event.type === \"load\" || $d.readyState === \"complete\" ) {\r\n\t\t$w_detach();\r\n\t\tif(!Whaty.isReady){\r\n\t\t\tconsole.log(\"Whaty.isReady---:\"+Whaty.isReady);\r\n\t\t\tWhaty.isReady = true;\r\n\t\t\t$w_init();\r\n\t\t}\r\n\t}\r\n}", "async function initialLoad() {\n setElementDisplay([sensorTypeSettingMenu, addNewSensorTypeMenu, addExistingSensorTypeMenu, updateSensorTypeMenu, removeSensorTypeReferenceMenu, popupBox], \"none\");\n setElementDisplay([mainMenu], \"block\");\n\n UC.clearSelect(sensorTypeSelect);\n\n popupConfirm.onclick = popupConfirm_Click;\n\n let sensorTypeInfo = await getSensorTypeInfo();\n await populateSelectWithSensorTypes(sensorTypeSelect, sensorTypeInfo);\n}", "onPageLoaded() {\n window.clearTimeout(this.animationTimeout_);\n window.clearTimeout(this.loadingTimeout_);\n this.setUIStep(AssistantLoadingUIState.LOADED);\n }", "loaded() {\n this.searchField.waitForVisible();\n return true;\n }", "function pageFullyLoaded () {}", "function waitForLoad (app, t) {\n return app.start().then(function () {\n return app.client.waitUntilWindowLoaded()\n }).then(function () {\n // Switch to the main window\n return app.client.windowByIndex(0)\n }).then(function () {\n return app.client.waitUntilWindowLoaded()\n })\n}", "function _load() {\r\n document.getElementById(\"loading-icon\").style.visibility = \"hidden\";\r\n document.getElementById(\"body\").style.visibility = \"visible\";\r\n }", "function ShowWaitDialog() {\n}", "function windowLoad() {\n\tdraw(startX, startY, startDirection);\n\tkarel[startX][startY] = true;\n//\tcheckWallAround(startX, startY);\n//\tcheckBeepersPresent(startX, startY);\n//\tloadDatabase();\n}", "function loadWindow(){\n\treturn new Promise (function(resolve, reject){\n\t\twindow.onload = function(){\n\t\t\tdocument.body.appendChild(canvas);\n\t\t\tresolve();\n\t\t}\n\t});\n}", "function SetWait (bWait)\n{\n\t$('#loading').css('display', bWait ? 'block' : 'none');\n\tdocument.body.style.cursor = bWait ? 'progress' : 'inherit';\n}", "function loading(w) {\n $(\"#logo\").click(function() {location.href = \"/index.html\"});\n $(\"body\").css({\"display\":\"block\"});\n var MarginTop=window.innerHeight/2-220;\n $(\"#LoginCanvas\").css({\"margin-top\":MarginTop+\"px\"});\n isTittle1=w;\n\tNavItemSelectorDefaultPos = (2-w)*96+15;\n material();\n\taddActionToOptionBox();\n}", "function wait() {\r\n\r\n var waitElem = $(WAIT_ELEM_ID);\r\n\r\n if (!waitElem) {\r\n\r\n waitElem = document.createElement('div');\r\n\r\n waitElem.setAttribute('id', WAIT_ELEM_ID);\r\n\r\n waitElem.setAttribute('style', 'position:absolute;width:100px;height:20px;left:15px;top:110px;');\r\n\r\n waitElem.innerHTML = '<img style=\"width:16px;height:16px;margin:2px 0px 2px 0px;\" src=\"' + WAIT_ICON + '\"/> Please wait...';\r\n\r\n $('geoForm').appendChild(waitElem);\r\n\r\n }\r\n\r\n waitElem.style.display = 'block';\r\n\r\n body_cursor_bak = document.getElementsByTagName('body')[0].style.cursor;\r\n\r\n document.getElementsByTagName('body')[0].style.cursor = 'wait';\r\n\r\n}", "waitFor_meetingRaceList_RaceContent() {\n if(!this.meetingRaceList_RaceContent.isVisible()){\n this.meetingRaceList_RaceContent.waitForVisible(5000);\n }\n }", "function runOnLoad(window) {\r\n\t\t//updateCheck(window);\r\n // Listen for one load event before checking the window type\r\n window.addEventListener(\"load\", function runOnce() {\r\n window.removeEventListener(\"load\", runOnce, false);\r\n\t\t\t//updateCheck(window);\r\n watcher(window);\r\n }, false);\r\n }", "function waitO(){\n\t\t\twiDiv.removeChild(document.getElementById('wiClose'));\n\t\t\twiDiv.style.position = \"relative\";\n\t\t\treturnToHome(false,false);\n\t\t\treturn false;\n\t\t}", "async waitForWindow() {\n return new Promise(resolve => {\n const defer = setInterval(() => {\n const windows = OriginalBrowserWindow.getAllWindows();\n\n if (windows.length === 1 && windows[0].webContents.getURL().includes('discordapp.com')) {\n resolve(windows[0]);\n clearInterval(defer);\n }\n }, 10);\n });\n }", "async function load() {\n await Datas.Settings.read();\n await Datas.Systems.read();\n //RPM.gameStack.pushTitleScreen();\n //RPM.datasGame.loaded = true;\n Manager.GL.initialize();\n Manager.GL.resize();\n Manager.Stack.requestPaintHUD = true;\n}", "function loadingScreen(){\n var timeOut = setTimeout(showPage, 2000);\n}", "function is_document_ready() {\n\n var visibleLoader = null;\n for (const loader of container.getElementsByClassName(\"loader\")) {\n if (loader.visible) {\n visibleLoader = loader;\n }\n }\n if (!visibleLoader) {\n get_all_prs();\n setInterval(get_all_prs, 30000);\n\n } else {\n console.log(\"Document not fully loaded. Waiting a bit more\");\n setTimeout(is_document_ready, 1000);\n }\n }", "waitFor_meetingRaceList_RaceTitle() {\n if(!this.meetingRaceList_RaceTitle.isVisible()){\n this.meetingRaceList_RaceTitle.waitForVisible(5000);\n }\n }", "registration_page_loaded() {\n Action.waitForJSReadystate();\n Action.setFrMainFrame();\n Action.waitForPageToLoad(this.lastname, \"Patient Registration Page\");\n }", "async waitForLoadingAnimation() {\n var i = 0;\n var isVisible;\n do {\n var isVisible = await this.driver\n .wait(\n until.elementLocated(By.className(this.loader)),\n this.defaultTimeout\n )\n .isDisplayed();\n i++;\n // the anmiation still needs a second to disapear after the attribute returns false\n await this.driver.sleep(1000);\n // keep running loop if element is visible, timeout after 100 tires if it never disapears\n } while (i < 100 && isVisible === true);\n }", "function showLoadingView() {\n//remove table and reset categories\n $('body').append('<div style=\"\" id=\"loadingDiv\"><div class=\"loader\">Loading...</div></div>');\n $(window).on('load', function(){\n setTimeout(hideLoadingView, 2000); //wait for page load PLUS two seconds.\n });\n}", "function showLoading() {\n\twindow.status = \"Obtendo informações\";\n\n\tmainContent.style.display = \"none\";\n\tloading.style.display = \"block\";\n}", "function showProgress() {\n $(\"#loading-ring\").show();\n WinJS.UI.processAll();\n}", "function jsShowWindowLoad(mensaje) {\r\n jsRemoveWindowLoad();\r\n\r\n if (mensaje === undefined) mensaje = procestxt;\r\n \r\n height = 20;\r\n var ancho = 0;\r\n var alto = 0;\r\n \r\n if (window.innerWidth == undefined) ancho = window.screen.width;\r\n else ancho = window.innerWidth;\r\n if (window.innerHeight == undefined) alto = window.screen.height;\r\n else alto = window.innerHeight;\r\n \r\n var heightdivsito = alto/2 - parseInt(height)/2;//Se utiliza en el margen superior, para centrar\r\n\tvar Widthdivsito = ancho/2 - 60;//Se utiliza en el margen superior, para centrar\r\n\r\n\t\timgCentro = \"<div style='text-align:center;height:\" + alto + \"px;'>\" + \r\n\t\t\t\t\t\"<div style='color:#000;margin-top:\" + heightdivsito + \"px; font-size:20px;font-weight:bold'>\" + \r\n\t\t\t\t\t\t\"<div class='loader' style='margin-top:\" + heightdivsito + \"px;margin-left: \" + Widthdivsito + \"px;'></div><br/><br/>\" +\r\n\t\t\t\t\t\tmensaje + \r\n\t\t\t\t\t\"</div>\" +\r\n\t\t\t\t\"</div>\";\r\n div = document.createElement(\"div\");\r\n div.id = \"WindowLoad\"\r\n div.style.width = ancho + \"px\";\r\n div.style.height = alto + \"px\";\r\n $(\"body\").append(div);\r\n input = document.createElement(\"input\");\r\n input.id = \"focusInput\";\r\n input.type = \"text\"\r\n $(\"#WindowLoad\").append(input);\r\n $(\"#focusInput\").focus();\r\n $(\"#focusInput\").hide();\r\n $(\"#WindowLoad\").html(imgCentro);\r\n \r\n}", "waitFor_meetingRaceList_RaceStatus() {\n if(!this.meetingRaceList_RaceStatus.isVisible()){\n this.meetingRaceList_RaceStatus.waitForVisible(5000);\n }\n }", "function loadComplete() {\n\thasLoaded = true;\n}", "function showLoader() {\n\t$(window).on('load', function () {\n\t\t$('#popUp').removeClass('hidden');\n\t\t$('#popUp a').hide();\n\t});\n}", "function loaded() {\n ut.assert(true);\n ut.async(false);\n }", "static waitMessageEnd() {\n $('#wmsg-modal').hide();\n }", "function GM_wait() {\r\n\t\tif(typeof unsafeWindow.jQuery == 'undefined'){\r\n\t\t\twindow.setTimeout(GM_wait, 100);\r\n\t\t}else{\r\n\t\t\t$ = unsafeWindow.jQuery.noConflict(true);\r\n\t\t\tload();\r\n\t\t}\r\n\t}", "function finishLoad() {\n // Show the document.\n var documentView = this.mainDisplay_.openDocument(doc);\n goog.asserts.assert(documentView);\n\n // Zoom to fit.\n // TODO(benvanik): remove setTimeout when zoomToFit is based on view\n wtf.timing.setTimeout(50, function() {\n documentView.zoomToFit();\n }, this);\n }", "function checkLoaded() {\n\tif(clickedOnce == false) {\n loadTest();\n\t}\n}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener || event.type === \"load\" || document.readyState === \"complete\") {\n detach();\n jQuery.ready();\n }\n }", "function jsShowWindowLoad(mensaje) {\r\n\t //eliminamos si existe un div ya bloqueando\r\n\t jsRemoveWindowLoad();\r\n\t \r\n\t //si no enviamos mensaje se pondra este por defecto\r\n\t if (mensaje === undefined) mensaje = \"Procesando la información<br>Espere por favor\";\r\n\t \r\n\t //centrar imagen gif\r\n\t height = 20;//El div del titulo, para que se vea mas arriba (H)\r\n\t var ancho = 0;\r\n\t var alto = 0;\r\n\t \r\n\t //obtenemos el ancho y alto de la ventana de nuestro navegador, compatible con todos los navegadores\r\n\t if (window.innerWidth == undefined) ancho = window.screen.width;\r\n\t else ancho = window.innerWidth;\r\n\t if (window.innerHeight == undefined) alto = window.screen.height;\r\n\t else alto = window.innerHeight;\r\n\t \r\n\t //operación necesaria para centrar el div que muestra el mensaje\r\n\t var heightdivsito = alto/2 - parseInt(height)/2;//Se utiliza en el margen superior, para centrar\r\n\t \r\n\t //imagen que aparece mientras nuestro div es mostrado y da apariencia de cargando\r\n\t imgCentro = \"<div style='z-index:10;text-align:center;height:\" + alto + \"px;'><div style='color:#000;margin-top:\" + heightdivsito + \"px; font-size:20px;font-weight:bold'>\" + mensaje + \"</div><img src='../images/loading.gif' width='107' height='106'></div>\";\r\n\t \r\n\t //creamos el div que bloquea grande------------------------------------------\r\n\t var altoDivGris=alto+500;\r\n\t div = document.createElement(\"div\");\r\n\t div.id = \"WindowLoad\"\r\n\t div.style.width = ancho + \"px\";\r\n\t div.style.height = altoDivGris + \"px\";\r\n\t $(\"#WindowLoad\").css(\"z-index\",\"50\");\r\n\t \r\n\t $(\"body\").append(div);\r\n\t \r\n\t //creamos un input text para que el foco se plasme en este y el usuario no pueda escribir en nada de atras\r\n\t input = document.createElement(\"input\");\r\n\t input.id = \"focusInput\";\r\n\t input.type = \"text\"\r\n\t \r\n\t //asignamos el div que bloquea\r\n\t $(\"#WindowLoad\").append(input);\r\n\t \r\n\t //asignamos el foco y ocultamos el input text\r\n\t $(\"#focusInput\").focus();\r\n\t $(\"#focusInput\").hide();\r\n\t \r\n\t //centramos el div del texto\r\n\t $(\"#WindowLoad\").html(imgCentro);\r\n\t \r\n\t}", "async wait() {\n this.waitingAnimationFinish = true;\n await Utils.delay(1000);\n this.waitingAnimationFinish = false;\n }", "function waitReady() {\n ready = getStore().getState().pageUpdateData.pageUpdateId !== initialPageUpdateId;\n if (!ready) {\n window.setTimeout(waitReady, 50);\n return false;\n }\n resolve(true);\n return true;\n }", "function GM_wait()\r\n{\r\n\tif(typeof unsafeWindow.jQuery == 'undefined')\r\n\t{\r\n\t\twindow.setTimeout(GM_wait,100);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$ = unsafeWindow.jQuery;\r\n\t\tLoad();\r\n\t}\r\n}", "function waitForImages() {\n\n\t\t// the rest of the code does not apply to IE9, so exit\n\t\tif ( classie.has(elHTML, 'ie9') ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar \telLoader = document.getElementById('loader_overlay'),\n\t\t\telPreloadImage = document.getElementById('bg-image');\n\n\t\t// listen for the end of <header> fadeIn animation\n\t\telLoader.addEventListener(transitionEvent, removeLoader);\n\n\t\tfunction removeLoader() {\n\n\t\t\t// remove the event listener from the loader\n\t\t\telLoader.removeEventListener(transitionEvent, removeLoader);\n\n\t\t\t// remove any unneeded elements\n\t\t\telBody.removeChild(elLoader);\n\t\t\telPreloadImage.parentNode.removeChild(elPreloadImage);\n\n\t\t\t// page is now fully ready to go\n\t\t\t// elHTML.setAttribute('data-page', 'ready');\n\t\t\telHTML.setAttribute('data-overlay', 'hidden');\n\n\t\t}\n\n\t\t// layout Packery after all images have loaded\n\t\timagesLoaded(elBody, function(instance) {\n\t\t\telHTML.setAttribute('data-images', 'loaded');\n\t\t});\n\n\t}", "function showLoadingState() {\n\tif (!globals.browser) return;\n\tvar loadingDiv = document.getElementById('loadingDiv');\n\tvar loadingDivSwf = document.getElementById('loadingDivSwf');\n\t\n\tvar browserDiv = document.getElementById('browserDiv');\n\tbrowserDiv.style.display = \"none\";\n\t\n\t// hide browser, as its always on top//\n\tglobals.browser.style.display = \"none\";\n\t// show loading//\n\tloadingDiv.style.height = globals.height + \"px\"\n\tloadingDiv.style.display = \"block\";\n\t// show loading swf //\n\tloadingDivSwf.style.display = \"\";\n\tcenterLoading();\n}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener || window.event.type === \"load\" || document.readyState === \"complete\") {\n detach();\n jQuery.ready();\n }\n }", "waitFor_viewMoreStewardsTab_RaceReplaysTab() {\n if(!this.viewMoreStewardsTab_RaceReplaysTab.isVisible()){\n this.viewMoreStewardsTab_RaceReplaysTab.waitForVisible(5000);\n }\n }", "waitFor_meetingHeader_Weather() {\n if(!this.meetingHeader_Weather.isVisible()){\n this.meetingHeader_Weather.waitForVisible(5000);\n }\n }", "function showQuiosqueLoad(){\n $(\"#myloadingDiv\" ).show();\n }", "function wait() {\n if (position < 9) { //this number can be changed depending on how many qustion we have.\n position++;\n generateQuestions();\n counter = 30;\n timerWrapper();\n } else {\n finalScreen()\n };\n\n }", "function jsShowWindowLoad(mensaje) {\n\t //eliminamos si existe un div ya bloqueando\n\t jsRemoveWindowLoad();\n\t \n\t //si no enviamos mensaje se pondra este por defecto\n\t if (mensaje === undefined) mensaje = \"Procesando la información<br>Espere por favor\";\n\t \n\t //centrar imagen gif\n\t height = 20;//El div del titulo, para que se vea mas arriba (H)\n\t var ancho = 0;\n\t var alto = 0;\n\t \n\t //obtenemos el ancho y alto de la ventana de nuestro navegador, compatible con todos los navegadores\n\t if (window.innerWidth == undefined) ancho = window.screen.width;\n\t else ancho = window.innerWidth;\n\t if (window.innerHeight == undefined) alto = window.screen.height;\n\t else alto = window.innerHeight;\n\t \n\t //operación necesaria para centrar el div que muestra el mensaje\n\t var heightdivsito = alto/2 - parseInt(height)/2;//Se utiliza en el margen superior, para centrar\n\t \n\t //imagen que aparece mientras nuestro div es mostrado y da apariencia de cargando\n\t imgCentro = \"<div style='text-align:center;height:\" + alto + \"px;'><div style='color:#000;margin-top:\" + heightdivsito + \"px; font-size:20px;font-weight:bold'>\" + mensaje + \"</div><img src='../images/loading.gif' width='107' height='106'></div>\";\n\t \n\t //creamos el div que bloquea grande------------------------------------------\n\t div = document.createElement(\"div\");\n\t div.id = \"WindowLoad\"\n\t div.style.width = ancho + \"px\";\n\t div.style.height = alto + \"px\";\n\t $(\"body\").append(div);\n\t \n\t //creamos un input text para que el foco se plasme en este y el usuario no pueda escribir en nada de atras\n\t input = document.createElement(\"input\");\n\t input.id = \"focusInput\";\n\t input.type = \"text\"\n\t \n\t //asignamos el div que bloquea\n\t $(\"#WindowLoad\").append(input);\n\t \n\t //asignamos el foco y ocultamos el input text\n\t $(\"#focusInput\").focus();\n\t $(\"#focusInput\").hide();\n\t \n\t //centramos el div del texto\n\t $(\"#WindowLoad\").html(imgCentro);\t \n\t}", "function loadSuccessView() {\n if (timerPairingTimeout) {\n clearTimeout(timerPairingTimeout);\n timerPairingTimeout = null;\n }\n // Set the status bar\n setStatusBar('result');\n\n // Fill the title\n document.getElementById('title').innerHTML = localization['Result']['SuccessTitle'];\n document.getElementById('title').className = \"success\";\n\n document.getElementById('app-over').className = \"borderLink\";\n document.getElementById('br-over').className = \"\";\n document.getElementById('app-logo').className = \"app-logo borderDone\";\n document.getElementById('br-logo').className = \"br-logo borderDone\";\n\n // Fill the content area\n var content = \"<p>\" + localization['Result']['SuccessDescription'] + \"</p>\";\n document.getElementById('content').innerHTML = content;\n\n // Show the bar-box\n document.getElementById('bar-box').style.display = \"\";\n\n document.addEventListener(\"enterPressed\", closeWindow);\n document.getElementById(\"discord\").addEventListener(\"click\", discord);\n document.getElementById(\"twitter\").addEventListener(\"click\", twitter);\n\n // Close this window\n function closeWindow() {\n window.close();\n }\n\n function discord() {\n window.opener.openDiscord();\n }\n\n function twitter() {\n window.opener.openTwitter();\n }\n}", "function loadDone() {\n return true;\n }", "function startLoadingPopupViewerScreen()\n{\n\t$(\"#popupViewerTabs\").block({ \n\t\tmessage: '<h1>Loading Visualizations...</h1>', \n\t\tborder: 'none', \n\t\tpadding: '15px', \n\t\tbackgroundColor: '#000', \n\t\t'-webkit-border-radius': '10px', \n\t\t'-moz-border-radius': '10px', \n\t\topacity: .5, \n\t\tcolor: '#fff' \n\t}); \n}", "function checkLoad() {\n\tchrome.tabs.query({\n\t\tactive: true,\n\t\tcurrentWindow: true\n\t}, function (tabs) {\n\n\t\t// send message to extension.js\n\t\tchrome.tabs.sendMessage(tabs[0].id, {\n\t\t\ttype: \"checkError\"\n\t\t}, function (loadError) {\n\n\t\t\t// if loadError, report; else, keep checking until event successfully obtained\n\t\t\tif (loadError) {\n\t\t\t\treport(\"load-error\")\n\t\t\t} else if (!eventSuccess) {\n\t\t\t\tsetTimeout(checkLoad, 250)\n\t\t\t}\n\t\t})\n\t})\n\n}", "waitFor_meetingRaceList_RaceNo() {\n if(!this.meetingRaceList_RaceNo.isVisible()){\n this.meetingRaceList_RaceNo.waitForVisible(5000);\n }\n }", "function addLoad(){\n $('#loadingPopup').css('display', 'block');\n }", "static async load()\n {\n await RPM.settings.read();\n await RPM.datasGame.read();\n RPM.gameStack.pushTitleScreen();\n RPM.datasGame.loaded = true;\n RPM.requestPaintHUD = true;\n }", "function waitFunction() {\n setTimeout(showDescription, 700);\n }", "function wait() {\n\tif ( questionCounter < 7 ) {\n\t\tquestionCounter++;\n\t\tgenerateHTML();\n\t\tcounter = 30;\n\t\ttimerWrapper();\n\t} else {\n\t\tfinalScreen();\n\t}\n}", "function initPopup () {\n getSettings().then (function () {\n if (document.readyState === \"complete\" || \"interactive\") {\n displaySettings(settings) \n addListeners() \n }\n else {\n document.addEventListener(\"DOMContentLoaded\", function () {\n displaySettings(settings) \n addListeners() \n })\n }\n })\n\n checkForUpdate().then (function (update_status) {\n if (update_status === true ) { \n displayUpdate() \n }\n })\n\n}", "function tabLoad() {\n // Tab load safety check\n if (tabHasLoaded) {\n return;\n }\n tabHasLoaded = true;\n\n setupPage();\n\n getAlerts();\n }", "function waitForDocLoadComplete(aBrowser=gBrowser) {\n let deferred = promise.defer();\n let progressListener = {\n onStateChange: function (webProgress, req, flags, status) {\n let docStop = Ci.nsIWebProgressListener.STATE_IS_NETWORK |\n Ci.nsIWebProgressListener.STATE_STOP;\n info(\"Saw state \" + flags.toString(16) + \" and status \" + status.toString(16));\n\n // When a load needs to be retargetted to a new process it is cancelled\n // with NS_BINDING_ABORTED so ignore that case\n if ((flags & docStop) == docStop && status != Cr.NS_BINDING_ABORTED) {\n aBrowser.removeProgressListener(progressListener);\n info(\"Browser loaded \" + aBrowser.contentWindow.location);\n deferred.resolve();\n }\n },\n QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,\n Ci.nsISupportsWeakReference])\n };\n aBrowser.addProgressListener(progressListener);\n info(\"Waiting for browser load\");\n return deferred.promise;\n}", "function watcher(window) {\n try {\n // Now that the window has loaded, only handle browser windows\n let {documentElement} = window.document;\n if (documentElement.getAttribute(\"windowtype\") == \"navigator:browser\") {\n loadCallback(window);\n }\n }\n catch(ex) {}\n }", "function mkdOnWindowLoad() {\n mkdSmoothTransition();\n }", "function runOnLoad(window) {\n // Listen for one load event before checking the window type\n window.addEventListener(\"load\", function runOnce() {\n window.removeEventListener(\"load\", runOnce, false);\n watcher(window);\n }, false);\n }", "async onLoad() {}", "function loading(w) {\n $(\"body\").css({\"display\":\"block\"});\n var MarginTop=window.innerHeight/2-220;\n $(\"#LoginCanvas\").css({\"margin-top\":MarginTop+\"px\"});\n isTittle1=w;\n material();\n}", "async function pageLoaded() {\n loadRegisteData();\n prepareHandles();\n}", "function wait() {\n\tif (questionCounter < 7) {\n\tquestionCounter++;\n\tgenerateHTML();\n\tcounter = 30;\n\ttimerWrapper();\n\t}\n\telse {\n\t\tfinalScreen();\n\t}\n}", "function LoadData(){\n \n // primero se muestra el mensaje de \"espere\"\n MsjWait.show();\n \n // Luego despues de un segundo cargamos el grid\n setTimeout(\"LoadGrid();\", 1000);\n\n}", "async isLoading() {\n return (await\n $(this.elements.loading)\n ).isDisplayed();\n }", "function clearloading(gui_done=false){\n\tif (!gui_done){\n\t\td3.select(\"#splashdiv5\").text(\"Building GUI...\");\n\t\treturn;\n\t}\n\n\tviewerParams.loaded = true;\n\tviewerParams.reset = false;\n\n\t//show the rest of the page\n\td3.select(\"#ContentContainer\").style(\"visibility\",\"visible\")\n\n\t//console.log(\"loaded\")\n\td3.select(\"#loader\").style(\"display\",\"none\")\n\tif (viewerParams.local){\n\t\td3.select(\"#splashdiv5\").text(\"Click to begin.\");\n\t\tif (!viewerParams.showSplashAtStartup) showSplash(false);\n\t} else {\n\t\tshowSplash(false);\n\t}\n\n}", "function loadLoadingPage() {\n\tvar loadingBrowser = document.getElementById(\"bc_loading\");\n\t\n\t\n\tfunction loadingBrowserLoad(e) {\n\t\tMM.BC.log('loading browser loaded');\n\t\t\n\t\t\n\t\tvar col = dw.getPanelColor();\n\t\t\n\t\tloadingBrowser.style.backgroundColor = \"#\" + MM.BC.UTILS.RGB2HTML(col[0], col[1], col[2]);\n\t\t\n\t\tvar loadingWin = loadingBrowser.getWindowObj();\n\t\tvar loadingDoc = loadingWin.document;\n\t\t\n\t\tloadingDoc.getElementsByTagName('body')[0].style.backgroundColor = \"#\" + MM.BC.UTILS.RGB2HTML(col[0], col[1], col[2]);\n\t\tloadingDoc.getElementById('loadingDivMsg').innerHTML = dw.loadString('bc/message/contactingServer');\n\t\t\t\t\n\t\tloadingBrowser.style.display = \"\";\n\t\t\n\t}\n\t\n\tloadingBrowser.addEventListener(\"BrowserControlLoad\", loadingBrowserLoad, false);\t\n\t\n\tloadingBrowser.openURL(dw.getUserConfigurationPath() + \"Floaters/BCLoading.html\");\t\n}", "function AppCommonWindowBegin() {\n\n OpenAppProgressWindow();\n\n}", "function onDocumentLoading(){\r\n $(\"#progressSpinner\").show();\r\n\r\n if(PendingFullScreen)\r\n setFullScreen(true);\r\n\r\n if(!slider && FlexPaperFullScreen){\r\n\t addSlider('zoomSliderFullScreen');\r\n fpToolbarLoadButtons();\r\n }\r\n}", "function runOnLoad(window) {\n // Listen for one load event before checking the window type\n window.addEventListener(\"load\", function runOnce() {\n window.removeEventListener(\"load\", runOnce, false);\n watcher(window);\n }, false);\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\") {\n\n detach();\n jQuery.ready();\n }\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\") {\n\n detach();\n jQuery.ready();\n }\n }", "function loadRemainingUI() {\n\t\tloadPalette();\n\t\tsetPlaybackButtons();\n\t\tloadDownloadButton();\n\t}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n detach();\n jQuery.ready();\n }\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\" ) {\n\n detach();\n jQuery.ready();\n }\n }" ]
[ "0.71897006", "0.67051417", "0.6670822", "0.6446899", "0.64305687", "0.64215", "0.63693374", "0.63647753", "0.63168645", "0.6312839", "0.6277075", "0.6274329", "0.6229013", "0.6201349", "0.6194943", "0.6186003", "0.6175848", "0.6147557", "0.61468637", "0.6143661", "0.6128239", "0.6125739", "0.61094993", "0.61017996", "0.6097393", "0.60960615", "0.6090745", "0.60877246", "0.60676014", "0.6056529", "0.6003142", "0.5996532", "0.5993449", "0.59776807", "0.5976831", "0.5970793", "0.59694785", "0.59606534", "0.5924972", "0.5915764", "0.591284", "0.5908992", "0.5904375", "0.5891502", "0.5889902", "0.588649", "0.5878264", "0.58692116", "0.5868268", "0.5846808", "0.5845526", "0.5840893", "0.58330894", "0.5824988", "0.5820391", "0.5818572", "0.581771", "0.58055156", "0.5799375", "0.57991576", "0.5797549", "0.579632", "0.57900995", "0.5780167", "0.57798606", "0.5767942", "0.5766055", "0.5764039", "0.5762768", "0.57468194", "0.5745677", "0.5739246", "0.5737022", "0.5736324", "0.57340044", "0.57331353", "0.572442", "0.57208276", "0.571905", "0.5709183", "0.57047254", "0.56991726", "0.56981295", "0.5695676", "0.56956714", "0.5687575", "0.568389", "0.56830275", "0.5676146", "0.5673782", "0.5672935", "0.5670165", "0.56556296", "0.5649171", "0.56428134", "0.5638833", "0.56325895", "0.56325895", "0.56258386", "0.5620734", "0.56188047" ]
0.0
-1
Perform the analysis. This must be called before writeTypingsFile().
analyze() { if (this._astEntryPoint) { throw new Error('DtsRollupGenerator.analyze() was already called'); } // Build the entry point const sourceFile = this._context.package.getDeclaration().getSourceFile(); this._astEntryPoint = this._astSymbolTable.fetchEntryPoint(sourceFile); const exportedAstSymbols = []; // Create a DtsEntry for each top-level export for (const exportedMember of this._astEntryPoint.exportedMembers) { const astSymbol = exportedMember.astSymbol; this._createDtsEntryForSymbol(exportedMember.astSymbol, exportedMember.name); exportedAstSymbols.push(astSymbol); } // Create a DtsEntry for each indirectly referenced export. // Note that we do this *after* the above loop, so that references to exported AstSymbols // are encountered first as exports. const alreadySeenAstSymbols = new Set(); for (const exportedAstSymbol of exportedAstSymbols) { this._createDtsEntryForIndirectReferences(exportedAstSymbol, alreadySeenAstSymbols); } this._makeUniqueNames(); this._dtsEntries.sort((a, b) => a.getSortKey().localeCompare(b.getSortKey())); this._dtsTypeDefinitionReferences.sort(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "postAnalysis() { }", "processTypings(files) {\n // Set hashes of the app's typings.\n files.forEach(file => {\n let isAppTypings = this.isDeclarationFile(file) &&\n !this.isPackageFile(file);\n\n let path = file.getPathInPackage();\n if (isAppTypings && !this._typingsMap.has(path)) {\n this._typingsMap.set(path, file.getSourceHash());\n }\n });\n\n let copiedFiles = [];\n // Process package typings.\n files.forEach(file => {\n // Check if it's a package declaration file.\n let isPkgTypings = this.isDeclarationFile(file) &&\n this.isPackageFile(file);\n\n if (isPkgTypings) {\n let path = file.getPathInPackage();\n // Check if the file is in the \"typings\" folder.\n if (!this._typingsRegEx.test(path)) {\n console.log('Typings path ${path} doesn\\'t start with \"typings\"');\n return;\n }\n\n let filePath = this._getStandardTypingsFilePath(file);\n let oldHash = this._typingsMap.get(filePath);\n let newHash = file.getSourceHash();\n // Copy file if it doesn't exist or has been updated.\n if (oldHash !== newHash) {\n this._copyTypings(filePath, file.getContentsAsString());\n this._typingsMap.set(filePath, newHash);\n copiedFiles.push(filePath);\n }\n }\n });\n\n if (copiedFiles.length) {\n // Report about added/updated typings.\n console.log(chalk.green('***** Typings that have been added/updated *****'));\n copiedFiles.forEach(filePath => {\n console.log(chalk.green(filePath));\n });\n console.log(chalk.green(\n 'Add typings in tsconfig.json or by references in files.'));\n }\n }", "mainLogic() {\n this.apexParser = new ApexParser(this.accessModifiers,this.sourceDirectory);\n const filesArray = this.getClassFilesFromPackageDirectories();\n\n //Create a new array of ClassModels\n const classModels = this.getClassModelsFromFiles(filesArray);\n const mapGroupNameToClassGroup = this.createMapGroupNameToClassGroup(classModels, this.sourceDirectory);\n\n const projectDetail = this.fm.parseHTMLFile(this.bannerFilePath);\n const homeContents = this.fm.parseHTMLFile(this.homefilepath);\n this.fm.createDoc(mapGroupNameToClassGroup, classModels, projectDetail, homeContents, this.hostedSourceUrl);\n console.log('ApexDoc has completed!');\n }", "function analyzer(data, sidePass) {\n //B.start('analyzer');\n var mainPass = !sidePass;\n\n var item = { items: data };\n var data = item;\n\n var newTypes = {};\n\n // Gather\n // Single-liners\n ['globalVariable', 'functionStub', 'unparsedFunction', 'unparsedGlobals', 'unparsedTypes', 'alias'].forEach(function(intertype) {\n var temp = splitter(item.items, function(item) { return item.intertype == intertype });\n item.items = temp.leftIn;\n item[intertype + 's'] = temp.splitOut;\n });\n var temp = splitter(item.items, function(item) { return item.intertype == 'type' });\n item.items = temp.leftIn;\n temp.splitOut.forEach(function(type) {\n //dprint('types', 'adding defined type: ' + type.name_);\n Types.types[type.name_] = type;\n newTypes[type.name_] = 1;\n if (QUANTUM_SIZE === 1) {\n Types.fatTypes[type.name_] = copy(type);\n }\n });\n\n // Functions & labels\n item.functions = [];\n var currLabelFinished = false; // Sometimes LLVM puts a branch in the middle of a label. We need to ignore all lines after that.\n item.items.sort(function(a, b) { return a.lineNum - b.lineNum });\n for (var i = 0; i < item.items.length; i++) {\n var subItem = item.items[i];\n assert(subItem.lineNum);\n if (subItem.intertype == 'function') {\n item.functions.push(subItem);\n subItem.endLineNum = null;\n subItem.lines = []; // We will fill in the function lines after the legalizer, since it can modify them\n subItem.labels = [];\n subItem.forceEmulated = false;\n\n // no explicit 'entry' label in clang on LLVM 2.8 - most of the time, but not all the time! - so we add one if necessary\n if (item.items[i+1].intertype !== 'label') {\n item.items.splice(i+1, 0, {\n intertype: 'label',\n ident: ENTRY_IDENT,\n lineNum: subItem.lineNum + '.5'\n });\n }\n } else if (subItem.intertype == 'functionEnd') {\n item.functions.slice(-1)[0].endLineNum = subItem.lineNum;\n } else if (subItem.intertype == 'label') {\n item.functions.slice(-1)[0].labels.push(subItem);\n subItem.lines = [];\n currLabelFinished = false;\n } else if (item.functions.length > 0 && item.functions.slice(-1)[0].endLineNum === null) {\n // Internal line\n if (!currLabelFinished) {\n item.functions.slice(-1)[0].labels.slice(-1)[0].lines.push(subItem); // If this line fails, perhaps missing a label?\n if (subItem.intertype in LABEL_ENDERS) {\n currLabelFinished = true;\n }\n } else {\n print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum);\n }\n } else {\n throw 'ERROR: what is this? ' + dump(subItem);\n }\n }\n delete item.items;\n\n // CastAway - try to remove bitcasts of double<-->i64, which LLVM sometimes generates unnecessarily\n // (load a double, convert to i64, use as i64).\n // We optimize this by checking if there are such bitcasts. If so we create a shadow\n // variable that is of the other type, and use that in the relevant places. (As SSA, this is valid, and\n // variable elimination later will remove the double load if it is no longer needed.)\n //\n // Note that aside from being an optimization, this is needed for correctness in some cases: If code\n // assumes it can bitcast a double to an i64 and back and forth without loss, that may be violated\n // due to NaN canonicalization.\n function castAway() {\n if (USE_TYPED_ARRAYS != 2) return;\n\n item.functions.forEach(function(func) {\n var has = false;\n func.labels.forEach(function(label) {\n var lines = label.lines;\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP) {\n has = true;\n }\n }\n });\n if (!has) return;\n // there are integer<->floating-point bitcasts, create shadows for everything\n var shadowed = {};\n func.labels.forEach(function(label) {\n var lines = label.lines;\n var i = 0;\n while (i < lines.length) {\n var lines = label.lines;\n var line = lines[i];\n if (line.intertype == 'load' && line.type in SHADOW_FLIP) {\n if (line.pointer.intertype != 'value') { i++; continue } // TODO\n shadowed[line.assignTo] = 1;\n var shadow = line.assignTo + '$$SHADOW';\n var flip = SHADOW_FLIP[line.type];\n lines.splice(i + 1, 0, { // if necessary this element will be legalized in the next phase\n tokens: null,\n indent: 2,\n lineNum: line.lineNum + 0.5,\n assignTo: shadow,\n intertype: 'load',\n pointerType: flip + '*',\n type: flip,\n valueType: flip,\n pointer: {\n intertype: 'value',\n ident: line.pointer.ident,\n type: flip + '*'\n },\n align: line.align,\n ident: line.ident\n });\n // note: no need to update func.lines, it is generated in a later pass\n i++;\n }\n i++;\n }\n });\n // use shadows where possible\n func.labels.forEach(function(label) {\n var lines = label.lines;\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP && line.ident in shadowed) {\n var shadow = line.ident + '$$SHADOW';\n line.params[0].ident = shadow;\n line.params[0].type = line.type;\n line.type2 = line.type;\n }\n }\n });\n });\n }\n\n // Legalize LLVM unrealistic types into realistic types.\n //\n // With full LLVM optimizations, it can generate types like i888 which do not exist in\n // any actual hardware implementation, but are useful during optimization. LLVM then\n // legalizes these types into real ones during code generation. Sadly, there is no LLVM\n // IR pass to legalize them, which would have been useful and nice from a design perspective.\n // The LLVM community is also not interested in receiving patches to implement that\n // functionality, since it would duplicate existing code from the code generation\n // component. Therefore, we implement legalization here in Emscripten.\n //\n // Currently we just legalize completely unrealistic types into bundles of i32s, and just\n // the most common instructions that can be involved with such types: load, store, shifts,\n // trunc and zext.\n function legalizer() {\n // Legalization\n if (USE_TYPED_ARRAYS == 2) {\n function getLegalVars(base, bits, allowLegal) {\n bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits\n if (allowLegal && bits <= 32) return [{ intertype: 'value', ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits, type: 'i' + bits }];\n if (isNumber(base)) return getLegalLiterals(base, bits);\n if (base[0] == '{') {\n warnOnce('seeing source of illegal data ' + base + ', likely an inline struct - assuming zeroinit');\n return getLegalLiterals('0', bits);\n }\n var ret = new Array(Math.ceil(bits/32));\n var i = 0;\n if (base == 'zeroinitializer' || base == 'undef') base = 0;\n while (bits > 0) {\n ret[i] = { intertype: 'value', ident: base ? base + '$' + i : '0', bits: Math.min(32, bits), type: 'i' + Math.min(32, bits) };\n bits -= 32;\n i++;\n }\n return ret;\n }\n function getLegalLiterals(text, bits) {\n var parsed = parseArbitraryInt(text, bits);\n var ret = new Array(Math.ceil(bits/32));\n var i = 0;\n while (bits > 0) {\n ret[i] = { intertype: 'value', ident: (parsed[i]|0).toString(), bits: Math.min(32, bits), type: 'i' + Math.min(32, bits) }; // resign all values\n bits -= 32;\n i++;\n }\n return ret;\n }\n function getLegalStructuralParts(value) {\n return value.params.slice(0);\n }\n function getLegalParams(params, bits) {\n return params.map(function(param) {\n var value = param.value || param;\n if (isNumber(value.ident)) {\n return getLegalLiterals(value.ident, bits);\n } else if (value.intertype == 'structvalue') {\n return getLegalStructuralParts(value).map(function(part) {\n part.bits = part.type.substr(1); // can be some nested IR, like LLVM calls\n return part;\n });\n } else {\n return getLegalVars(value.ident, bits);\n }\n });\n }\n // Uses the right factor to multiply line numbers by so that they fit in between\n // the line[i] and the line after it\n function interpLines(lines, i, toAdd) {\n var prev = i >= 0 ? lines[i].lineNum : -1;\n var next = (i < lines.length-1) ? lines[i+1].lineNum : (lines[i].lineNum + 0.5);\n var factor = (next - prev)/(4*toAdd.length+3);\n for (var k = 0; k < toAdd.length; k++) {\n toAdd[k].lineNum = prev + ((k+1)*factor);\n assert(k == 0 || toAdd[k].lineNum > toAdd[k-1].lineNum);\n }\n }\n function removeAndAdd(lines, i, toAdd) {\n var item = lines[i];\n interpLines(lines, i, toAdd);\n Array.prototype.splice.apply(lines, [i, 1].concat(toAdd));\n if (i > 0) assert(lines[i].lineNum > lines[i-1].lineNum);\n if (i + toAdd.length < lines.length) assert(lines[i + toAdd.length - 1].lineNum < lines[i + toAdd.length].lineNum);\n return toAdd.length;\n }\n function legalizeFunctionParameters(params) {\n var i = 0;\n while (i < params.length) {\n var param = params[i];\n if (param.intertype == 'value' && isIllegalType(param.type)) {\n var toAdd = getLegalVars(param.ident, getBits(param.type)).map(function(element) {\n return {\n intertype: 'value',\n type: 'i' + element.bits,\n ident: element.ident,\n byval: 0\n };\n });\n Array.prototype.splice.apply(params, [i, 1].concat(toAdd));\n i += toAdd.length;\n continue;\n } else if (param.intertype == 'structvalue') {\n // 'flatten' out the struct into scalars\n var toAdd = param.params;\n toAdd.forEach(function(param) {\n param.byval = 0;\n });\n Array.prototype.splice.apply(params, [i, 1].concat(toAdd));\n continue; // do not increment i; proceed to process the new params\n }\n i++;\n }\n }\n function fixUnfolded(item) {\n // Unfolded items may need some correction to work properly in the global scope\n if (item.intertype in MATHOPS) {\n item.op = item.intertype;\n item.intertype = 'mathop';\n }\n }\n data.functions.forEach(function(func) {\n // Legalize function params\n legalizeFunctionParameters(func.params);\n // Legalize lines in labels\n var tempId = 0;\n func.labels.forEach(function(label) {\n if (dcheck('legalizer')) dprint('zz legalizing: \\n' + dump(label.lines));\n var i = 0, bits;\n while (i < label.lines.length) {\n var item = label.lines[i];\n var value = item;\n // Check if we need to legalize here, and do some trivial legalization along the way\n var isIllegal = false;\n walkInterdata(item, function(item) {\n if (item.intertype == 'getelementptr' || (item.intertype == 'call' && item.ident in LLVM.INTRINSICS_32)) {\n // Turn i64 args into i32\n for (var i = 0; i < item.params.length; i++) {\n if (item.params[i].type == 'i64') item.params[i].type = 'i32';\n }\n } else if (item.intertype == 'inttoptr') {\n var input = item.params[0];\n if (input.type == 'i64') input.type = 'i32'; // inttoptr can only care about 32 bits anyhow since pointers are 32-bit\n }\n if (isIllegalType(item.valueType) || isIllegalType(item.type)) {\n isIllegal = true;\n } else if ((item.intertype == 'load' || item.intertype == 'store') && isStructType(item.valueType)) {\n isIllegal = true; // storing an entire structure is illegal\n } else if (item.intertype == 'mathop' && item.op == 'trunc' && isIllegalType(item.params[1].ident)) { // trunc stores target value in second ident\n isIllegal = true;\n }\n });\n if (!isIllegal) {\n //if (dcheck('legalizer')) dprint('no need to legalize \\n' + dump(item));\n i++;\n continue;\n }\n // Unfold this line. If we unfolded, we need to return and process the lines we just\n // generated - they may need legalization too\n var unfolded = [];\n walkAndModifyInterdata(item, function(subItem) {\n // Unfold all non-value interitems that we can, and also unfold all numbers (doing the latter\n // makes it easier later since we can then assume illegal expressions are always variables\n // accessible through ident$x, and not constants we need to parse then and there)\n if (subItem != item && (!(subItem.intertype in UNUNFOLDABLE) ||\n (subItem.intertype == 'value' && isNumber(subItem.ident) && isIllegalType(subItem.type)))) {\n if (item.intertype == 'phi') {\n assert(subItem.intertype == 'value' || subItem.intertype == 'structvalue' || subItem.intertype in PARSABLE_LLVM_FUNCTIONS, 'We can only unfold some expressions in phis');\n // we must handle this in the phi itself, if we unfold normally it will not be pushed back with the phi\n } else {\n var tempIdent = '$$etemp$' + (tempId++);\n subItem.assignTo = tempIdent;\n unfolded.unshift(subItem);\n fixUnfolded(subItem);\n return { intertype: 'value', ident: tempIdent, type: subItem.type };\n }\n } else if (subItem.intertype == 'switch' && isIllegalType(subItem.type)) {\n subItem.switchLabels.forEach(function(switchLabel) {\n if (switchLabel.value[0] != '$') {\n var tempIdent = '$$etemp$' + (tempId++);\n unfolded.unshift({\n assignTo: tempIdent,\n intertype: 'value',\n ident: switchLabel.value,\n type: subItem.type\n });\n switchLabel.value = tempIdent;\n }\n });\n }\n });\n if (unfolded.length > 0) {\n interpLines(label.lines, i-1, unfolded);\n Array.prototype.splice.apply(label.lines, [i, 0].concat(unfolded));\n continue; // remain at this index, to unfold newly generated lines\n }\n // This is an illegal-containing line, and it is unfolded. Legalize it now\n dprint('legalizer', 'Legalizing ' + item.intertype + ' at line ' + item.lineNum);\n var finalizer = null;\n switch (item.intertype) {\n case 'store': {\n var toAdd = [];\n bits = getBits(item.valueType);\n var elements = getLegalParams([item.value], bits)[0];\n var j = 0;\n elements.forEach(function(element) {\n var tempVar = '$st$' + (tempId++) + '$' + j;\n toAdd.push({\n intertype: 'getelementptr',\n assignTo: tempVar,\n ident: item.pointer.ident,\n type: '[0 x i32]*',\n params: [\n { intertype: 'value', ident: item.pointer.ident, type: '[0 x i32]*' }, // technically a bitcase is needed in llvm, but not for us\n { intertype: 'value', ident: '0', type: 'i32' },\n { intertype: 'value', ident: j.toString(), type: 'i32' }\n ],\n });\n var actualSizeType = 'i' + element.bits; // The last one may be smaller than 32 bits\n toAdd.push({\n intertype: 'store',\n valueType: actualSizeType,\n value: { intertype: 'value', ident: element.ident, type: actualSizeType },\n pointer: { intertype: 'value', ident: tempVar, type: actualSizeType + '*' },\n ident: tempVar,\n pointerType: actualSizeType + '*',\n align: item.align,\n });\n j++;\n });\n Types.needAnalysis['[0 x i32]'] = 0;\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n // call, return: Return the first 32 bits, the rest are in temp\n case 'call': {\n var toAdd = [value];\n // legalize parameters\n legalizeFunctionParameters(value.params);\n // legalize return value, if any\n var returnType = getReturnType(item.type);\n if (value.assignTo && isIllegalType(returnType)) {\n bits = getBits(returnType);\n var elements = getLegalVars(item.assignTo, bits);\n // legalize return value\n value.assignTo = elements[0].ident;\n for (var j = 1; j < elements.length; j++) {\n var element = elements[j];\n toAdd.push({\n intertype: 'value',\n assignTo: element.ident,\n type: 'i' + element.bits,\n ident: 'tempRet' + (j - 1)\n });\n assert(j<10); // TODO: dynamically create more than 10 tempRet-s\n }\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'landingpad': {\n // not much to legalize\n i++;\n continue;\n }\n case 'return': {\n bits = getBits(item.type);\n var elements = getLegalVars(item.value.ident, bits);\n item.value.ident = '(';\n for (var j = 1; j < elements.length; j++) {\n item.value.ident += 'tempRet' + (j-1) + '=' + elements[j].ident + ',';\n }\n item.value.ident += elements[0].ident + ')';\n i++;\n continue;\n }\n case 'invoke': {\n legalizeFunctionParameters(value.params);\n // We can't add lines after this, since invoke already modifies control flow. So we handle the return in invoke\n i++;\n continue;\n }\n case 'value': {\n bits = getBits(value.type);\n var elements = getLegalVars(item.assignTo, bits);\n var values = getLegalLiterals(item.ident, bits);\n var j = 0;\n var toAdd = elements.map(function(element) {\n return {\n intertype: 'value',\n assignTo: element.ident,\n type: 'i' + bits,\n ident: values[j++].ident\n };\n });\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'structvalue': {\n bits = getBits(value.type);\n var elements = getLegalVars(item.assignTo, bits);\n var toAdd = [];\n for (var j = 0; j < item.params.length; j++) {\n toAdd[j] = {\n intertype: 'value',\n assignTo: elements[j].ident,\n type: 'i32',\n ident: item.params[j].ident\n };\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'load': {\n bits = getBits(value.valueType);\n var elements = getLegalVars(item.assignTo, bits);\n var j = 0;\n var toAdd = [];\n elements.forEach(function(element) {\n var tempVar = '$ld$' + (tempId++) + '$' + j;\n toAdd.push({\n intertype: 'getelementptr',\n assignTo: tempVar,\n ident: value.pointer.ident,\n type: '[0 x i32]*',\n params: [\n { intertype: 'value', ident: value.pointer.ident, type: '[0 x i32]*' }, // technically bitcast is needed in llvm, but not for us\n { intertype: 'value', ident: '0', type: 'i32' },\n { intertype: 'value', ident: j.toString(), type: 'i32' }\n ]\n });\n var newItem = {\n intertype: 'load',\n assignTo: element.ident,\n pointerType: 'i32*',\n valueType: 'i32',\n type: 'i32',\n pointer: { intertype: 'value', ident: tempVar, type: 'i32*' },\n ident: tempVar,\n align: value.align\n };\n var newItem2 = null;\n // The last one may be smaller than 32 bits\n if (element.bits < 32) {\n newItem.assignTo += '$preadd$';\n newItem2 = {\n intertype: 'mathop',\n op: 'and',\n assignTo: element.ident,\n type: 'i32',\n params: [{\n intertype: 'value',\n type: 'i32',\n ident: newItem.assignTo\n }, {\n intertype: 'value',\n type: 'i32',\n ident: (0xffffffff >>> (32 - element.bits)).toString()\n }],\n };\n }\n toAdd.push(newItem);\n if (newItem2) toAdd.push(newItem2);\n j++;\n });\n Types.needAnalysis['[0 x i32]'] = 0;\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'phi': {\n bits = getBits(value.type);\n var toAdd = [];\n var elements = getLegalVars(item.assignTo, bits);\n var j = 0;\n var values = getLegalParams(value.params, bits);\n elements.forEach(function(element) {\n var k = 0;\n toAdd.push({\n intertype: 'phi',\n assignTo: element.ident,\n type: 'i' + element.bits,\n params: value.params.map(function(param) {\n return {\n intertype: 'phiparam',\n label: param.label,\n value: values[k++][j]\n };\n })\n });\n j++;\n });\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'switch': {\n i++;\n continue; // special case, handled in makeComparison\n }\n case 'va_arg': {\n assert(value.type == 'i64');\n assert(value.value.type == 'i32*', value.value.type);\n i += removeAndAdd(label.lines, i, range(2).map(function(x) {\n return {\n intertype: 'va_arg',\n assignTo: value.assignTo + '$' + x,\n type: 'i32',\n value: {\n intertype: 'value',\n ident: value.value.ident, // We read twice from the same i32* var, incrementing // + '$' + x,\n type: 'i32*'\n }\n };\n }));\n continue;\n }\n case 'extractvalue': { // XXX we assume 32-bit alignment in extractvalue/insertvalue,\n // but in theory they can run on packed structs too (see use getStructuralTypePartBits)\n // potentially legalize the actual extracted value too if it is >32 bits, not just the extraction in general\n var index = item.indexes[0][0].text;\n var parts = getStructureTypeParts(item.type);\n var indexedType = parts[index];\n var targetBits = getBits(indexedType);\n var sourceBits = getBits(item.type);\n var elements = getLegalVars(item.assignTo, targetBits, true); // possibly illegal\n var sourceElements = getLegalVars(item.ident, sourceBits); // definitely illegal\n var toAdd = [];\n var sourceIndex = 0;\n for (var partIndex = 0; partIndex < parts.length; partIndex++) {\n if (partIndex == index) {\n for (var j = 0; j < elements.length; j++) {\n toAdd.push({\n intertype: 'value',\n assignTo: elements[j].ident,\n type: 'i' + elements[j].bits,\n ident: sourceElements[sourceIndex+j].ident\n });\n }\n break;\n }\n sourceIndex += getStructuralTypePartBits(parts[partIndex])/32;\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'insertvalue': {\n var index = item.indexes[0][0].text; // the modified index\n var parts = getStructureTypeParts(item.type);\n var indexedType = parts[index];\n var indexBits = getBits(indexedType);\n var bits = getBits(item.type); // source and target\n bits = getBits(value.type);\n var toAdd = [];\n var elements = getLegalVars(item.assignTo, bits);\n var sourceElements = getLegalVars(item.ident, bits);\n var indexElements = getLegalVars(item.value.ident, indexBits, true); // possibly legal\n var sourceIndex = 0;\n for (var partIndex = 0; partIndex < parts.length; partIndex++) {\n var currNum = getStructuralTypePartBits(parts[partIndex])/32;\n for (var j = 0; j < currNum; j++) {\n toAdd.push({\n intertype: 'value',\n assignTo: elements[sourceIndex+j].ident,\n type: 'i' + elements[sourceIndex+j].bits,\n ident: partIndex == index ? indexElements[j].ident : sourceElements[sourceIndex+j].ident\n });\n }\n sourceIndex += currNum;\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n case 'bitcast': {\n var inType = item.type2;\n var outType = item.type;\n if ((inType in Runtime.INT_TYPES && outType in Runtime.FLOAT_TYPES) ||\n (inType in Runtime.FLOAT_TYPES && outType in Runtime.INT_TYPES)) {\n i++;\n continue; // special case, handled in processMathop\n }\n // fall through\n }\n case 'inttoptr': case 'ptrtoint': case 'zext': case 'sext': case 'trunc': case 'ashr': case 'lshr': case 'shl': case 'or': case 'and': case 'xor': {\n value = {\n op: item.intertype,\n variant: item.variant,\n type: item.type,\n params: item.params\n };\n // fall through\n }\n case 'mathop': {\n var toAdd = [];\n var sourceBits = getBits(value.params[0].type);\n // All mathops can be parametrized by how many shifts we do, and how big the source is\n var shifts = 0;\n var targetBits = sourceBits;\n var processor = null;\n var signed = false;\n switch (value.op) {\n case 'ashr': {\n signed = true;\n // fall through\n }\n case 'lshr': {\n shifts = parseInt(value.params[1].ident);\n break;\n }\n case 'shl': {\n shifts = -parseInt(value.params[1].ident);\n break;\n }\n case 'sext': {\n signed = true;\n // fall through\n }\n case 'trunc': case 'zext': case 'ptrtoint': {\n targetBits = getBits(value.params[1] ? value.params[1].ident : value.type);\n break;\n }\n case 'inttoptr': {\n targetBits = 32;\n break;\n }\n case 'bitcast': {\n if (!sourceBits) {\n // we can be asked to bitcast doubles or such to integers, handle that as best we can (if it's a double that\n // was an x86_fp80, this code will likely break when called)\n sourceBits = targetBits = Runtime.getNativeTypeSize(value.params[0].type);\n warn('legalizing non-integer bitcast on ll #' + item.lineNum);\n }\n break;\n }\n case 'select': {\n sourceBits = targetBits = getBits(value.params[1].type);\n var params = getLegalParams(value.params.slice(1), sourceBits);\n processor = function(result, j) {\n return {\n intertype: 'mathop',\n op: 'select',\n type: 'i' + params[0][j].bits,\n params: [\n value.params[0],\n { intertype: 'value', ident: params[0][j].ident, type: 'i' + params[0][j].bits },\n { intertype: 'value', ident: params[1][j].ident, type: 'i' + params[1][j].bits }\n ]\n };\n };\n break;\n }\n case 'or': case 'and': case 'xor': case 'icmp': {\n var otherElements = getLegalVars(value.params[1].ident, sourceBits);\n processor = function(result, j) {\n return {\n intertype: 'mathop',\n op: value.op,\n variant: value.variant,\n type: 'i' + otherElements[j].bits,\n params: [\n result,\n { intertype: 'value', ident: otherElements[j].ident, type: 'i' + otherElements[j].bits }\n ]\n };\n };\n if (value.op == 'icmp') {\n if (sourceBits == 64) { // handle the i64 case in processMathOp, where we handle full i64 math\n i++;\n continue;\n }\n finalizer = function() {\n var ident = '';\n for (var i = 0; i < targetElements.length; i++) {\n if (i > 0) {\n switch(value.variant) {\n case 'eq': ident += '&'; break;\n case 'ne': ident += '|'; break;\n default: throw 'unhandleable illegal icmp: ' + value.variant;\n }\n }\n ident += targetElements[i].ident;\n }\n return {\n intertype: 'value',\n ident: ident,\n type: 'rawJS',\n assignTo: item.assignTo\n };\n }\n }\n break;\n }\n case 'add': case 'sub': case 'sdiv': case 'udiv': case 'mul': case 'urem': case 'srem': {\n if (sourceBits < 32) {\n // when we add illegal types like i24, we must work on the singleton chunks\n item.assignTo += '$0';\n item.params[0].ident += '$0';\n item.params[1].ident += '$0';\n }\n // fall through\n }\n case 'uitofp': case 'sitofp': case 'fptosi': case 'fptoui': {\n // We cannot do these in parallel chunks of 32-bit operations. We will handle these in processMathop\n i++;\n continue;\n }\n default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)];\n }\n // Do the legalization\n var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true);\n if (!isNumber(shifts)) {\n // We can't statically legalize this, do the operation at runtime TODO: optimize\n assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits');\n assert(PRECISE_I64_MATH, 'Must have precise i64 math for non-constant 64-bit shifts');\n Types.preciseI64MathUsed = 1;\n value.intertype = 'value';\n value.ident = makeVarDef(value.assignTo) + '$0=' +\n asmCoercion('_bitshift64' + value.op[0].toUpperCase() + value.op.substr(1) + '(' + \n asmCoercion(sourceElements[0].ident, 'i32') + ',' +\n asmCoercion(sourceElements[1].ident, 'i32') + ',' +\n asmCoercion(value.params[1].ident + '$0', 'i32') + ')', 'i32'\n ) + ';' +\n makeVarDef(value.assignTo) + '$1=tempRet0;';\n value.vars = [[value.assignTo + '$0', 'i32'], [value.assignTo + '$1', 'i32']];\n value.assignTo = null;\n i++;\n continue;\n }\n var targetElements = getLegalVars(item.assignTo, targetBits);\n var sign = shifts >= 0 ? 1 : -1;\n var shiftOp = shifts >= 0 ? 'shl' : 'lshr';\n var shiftOpReverse = shifts >= 0 ? 'lshr' : 'shl';\n var whole = shifts >= 0 ? Math.floor(shifts/32) : Math.ceil(shifts/32);\n var fraction = Math.abs(shifts % 32);\n if (signed) {\n var signedFill = {\n intertype: 'mathop',\n op: 'select',\n variant: 's',\n type: 'i32',\n params: [{\n intertype: 'mathop',\n op: 'icmp',\n variant: 'slt',\n type: 'i32',\n params: [\n { intertype: 'value', ident: sourceElements[sourceElements.length-1].ident, type: 'i' + Math.min(sourceBits, 32) },\n { intertype: 'value', ident: '0', type: 'i32' }\n ]\n },\n { intertype: 'value', ident: '-1', type: 'i32' },\n { intertype: 'value', ident: '0', type: 'i32' },\n ]\n };\n }\n for (var j = 0; j < targetElements.length; j++) {\n var inBounds = j + whole >= 0 && j + whole < sourceElements.length;\n var result;\n if (inBounds || !signed) {\n result = {\n intertype: 'value',\n ident: inBounds ? sourceElements[j + whole].ident : '0',\n type: 'i' + Math.min(sourceBits, 32),\n };\n if (j == 0 && sourceBits < 32) {\n // zext sign correction\n var result2 = {\n intertype: 'mathop',\n op: isUnsignedOp(value.op) ? 'zext' : 'sext',\n params: [result, {\n intertype: 'type',\n ident: 'i32',\n type: 'i' + sourceBits\n }],\n type: 'i32'\n };\n result = result2;\n }\n } else {\n // out of bounds and signed\n result = copy(signedFill);\n }\n if (fraction != 0) {\n var other;\n var otherInBounds = j + sign + whole >= 0 && j + sign + whole < sourceElements.length;\n if (otherInBounds || !signed) {\n other = {\n intertype: 'value',\n ident: otherInBounds ? sourceElements[j + sign + whole].ident : '0',\n type: 'i32',\n };\n } else {\n other = copy(signedFill);\n }\n other = {\n intertype: 'mathop',\n op: shiftOp,\n type: 'i32',\n params: [\n other,\n { intertype: 'value', ident: (32 - fraction).toString(), type: 'i32' }\n ]\n };\n result = {\n intertype: 'mathop',\n // shifting in 1s from the top is a special case\n op: (signed && shifts >= 0 && j + sign + whole >= sourceElements.length) ? 'ashr' : shiftOpReverse,\n type: 'i32',\n params: [\n result,\n { intertype: 'value', ident: fraction.toString(), type: 'i32' }\n ]\n };\n result = {\n intertype: 'mathop',\n op: 'or',\n type: 'i32',\n params: [\n result,\n other\n ]\n }\n }\n if (targetElements[j].bits < 32 && shifts < 0) {\n // truncate bits that fall off the end. This is not needed in most cases, can probably be optimized out\n result = {\n intertype: 'mathop',\n op: 'and',\n type: 'i32',\n params: [\n result,\n { intertype: 'value', ident: (Math.pow(2, targetElements[j].bits)-1).toString(), type: 'i32' }\n ]\n }\n }\n if (processor) {\n result = processor(result, j);\n }\n result.assignTo = targetElements[j].ident;\n toAdd.push(result);\n }\n if (targetBits <= 32) {\n // We are generating a normal legal type here\n legalValue = { intertype: 'value', ident: targetElements[0].ident, type: 'i32' };\n if (targetBits < 32) {\n legalValue = {\n intertype: 'mathop',\n op: 'and',\n type: 'i32',\n params: [\n legalValue,\n { intertype: 'value', ident: (Math.pow(2, targetBits)-1).toString(), type: 'i32' }\n ]\n }\n };\n legalValue.assignTo = item.assignTo;\n toAdd.push(legalValue);\n } else if (finalizer) {\n toAdd.push(finalizer());\n }\n i += removeAndAdd(label.lines, i, toAdd);\n continue;\n }\n }\n assert(0, 'Could not legalize illegal line: ' + [item.lineNum, dump(item)]);\n }\n if (dcheck('legalizer')) dprint('zz legalized: \\n' + dump(label.lines));\n });\n });\n }\n\n // Add function lines to func.lines, after our modifications to the label lines\n data.functions.forEach(function(func) {\n func.labels.forEach(function(label) {\n func.lines = func.lines.concat(label.lines);\n });\n });\n }\n\n function addTypeInternal(type) {\n if (type.length == 1) return;\n if (Types.types[type]) return;\n if (['internal', 'hidden', 'inbounds', 'void'].indexOf(type) != -1) return;\n if (Runtime.isNumberType(type)) return;\n dprint('types', 'Adding type: ' + type);\n\n // 'blocks': [14 x %struct.X] etc. If this is a pointer, we need\n // to look at the underlying type - it was not defined explicitly\n // anywhere else.\n var nonPointing = removeAllPointing(type);\n if (Types.types[nonPointing]) return;\n var check = /^\\[(\\d+)\\ x\\ (.*)\\]$/.exec(nonPointing);\n if (check) {\n var num = parseInt(check[1]);\n num = Math.max(num, 1); // [0 x something] is used not for allocations and such of course, but\n // for indexing - for an |array of unknown length|, basically. So we\n // define the 'type' as having a single field. TODO: Ensure as a sanity\n // check that we never allocate with this (either as a child structure\n // in the analyzer, or in calcSize in alloca).\n var subType = check[2];\n addTypeInternal(subType); // needed for anonymous structure definitions (see below)\n\n var fields = [subType, subType]; // Two, so we get the flatFactor right. We care about the flatFactor, not the size here. see calculateStructAlignment\n Types.types[nonPointing] = {\n name_: nonPointing,\n fields: fields,\n lineNum: '?'\n };\n newTypes[nonPointing] = 1;\n // Also add a |[0 x type]| type\n var zerod = '[0 x ' + subType + ']';\n if (!Types.types[zerod]) {\n Types.types[zerod] = {\n name_: zerod,\n fields: fields,\n lineNum: '?'\n };\n newTypes[zerod] = 1;\n }\n return;\n }\n\n // anonymous structure definition, for example |{ i32, i8*, void ()*, i32 }|\n if (type[0] == '{' || type[0] == '<') {\n type = nonPointing;\n var packed = type[0] == '<';\n var internal = type;\n if (packed) {\n if (type[1] !== '{') {\n // vector type, <4 x float> etc.\n var size = getVectorSize(type);\n Types.types[type] = {\n name_: type,\n fields: zeros(size).map(function() {\n return getVectorNativeType(type);\n }),\n packed: false,\n flatSize: 4*size,\n lineNum: '?'\n };\n return;\n }\n if (internal[internal.length-1] != '>') {\n warnOnce('ignoring type ' + internal);\n return; // function pointer or such\n }\n internal = internal.substr(1, internal.length-2);\n }\n assert(internal[0] == '{', internal);\n if (internal[internal.length-1] != '}') {\n warnOnce('ignoring type ' + internal);\n return; // function pointer or such\n }\n internal = internal.substr(2, internal.length-4);\n Types.types[type] = {\n name_: type,\n fields: splitTokenList(tokenize(internal)).map(function(segment) {\n return segment[0].text;\n }),\n packed: packed,\n lineNum: '?'\n };\n newTypes[type] = 1;\n return;\n }\n\n if (isPointerType(type)) return;\n if (['['].indexOf(type) != -1) return;\n Types.types[type] = {\n name_: type,\n fields: [ 'i' + (QUANTUM_SIZE*8) ], // a single quantum size\n flatSize: 1,\n lineNum: '?'\n };\n newTypes[type] = 1;\n }\n\n function addType(type) {\n addTypeInternal(type);\n if (QUANTUM_SIZE === 1) {\n Types.flipTypes();\n addTypeInternal(type);\n Types.flipTypes();\n }\n }\n\n // Typevestigator\n function typevestigator() {\n if (sidePass) { // Do not investigate in the main pass - it is only valid to start to do so in the first side pass,\n // which handles type definitions, and later. Doing so before the first side pass will result in\n // making bad guesses about types which are actually defined\n for (var type in Types.needAnalysis) {\n if (type) addType(type);\n }\n Types.needAnalysis = {};\n }\n }\n\n // Type analyzer\n function analyzeTypes(fatTypes) {\n var types = Types.types;\n\n // 'fields' is the raw list of LLVM fields. However, we embed\n // child structures into parent structures, basically like C.\n // So { int, { int, int }, int } would be represented as\n // an Array of 4 ints. getelementptr on the parent would take\n // values 0, 1, 2, where 2 is the entire middle structure.\n // We also need to be careful with getelementptr to child\n // structures - we return a pointer to the same slab, just\n // a different offset. Likewise, need to be careful for\n // getelementptr of 2 (the last int) - it's real index is 4.\n // The benefit of this approach is inheritance -\n // { { ancestor } , etc. } = descendant\n // In this case it is easy to bitcast ancestor to descendant\n // pointers - nothing needs to be done. If the ancestor were\n // a new slab, it would need some pointer to the outer one\n // for casting in that direction.\n // TODO: bitcasts of non-inheritance cases of embedding (not at start)\n var more = true;\n while (more) {\n more = false;\n for (var typeName in newTypes) {\n var type = types[typeName];\n if (type.flatIndexes) continue;\n var ready = true;\n type.fields.forEach(function(field) {\n if (isStructType(field)) {\n if (!types[field]) {\n addType(field);\n ready = false;\n } else {\n if (!types[field].flatIndexes) {\n newTypes[field] = 1;\n ready = false;\n }\n }\n }\n });\n if (!ready) {\n more = true;\n continue;\n }\n\n Runtime.calculateStructAlignment(type);\n\n if (dcheck('types')) dprint('type (fat=' + !!fatTypes + '): ' + type.name_ + ' : ' + JSON.stringify(type.fields));\n if (dcheck('types')) dprint(' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes)));\n }\n }\n\n if (QUANTUM_SIZE === 1 && !fatTypes) {\n Types.flipTypes();\n // Fake a quantum size of 4 for fat types. TODO: Might want non-4 for some reason?\n var trueQuantumSize = QUANTUM_SIZE;\n Runtime.QUANTUM_SIZE = 4;\n analyzeTypes(true);\n Runtime.QUANTUM_SIZE = trueQuantumSize;\n Types.flipTypes();\n }\n\n newTypes = null;\n }\n \n // Variable analyzer\n function variableAnalyzer() {\n // Globals\n\n var old = item.globalVariables;\n item.globalVariables = {};\n old.forEach(function(variable) {\n variable.impl = 'emulated'; // All global variables are emulated, for now. Consider optimizing later if useful\n item.globalVariables[variable.ident] = variable;\n });\n\n // Function locals\n\n item.functions.forEach(function(func) {\n func.variables = {};\n\n // LLVM is SSA, so we always have a single assignment/write. We care about\n // the reads/other uses.\n\n // Function parameters\n func.params.forEach(function(param) {\n if (param.intertype !== 'varargs') {\n if (func.variables[param.ident]) warn('cannot have duplicate variable names: ' + param.ident); // toNiceIdent collisions?\n func.variables[param.ident] = {\n ident: param.ident,\n type: param.type,\n origin: 'funcparam',\n lineNum: func.lineNum,\n rawLinesIndex: -1\n };\n }\n });\n\n // Normal variables\n func.lines.forEach(function(item, i) {\n if (item.assignTo) {\n if (func.variables[item.assignTo]) warn('cannot have duplicate variable names: ' + item.assignTo); // toNiceIdent collisions?\n var variable = func.variables[item.assignTo] = {\n ident: item.assignTo,\n type: item.type,\n origin: item.intertype,\n lineNum: item.lineNum,\n rawLinesIndex: i\n };\n if (variable.origin === 'alloca') {\n variable.allocatedNum = item.ident;\n }\n if (variable.origin === 'call') {\n variable.type = getReturnType(variable.type);\n }\n }\n });\n\n if (QUANTUM_SIZE === 1) {\n // Second pass over variables - notice when types are crossed by bitcast\n\n func.lines.forEach(function(item) {\n if (item.assignTo && item.intertype === 'bitcast') {\n // bitcasts are unique in that they convert one pointer to another. We\n // sometimes need to know the original type of a pointer, so we save that.\n //\n // originalType is the type this variable is created from\n // derivedTypes are the types that this variable is cast into\n func.variables[item.assignTo].originalType = item.type2;\n\n if (!isNumber(item.assignTo)) {\n if (!func.variables[item.assignTo].derivedTypes) {\n func.variables[item.assignTo].derivedTypes = [];\n }\n func.variables[item.assignTo].derivedTypes.push(item.type);\n }\n }\n });\n }\n\n // Analyze variable uses\n\n function analyzeVariableUses() {\n dprint('vars', 'Analyzing variables for ' + func.ident + '\\n');\n\n for (vname in func.variables) {\n var variable = func.variables[vname];\n\n // Whether the value itself is used. For an int, always yes. For a pointer,\n // we might never use the pointer's value - we might always just store to it /\n // read from it. If so, then we can optimize away the pointer.\n variable.hasValueTaken = false;\n\n variable.pointingLevels = pointingLevels(variable.type);\n\n variable.uses = 0;\n }\n\n // TODO: improve the analysis precision. bitcast, for example, means we take the value, but perhaps we only use it to load/store\n var inNoop = 0;\n func.lines.forEach(function(line) {\n walkInterdata(line, function(item) {\n if (item.intertype == 'noop') inNoop++;\n if (!inNoop) {\n if (item.ident in func.variables) {\n func.variables[item.ident].uses++;\n\n if (item.intertype != 'load' && item.intertype != 'store') {\n func.variables[item.ident].hasValueTaken = true;\n }\n }\n }\n }, function(item) {\n if (item.intertype == 'noop') inNoop--;\n });\n });\n\n //if (dcheck('vars')) dprint('analyzed variables: ' + dump(func.variables));\n }\n\n analyzeVariableUses();\n\n // Decision time\n\n for (vname in func.variables) {\n var variable = func.variables[vname];\n var pointedType = pointingLevels(variable.type) > 0 ? removePointing(variable.type) : null;\n if (variable.origin == 'getelementptr') {\n // Use our implementation that emulates pointers etc.\n // TODO Can we perhaps nativize some of these? However to do so, we need to discover their\n // true types; we have '?' for them now, as they cannot be discovered in the intertyper.\n variable.impl = VAR_EMULATED;\n } else if (variable.origin == 'funcparam') {\n variable.impl = VAR_EMULATED;\n } else if (variable.type == 'i64*' && USE_TYPED_ARRAYS == 2) {\n variable.impl = VAR_EMULATED;\n } else if (MICRO_OPTS && variable.pointingLevels === 0) {\n // A simple int value, can be implemented as a native variable\n variable.impl = VAR_NATIVE;\n } else if (MICRO_OPTS && variable.origin === 'alloca' && !variable.hasValueTaken &&\n variable.allocatedNum === 1 &&\n (Runtime.isNumberType(pointedType) || Runtime.isPointerType(pointedType))) {\n // A pointer to a value which is only accessible through this pointer. Basically\n // a local value on the stack, which nothing fancy is done on. So we can\n // optimize away the pointing altogether, and just have a native variable\n variable.impl = VAR_NATIVIZED;\n } else {\n variable.impl = VAR_EMULATED;\n }\n if (dcheck('vars')) dprint('// var ' + vname + ': ' + JSON.stringify(variable));\n }\n });\n }\n\n // Sign analyzer\n //\n // Analyze our variables and detect their signs. In USE_TYPED_ARRAYS == 2,\n // we can read signed or unsigned values and prevent the need for signing\n // corrections. If on the other hand we are doing corrections anyhow, then\n // we can skip this pass.\n //\n // For each variable that is the result of a Load, we look a little forward\n // to see where it is used. We only care about mathops, since only they\n // need signs.\n //\n function signalyzer() {\n if (USE_TYPED_ARRAYS != 2 || CORRECT_SIGNS == 1) return;\n\n function seekIdent(item, obj) {\n if (item.ident === obj.ident) {\n obj.found++;\n }\n }\n\n function seekMathop(item, obj) {\n if (item.intertype === 'mathop' && obj.found && !obj.decided) {\n if (isUnsignedOp(item.op, item.variant)) {\n obj.unsigned++;\n } else {\n obj.signed++;\n }\n }\n }\n\n item.functions.forEach(function(func) {\n func.lines.forEach(function(line, i) {\n if (line.intertype === 'load') {\n // Floats have no concept of signedness. Mark them as 'signed', which is the default, for which we do nothing\n if (line.type in Runtime.FLOAT_TYPES) {\n line.unsigned = false;\n return;\n }\n // Booleans are always unsigned\n var data = func.variables[line.assignTo];\n if (data.type === 'i1') {\n line.unsigned = true;\n return;\n }\n\n var total = data.uses;\n if (total === 0) return;\n var obj = { ident: line.assignTo, found: 0, unsigned: 0, signed: 0, total: total };\n // in loops with phis, we can also be used *before* we are defined\n var j = i-1, k = i+1;\n while(1) {\n assert(j >= 0 || k < func.lines.length, 'Signalyzer ran out of space to look for sign indications for line ' + line.lineNum);\n if (j >= 0 && walkInterdata(func.lines[j], seekIdent, seekMathop, obj)) break;\n if (k < func.lines.length && walkInterdata(func.lines[k], seekIdent, seekMathop, obj)) break;\n if (obj.total && obj.found >= obj.total) break; // see comment below\n j -= 1;\n k += 1;\n }\n\n // unsigned+signed might be < total, since the same ident can appear multiple times in the same mathop.\n // found can actually be > total, since we currently have the same ident in a GEP (see cubescript test)\n // in the GEP item, and a child item (we have the ident copied onto the GEP item as a convenience).\n // probably not a bug-causer, but FIXME. see also a reference to this above\n // we also leave the loop above potentially early due to this. otherwise, though, we end up scanning the\n // entire function in some cases which is very slow\n assert(obj.found >= obj.total, 'Could not Signalyze line ' + line.lineNum);\n line.unsigned = obj.unsigned > 0;\n dprint('vars', 'Signalyzer: ' + line.assignTo + ' has unsigned == ' + line.unsigned + ' (line ' + line.lineNum + ')');\n }\n });\n });\n }\n\n // Quantum fixer\n //\n // See settings.js for the meaning of QUANTUM_SIZE. The issue we fix here is,\n // to correct the .ll assembly code so that things work with QUANTUM_SIZE=1.\n //\n function quantumFixer() {\n if (QUANTUM_SIZE !== 1) return;\n\n // ptrs: the indexes of parameters that are pointers, whose originalType is what we want\n // bytes: the index of the 'bytes' parameter\n // TODO: malloc, realloc?\n var FIXABLE_CALLS = {\n 'memcpy': { ptrs: [0,1], bytes: 2 },\n 'memmove': { ptrs: [0,1], bytes: 2 },\n 'memset': { ptrs: [0], bytes: 2 },\n 'qsort': { ptrs: [0], bytes: 2 }\n };\n\n function getSize(types, type, fat) {\n if (types[type]) return types[type].flatSize;\n if (fat) {\n Runtime.QUANTUM_SIZE = 4;\n }\n var ret = Runtime.getNativeTypeSize(type);\n if (fat) {\n Runtime.QUANTUM_SIZE = 1;\n }\n return ret;\n }\n\n function getFlatIndexes(types, type) {\n if (types[type]) return types[type].flatIndexes;\n return [0];\n }\n\n item.functions.forEach(function(func) {\n function getOriginalType(param) {\n function get() {\n if (param.intertype === 'value' && !isNumber(param.ident)) {\n if (func.variables[param.ident]) {\n return func.variables[param.ident].originalType || null;\n } else {\n return item.globalVariables[param.ident].originalType;\n }\n } else if (param.intertype === 'bitcast') {\n return param.params[0].type;\n } else if (param.intertype === 'getelementptr') {\n if (param.params[0].type[0] === '[') return param.params[0].type;\n }\n return null;\n }\n var ret = get();\n if (ret && ret[0] === '[') {\n var check = /^\\[(\\d+)\\ x\\ (.*)\\]\\*$/.exec(ret);\n assert(check);\n ret = check[2] + '*';\n }\n return ret;\n }\n\n func.lines.forEach(function(line) {\n // Call\n if (line.intertype === 'call') {\n var funcIdent = LibraryManager.getRootIdent(line.ident.substr(1));\n var fixData = FIXABLE_CALLS[funcIdent];\n if (!fixData) return;\n var ptrs = fixData.ptrs.map(function(ptr) { return line.params[ptr] });\n var bytes = line.params[fixData.bytes].ident;\n\n // Only consider original types. This assumes memcpy always has pointers bitcast to i8*\n var originalTypes = ptrs.map(getOriginalType);\n for (var i = 0; i < originalTypes.length; i++) {\n if (!originalTypes[i]) return;\n }\n originalTypes = originalTypes.map(function(type) { return removePointing(type) });\n var sizes = originalTypes.map(function(type) { return getSize(Types.types, type) });\n var fatSizes = originalTypes.map(function(type) { return getSize(Types.fatTypes, type, true) });\n // The sizes may not be identical, if we copy a descendant class into a parent class. We use\n // the smaller size in that case. However, this may also be a bug, it is hard to tell, hence a warning\n warn(dedup(sizes).length === 1, 'All sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +\n line.lineNum);\n warn(dedup(fatSizes).length === 1, 'All fat sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +\n line.lineNum);\n var size = Math.min.apply(null, sizes);\n var fatSize = Math.min.apply(null, fatSizes);\n if (isNumber(bytes)) {\n // Figure out how much to copy.\n var fixedBytes;\n if (bytes % fatSize === 0) {\n fixedBytes = size*(bytes/fatSize);\n } else if (fatSize % bytes === 0 && size % (fatSize/bytes) === 0) {\n // Assume this is a simple array. XXX We can be wrong though! See next TODO\n fixedBytes = size/(fatSize/bytes);\n } else {\n // Just part of a structure. Align them to see how many fields. Err on copying more.\n // TODO: properly generate a complete structure, including nesteds, and calculate on that\n var flatIndexes = getFlatIndexes(Types.types, originalTypes[0]).concat(size);\n var fatFlatIndexes = getFlatIndexes(Types.fatTypes, originalTypes[0]).concat(fatSize);\n var index = 0;\n var left = bytes;\n fixedBytes = 0;\n while (left > 0) {\n left -= fatFlatIndexes[index+1] - fatFlatIndexes[index]; // note: we copy the alignment bytes too, which is unneeded\n fixedBytes += flatIndexes[index+1] - flatIndexes[index];\n }\n }\n line.params[fixData.bytes].ident = fixedBytes;\n } else {\n line.params[fixData.bytes].intertype = 'jsvalue';\n // We have an assertion in library::memcpy() that this is round\n line.params[fixData.bytes].ident = size + '*(' + bytes + '/' + fatSize + ')';\n }\n }\n });\n });\n\n // 2nd part - fix hardcoded constant offsets in global constants\n values(item.globalVariables).forEach(function(variable) {\n function recurse(item) {\n if (item.contents) {\n item.contents.forEach(recurse);\n } else if (item.intertype === 'getelementptr' && item.params[0].intertype === 'bitcast' && item.params[0].type === 'i8*') {\n var originalType = removePointing(item.params[0].params[0].type);\n var fatSize = getSize(Types.fatTypes, originalType, true);\n var slimSize = getSize(Types.types, originalType, false);\n assert(fatSize % slimSize === 0);\n item.params.slice(1).forEach(function(param) {\n if (param.intertype === 'value' && isNumber(param.ident)) {\n var corrected = parseInt(param.ident)/(fatSize/slimSize);\n assert(corrected % 1 === 0);\n param.ident = corrected.toString();\n }\n });\n } else if (item.params) {\n item.params.forEach(recurse);\n }\n }\n if (!variable.external && variable.value) recurse(variable.value);\n });\n }\n\n function operateOnLabels(line, func) {\n function process(item, id) {\n ['label', 'labelTrue', 'labelFalse', 'toLabel', 'unwindLabel', 'defaultLabel'].forEach(function(id) {\n if (item[id]) {\n func(item, id);\n }\n });\n }\n if (line.intertype in BRANCH_INVOKE) {\n process(line);\n } else if (line.intertype == 'switch') {\n process(line);\n line.switchLabels.forEach(process);\n }\n }\n\n // Label analyzer\n function labelAnalyzer() {\n item.functions.forEach(function(func) {\n func.labelsDict = {};\n func.labelIds = {};\n func.labelIdsInverse = {};\n func.labelIdCounter = 1;\n func.labels.forEach(function(label) {\n if (!(label.ident in func.labelIds)) {\n func.labelIds[label.ident] = func.labelIdCounter++;\n func.labelIdsInverse[func.labelIdCounter-1] = label.ident;\n }\n });\n var entryIdent = func.labels[0].ident;\n\n // Minify label ids to numeric ids.\n func.labels.forEach(function(label) {\n label.ident = func.labelIds[label.ident];\n label.lines.forEach(function(line) {\n operateOnLabels(line, function(item, id) {\n item[id] = func.labelIds[item[id]].toString(); // strings, because we will append as we process\n });\n });\n });\n\n func.labels.forEach(function(label) {\n func.labelsDict[label.ident] = label;\n });\n\n // Correct phis\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n phi.params[i].label = func.labelIds[phi.params[i].label];\n if (VERBOSE && !phi.params[i].label) warn('phi refers to nonexistent label on line ' + phi.lineNum);\n }\n }\n });\n });\n\n func.lines.forEach(function(line) {\n if (line.intertype == 'indirectbr') {\n func.forceEmulated = true;\n }\n });\n\n function getActualLabelId(labelId) {\n if (func.labelsDict[labelId]) return labelId;\n // If not present, it must be a surprisingly-named entry (or undefined behavior, in which case, still ok to use the entry)\n labelId = func.labelIds[entryIdent];\n assert(func.labelsDict[labelId]);\n return labelId;\n }\n\n // Basic longjmp support, see library.js setjmp/longjmp\n var setjmp = toNiceIdent('@setjmp');\n func.setjmpTable = null;\n for (var i = 0; i < func.labels.length; i++) {\n var label = func.labels[i];\n for (var j = 0; j < label.lines.length; j++) {\n var line = label.lines[j];\n if ((line.intertype == 'call' || line.intertype == 'invoke') && line.ident == setjmp) {\n if (line.intertype == 'invoke') {\n // setjmp cannot trigger unwinding, so just reduce the invoke to a call + branch\n line.intertype = 'call';\n label.lines.push({\n intertype: 'branch',\n label: line.toLabel,\n lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this\n });\n line.toLabel = line.unwindLabel = -2;\n }\n // split this label into up to the setjmp (including), then a new label for the rest. longjmp will reach the rest\n var oldLabel = label.ident;\n var newLabel = func.labelIdCounter++;\n if (!func.setjmpTable) func.setjmpTable = [];\n func.setjmpTable.push({ oldLabel: oldLabel, newLabel: newLabel, assignTo: line.assignTo });\n func.labels.splice(i+1, 0, {\n intertype: 'label',\n ident: newLabel,\n lineNum: label.lineNum + 0.5,\n lines: label.lines.slice(j+1)\n });\n func.labelsDict[newLabel] = func.labels[i+1];\n label.lines = label.lines.slice(0, j+1);\n label.lines.push({\n intertype: 'branch',\n label: toNiceIdent(newLabel),\n lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this\n });\n // Correct phis\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n var sourceLabelId = getActualLabelId(phi.params[i].label);\n if (sourceLabelId == oldLabel) {\n phi.params[i].label = newLabel;\n }\n }\n }\n });\n });\n }\n }\n }\n if (func.setjmpTable) {\n func.forceEmulated = true;\n recomputeLines(func);\n }\n\n // Properly implement phis, by pushing them back into the branch\n // that leads to here. We will only have the |var| definition in this location.\n\n // First, push phis back\n func.labels.forEach(function(label) {\n label.lines.forEach(function(phi) {\n if (phi.intertype == 'phi') {\n for (var i = 0; i < phi.params.length; i++) {\n var param = phi.params[i];\n if (VERBOSE && !param.label) warn('phi refers to nonexistent label on line ' + phi.lineNum);\n var sourceLabelId = getActualLabelId(param.label);\n if (sourceLabelId) {\n var sourceLabel = func.labelsDict[sourceLabelId];\n var lastLine = sourceLabel.lines.slice(-1)[0];\n assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis:' + [func.ident, label.ident, lastLine.intertype]);\n if (!lastLine.phi) {\n lastLine.phi = true;\n assert(!lastLine.dependent);\n lastLine.dependent = {\n intertype: 'phiassigns',\n params: []\n };\n };\n lastLine.dependent.params.push({\n intertype: 'phiassign',\n ident: phi.assignTo,\n value: param.value,\n targetLabel: label.ident\n });\n }\n }\n // The assign to phi is now just a var\n phi.intertype = 'var';\n phi.ident = phi.assignTo;\n phi.assignTo = null;\n }\n });\n });\n\n if (func.ident in NECESSARY_BLOCKADDRS) {\n Functions.blockAddresses[func.ident] = {};\n for (var needed in NECESSARY_BLOCKADDRS[func.ident]) {\n assert(needed in func.labelIds);\n Functions.blockAddresses[func.ident][needed] = func.labelIds[needed];\n }\n }\n });\n }\n\n // Stack analyzer - calculate the base stack usage\n function stackAnalyzer() {\n data.functions.forEach(function(func) {\n var lines = func.labels[0].lines;\n var hasAlloca = false;\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break;\n item.allocatedSize = func.variables[item.assignTo].impl === VAR_EMULATED ?\n calcAllocatedSize(item.allocatedType)*item.ident: 0;\n hasAlloca = true;\n if (USE_TYPED_ARRAYS === 2) {\n // We need to keep the stack aligned\n item.allocatedSize = Runtime.forceAlign(item.allocatedSize, Runtime.STACK_ALIGN);\n }\n }\n var index = 0;\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break;\n item.allocatedIndex = index;\n index += item.allocatedSize;\n delete item.allocatedSize;\n }\n func.initialStack = index;\n func.otherStackAllocations = false;\n if (func.initialStack === 0 && hasAlloca) func.otherStackAllocations = true; // a single alloca of zero still requires us to emit stack support code\n while (func.initialStack == 0) { // one-time loop with possible abort in the middle\n // If there is no obvious need for stack management, perhaps we don't need it\n // (we try to optimize that way with SKIP_STACK_IN_SMALL). However,\n // we need to note if stack allocations other than initial allocs can happen here\n // If so, we need to rewind the stack when we leave.\n\n // By-value params are causes of additional allocas (although we could in theory make them normal allocas too)\n func.params.forEach(function(param) {\n if (param.byVal) {\n func.otherStackAllocations = true;\n }\n });\n if (func.otherStackAllocations) break;\n\n // Allocas\n var finishedInitial = false;\n\n lines = func.lines; // We need to consider all the function lines now, not just the first label\n\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (!finishedInitial && (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident))) {\n finishedInitial = true;\n }\n if (item.intertype == 'alloca' && finishedInitial) {\n func.otherStackAllocations = true;\n break;\n }\n }\n if (func.otherStackAllocations) break;\n\n // Varargs\n for (var i = 0; i < lines.length; i++) {\n var item = lines[i];\n if (item.intertype == 'call' && isVarArgsFunctionType(item.type)) {\n func.otherStackAllocations = true;\n break;\n }\n }\n if (func.otherStackAllocations) break;\n\n break;\n }\n });\n }\n\n // ReLooper - reconstruct nice loops, as much as possible\n // This is now done in the jsify stage, using compiled relooper2\n function relooper() {\n function makeBlock(labels, entries, labelsDict, forceEmulated) {\n if (labels.length == 0) return null;\n dprint('relooping', 'prelooping: ' + entries + ',' + labels.length + ' labels');\n assert(entries && entries[0]); // need at least 1 entry\n\n var emulated = {\n type: 'emulated',\n id: 'B',\n labels: labels,\n entries: entries.slice(0)\n };\n return emulated;\n }\n item.functions.forEach(function(func) {\n dprint('relooping', \"// relooping function: \" + func.ident);\n func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated);\n });\n }\n\n // main\n castAway();\n legalizer();\n typevestigator();\n analyzeTypes();\n variableAnalyzer();\n signalyzer();\n quantumFixer();\n labelAnalyzer();\n stackAnalyzer();\n relooper();\n\n //B.stop('analyzer');\n return item;\n}", "async postParsingAnalysis () {\n var sortedByCount = this.sortEntriesByCount(this.results)\n var topNentries = this.getTopN(sortedByCount, N)\n\n var fileName = `${this.baseOutPath}-${analysisName}.json`\n var fileContent = {\n // Signal and format to visualize as barchart\n piechart: {\n datasets: [{\n backgroundColor: ['#D33F49', '#77BA99', '#23FFD9', '#27B299', '#831A49'],\n data: this.pickCounts(topNentries)\n }],\n labels: this.pickBrowserOS(topNentries)\n },\n hint: ''\n }\n var summary = {\n fileName: fileName,\n attackCategory: 'HTTP',\n analysisName: 'Most used Browser and OS Combinations',\n supportedDiagrams: ['PieChart']\n }\n\n return this.storeAndReturnResult(fileName, fileContent, summary)\n }", "function processAggregate() {\n\n\tvar success = true;\n\tconsole.log(\"\\n2. Validating exported metadata\");\n\n\t//Debug: dump metadata before processing\n\tif (debug) {\n\t\tfs.writeFileSync('.\\\\debug.json', JSON.stringify(metaData));\n\t}\n\n\t//Remove undesired properties from objects\n\tremoveProperties();\n\tremoveNameFromPTEA();\n\tremoveNameFromTETA();\n\n\t//Configure sharing and metadata ownership\n\tconfigureSharing();\n\tconfigureOwnership();\n\n\t//Remove users from user groups\n\tclearUserGroups();\n\n\t//Reset/remove lat/long/zoom on maps\n\tclearMapZoom();\n\tclearMapViews();\n\n\t//Make sure the \"default defaults\" are used\n\tsetDefaultUid();\n\n\t//Make sure we don't include orgunit assigment in datasets or users, or orgunit levels in predictors\n\tclearOrgunitAssignment();\n\n\t//Verify that all data elements referred in indicators, validation rules,\n\t//predictors are included\n\tif (!validateDataElementReference()) success = false;\n\n\t//Remove invalid references to data elements or indicators from groups\n\t//Verify that there are no data elements or indicators without groups\n\tif (!validateGroupReferences()) success = false;\n\n\t//Verify that favourites only use relative orgunits\n\tif (!validateFavoriteOrgunits()) success = false;\n\n\t//Verify that favourites only use indicators\n\tif (!validateFavoriteDataItems()) success = false;\n\n\t//Verify that no unsupported data dimensions are used\n\tif (!validateFavoriteDataDimension()) success = false;\n\n\t//Verify that data sets with section include all data elements\n\tif (!validationDataSetSections()) success = false;\n\n\t/** CUSTOM MODIFICATIONS */\n\tif (currentExport.hasOwnProperty(\"_customFuncs\")) {\n\t\tfor (var customFunc of currentExport._customFuncs) {\n\t\t\tvar func = new Function(\"metaData\", customFunc);\n\t\t\tfunc(metaData);\n\t\t}\n\t}\n\n\tif (success) {\n\t\tconsole.log(\"✔ Validation passed\");\n\t\tsaveAggregate();\n\t}\n\telse {\n\t\tconsole.log(\"\");\n\t\tvar schema = {\n\t\t\tproperties: {\n\t\t\t\tcontinue: {\n\t\t\t\t\tdescription: \"Validation failed. Continue anyway? (yes/no)\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdefault: \"no\",\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprompt.get(schema, function (err, result) {\n\t\t\tif (result.continue == \"yes\") saveAggregate();\n\t\t\telse cancelCurrentExport();\n\t\t});\n\t}\n}", "writeTypingsFile(dtsFilename, dtsKind) {\n const indentedWriter = new IndentedWriter_1.IndentedWriter();\n this._generateTypingsFileContent(indentedWriter, dtsKind);\n node_core_library_1.FileSystem.writeFile(dtsFilename, indentedWriter.toString(), {\n convertLineEndings: \"\\r\\n\" /* CrLf */,\n ensureFolderExists: true\n });\n }", "function tidy() {\n walker = walk.walk(process.cwd());\n\n walker.on('file', function(root, fileStats, next){\n console.log(fileStats);\n\n // Process stats\n var ext = fileStats.name.split('.')[1];\n var name = fileStats.name;\n var assets = ['jpg', 'gif', 'png', 'mpg', 'txt', 'psd'];\n\n if (ext == 'md') {\n mv('./' + name, './posts/' + name, {mkdirp: true}, function(err){\n if (err) {\n console.log(err.red);\n }\n });\n } else if (assets.indexOf(ext) != -1) {\n mv('./' + name, './assets/' + name, {mkdirp: true}, function(err){\n if (err) {\n console.log(err.red);\n }\n });\n }\n next();\n });\n\n walker.on('errors', function(root, nodeStatsArray, next){\n next();\n });\n\n walker.on('end', function(){\n console.log(\"Finished tidying ✔\".green);\n });\n}", "function processTracker() {\n\n\tvar success = true;\n\tconsole.log(\"\\n2. Validating exported metadata\");\n\n\t//Debug: dump metadata before processing\n\tif (debug) {\n\t\tfs.writeFileSync('.\\\\debug.json', JSON.stringify(metaData));\n\t}\n\n\t//Remove undesired properties from objects\n\tremoveProperties();\n\tremoveNameFromPTEA();\n\tremoveNameFromTETA();\n\n\t//Reset/remove lat/long/zoom on maps\n\tclearMapZoom();\n\tclearMapViews();\n\n\t//Configure sharing and metadata ownership\n\tconfigureSharing();\n\tconfigureOwnership();\n\n\t//Remove users from user groups\n\tclearUserGroups();\n\n\t//Make sure the \"default defaults\" are used\n\tsetDefaultUid();\n\n\t//Make sure we don't include orgunit assigment in datasets or users\n\tclearOrgunitAssignment();\n\n\t//Remove duplicate programStageDataElements\n\tremoveDuplicateObjects();\n\n\t//Verify that all data elements referred in indicators, validation rules,\n\t//predictors are included\n\tif (!validateDataElementReference()) success = false;\n\n\t//Verify that all program indicators referred to in indicators and predictors are included\n\tif (!validateProgramIndicatorReference()) success = false;\n\n\t//Remove invalid references to data elements or indicators from groups\n\t//Verify that there are no data elements or indicators without groups\n\tif (!validateGroupReferences()) success = false;\n\n\t//Verify that favourites only use relative orgunits\n\tif (!validateFavoriteOrgunits()) success = false;\n\n\t//Verify that favourites only use indicators\n\tif (!validateFavoriteDataItems()) success = false;\n\n\t//Verify that no unsupported data dimensions are used\n\tif (!validateFavoriteDataDimension()) success = false;\n\n\t//Verify that data sets with section include all data elements\n\tif (!validationDataSetSections()) success = false;\n\n\n\t/** CUSTOM MODIFICATIONS */\n\tif (currentExport.hasOwnProperty(\"_customFuncs\")) {\n\t\tfor (var customFunc of currentExport._customFuncs) {\n\t\t\tvar func = new Function(\"metaData\", customFunc);\n\t\t\tfunc(metaData);\n\t\t}\n\t}\n\n\tif (success) {\n\t\tconsole.log(\"✔ Validation passed\");\n\t\tsaveTracker();\n\t}\n\telse {\n\t\tconsole.log(\"\");\n\t\tvar schema = {\n\t\t\tproperties: {\n\t\t\t\tcontinue: {\n\t\t\t\t\tdescription: \"Validation failed. Continue anyway? (yes/no)\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdefault: \"no\",\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif(args.ignoreerrors)\n\t\t{\n\t\t\tsaveTracker();\n\t\t} else {\n\t\t\tprompt.get(schema, function (err, result) {\n\t\t\t\tif (result.continue == \"yes\") saveTracker();\n\t\t\t\telse cancelCurrentExport();\n\t\t\t});\n\t\t}\n\t}\n}", "async postParsingAnalysis () {\n var mapped = Object.keys(this.results).map(addr => {return { addr: addr, count: this.results[addr] }})\n var sortedByCount = this.sortEntriesByCount(mapped)\n var topNentries = this.getTopN(sortedByCount, N)\n\n var fileName = `${this.baseOutPath}-${analysisName}.json`\n var fileContent = {\n // Signal and format to visualize as piechart\n piechart: {\n datasets: [{\n backgroundColor: ['#D33F49', '#77BA99', '#23FFD9', '#27B299', '#831A49'],\n data: this.formatData(topNentries)\n }],\n labels: await this.formatLabelsForPieChart(topNentries)\n },\n hint: 'The labels of this chart have been computed using temporally sensitive data'\n }\n var summary = {\n fileName: fileName,\n attackCategory: 'Network State',\n analysisName: `Top ${N} sources by traffic`,\n supportedDiagrams: ['PieChart']\n }\n return await this.storeAndReturnResult(fileName, fileContent, summary)\n }", "_run()\n {\n var info = this._getInfoFromPackageJson()\n\n if (Tester.is(this._output, 'function')) {\n this._output('################################################')\n this._output(info.label)\n this._output(info.labelDescription)\n this._output('################################################')\n }\n\n var start = new Date()\n\n // @todo Progress bar start.\n\n this._runTestMethods()\n\n // @todo Progress bar stop.\n\n var end = new Date()\n var time = end - start\n var formatTime = time > 1000 ? (time / 1000).toFixed(1) + ' seconds' : time + ' miliseconds'\n var memoryBytes = process.memoryUsage().heapTotal\n var trace = Tester.getBacktrace(new Error(), 3)\n\n this._resultsJson = {\n info: info,\n errors: this._errors,\n ok: this._ok,\n all: this._all,\n className: this.constructor.name,\n assertionsCounter: this._assertionsCounter,\n testsCounter: this._testsCounter,\n timeMiliseconds: time,\n formatTime: formatTime,\n memoryBytes: memoryBytes,\n formatMemory: Tester.formatBytes(memoryBytes),\n from: trace\n }\n\n if (Tester.is(this._output, 'function')) {\n var arr = this._showOk === true ? this._all : this._errors\n for (let value of arr) {\n if (this._colorize === true) {\n // reverse red\n value = value.replace(/^Error:/, '\\x1b[31m\\x1b[7mError:\\x1b[0m')\n // reverse\n value = value.replace(/^Ok:/, '\\x1b[7mOk:\\x1b[0m')\n }\n this._output(value)\n }\n\n var className = this.constructor.name + ':'\n\n this._output(className)\n this._output(' - tests ' + this._testsCounter)\n this._output(' - assertions ' + this._assertionsCounter)\n this._output(' - errors ' + this._errors.length)\n this._output(' - time ' + formatTime)\n this._output(' - memory ' + Tester.formatBytes(memoryBytes))\n this._output(' - from ' + trace)\n this._output('')\n }\n }", "setupSchema() {\n\t\tfor (const type in this.Definition) {\n\t\t\tif (this.Definition.hasOwnProperty(type)) {\n\t\t\t\t// console.log(type);\n\t\t\t\tconst typeDef = this.Definition[type];\n\t\t\t\tthis.Schema[type] = oas.compile(typeDef);\n\t\t\t}\n\t\t}\n\t\tfor (const type in this.precompiled) {\n\t\t\tif (this.precompiled.hasOwnProperty(type)) {\n\t\t\t\t// console.log(type);\n\t\t\t\tconst typeDef = this.precompiled[type];\n\t\t\t\tthis.Schema[type] = typeDef;\n\t\t\t}\n\t\t}\n\t}", "async function main() {\n const modelManager = await ModelLoader.loadModelManagerFromModelFiles([metaModelCto], {strict: true});\n const visitor = new TypescriptVisitor();\n const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated'));\n const parameters = { fileWriter };\n modelManager.accept(visitor, parameters);\n}", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "function process() \n{\n\t//Read parameters\n\tvar theform = document.theform;\n\n\touttype = 0;\n\tif (theform.outtype[1].checked) outtype = 1;\n\tif (theform.outtype[2].checked) outtype = 2;\n\n\tprintRules = true; //theform.report.checked;\n\tshowDiff = theform.showdiff.checked;\n\trewout = theform.rewout.checked;\n \n // flush all arrays\n all_rules = [];\n all_rewrites = [];\n all_categories = [];\n applied_rules = {};\n \n\t// Stuff we can do once\n\ts = readStuff();\n\n\t// If that went OK, apply the rules\n\tif (s.length == 0) {\n\n\t\tDoWords();\n\t}\n \n // now, check the goodness of fit\n var goodness = compareAO();\n s += '</li><li>Correct conversions: '+goodness[0] + ' from '+goodness[4] + ' ('+goodness[2]+'%)';\n s += '</li><li>Wrong conversions: '+goodness[1] + ' from '+goodness[4] + ' ('+goodness[3]+'%)';\n s += '</li></ul>';\n if(goodness[2] > 50)\n {\n s += '<span style=\"color:red;font-weight:bold;\">Great, the rules you defined already explain more than half of all words!</span>';\n }\n else\n {\n s += '<span style=\"color:red;font-weight:bold;\">Well, less than half of all words can be explained. Maybe you should try a bit harder...</span>';\n }\n\n // insert the quality of the rules\n s += '<h3>Rule Evaluation</h3><ul>';\n for(rule in applied_rules)\n {\n s += '<li style=\"list-style:circle\"><code>\"'+rule+'\"</code> applies to '+applied_rules[rule]+' words.</li>';\n }\n s += '</ul>';\n\n\t// Set the output field\n\tdocument.getElementById(\"mytext\").innerHTML = s;\n \n}", "function analysisObject () {\n this.type;\n this.elements;\n this.numOfElements;\n this.timeScale;\n}", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "function analyzeMoodVsProductivity () {\n\ttry {\n\t\tshowProgressBar();\n\t\t// Get the name of the project, its owner and \"restriction\" value from input fields\n\t\tprojectName = $(\"#project\").val();\n\t\tprojectOwner = $(\"#owner\").val();\t\n\t\trestriction = $(\"#restriction\")[0].checked;\n\t\t// Starts analysis\n\t\tvar result = analyze();\n\t\thideProgressBar();\n\t} catch (exception) {\n\t\texceptionHandler(exception);\n\t}\n\t// Shows result of the analysis\n\tshowResult(result);\n}", "function postRespec() {\n\taddTextSemantics();\n\tswapInDefinitions();\n\ttermTitles();\n\tlinkUnderstanding();\n}", "function analyze(sourceCode) {\n machineState = 1;\n currentLineNumber = 1;\n currentLexemeCode = 1;\n definedIdns = [];\n $('.errors-container').empty();\n var lexemes = parseLexemes(sourceCode);\n lexemes = setIdnsConstsCodes(lexemes);\n lexemes = fixMinus(lexemes);\n lexemes = setLexemeCodes(lexemes);\n printLexemes(lexemes);\n printConsts(lexemes);\n printIdns(lexemes);\n var syntaxAnalyzer = new SyntaxAnalyzer(lexemes);\n syntaxAnalyzer.analyze();\n printSyntaxErrors(syntaxAnalyzer.errors);\n\n const lexemeChain = lexemes.map((lexeme) => {\n let type = '';\n switch (lexeme.lexemeCode) {\n case 32: type = 'idn'; break;\n case 33: type = 'con'; break;\n default: type = 'operation'; break;\n }\n return new PolizItem(lexeme.lexemeName, type);\n });\n\n const polizBuilder = new PolizBuilder();\n const poliz = polizBuilder.build(lexemeChain);\n $('#poliz-chain').empty();\n poliz.chain.forEach(item => {\n $('#poliz-chain').append(item.token + ' ');\n });\n\n $('#poliz-history tbody').empty();\n polizBuilder.history.forEach(historyItem => {\n $('#poliz-history tbody').append(\n `<tr><td>${historyItem.lexeme.token}</td>\n <td>${historyItem.stack}</td>\n <td>${historyItem.poliz}</td>\n </tr>`\n );\n });\n\n $('#poliz-labels tbody').empty();\n poliz.polizLabels.forEach(label => {\n $('#poliz-labels tbody').append(\n `<tr><td>${label.label}</td>\n <td>${label.position}</td>\n </tr>`\n );\n });\n\n const polizExecutor = new PolizExecutor(\n poliz.chain, poliz.polizLabels, poliz.polizCells, idns\n );\n\n polizExecutor.execute();\n $('#console').empty();\n polizExecutor.outputData.forEach(item => {\n $('#console').append(\n `<div>${item.token} ${item.value}</div>`);\n });\n\n $('#poliz-execution-history tbody').empty();\n polizExecutor.history.forEach(item => {\n $('#poliz-execution-history tbody').append(\n `<tr><td>${item.lexeme}</td>\n <td>${item.stack}</td>\n </tr>`\n );\n });\n Array.prototype.last = function() {\n return this[this.length-1];\n };\n Array.prototype.clone = function() {\n return this.slice(0);\n };\n\n}", "async function run () {\n shell.echo(`Analyzing ${path.join(originProtoPath)} directory`);\n if (funcList.length > 0) {\n shell.echo(`${funcList.length} proto files found`);\n for (const func of funcList) {\n try {\n await func();\n } catch (e) {\n shell.echo('Code generation operation couldn\\'t be completed');\n } \n }\n shell.echo(`Generated code stored in ${path.join(destCodePath)}`);\n }\n else {\n shell.echo('No proto files found');\n }\n}", "function main() {\n const allResults = [];\n fs.readdirSync(constants.OUT_PATH).forEach(siteDir => {\n const sitePath = path.resolve(constants.OUT_PATH, siteDir);\n if (!utils.isDir(sitePath)) {\n return;\n }\n allResults.push({site: siteDir, results: analyzeSite(sitePath)});\n });\n const generatedResults = groupByMetrics(allResults);\n fs.writeFileSync(\n GENERATED_RESULTS_PATH,\n `var generatedResults = ${JSON.stringify(generatedResults)}`\n );\n console.log('Opening the charts web page...'); // eslint-disable-line no-console\n opn(path.resolve(__dirname, 'index.html'));\n}", "function runAnalysis () {\n ee.initialize(null, null, geeScript, initializationError);\n}", "async validate(){\n \n // ensure classes \n if(!this.apexClassNames || this.apexClassNames.length == 0)\n throw new Error('No Apex classes prescribed in pset.');\n\n // get each of the class bodies via tooling\n this.classBodies = ''; \n try{\n stdio.warn(`Retrieving ${this.apexClassNames.length > 1 ? 'classes' : 'class'} ${this.apexClassNames.join(', ')} from ${ config.mode === 'local' ? 'default local directory...' : 'authorized SF org...' }`);\n for(let apexClass of await tooling.getApex(this.apexClassNames)){\n // replace any instances of static methods with static global-level variables, \n // and remove the static method keywords, such that apex class calls to static methods\n // are immitated\n const name = apexClass.name; \n let body = apexClass.body; \n if(apexClass.body.indexOf(' static ') != -1){\n this.globalVars.push(`// mimic static method(s) in class ${name}\\nstatic ${name} ${name} = new ${name}();`);\n body = body.replace(new RegExp(/ static /, 'gi'), ` /** static method mimicked by var '${name}' **/ `); \n }\n this.classBodies += `${body}\\n\\n`;\n }\n } catch(e){\n throw e; \n }\n\n // construct anonymous body\n try{\n stdio.warn('Constructing tests...'); \n const anonBody = buildAnonTest(this); \n stdio.warn('Validating assertions in authorized org...');\n await tooling.executeAnonApex(anonBody); \n } catch(e){\n throw e; \n }\n\n }", "function beginProcessing (data) {\n var len = data.length;\n if (data.length === 0) {\n alert(\"Nothing entered\");\n } else {\n \tdata = data.toLowerCase();\n //look for word delimiters\n var delimiters = '.:;?! !@#$%^&*()+';\n var words = splitTokens(data, delimiters); //http://p5js.org/reference/#/p5/splitTokens\n tokens = words;\n tokens \n for (var i = 0; i < words.length; i++) {\n var word = words[i];\n totalSyllables += countSyllables(word);\n totalWords++;\n }\n //look for sentence delimiters\n var sentenceDelim = '.:;?!';\n var sentences = splitTokens(data, sentenceDelim);\n phrases = sentences;\n totalSentences = sentences.length;\n calculateFlesch(totalSyllables, totalWords, totalSentences);\n // findWordFrequency();\n avgWordsPerSentence = totalWords / totalSentences;\n avgSyllablesPerSentence = totalSyllables / totalSentences;\n avgSyllablesPerWord = totalSyllables / totalWords;\n\t flesch = + flesch.toFixed(3);\n\t avgWordsPerSentence = +avgWordsPerSentence.toFixed(3);\n\t avgSyllablesPerSentence = +avgSyllablesPerSentence.toFixed(3);\n\t avgSyllablesPerWord = +avgSyllablesPerWord.toFixed(3);\n report += \"Total Syllables : \" + totalSyllables +\"\\n\";\n report += \"Total Words : \" + totalWords + \"\\n\";\n report += \"Total Sentences : \" + totalSentences + \"\\n\";\n report += \"Avg Words Per Sentence : \" + avgWordsPerSentence + \"\\n\";\n report += \"Avg Syllables Per Word : \" + avgSyllablesPerWord + \"\\n\";\n report += \"Avg Syllables Per Sentence : \" + avgSyllablesPerSentence + \"\\n\";\n report += \"Flesch Readability Index : \" + flesch + \"\\n\";\n // report += \"Word Frequency Counter (Ignore the 'undefined') : \" + \"<br>\";\n // report += wordCounterString;\n // var wordCounterString = keys[i] + \" : \" + concordance[keys[i];\n //\tReadability scales the Flesch index into a more managable number\n // var basicTextResults = createP(report);\n createNewDiv();\n }\n}", "function semanticAnalysis(CST, programCount) {\n //From the CST, build the AST\t\n buildAST(CST.root);\n //Print the AST\n log(\"Abstract Syntax Tree for Program \" + programCount + \": <br />\");\n AST.toString(AST.root, \"-\");\n //Scope and type check the AST\n scopeAndTypeCheck(AST.root);\n //Print the symbol table\n SymbolTableInstance.toString(SymbolTableInstance.root, \"-\");\n //Generate machine code\n codeGeneration();\n //reset all these globals\n AST = new AbstractSyntaxTree(null, null);\n currentScope = null;\n SymbolTableInstance = new SymbolTable(null, null);\n activeValue = null;\n}", "transform(program) {\n var options = AsxFormatter.options(this.file.ast);\n //DefaultFormatter.prototype.transform.apply(this, arguments);\n\n var locals = [];\n var definitions = [];\n var body = [];\n program.body.forEach(item=>{\n switch(item.type){\n case 'ExpressionStatement':\n var exp = item.expression;\n if(exp.type=='Literal' && exp.value.toLowerCase()=='use strict'){\n return;\n }\n break;\n case 'VariableDeclaration':\n item.declarations.forEach(d=>{\n locals.push(d.id);\n });\n break;\n case 'FunctionDeclaration':\n if(item.id.name=='module'){\n item.body.body.forEach(s=>{\n body.push(s);\n })\n return;\n }else\n if(item._class){\n item.id =t.identifier('c$'+item._class);\n body.push(t.expressionStatement(t.callExpression(\n t.memberExpression(\n t.identifier('asx'),\n t.identifier('c$')\n ),[item])));\n return;\n }else{\n locals.push(item.id);\n }\n break;\n }\n body.push(item);\n });\n\n var definer = [];\n\n\n\n if(Object.keys(this.imports).length){\n\n Object.keys(this.imports).forEach(key=>{\n var items = this.imports[key];\n if(items['*'] && typeof items['*']=='string'){\n this.imports[key]=items['*'];\n }\n });\n definer.push(t.property('init',\n t.identifier('imports'),\n t.valueToNode(this.imports)\n ))\n }\n var exports;\n if(this.exports['*']){\n exports = this.exports['*'];\n delete this.exports['*'];\n }\n if(Object.keys(this.exports).length){\n definer.push(t.property('init',\n t.identifier('exports'),\n t.valueToNode(this.exports)\n ))\n }\n if(body.length){\n if(exports){\n var ret = [];\n Object.keys(exports).forEach(key=>{\n var val = exports[key];\n if(typeof val=='string') {\n ret.push(t.property('init',\n t.literal(key), t.identifier(val == '*' ? key : val)\n ))\n }else{\n ret.push(t.property('init',\n t.literal(key), val\n ))\n }\n });\n body.push(t.returnStatement(\n t.objectExpression(ret)\n ));\n }\n var initializer = t.functionExpression(null, [t.identifier('asx')], t.blockStatement(body));\n definer.push(t.property('init',\n t.identifier('execute'),\n initializer\n ))\n }\n definitions.forEach(item=>{\n\n if(item._class){\n definer.push(t.property('init',\n t.literal('.'+item._class),\n item\n ))\n }else{\n definer.push(t.property('init',\n t.literal(':'+item.id.name),\n item\n ))\n }\n\n })\n definer = t.objectExpression(definer);\n\n\n\n /*\n var definer = t.functionExpression(null, [t.identifier(\"module\")], t.blockStatement(body));\n if(options.bind){\n definer = t.callExpression(\n t.memberExpression(\n definer,\n t.identifier(\"bind\")\n ),[\n t.callExpression(t.identifier(\"eval\"),[t.literal(\"this.global=this\")])\n ]\n );\n }*/\n var body = [];\n var definer = util.template(\"asx-module\",{\n MODULE_NAME: t.literal(this.getModuleName()),\n MODULE_BODY: definer\n });\n if(options.runtime){\n var rt = util.template(\"asx-runtime\")\n //rt._compact = true;\n body.push(t.expressionStatement(rt));\n }\n body.push(t.expressionStatement(definer))\n program.body = body;\n }", "function healthCheckCallback(healthCheckResults) {\n console.log(\"Results are ready.\");\n var newSource = sfp.readFile('test-output/temp.js');\n // healthCheckResults.source = sfp.readFile(tempFilePath);\n healthCheckResults.source = realSource;\n healthCheckResults.processedSource = newSource;\n runJsDoc(projectPath + '/test-output', healthCheckResults);\n }", "inferHoleTypesCommand() {\n const editor = atom.workspace.getActiveTextEditor();\n if (helper.isElmEditor(editor)) {\n const origCode = editor.getText();\n const modifiedCode = origCode.replace(new RegExp('(^|\\\\s|\\\\n)(' + _.escapeRegExp(helper.holeToken()) + ')(\\\\s|$)', 'g'), '$1' + dummyType() + '$3');\n const inputCode = modifiedCode + '\\n' + 'type ' + dummyType() + ' = ' + dummyType();\n if (origCode !== modifiedCode) {\n this.inferQueue.push({\n inputCode,\n inferenceType: HOLE_TYPES,\n inferenceName: helper.holeToken(),\n editor,\n shouldDecorate: true,\n shouldDestroyOnChange: true,\n shouldShowAutocomplete: false,\n getInferenceFunction: (problem, editor) => {\n return {\n type: getInferredTypeFromProblem(problem),\n range: getHoleRangeFromProblem(problem, editor)\n };\n }\n });\n }\n }\n }", "function phoneticAnalysisHandler() { \n const currentTask = \"phonetic\";\n const taskDiv = window.utils.createEl('div'), \n taskHeading = window.utils.createEl('p'), \n submitButton = window.utils.createEl('button'),\n warning = window.utils.createEl('p'),\n divWrapper = window.utils.createEl('section'),\n pWrapper = window.utils.createEl('section');\n const word = _.sample(window.tasks.phoneticAnalysis);\n for (let i = 0; i < word.length; i++){\n pWrapper.appendChild(window.utils.createEl('p'));\n pWrapper.lastChild.classList.add('word');\n pWrapper.lastChild.textContent = word[i];\n } \n\n _.forEach(window.tasks.lettersTypes, function(value) {\n divWrapper.appendChild(window.utils.createEl('div'));\n divWrapper.lastChild.textContent = value;\n divWrapper.lastChild.classList.add('lettersType');\n });\n\n taskDiv.classList.add('task');\n taskDiv.classList.add('phonetic');\n taskHeading.classList.add('task-heading');\n pWrapper.classList.add('p-wrapper');\n divWrapper.classList.add('div-wrapper');\n submitButton.classList.add('submit-button');\n taskHeading.textContent = \"Определи гласные и согласные буквы\";\n submitButton.textContent = \"Я сделал!\";\n\n const storage = [];\n storage.push(taskHeading, divWrapper, pWrapper, submitButton, warning);\n storage.forEach(function(el){taskDiv.appendChild(el);});\n window.utils.addDocumentFragment(taskDiv, taskWrapper);\n\n const pairs = dragAndDrop(\".word\", \".lettersType\");\n submitButton.addEventListener('click', checkAnswer);\n function checkAnswer(){\n if (pWrapper.firstChild) { \n warning.textContent = 'Выполни задание'\n } else {\n const condition = checkPairs(pairs, window.tasks.alphabet);\n window.main.isCorrect(condition, taskDiv, taskWrapper, currentTask);\n }\n }\n }", "async function main() {\n // get all .svelte files\n glob(path.join(srcPath, \"**/*.svelte\"), null, async function (err, files) {\n if (err) throw err;\n // process them\n await Promise.all(files.map((filePath) => preprocessSvelte(path.resolve(filePath))));\n });\n\n // move .d.ts files into /dist/ts\n glob(path.join(distPath, \"**/*.d.ts\"), null, async function (err, files) {\n if (err) throw err;\n const tsPath = path.join(distPath, \"ts\");\n\n await Promise.all(\n files.map(async (filePath) => {\n filePath = path.resolve(filePath);\n // ignore anything in /dist/ts (could probably make a better glob pattern)\n if (!filePath.includes(tsPath)) {\n await fs.move(filePath, filePath.replace(distPath, tsPath), {\n overwrite: true,\n });\n }\n })\n );\n });\n}", "function processFile(resolve, reject, entry, fileObj) {\n\n //get the annotations\n var data = fileObj.data\n , ans = annotation.getAll(data)\n ;\n\n //update the entry's fileTypes property\n if (entry.fileTypes.indexOf(fileObj.ext) === -1) {\n entry.fileTypes.push(fileObj.ext);\n }\n\n //remove the annotations for file processing\n data = annotation.clear(data);\n\n //if the file is not a .js or .json then convert it to a string\n if (cnsts.jsExt.indexOf(fileObj.ext) === -1 ) {\n data = type_javascript_javaScriptConverter(fileObj.ext.substring(1), data);\n }\n else if (isEmpty(data)) {\n data = \"\\\"\\\"\";\n }\n\n //see if we are going to perform the linting\n if (entry.lint === true || entry.lint === \"pre\") {\n lintFile(data, fileObj, finish);\n }\n else {\n finish();\n }\n\n //junction function\n function finish() {\n //add the annotations back\n fileObj.data = annotation.annotateAll(ans, data);\n //resolve with the updated file object\n resolve(fileObj);\n }\n\n }", "parseFileMetadata(allFiles) {\n let SUMMARY_STATS_FILE_TYPE = \"SUMMARY_STATS\";\n let METADATA_FILE_TYPE = \"METADATA\";\n let SUMMARY_STATS_TEMPLATE_FILE_TYPE = \"SUMMARY_STATS_TEMPLATE\";\n\n let summaryStatsFileMetadata = {};\n let metadataFileMetadata = {};\n let summaryStatsTemplateFileMetadata = {};\n\n allFiles.forEach((file) => {\n /**\n * Set data for Summary Stats File Object\n */\n if (file.type === SUMMARY_STATS_FILE_TYPE) {\n\n // Set Summary Stats fileUploadId\n if (file.fileUploadId) {\n summaryStatsFileMetadata.fileUploadId = file.fileUploadId;\n }\n\n // Set Summary Stats fileName\n if (file.fileName) {\n summaryStatsFileMetadata.fileName = file.fileName;\n }\n\n // Set Summary Stats errors\n let summaryStatsErrorMessage = [];\n if (file.errors && file.errors.length > 0) {\n // let fieldHeaderText = \"Error: \";\n let index = 0;\n // let fieldHeader = <span key={index}>{fieldHeaderText}<br /></span>;\n // summaryStatsErrorMessage.push(fieldHeader);\n\n for (const error of file.errors) {\n index = index + 1;\n summaryStatsErrorMessage.push(<span key={index}>{error}<br /></span>);\n }\n summaryStatsFileMetadata.summary_stats_errors = summaryStatsErrorMessage;\n }\n }\n\n /**\n * Set data for Metadata File Object\n */\n if (file.type === METADATA_FILE_TYPE) {\n\n // Set Metadata fileUploadId\n if (file.fileUploadId) {\n metadataFileMetadata.fileUploadId = file.fileUploadId;\n }\n\n // Set Metadata fileName\n if (file.fileName) {\n metadataFileMetadata.fileName = file.fileName;\n }\n\n // Set Metadata errors\n let metadataErrorMessage = [];\n if (file.errors && file.errors.length > 0) {\n // let fieldHeaderText = \"Error: \";\n let index = 0;\n // let fieldHeader = <span key={index}>{fieldHeaderText}<br /></span>;\n // metadataErrorMessage.push(fieldHeader);\n\n for (const error of file.errors) {\n index = index + 1;\n metadataErrorMessage.push(<span key={index}>{error}<br /></span>);\n }\n metadataFileMetadata.metadata_errors = metadataErrorMessage;\n }\n }\n\n /**\n * Set data for Summary Stats Template File Object\n */\n if (file.type === SUMMARY_STATS_TEMPLATE_FILE_TYPE) {\n\n // Set Summary Stats Template fileUploadId\n if (file.fileUploadId) {\n summaryStatsTemplateFileMetadata.fileUploadId = file.fileUploadId;\n }\n\n // Set Summary Stats Template fileName\n if (file.fileName) {\n summaryStatsTemplateFileMetadata.fileName = file.fileName;\n }\n\n // Set Summary Stats Template errors\n let summaryStatsTemplateErrorMessage = [];\n if (file.errors && file.errors.length > 0) {\n let fieldHeaderText = \"Error: \";\n let index = 0;\n let fieldHeader = <span key={index}>{fieldHeaderText}<br /></span>;\n summaryStatsTemplateErrorMessage.push(fieldHeader);\n\n for (const error of file.errors) {\n index = index + 1;\n summaryStatsTemplateErrorMessage.push(<span key={index}>{error}<br /></span>);\n }\n summaryStatsTemplateFileMetadata.metadata_errors = summaryStatsTemplateErrorMessage;\n }\n }\n });\n return { summaryStatsFileMetadata, metadataFileMetadata, summaryStatsTemplateFileMetadata };\n }", "function healthCheckCallback(healthCheckResults) {\n console.log(\"Results are ready.\");\n var newSource = sfp.readFile('test-output/temp.js');\n // healthCheckResults.source = sfp.readFile(tempFilePath);\n healthCheckResults.source = realSource;\n healthCheckResults.processedSource = newSource;\n runJsDoc('test-output', healthCheckResults);\n }", "function analyze(attempt_data) {\n\n\tnormalize_data(attempt_data);\n\n // get errors by comparing correct vs attempt\n var errors = [];\n\n // make list of 0s for each feature - will change to 1 if move in wrong dir\n var wrong_dir_indices = [];\n for (var l = 0; l < attempt_data[0].length; l++) {wrong_dir_indices.push(0);}\n\n compute_errors(errors, wrong_dir_indices, attempt_data, correct_data);\n\n // compute results by finding which joints have errors above threshold\n var results_str = generate_results(errors, wrong_dir_indices, sd_data);\n\n // display results\n $(\".text\").html(results_str);\n}", "function setIsCoded(analysis) {\n analysis.isCoded = false;\n analysis.dataTypes.forEach(function(dt){\n if (['code','Coding','CodeableConcept'].indexOf(dt.code) > -1) {\n analysis.isCoded = true;\n }\n })\n }", "async setup() {\n if (this.type == \"file\") this.addFile();\n else this.addFolder();\n }", "function run_analysis(analysis_URL) {\n d3.select(\"body\").style(\"cursor\",\"wait\");\n\n d3.json(analysis_URL, function (error, result) {\n if (result) {\n alert(\"Analysis results: \" + result.status);\n }\n d3.select(\"body\").style(\"cursor\",\"default\");\n populate_selects();\n });\n}", "async function main() {\n const resolvedPaths = globby.sync(files as string[])\n const transformationModule = loadTransformationModule(transformationName)\n\n log(`Processing ${resolvedPaths.length} files…`)\n\n for (const p of resolvedPaths) {\n debug(`Processing ${p}…`)\n const fileInfo = {\n path: p,\n source: fs.readFileSync(p).toString(),\n }\n try {\n const result = runTransformation(\n fileInfo,\n transformationModule,\n params as object\n )\n fs.writeFileSync(p, result)\n } catch (e) {\n console.error(e)\n }\n }\n}", "function processDashboard() {\n\n\tvar success = true;\n\tconsole.log(\"\\n2. Validating exported metadata\");\n\n\t//Debug: dump metadata before processing\n\tif (debug) {\n\t\tfs.writeFileSync('.\\\\debug.json', JSON.stringify(metaData));\n\t}\n\n\t//Remove undesired properties from objects\n\tremoveProperties();\n\tremoveNameFromPTEA();\n\tremoveNameFromTETA();\n\n\t//Remove current configuration of indicators and cateogry option groups\n\tclearIndicatorFormulas();\n\tclearCategoryOptionGroups();\n\n\t//Reset/remove lat/long/zoom on maps\n\tclearMapZoom();\n\tclearMapViews();\n\n\t//Add prefix to objects to be mapped\n\tprefixIndicators();\n\tprefixCategoryOptionGroups();\n\n\t//Make sure we don't include orgunit assigment in datasets or users, and orgunit levels in predictors\n\tclearOrgunitAssignment();\n\n\t//Configure sharing and metadata ownership\n\tconfigureSharing();\n\tconfigureOwnership();\n\n\t//Remove users from user groups\n\tclearUserGroups();\n\n\t//Make sure the \"default defaults\" are used\n\tsetDefaultUid();\n\n\t//Remove invalid references to data elements, indicators, catOptGroups from groups (group sets)\n\t//Verify that there are no data elements or indicators without groups\n\tif (!validateGroupReferences()) success = false;\n\n\t//Verify that favourites only use relative orgunits\n\tif (!validateFavoriteOrgunits()) success = false;\n\n\t//Verify that favourites only use indicators\n\tif (!validateFavoriteDataItems()) success = false;\n\n\t//Verify that no unsupported data dimensions are used\n\tif (!validateFavoriteDataDimension()) success = false;\n\n\t/** CUSTOM MODIFICATIONS */\n\tif (currentExport.hasOwnProperty(\"_customFuncs\")) {\n\t\tfor (var customFunc of currentExport._customFuncs) {\n\t\t\tvar func = new Function(\"metaData\", customFunc);\n\t\t\tfunc(metaData);\n\t\t}\n\t}\n\n\tif (success) {\n\t\tconsole.log(\"✔ Validation passed\");\n\t\tsaveDashboard();\n\t}\n\telse {\n\t\tconsole.log(\"\");\n\t\tvar schema = {\n\t\t\tproperties: {\n\t\t\t\tcontinue: {\n\t\t\t\t\tdescription: \"Validation failed. Continue anyway? (yes/no)\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tdefault: \"no\",\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tprompt.get(schema, function (err, result) {\n\t\t\tif (result.continue == \"yes\") saveDashboard();\n\t\t\telse cancelCurrentExport();\n\t\t});\n\t}\n}", "function typecheckFiles (files) {\n clearConsole();\n clearDebugFile();\n processFiles(files)\n .then(files => {\n if (process.env.DEBUG) {\n writeToDebugFile(`${getTimestamp()} Finished file processing`);\n }\n execInfraredCore(files);\n })\n .catch(error => {\n clearConsole();\n process.stdout.write(error);\n process.stdout.write(chalk.bold('\\nProcess stopped.\\n\\n'));\n process.exit(1);\n });\n}", "function analyze_document(document) {\n add_form_buttons(document);\n document_submit_catcher(document);\n }", "function setup() {\n for (var i = 0; i < restaurantFile.results.length; i++) {\n restaurantInfo.push(restaurantFile.results[i].rating);\n }\n linearSearch(); //run the linearSearch function\n}", "function postToAPI() {\n console.log(\"Sending file to analyze\");\n\n nest.analyzeFile(file, nest.guessType(file), {\n onload: function (result) {\n\n var response = result.response;\n\n var data = result;\n\n console.log(\"Got response\");\n console.log(response);\n\n if (response.track && response.track.audio_summary) {\n console.log(\"Loading analysis URL:\" + response.track.audio_summary.analysis_url);\n\n if(!response.track.audio_summary.analysis_url) {\n console.error(\"Echonest does not like us and didn't produce track analysis URL\");\n if(failed) {\n failed();\n return;\n }\n }\n\n nest.loadAnalysis(response.track.audio_summary.analysis_url, {\n onload: function (result) {\n data.analysis = result;\n storeCachedResult(hash, JSON.stringify(data));\n ready(data);\n }\n });\n }\n }\n });\n }", "function modify(tree) {\n\t// These structures store which objects and storage elements are tainted\n\ttree.unshift(esprima.parse('var TSobjects = new Array();'));\n\ttree.unshift(esprima.parse('var TSlocalStorage = new Array();'));\n\ttree.unshift(esprima.parse('var TSsessionStorage = new Array();'));\n\n\t// Loop through each line in the method\n\tfor (i = 0; i < tree.length; i++) {\n\t\t// Check the syntax\n\t\tswitch(tree[i].type) {\n\t\t\tcase 'VariableDeclaration':\n\t\t\t\ti += taintVariableDeclaration(tree, i);\n\t\t\t\tbreak;\n\t\t\tcase \"IfStatement\":\n\t\t\t\ttaintIfStatement(tree[i]);\n\t\t\t\tbreak;\n\t\t\tcase \"ExpressionStatement\":\n\t\t\t\ti += taintExpressionStatement(tree, i);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}", "function analyze(start = find_start_line()) {\n const code = parse(cm.getValue())\n // TODO: validate code (ensure labels are defined and unique)\n const cfg = build_cfg(code, code_line(code, start))\n const dead = find_dead_code(code, cfg)\n\n highlight_dead_code(dead, code)\n}", "function builBbusinessTripTypes() {\n self.types([]);\n \n self.types(rootViewModel.globalTypes());\n \n\n }", "function analyseEntryPoint(graph, entryPoint, entryPoints) {\n const { oldPrograms, analysesSourcesFileCache, moduleResolutionCache } = entryPoint.cache;\n const oldProgram = oldPrograms && oldPrograms['analysis'];\n const { moduleId } = entryPoint.data.entryPoint;\n const packageNode = graph.find(nodes_1.isPackage);\n const primaryModuleId = packageNode.data.primary.moduleId;\n log_1.debug(`Analysing sources for ${moduleId}`);\n const tsConfigOptions = {\n ...entryPoint.data.tsConfig.options,\n skipLibCheck: true,\n noLib: true,\n noEmit: true,\n types: [],\n target: ts.ScriptTarget.Latest,\n strict: false,\n };\n const compilerHost = cache_compiler_host_1.cacheCompilerHost(graph, entryPoint, tsConfigOptions, moduleResolutionCache, undefined, analysesSourcesFileCache, false);\n const potentialDependencies = new Set();\n compilerHost.resolveTypeReferenceDirectives = (moduleNames, containingFile, redirectedReference, options) => {\n return moduleNames.map(moduleName => {\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n return undefined;\n }\n const result = ts.resolveTypeReferenceDirective(moduleName, path_1.ensureUnixPath(containingFile), options, compilerHost, redirectedReference).resolvedTypeReferenceDirective;\n return result;\n });\n };\n compilerHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference, options) => {\n return moduleNames.map(moduleName => {\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n return undefined;\n }\n const { resolvedModule } = ts.resolveModuleName(moduleName, path_1.ensureUnixPath(containingFile), options, compilerHost, moduleResolutionCache, redirectedReference);\n return resolvedModule;\n });\n };\n const program = ts.createProgram(entryPoint.data.tsConfig.rootNames, tsConfigOptions, compilerHost, oldProgram);\n log_1.debug(`tsc program structure is reused: ${oldProgram ? oldProgram.structureIsReused : 'No old program'}`);\n entryPoint.cache.oldPrograms = { ...entryPoint.cache.oldPrograms, ['analysis']: program };\n const entryPointsMapped = {};\n for (const dep of entryPoints) {\n entryPointsMapped[dep.data.entryPoint.moduleId] = dep;\n }\n for (const moduleName of potentialDependencies) {\n const dep = entryPointsMapped[moduleName];\n if (dep) {\n log_1.debug(`Found entry point dependency: ${moduleId} -> ${moduleName}`);\n if (moduleId === moduleName) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on itself.`);\n }\n if (dep.some(n => entryPoint === n)) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on ${moduleId}.`);\n }\n entryPoint.dependsOn(dep);\n }\n else {\n throw new Error(`Entry point ${moduleName} which is required by ${moduleId} doesn't exists.`);\n }\n }\n}", "function main(): void {\n const cli = new commander.Command();\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n cli.version(require(\"../package.json\").version)\n .description(\n \"CLI to convert CDS models to Typescript interfaces and enumerations\"\n )\n .option(\"-c, --cds <file.cds>\", \"CDS file to convert\")\n .option(\n \"-o, --output ./<path>/\",\n \"Output location in which the generated *.ts files are written to. Make sure the path ends with '/'.\"\n )\n .option(\"-p, --prefix <I>\", \"Interface prefix\", \"\")\n .option(\n \"-j, --json\",\n \"Prints the compiled JSON representation of the CDS sources\"\n )\n .option(\n \"-d, --debug\",\n \"Prints JavaScript error message, should be used for issue reporting => https://github.com/mrbandler/cds2types/issues\"\n )\n .option(\n \"-f, --format\",\n \"Flag, whether to format the outputted source code or not (will try to format with prettier rules in the project)\"\n )\n .option(\n \"-s, --sort\",\n \"Flag, whether to sort outputted source code or not\"\n )\n .parse(process.argv);\n\n if (!process.argv.slice(2).length) {\n cli.outputHelp();\n } else {\n const options = cli.opts() as IOptions;\n new Program().run(options).catch((error: Error) => {\n const debugHint =\n \"Please use the debug flag (-d, --debug) for a detailed error message.\";\n console.log(\n `Unable to write types. ${options.debug ? \"\" : debugHint}`\n );\n\n if (options.debug) console.error(\"Error:\", error.message);\n process.exit(-1);\n });\n }\n}", "function ANT() { }", "function loadDatasetsAnalyzer(fileContents) { \n //Empty the array when new files are uploaded\n contentObjsAnalyzer = [];\n \n //Remove pre-existing UI\n $(\"div[name=data-analyzer] form.file-headers\").remove();\n \n //Create the form for selecting options.\n var form = $(\"<form class='file-headers file-headers-grid'><h3>Fields</h3><ul name='checkboxes'></ul></form>\");\n $(\"div[name=data-analyzer] .panel\").prepend(form);\n \n //Loop through each file, save its contents, and add its fields to the list of choices.\n for(var i = 0; i < fileContents.length; i++) {\n fileContents[i] = fileContents[i].split('\\n').filter(x => {\n return x.replace(/,|\\r|\\n/g, '').length != 0;\n }).join('\\n');\n \n var data = Papa.parse(fileContents[i], {\n header: true,\n skipEmptyLines: true\n });\n contentObjsAnalyzer.push(data.data);\n \n //Create the column labels for the grid.\n var row = $(\"<li class='flex-row columns'></li>\");\n for(var l = 0; l < data.meta.fields.length; l++)\n row.append($(\"<p>\" + data.meta.fields[data.meta.fields.length - 1 - l] + \"</p>\"));\n \n form.find(\"ul\").append(row);\n \n //Create the checkbox grid for fields to be selected as both rows and columns;\n for(var j = 0; j < data.meta.fields.length; j++) {\n //Create a new row of checkboxes\n var newRow = $(\"<li class='flex-row'><p>\" + data.meta.fields[j] + \"</p></li>\")\n \n for(var k = 0; k < data.meta.fields.length - j; k++) { \n //Get the fields\n var fieldX = data.meta.fields[j];\n var fieldY = data.meta.fields[data.meta.fields.length - 1 - k];\n \n //Add callbacks for creating/destroying graphs\n var newCheckbox = $(\"<input type='checkbox' data-field-x='\" + fieldX + \"' data-field-y='\" + fieldY + \"'>\").change(function() {\n //Get fields of checkbox\n var _fieldX = $(this).attr('data-field-x');\n var _fieldY = $(this).attr('data-field-y');\n \n //Generate or destroy based on whether something was enabled or disabled.\n if($(this).prop(\"checked\"))\n generateGraph(_fieldX, j, _fieldY, k);\n else\n destroyGraph(_fieldX, _fieldY);\n });\n newRow.append(newCheckbox);\n }\n \n form.find(\"ul\").append(newRow);\n }\n }\n \n form.append($(\"<div class='flex-row-center'><a name='scroll-to-graphs' href='#graphs' class='flex-row-center'><img src='images/icons/chevron-down.png'><p>Scroll Down for Results</p><img src='images/icons/chevron-down.png'></a></div>'\"));\n}", "function startPlatoVisualizer(done) {\n log('Running Plato');\n\n var files = glob.sync(config.plato.js);\n var excludeFiles = /.*\\.spec\\.js/;\n var plato = require('plato');\n\n var options = {\n title: 'Plato Inspections Report',\n exclude: excludeFiles\n };\n var outputDir = config.report + '/plato';\n\n plato.inspect(files, outputDir, options, platoCompleted);\n\n function platoCompleted(report) {\n var overview = plato.getOverviewReport(report);\n if (args.verbose) {\n log(overview.summary);\n }\n if (done) {\n done();\n }\n }\n }", "function analyze(session, instant) {\n runSessionHandler(session, \"change\", 1000);\n runSessionHandler(session, \"index\", instant ? null : api.getHandlerTimeout(\"index\", session.filename, 1000));\n runSessionHandler(session, \"check\", instant ? null : api.getHandlerTimeout(\"check\", session.filename, 2000)).then(function(annos) {\n setAnnotations(session, annos);\n });\n }", "async analyzeFile(finfo, data) {\n // ## process the AST to get our method boundaries\n let boundsByLine;\n if (data.ast) {\n boundsByLine = this._extractMethodBoundariesFromAST(data.ast);\n }\n\n console.log('line bounds', boundsByLine);\n\n // NOTE this is where we're touching DOM stuff that necessitates we be on\n // the main thread.\n const parser = new DOMParser();\n\n // ## parse the searchfox HTML and its ANALYSIS_DATA JSON-ish struct.\n const hdoc = parser.parseFromString(data.html, \"text/html\");\n\n /**\n * This is searchfox's array of [jumps, searches] lists. Jumps are used to\n * populate \"Go to definition of\" and searches are used for \"Search for\"\n * to search using the actual symbol.\n *\n * Each jumps array contains zero or more items of the form { pretty, sym }\n * where `sym` is the mangled symbol name and `pretty` is the unmangled\n * symbol name. Each searches array contains zero or more items of the same\n * { pretty, sym } form except these `pretty` representations contain\n * prefixes of the form \"constructor\", \"field\", etc.\n *\n * We expect the jumps array to be empty when the token is already the\n * definition point of the symbol. Otherwise we expect jumps and searches\n * to have the same number of entries, although their ordering may vary.\n * Multiple entries usually occur in places where a constructor is involved.\n * For example, in a constructor's initializer list for mMonitor(), mMonitor\n * will have entries for both the \"field\" and the \"constructor\".\n *\n * The items are referenced via \"data-i\" attributes on syntax-highlighted\n * spans for which this info is available. Any span that has a \"data-i\"\n * should also have a \"data-symbols\" attribute for searchfox's \"highlight\"\n * functionality where other instances of the same underlying symbol(s) will\n * be highlighted on hover or when requested via \"Sticky highlight\" menu\n * option. (Note: \"data-symbols\" was previously \"data-id\" which was\n * heuristically chosen to be one of the the symbols. We never used\n * \"data-id\" because the heuristic was not helpful to our analysis, and\n * \"data-symbols\" is redundant.\n */\n let anData;\n /**\n * This is a processed version of the above is a filtered version of each\n * `jumps` so that only entries corresponding to potential calls remain.\n */\n let callDex;\n try {\n // hdoc is a data document and doesn't have an associated window at this\n // point. As much fun as it would be to stick it in an iframe, that's\n // asking for trouble and we can just parse the data out.\n const adScript = hdoc.querySelector('#content script');\n const adScriptStr = adScript.textContent;\n\n const idxFirstBracket = adScriptStr.indexOf('[');\n const idxLastBracket = adScriptStr.lastIndexOf(']');\n\n // ## Process ANALYSIS_DATA to populate callDex.\n anData =\n JSON.parse(adScriptStr.substring(idxFirstBracket, idxLastBracket + 1));\n\n callDex = new Array(anData.length);\n for (let iSym=0; iSym < anData.length; iSym++) {\n const [jumps, searches] = anData[iSym];\n if (!jumps || !jumps.length || jumps.length !== searches.length) {\n continue;\n }\n let use = null;\n for (let i=0; i < jumps.length; i++) {\n const jump = jumps[i];\n const search = searches[i];\n const type = search.pretty.split(' ', 1)[0];\n switch (type) {\n default:\n console.warn('unsupported symbol type:', type);\n continue;\n case 'constructor':\n case 'destructor':\n case 'function':\n // do use, fall out.\n break;\n // These are the ones not to use, so we continue the loop.\n case 'type':\n case 'macro':\n case 'field':\n case 'variable':\n case 'enum':\n continue;\n }\n\n if (!use) {\n use = [];\n }\n use.push(jump);\n }\n callDex[iSym] = use;\n }\n } catch (ex) {\n console.warn('problem parsing out ANALYSIS_DATA:', ex);\n }\n\n try {\n const codePre = hdoc.querySelector('#file tbody tr td.code pre');\n finfo.sourceFragment = new DocumentFragment();\n // We want to be able to show the entire file source. The individual\n // SymInfo.sourceFragment DocumentFragments steal the lines, so it's up\n // to us to clone here.\n finfo.sourceFragment.appendChild(codePre.cloneNode(true));\n\n // ## Process the HTML along method boundaries.\n // Snapshot the children so we can mutate the DOM, re-parenting the lines\n // into per-method fragments without confusing ourselves when debugging.\n const frozenChildren = Array.from(codePre.children);\n const allSynLines = finfo.lineToSymbolBounds =\n new Array(frozenChildren.length);\n const dataIndexToSymbolBounds = finfo.dataIndexToSymbolBounds =\n new Array(anData.length);\n\n // AST-aware processing state that is used to detect transitions from the\n // previous boundsByLine value.\n let curMethod = null; // current method symbol name\n let curSym = null; // the SymbolInfo for that method.\n let curLineObj = null;\n let curFragment = null;\n\n for (const eLine of frozenChildren) {\n // ZERO-based line number.\n const iLine = parseInt(eLine.getAttribute('aria-labelledby'), 10) - 1;\n const synLine = allSynLines[iLine] = [];\n\n // ## Perform AST-ignorant searchfox line-symbol extraction.\n // Populate the file's lineToSymbolBounds.\n\n // ### Saved off for the benefit of the AST-aware logic below.\n // Array of values from callDex. This has to be an array because a\n // single line can contain multiple call-related uses.\n let lineCallJumps;\n // This is just a single def's `searches` Array. It's a single one\n // because we are using this as a hacky way to bridge the raw symbol\n // corresponding to the method definition to the AST logic below without\n // getting caught up in exact token match-ups. We may need to do the\n // exact match-up, but for our hack, we only want the last def because\n // we're sane white-spacing/etc.\n let lastDefSearches;\n\n // We only care about non-local symbols, which means only elements with\n // a \"data-i\" attribute. However, we do also care about text offsets,\n // so we do need to process all nodes, not just elements with a data-i\n // attribute.\n let offset = 0;\n let firstTextOffset = -1;\n for (const nKid of eLine.childNodes) {\n if (nKid.nodeType !== 1 && nKid.nodeType !== 3) {\n continue;\n }\n\n const textContent = nKid.textContent;\n const tcLen = textContent.length;\n\n if (firstTextOffset === -1) {\n const iNonWS = findNonWS(textContent);\n if (iNonWS !== -1) {\n firstTextOffset = offset + iNonWS;\n }\n }\n\n // element, therefore data-i is possible.\n if (nKid.nodeType === 1) {\n if ('i' in nKid.dataset) {\n const jumpIdx = parseInt(nKid.dataset.i, 10);\n // save these for processing in the AST-aware logic below.\n const callJumps = callDex[jumpIdx];\n if (callJumps) {\n if (!lineCallJumps) {\n lineCallJumps = [];\n }\n lineCallJumps.push(callJumps);\n }\n\n const [jumps, searches] = anData[jumpIdx];\n // Resolve the symbol and put it in the per-line symbol list.\n const isDef = jumps.length === 0; // defs have no jumps.\n // XXX hack here to avoid getting tricked by types that we don't\n // have jumps for. This works unconscionably well.\n if (isDef && !searches[0].pretty.startsWith('type ')) {\n lastDefSearches = searches;\n }\n // Okay, right, so there may be multiple search entries, and these\n // may in fact have multiple comma-delimited symbols in the 'sym'\n // field. We punt to the helper below and its hand-waving.\n const bestRawSym = pickBestSymbolFromSearches(searches);\n if (bestRawSym) {\n const synSym = this.kb.lookupRawSymbol(bestRawSym, false);\n const symBounds = {\n bounds: [offset, offset + tcLen],\n type: isDef ? 'def' : 'use',\n symInfo: synSym\n };\n synLine.push(symBounds);\n dataIndexToSymbolBounds[jumpIdx] = symBounds;\n }\n }\n }\n\n offset += tcLen;\n }\n\n // ## AST-aware line processing\n if (!boundsByLine) {\n continue;\n }\n\n const newLineObj = boundsByLine[iLine];\n // A change in object signifies either entering/leaving a method def or\n // its body.\n if (newLineObj !== curLineObj) {\n // falsey means exiting back to not inside a method at all.\n if (!newLineObj) {\n curMethod = null;\n if (curSym) {\n curSym.markDirty();\n }\n curSym = null;\n curFragment = null;\n } else {\n const newType = newLineObj.type;\n const newMethod = newLineObj.method;\n if (newType === 'def') {\n if (newMethod === curMethod) {\n // okay, so we probably are just encountering some post-body\n // definition lip. We want to ignore this, but we want to make\n // sure that we handle a multi-line lip, so null out only the\n // symbol\n if (curSym) {\n curSym.markDirty();\n }\n curSym = null;\n } else {\n // Okay, this is not the method we were processing, so let's\n // process the def for real.\n curMethod = newMethod;\n curFragment = new DocumentFragment();\n curSym = null;\n // (fall-through)\n }\n } else {\n // Okay, now we're switching to the body.\n if (!curSym) {\n console.log('sketchy: left', curMethod, 'def without curSym');\n }\n }\n }\n\n curLineObj = newLineObj;\n }\n\n if (curMethod) {\n // There is a method and we're still processing it.\n\n // This line also gets displayed in our syntax highlighted source...\n curFragment.appendChild(eLine);\n\n if (!curSym && newLineObj.type === 'def' && lastDefSearches) {\n // NB: this probably wants its own helper; our intent here is very\n // different from our intent above.\n const rawSym = pickBestSymbolFromSearches(lastDefSearches);\n // and our direct lastDefSearches[0] accordingly assumes the impl.\n curSym = this.kb.lookupRawSymbol(\n rawSym, false, stripPrettyTypePrefix(lastDefSearches[0].pretty),\n { sourcePath: finfo.path });\n curSym.sourceFragment = curFragment;\n curSym.sourceFileInfo = finfo;\n\n finfo.fileSymbolDefs.add(curSym);\n }\n\n if (curSym && newLineObj.type === 'body' && lineCallJumps) {\n for (const jumps of lineCallJumps) {\n // NB: pretty is also included here\n for (const { sym, pretty } of jumps) {\n let prevSymbols = [];\n for (const rawSym of sym.split(',')) {\n const linkedSym =\n this.kb.lookupRawSymbol(rawSym, false, pretty);\n curSym.callsOutTo.add(linkedSym);\n linkedSym.receivesCallsFrom.add(curSym);\n for (const prevSym of prevSymbols) {\n prevSym.superSymbols.add(linkedSym);\n linkedSym.subSymbols.add(prevSym);\n }\n prevSymbols.push(linkedSym);\n }\n }\n }\n }\n }\n }\n\n if (curSym) {\n curSym.markDirty();\n }\n } catch (ex) {\n console.warn('problem processing searchfox html:', ex);\n }\n\n return finfo;\n }", "function AE_typeMaker() {\n //minified json2.js\n $.evalFile($.getenv(\"BUCK_VENDOR_ROOT\")+\"/AE/lib/json2.js\");\n try{\n \n app.beginUndoGroup(\"Export Layered PSD and JSON\");\n var proj = app.project;\n var comp = proj.activeItem;\n if (!(comp instanceof CompItem)) return alert(\"Select a comp or viewer window before running this script.\");\n // function that gets justification of text layers\n function textJustVal(textDoc){\n var val = textDoc.justification;\n //var Justification = {};\n if(val == ParagraphJustification.LEFT_JUSTIFY){\n return \"LEFT\";\n }else if(val == ParagraphJustification.RIGHT_JUSTIFY){\n return \"RIGHT\";\n }else if(val == ParagraphJustification.CENTER_JUSTIFY){\n return \"CENTER\";\n }else if(val == ParagraphJustification.FULL_JUSTIFY_LASTLINE_LEFT){\n return \"LEFTJUSTIFIED\";\n }else if(val == ParagraphJustification.FULL_JUSTIFY_LASTLINE_RIGHT){\n return \"RIGHTJUSTIFIED\";\n }else if(val == ParagraphJustification.FULL_JUSTIFY_LASTLINE_CENTER){\n return \"CENTERJUSTIFIED\";\n }else if(val == ParagraphJustification.FULL_JUSTIFY_LASTLINE_FULL){\n return \"FULLYJUSTIFIED\";\n }else{\n alert(\"There must be an error.\");\n }\n }\n \n //function to get needed information to recreate text layers in photoshop,\n //and export that information to a JSON file.\n //returns JSON objects for supplied text layer 'l'\n function textToObjs(l) {\n var textObj = {};\n var textDocument = l.property(\"ADBE Text Properties\").property(\"ADBE Text Document\").value;\n \n //temporarily unparent the layer (if it is actually parented) to get accurate scale\n try{\n var tempParent = l.parent;\n l.parent = \"\";\n var scaleV = l.property(\"ADBE Transform Group\").property(\"ADBE Scale\").value;\n l.parent = tempParent;\n } catch (e) {\n var scaleV = l.property(\"ADBE Transform Group\").property(\"ADBE Scale\").value;\n }\n //\n\n textObj.layerName= l.name;\n textObj.layerScale= [scaleV[0],scaleV[1]];\n textObj.rotation = l.property(\"ADBE Transform Group\").property(\"ADBE Rotate Z\").value;\n \n //NOTE: position is handled in the main recurse() function, because i'm either lazy, stupid, or STPUD LIKE A FOX. guess which! \n\n //textObj.anchorPoint = l.transform.anchorPoint.value;\n\n textObj.font= textDocument.font;\n textObj.fontSize= textDocument.fontSize;\n textObj.fillColor= textDocument.fillColor;\n textObj.justification= textJustVal(textDocument);\n textObj.applyFill= textDocument.applyFill;\n textObj.text= textDocument.text;\n textObj.tracking= textDocument.tracking;\n try {\n if(textDocument.boxText) textObj.kind = \"PARAGRAPHTEXT\";\n textObj.boxTextSize= textDocument.boxTextSize;\n \n } catch(e) {\n if(textDocument.pointText) textObj.kind = \"POINTTEXT\";\n }\n \n // replace line returns with no characters/whitespace with line returns WITH whitespace\n l.property(\"Source Text\").setValue(textDocument.text.replace(\"\\r\\r\",\"\\rQ\\r\")); // cheat to make certain the second line always has a valid baselineLocs value (doesn't work with \\r)\n textObj.baselineLocs = l.property(\"ADBE Text Properties\").property(\"ADBE Text Document\").value.baselineLocs;\n l.property(\"Source Text\").setValue(textObj.text);\n return textObj;\n\n }\n \n // recursively converts text objects to strings. returns JSON string.\n function textToString(inComp) {\n try{\n var res = {};\n var cnt = 0;\n var compCnt = 0;\n var parentPath = [\"doc\"];\n var parentScaleOffset = [];\n \n var parentPositionOffset = [\"comp(\\\"\"+inComp.name+\"\\\")\"];\n var aeParentPath = [\"comp(\\\"\"+inComp.name+\"\\\")\"];\n var parentRotationOffset = [];\n var baseComp = app.project.activeItem;\n var tempComp = app.project.items.addComp(\"tempComp\",baseComp.width,baseComp.height,baseComp.pixelAspect,baseComp.duration,baseComp.frameRate);\n\n function recurse(inComp,tempComp){ //recursively checks comps for text layers, returns a \"path\" to them, requires the variable \"parentPath\" note: now it does a bunch of other stuff *shrug*\n try{\n\n var lyrs = inComp.layers;\n \n for (var i=1; i<=lyrs.length; i++) {\n var l = lyrs[i];\n var currPath;\n if (l.source instanceof CompItem) {\n //build a recursive toComp() expression to find the position of text layers inside the comp, something like this:\n // thisComp.layer(\"middle Comp 1\").toComp(comp(\"middle Comp 1\").layer(\"deepest Comp 1\").toComp(comp(\"deepest Comp 1\").layer(\"deepest\").toComp([0,0,0])))\n aeParentPath[compCnt] = \"comp(\\\"\"+l.source.name+\"\\\")\";\n parentPositionOffset.push(\"layer(\\\"\"+l.name+\"\\\").toComp(\"+aeParentPath[compCnt]);\n \n currPath = \"layerSets.getByName('\"+l.name+\"')\";\n parentPath.push(currPath);\n \n //temporarily unparent the layer (if it is actually parented) to get accurate scale\n try{\n var tempParent = l.parent;\n l.parent = \"\";\n parentScaleOffset.push(l.property(\"ADBE Transform Group\").property(\"ADBE Scale\").value);\n l.parent = tempParent;\n } catch (e) {\n parentScaleOffset.push(l.property(\"ADBE Transform Group\").property(\"ADBE Scale\").value);\n }\n //\n parentRotationOffset.push(l.property(\"ADBE Transform Group\").property(\"ADBE Rotate Z\").value);\n\n compCnt++;\n recurse(l.source,tempComp);\n } else if (l instanceof TextLayer) { //is the layer a text layer?\n var prnt = aeParentPath[compCnt-1];\n res[\"textLayer\"+cnt] = textToObjs(l);\n res[\"textLayer\"+cnt].parentPath = parentPath.slice(0,compCnt+1).join(\".\");\n // create null to find position of text layer\n var tempNull = tempComp.layers.addNull();\n var nullPos = tempNull.property(\"ADBE Transform Group\").property(\"ADBE Position\");\n if (!prnt) {prnt = \"comp(\\\"\"+app.project.activeItem.name+\"\\\")\"}\n nullPos.expression =\"r = \"+prnt+\".layer(\\\"\"+l.name+\"\\\").sourceRectAtTime();\\r\"+ parentPositionOffset.slice(0,compCnt+1).join(\".\")+\".layer(\\\"\"+l.name+\"\\\").toComp([r.left,r.top])\"+Array(compCnt+1).join(\")\"); //toComp spiral of doom\n res[\"textLayer\"+cnt].layerPosition = nullPos.value;\n\n //\n // calculate scale based on all parent comps\n var tempScale = [100,100,100];\n for (s = 0; s<compCnt; s++) {\n for (a = 0; a<tempScale.length; a++){tempScale[a] *= parentScaleOffset[s][a]*.01};\n }\n res[\"textLayer\"+cnt].parentScaleOffset = tempScale;\n //\n \n // add all elements of rotation offset array\n res[\"textLayer\"+cnt].parentRotationOffset = 0;\n for (r = 0; r<compCnt; r++) {res[\"textLayer\"+cnt].parentRotationOffset += parentRotationOffset[r]};\n //\n cnt++; //iterate counter for each found text layer\n }\n\n if (i == lyrs.length && inComp != app.project.activeItem) {\n compCnt--;\n parentScaleOffset.pop();\n parentRotationOffset.pop();\n parentPositionOffset.pop();\n parentPath.pop(); \n }\n }\n \n } catch (err) {\n alert(err.line+\"\\r\"+err.toString());\n }\n }\n \n recurse(inComp,tempComp);\n tempComp.remove();\n return JSON.stringify(res, undefined, 4);\n } catch (err) {\n alert(err.line+\"\\r\"+err.toString());\n }\n }\n \n var objString = textToString(comp);\n \n //app.executeCommand(app.findMenuCommandId(\"Photoshop Layers...\")); // export layered photoshop file\n var thisFile = proj.file.fsName.substring(0,proj.file.fsName.lastIndexOf(\".\"));\n var textFile = new File(thisFile+\".json\");\n objFile = textFile.saveDlg (\"Save text as JSON...\", \"JSON:*.json;\");\n if (!objFile) return ;\n //write JSON file\n\n if (objFile.open(\"w\")) {\n objFile.encoding = \"UTF-8\";\n objFile.write(objString);\n objFile.close();\n }\n \n app.endUndoGroup();\n } catch (err) {\n alert(err.line+\"\\r\"+err.toString());\n }\n}", "function measure() {\n\t\t\n\t\t// Call our validate routine and make sure all component properties have been set\n\t\tviz.validate();\n\t\t\n\t\t// Get our size based on height, width, and margin\n\t\tsize = vizuly2.util.size(scope.margin, scope.width, scope.height, scope.parent);\n\t\t\n\t\tscope.size = size;\n\t\t\n\t\t// Tell everyone we are done making our measurements\n\t\tscope.dispatch.apply('measured', viz);\n\t\t\n\t}", "report() {\n console.log(this.name + \" is a \" + this.type + \" type and has \" + this.energy + \" energy.\");\n }", "analyze(input){ return null }", "function reallyDo() {\n var fields = [];\n if (issue_type) {\n var viable_actions = transaction_attributes[issue_type].actions;\n fields = viable_actions[transaction_type].fields;\n }\n if (transaction_type != \"issue certificate\") {\n type_list.splice(defaultTypes.length, type_list.length); // remove anything past the defaultTypes\n } else {\n type_list.splice(0); // no default annotation types for certificates\n type_list.push({name: \"transferForm\", display: \"Transfer Form\", typename: \"text\"});\n }\n for (var t in variableDefaultTypes) {\n type_list.push(variableDefaultTypes[t]);\n }\n var tmp_array = [];\n for (var field in fields) {\n var f = fields[field];\n tmp_array.push({name: f.name, display: f.display_name, required: f.required, typename: f.typname, labels: f.labels});\n }\n if (tmp_array.length > 0 && transaction_type != \"issue certificate\") {\n // only add effective date if we're definitely in a transaction\n var display = \"Effective Date\";\n if ((issue_type == \"Equity Common\" && transaction_type == \"grant\") ||\n (issue_type == \"Equity\" && transaction_type == \"grant\") ||\n (issue_type == \"Debt\" && transaction_type == \"purchase\") ||\n (issue_type == \"Convertible Debt\" && transaction_type == \"purchase\") ||\n (issue_type == \"Safe\" && transaction_type == \"grant\")) {\n display = \"investment date\";\n } else if ((issue_type == \"Option\" && transaction_type == \"grant\") ||\n (issue_type == \"Warrant\" && transaction_type == \"grant\")) {\n display = \"grant date\";\n }\n tmp_array.push({name: 'effective_date', display: display, required: true, typename: 'date'});\n }\n // add new types onto the end (in one action, without changing the reference, for performance reasons)\n var args = [type_list.length, 0].concat(tmp_array);\n Array.prototype.splice.apply(type_list, args);\n // TODO: remove duplicate types, favoring the transaction type\n annotation_list.forEach(function(annot) {\n annot.updateTypeInfo(type_list);\n });\n }", "function TypeChecker() {\n this.checks = [];\n}", "function cleanType(typ) {\n\tlet outputDir, ext, deleted_paths, len, deleted_empty_dirs, len_e;\n\t\n\tlet msg = typ + 'processing';\n\tlet durationStream = $.duration(msg);\n\n\tif (typ === 'js') {\n\t\text = 'js';\n\t}\n\telse if (typ === 'css') {\n\t\text = 'css';\n\t}\n\telse if (typ === 'templates') {\n\t\text = 'html';\n\t}\n\telse if(typ === 'media') {\n\t\text = '*';\n\t}\n\telse if(typ === 'maps') {\n\t\text = '*';\n\t\toutputDir = config.mapsDir;\n\t}\n\telse {\n\t\t$.gutil.log(chalk.red('Type of clean command should be js, css, templates or media.'));\n\t\treturn;\n\t}\n\t\n\tif(typ === 'maps') {\t\t\n \t\tdeleted_paths = $.del.sync([outputDir + '/js/*.' + ext, '!' + outputDir + '/js'], {force: true});\n \t\tlen = deleted_paths.length;\n \t\tdeleted_empty_dirs = $.delempty.sync([outputDir + '/js/*', '!' + outputDir + '/js'], {force: true});\n \t\tlen_e = len_e + deleted_empty_dirs.length;\n \t\t\n \t\tdeleted_paths = $.del.sync([outputDir + '/css/*.' + ext, '!' + outputDir + '/css'], {force: true});\n \t\tlen = len + deleted_paths.length;\n \t\tdeleted_empty_dirs = $.delempty.sync([outputDir + '/css/*', '!' + outputDir + '/css'], {force: true});\n \t\tlen_e = len_e + deleted_empty_dirs.length;\n \t\t\n \t\tdeleted_paths = $.del.sync([outputDir + '/templates/*.' + ext, '!' + outputDir + '/templates'], {force: true});\n \t\tlen = len + deleted_paths.length;\n \t\tdeleted_empty_dirs = $.delempty.sync([outputDir + '/templates/*', '!' + outputDir + '/templates'], {force: true});\n \t\tlen_e = len_e + deleted_empty_dirs.length;\n\t}\t\n\telse {\n\t\toutputDir = config.client[typ].outputDir;\n\t \n\t deleted_paths = $.del.sync([outputDir + '/**/*.' + ext, '!' + outputDir], {force: true});\n\t len = deleted_paths.length;\n\n\t deleted_empty_dirs = $.delempty.sync([outputDir + '/*', '!' + outputDir], {force: true});\n \t\tlen_e = len_e + deleted_empty_dirs.length;\n\t}\n \n // let deleted_empty_dirs = $.delempty.sync(outputDir + '/');\n \n $.gutil.log(chalk.red('Files Deleted : ') + chalk.blue(len));\n $.gutil.log(chalk.red('Directories Deleted : ') + chalk.blue(len_e));\n \n durationStream.emit('end');\n\n return;\n}", "_processHints() {\n this._validateHints();\n this._syncDescribedByIds();\n }", "function processFile(contents,fullFileName) {\n let splitter = \"Instance:\"\n //let arResults = []\n let arInstances = contents.split(splitter); //the instances defined in this file\n\n arInstances.forEach(function(i) { //check each instance\n\n let fileContents = splitter + i //add back in the splitter\n //arResults.push(splitter + i)\n //console.log(fileContents)\n let summary = {description:\"\",title:\"\"}\n let ar = fileContents.split('\\n')\n ar.forEach(function(lne){\n lne = lne.replace(/['\"]+/g, ''); //get rid of all the quotes\n if (lne.substr(0,11) == 'InstanceOf:') {\n summary.type = lne.substr(12)\n } else if (lne.substr(0,9) == 'Instance:') {\n summary.id = lne.substr(10)\n } else if (lne.substr(0,11) == '//BaseType:') {\n summary.baseType = lne.substr(12).trim();\n }else if (lne.substr(0,6) == 'Title:') {\n summary.title = lne.substr(7)\n } else if (lne.substr(0,12) == 'Description:') {\n summary.description = lne.substr(13)\n }\n })\n\n if (summary.type && summary.id) {\n //summary.content = fileContents;\n \n summary.fileName = fullFileName\n if (summary.baseType) {\n summary.link = summary.baseType + \"-\" + summary.id + \".json.html\"\n }\n \n hashExamples[summary.type] = hashExamples[summary.type] || []\n hashExamples[summary.type].push(summary);\n }\n\n\n console.log(summary.id)\n\n })\n \n\n\n}", "function lintTS (done) {\n console.log(\"TODO: TSLint not configured yet. \");\n done();\n // return gulp.src(\"**/*.tsx\")\n // .pipe(plumber())\n // .pipe(tslint({\n // formatter: \"verbose\"\n // }))\n // .pipe(tslint.report({\n // formatter: \"verbose\"\n // }));\n}", "function fixTypewriter( content ){\n\n\tlet typewriter = setupTypewriter( content );\n\ttypewriter.type();\n\n\treturn false\n}", "function analyze(){\t\r\n\r\n\tvar dataChoice;\r\n\r\n\t// Remove previous vector layers\r\n\tif(returnLayer.features[0] != null){ \r\n\t\toldReturnLayer.addFeatures(returnLayer.features[0]);\r\n\t\toldReturnLayer.redraw({force:true});\r\n\t\treturnLayer.removeAllFeatures();\r\n\t}\r\n\t\r\n\t// Get normalization value - this is done by checking color of 'showRawDataButton' button\t\r\n\tvar normalization = parseInt( $(\"input:radio[name=radio_norm]\").val() ); //get radio value\t\r\n\t//console.log('Normalization: ' + normalization);\r\n\r\n\t// Check for hand drawn polygons, make central otherwise\r\n\tif(map.getControl('userPolygon').drawn){\r\n\t\t// Reset drawing feature\r\n\t\tmap.getControl('userPolygon').drawn = false;\r\n\t\tsetTimeout('$(\".tag\").css({\"display\":\"block\"});', 6000);\r\n\t}\r\n\telse{\r\n\t\t// Update style\r\n\t\tsetStyle(clickNumber, currentLayer, oldLayer);\r\n\t\tpushLayers();\t\t\t\t\t\r\n\t\tmakeCentralPolygon();\t// Create polygon\r\n\t}\t\r\n\t\r\n\tpointlist = []\t\t\t\t\t\t\t\t// Clear pointlist before calling next querry\r\n\tspatialQuery(currentLayer, normalization);\t// Call spatial query\r\n\tclickNumber += 1\t\t\t\t\t\t\t// keep track of what colour to make things\r\n\t\r\n\t\r\n}", "function analyse(text, fileName) {\n let lexer = new Lexer(text, fileName);\n return lexer.analyse();\n }", "_ensureFacets(definition) {\n if (!definition.files) return\n const facetFiles = this._computeFacetFiles([...definition.files], get(definition, 'described.facets'))\n for (const facet in facetFiles)\n setIfValue(definition, `licensed.facets.${facet}`, this._summarizeFacetInfo(facet, facetFiles[facet]))\n }", "function _setupParser(){\n\t\t//Extend the parser with the local displayError function\n\t\tparser.displayError = displayError;\n\n\t\t$('html')\n\t\t\t.fileDragAndDrop(function(fileCollection){\n\t\t\t\t_resetUI();\n\n\t\t\t\t//Reset lists\n\t\t\t\tparser.errorList = [];\n\t\t\t\tparser.songList = [];\n\n\t\t\t\t//Loop through each file and parse it\n\t\t\t\t$.each(fileCollection, parser.parseFile);\n\n\t\t\t\t//Parsing complete, run the display/output functions\n\t\t\t\tparser.complete($output);\n\n\t\t\t\t//Update the total converted song count\n\t\t\t\t_updateSongCount(parser.songList.length);\n\t\t\t\t\n\t\t\t\t//Also display errors if there are any\n\t\t\t\tif(parser.errorList.length){\n\n\t\t\t\t\tvar errorTitle = parser.errorList.length == 1 ? \"One song ran into an error and could not be converted\": \"We ran into errors with \" + parser.errorList.length + \" of the songs, and they were not converted\";\n\n\t\t\t\t\t//Join all the error messages together\n\t\t\t\t\tdisplayError(parser.errorList.join(\"<br/>\"), errorTitle);\n\t\t\t\t}\n\n\t\t\t});\n\t}", "function analyze(data, scope, ops) {\n // POSSIBLE TODOs:\n // - error checking for treesource on tree operators (BUT what if tree is upstream?)\n // - this is local analysis, perhaps some tasks better for global analysis...\n\n var output = [],\n source = null,\n modify = false,\n generate = false,\n upstream, i, n, t, m;\n\n if (data.values) {\n // hard-wired input data set\n output.push(source = collect({$ingest: data.values, $format: data.format}));\n } else if (data.url) {\n // load data from external source\n output.push(source = collect({$request: data.url, $format: data.format}));\n } else if (data.source) {\n // derives from one or more other data sets\n source = upstream = (0,vega_util__WEBPACK_IMPORTED_MODULE_4__.array)(data.source).map(function(d) {\n return (0,_util__WEBPACK_IMPORTED_MODULE_2__.ref)(scope.getData(d).output);\n });\n output.push(null); // populate later\n }\n\n // scan data transforms, add collectors as needed\n for (i=0, n=ops.length; i<n; ++i) {\n t = ops[i];\n m = t.metadata;\n\n if (!source && !m.source) {\n output.push(source = collect());\n }\n output.push(t);\n\n if (m.generates) generate = true;\n if (m.modifies && !generate) modify = true;\n\n if (m.source) source = t;\n else if (m.changes) source = null;\n }\n\n if (upstream) {\n n = upstream.length - 1;\n output[0] = (0,_transforms__WEBPACK_IMPORTED_MODULE_3__.Relay)({\n derive: modify,\n pulse: n ? upstream : upstream[0]\n });\n if (modify || n) {\n // collect derived and multi-pulse tuples\n output.splice(1, 0, collect());\n }\n }\n\n if (!source) output.push(collect());\n output.push((0,_transforms__WEBPACK_IMPORTED_MODULE_3__.Sieve)({}));\n return output;\n}", "function lintFile(data, fileObj, finish) {\n //run the linter promise\n type_javascript_linter(data)\n .then(function (results) {\n //add the results to the fileObj\n fileObj[\"lint\"] = results;\n //run the junction callback\n finish();\n });\n }", "lint(sources) {\n for (const source of sources) {\n /* create parser for source */\n const parser = this.instantiateParser();\n /* setup plugins and rules */\n const { rules } = this.setupPlugins(source, this.config, parser);\n /* create a faux location at the start of the stream for the next events */\n const location = {\n filename: source.filename,\n line: 1,\n column: 1,\n offset: 0,\n size: 1,\n };\n /* trigger configuration ready event */\n const configEvent = {\n location,\n config: this.config,\n rules,\n };\n parser.trigger(\"config:ready\", configEvent);\n /* trigger source ready event */\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars -- object destructured on purpose to remove property */\n const { hooks: _, ...sourceData } = source;\n const sourceEvent = {\n location,\n source: sourceData,\n };\n parser.trigger(\"source:ready\", sourceEvent);\n /* setup directive handling */\n parser.on(\"directive\", (_, event) => {\n this.processDirective(event, parser, rules);\n });\n /* parse token stream */\n try {\n parser.parseHtml(source);\n }\n catch (e) {\n if (e instanceof InvalidTokenError || e instanceof ParserError) {\n this.reportError(\"parser-error\", e.message, e.location);\n }\n else {\n throw e;\n }\n }\n }\n /* generate results from report */\n return this.report.save(sources);\n }", "function handleAnnotationTypeChange() {\n gAnnotationType = parseInt($('#annotation_type_id').val());\n globals.currentAnnotationsOfSelectedType = gCurrentAnnotations.filter(function(e) {\n return e.annotation_type.id === gAnnotationType;\n });\n setTool();\n setupCBCheckboxes();\n }", "function getResults()\n{\n for(var i in whiteList)\n {\n //clears whiteList previously detected\n whiteList[i] = false;\n }\n for(var j in blackList)\n {\n //clears blackList previously detected\n blackList[j] = false;\n }\n var endStack = [];\n var x = document.getElementById(\"myTextarea\").value;\n var ast = acorn.parse(x);\n var structureResult = \"\";\n walk(ast, {\n enter: function(node, parent)\n {\n if(!wantedNodeTypes[node.type])\n {\n //skips nodes that aren't wanted\n return;\n }\n if(whiteList.hasOwnProperty(node.type) && !whiteList[node.type])\n {\n //whiteList node detected!\n whiteList[node.type] = true;\n }\n if(blackList.hasOwnProperty(node.type) && !blackList[node.type])\n {\n //blackList node detected!\n blackList[node.type] = true;\n }\n //structure algorithm begins here\n if(!structureResult)\n {\n //this is the first node in the structure detected!\n structureResult = \"This program starts with a \" + node.type;\n endStack.push([node.end, node.type]);\n }\n else\n {\n if(node.start > peek(endStack)[0])\n {\n //if the current start position of node is greater than\n //the top of the stack then we need to continue to next node\n while(endStack.length > 0 && node.start > peek(endStack)[0])\n {\n //pops nodes off the stack that are previous to current node\n endStack.pop();\n }\n if(endStack.length > 0)\n {\n //if the current node is still within a node\n structureResult += \". Continuing within \" + peek(endStack)[1] + \", there is a \" + node.type;\n }\n else\n {\n //if the current node is not within a node\n structureResult += \". Next, there is a \" + node.type;\n }\n endStack.push([node.end, node.type]);\n }\n else\n {\n //need to traverse inside the node\n if(parent.type == \"ForStatement\" && node.type == \"VariableDeclaration\")\n {\n //ignores variable delecration within forloop control\n return;\n }\n structureResult += \", and inside there is a \" + node.type;\n endStack.push([node.end, node.type]);\n }\n }\n }\n });\n if(structureResult)\n {\n //if there was a result then concat a period\n structureResult+= '.';\n }\n else\n {\n //result was blank\n structureResult = \"This program is empty.\";\n }\n var whiteListResult = \"\";\n for(var i in whiteList)\n {\n //iterate whiteList to detect those unused\n if(!whiteList[i])\n {\n if(!whiteListResult)\n {\n //first whiteList element was not used\n whiteListResult = \"This program MUST use a \" + i;\n }\n else\n {\n //subsequent whiteList elements not used\n whiteListResult += \" and a \" + i;\n }\n }\n }\n if(whiteListResult)\n {\n //add period if result is not empty\n whiteListResult +='.';\n }\n else\n {\n //all whiteList elements were used\n whiteListResult = \"is good.\"\n }\n var blackListResult = \"\";\n for(var i in blackList)\n {\n //iterate whiteList to detect those used\n if(blackList[i])\n {\n if(!blackListResult)\n {\n //first blackList element used\n blackListResult = \"This program MUST NOT use a \" + i;\n }\n else\n {\n //subsequent blackList elements used\n blackListResult += \" or a \" + i;\n }\n }\n }\n if(blackListResult)\n {\n //add period if result is not empty.\n blackListResult +='.';\n }\n else\n {\n //all blackList elements were unused\n blackListResult = \"is good.\"\n }\n document.getElementById(\"whitelist\").innerHTML=\"1. (Whitelist) \" + whiteListResult;\n document.getElementById(\"blacklist\").innerHTML=\"2. (Blacklist) \" + blackListResult;\n document.getElementById(\"structure\").innerHTML=\"3. (Structure) \" + structureResult;\n //document.getElementById(\"parsed\").innerHTML=JSON.stringify(ast, null, 2);\n}", "function parseAnalysisInfo(item) {\n switch (item.typ) {\n case 'numeric':\n item.average = item.data.reduce(function (prev, current) {\n return prev + parseInt(current, 10);\n }, 0) / item.data.length;\n item.template = 'numeric';\n break;\n\n case 'info':\n item.data = item.data.map(function(dataItem) {\n dataItem = $mmText.parseJSON(dataItem);\n return typeof dataItem.show != \"undefined\" ? dataItem.show : false;\n }).filter(function(dataItem) {\n // Filter false entries.\n return dataItem;\n });\n case 'textfield':\n case 'textarea':\n item.template = 'list';\n break;\n\n case 'multichoicerated':\n case 'multichoice':\n item.data = item.data.map(function(dataItem) {\n dataItem = $mmText.parseJSON(dataItem);\n return typeof dataItem.answertext != \"undefined\" ? dataItem : false;\n }).filter(function(dataItem) {\n // Filter false entries.\n return dataItem;\n });\n\n // Format labels.\n item.labels = item.data.map(function(dataItem) {\n dataItem.quotient = parseFloat(dataItem.quotient * 100).toFixed(2);\n var label = \"\";\n\n if (typeof dataItem.value != \"undefined\") {\n label = '(' + dataItem.value + ') ';\n }\n label += dataItem.answertext;\n label += dataItem.quotient > 0 ? ' (' + dataItem.quotient + '%)' : \"\";\n return label;\n });\n item.chartData = item.data.map(function(dataItem) {\n return dataItem.answercount;\n });\n\n if (item.typ == 'multichoicerated') {\n item.average = item.data.reduce(function (prev, current) {\n return prev + parseFloat(current.avg);\n }, 0.0);\n }\n\n var subtype = item.presentation.charAt(0);\n item.single = subtype != 'c';\n\n item.template = 'chart';\n break;\n }\n\n return item;\n }", "function analyzeCode(code) {\n\n\n\n var ast = esprima.parse(code);\n var functionsStats = {}; //1\n var addStatsEntry = function(funcName) { //2\n if (!functionsStats[funcName]) {\n functionsStats[funcName] = {calls: 0, declarations:0};\n }\n };\n\n const globals = [];\n\n traverse(ast, function(node) { //3\n if (node.type === 'VariableDeclaration') {\n globals.push(node.declarations[0].id.name);\n console.log(`${JSON.stringify(node.declarations[0].id)}`.cyan);\n if (node.declarations[0].id.name == \"config\") {\n verifyConfig(node.declarations[0].init.properties);\n }\n //addStatsEntry(node.id.name); //4\n //functionsStats[node.id.name].declarations++;\n } else if (node.type === 'CallExpression' && node.callee.type === 'Identifier') {\n addStatsEntry(node.callee.name);\n functionsStats[node.callee.name].calls++; //5\n }\n });\n\n verifyGlobals(globals);\n}", "apply(compiler) {\n compiler.hooks.invalid.tap('invalid', () => {\n this.stdout('compiling...');\n });\n\n compiler.hooks.done.tap('done', stats => {\n // don't care about module messages\n // just warnings + errors\n const statsData = stats.toJson({\n all: false,\n warnings: true,\n errors: true\n });\n\n const wasSuccessful =\n !statsData.errors.length && !statsData.warnings.length;\n if (wasSuccessful) {\n this.stdout('success!');\n }\n\n if (statsData.errors.length) {\n const error = statsData.errors[0];\n return this.stdout(formatErrorMessage(error));\n }\n\n if (statsData.warnings.length) {\n this.stdout(statsData.warnings.join('\\n\\n'));\n }\n });\n }", "function processEntriesToTyposDef(entries) {\n const def = isIterable(entries) ? reduceToTyposDef(entries) : entries;\n const result = sanitizeIntoTypoDef(def);\n (0, assert_1.default)(result);\n return result;\n}", "function _run () {\n // Set up Guideline-specific behaviors.\n var noop = function () {};\n for (var guideline in quail.guidelines) {\n if (quail.guidelines[guideline] && typeof quail.guidelines[guideline].setup === 'function') {\n quail.guidelines[guideline].setup(quail.tests, this, {\n successCriteriaEvaluated: options.successCriteriaEvaluated || noop\n });\n }\n }\n\n // Invoke all the registered tests.\n quail.tests.run({\n preFilter: options.preFilter || function () {},\n caseResolve: options.caseResolve || function () {},\n testComplete: options.testComplete || function () {},\n testCollectionComplete: options.testCollectionComplete || function () {},\n complete: options.complete || function () {}\n });\n }", "function _testRunnerMain() {\n _doSetup();\n\n // if there's no _runTest, assume we need to test the parser. Pass Processing env.\n if (this._testWrapper)\n this._testWrapper(this._pctx);\n else\n _checkParser();\n\n if (this._finished)\n this._finished();\n\n print('TEST-SUMMARY: ' + _passCount + '/' + _failCount);\n}", "function FileAnalysis(path, analysis) {\n this.path = path;\n\n const cyclomatic = analysis.functions.map(f => f.cyclomatic);\n\n // Scale to between 0 and 100\n this.maintainability = Math.max(0, analysis.maintainability * 100 / 171);\n this.sloc = analysis.aggregate.sloc.logical;\n this.cyclomatic = {\n avg: utils.average(cyclomatic),\n max: utils.max(cyclomatic)\n };\n this.difficulty = analysis.aggregate.halstead.difficulty\n this.bugs = analysis.aggregate.halstead.bugs;\n\n this.functions = analysis.functions.map(f => ({\n name: f.name,\n line: f.line,\n params: f.params,\n sloc: f.sloc.logical,\n cyclomatic: f.cyclomatic,\n difficulty: f.halstead.difficulty,\n bugs: f.halstead.bugs\n }));\n\n Object.freeze(this);\n}", "exitTypeAnnotation(ctx) {\n }", "typeAnimation(){\n\t\t//preserve a copy of all the text we're about to display incase we need to save\n\t\tthis.saveCopy();\n\t\t\n\t\tFileManager.writing = false; \n\t\t\n\t\t//figure out how fast we want to type the screen based on how much content needs typing \n\t\tvar letters = 0;\n\t\tfor (i=0; i< this.state.toShowText.length; i++){\t\t\t \n\t\t\tletters += this.state.toShowText[i].text.length;\n\t\t}\n\t\tvar scale = Math.floor(letters/20);\n\t\tif(scale < 1){\n\t\t\tscale = 1;\n\t\t}\n\t\t\n\t\t\n\t\t//do the actual typing\n\t\tthis.typeAnimationActual(scale);\n\t\t\n\t}", "function evaluateTransclusions() {\n //Get all nodes in the document.\n var nodes = ve.init.target.getSurface().getModel().getDocument().getDocumentNode();\n //Filter the result so we only keep the 'transclusion nodes' (templates).\n var transclusions = getTransclusions(nodes);\n //iterate over our transclusions\n for (var i = 0; i < transclusions.length; i++) {\n //retrieve the template name.\n var templateName = getTemplate(transclusions[i]);\n //execute an ask query for every template, checking the categories the template belongs to.\n new mw.Api().get({\n action: \"query\",\n prop: \"categories\",\n titles: templateName,\n formatversion: 2\n }).done(function (data) {\n if (data.query == null) return;\n var page = data.query.pages[0]; // we're only asking for a single page.\n for (var y = 0; y < page.categories.length; y++) {\n //Does the template have the 'System' template?\n if (page.categories[y].title.split(\":\").pop() == \"EMont core protected\") {\n //if so, add it to our list of protected templates.\n protectedTemplates[page.title.replace(/ /g,\"_\")] = true;\n }\n }\n if (Object.keys(protectedTemplates).length > 0 && overriden == false) {\n overrides();\n overriden = true;\n }\n })\n }\n }", "function setup_word_info() {\n $(\"#output_table\").change(function() {\n is_word_info_as_table=true;\n display_word_info_as_table()\n });\n\n $(\"#output_histogram\").change(function() {\n is_word_info_as_table=false;\n display_word_info_as_histogram()\n });\n}", "function runFile (inFile, outFile) {\n const currentTest = new NameParser(inFile, outFile)\n currentTest.uniqueFullNameCount()\n currentTest.uniqueLastNameCount()\n currentTest.uniqueFirstNameCount()\n currentTest.commonLastNames()\n currentTest.commonFirstNames()\n currentTest.modifiedNames(25)\n}", "build() {\n const inputPath = first(this.inputPaths);\n this.exporters.forEach(([fileName, exporter]) => {\n const srcPath = path.join(inputPath, fileName);\n if (fs.existsSync(srcPath)) {\n const sourceCode = exporter.processSourceCode(fs.readFileSync(srcPath, 'utf8'));\n const destPath = path.join(this.outputPath, fileName);\n\n // Make sure the directory exists before writing it.\n mkdirpSync(path.dirname(destPath));\n fs.writeFileSync(destPath, sourceCode);\n }\n });\n }", "function run() {\n\t\tif ( preferences.getValue( 'enabled' ) && !processed ) {\n\t\t\tvar editor = EditorManager.getCurrentFullEditor(),\n\t\t\t\tcurrentDocument = editor.document,\n\t\t\t\toriginalText = currentDocument.getText(),\n\t\t\t\tprocessedText = autoprefixer.compile( originalText ),\n\t\t\t\tcursorPos = editor.getCursorPos(),\n\t\t\t\tscrollPos = editor.getScrollPos();\n\t\t\t\n\t\t\t// Replace text.\n\t\t\tcurrentDocument.setText( formatCode( processedText ) );\n\t\t\t\n\t\t\t// Restore cursor and scroll positons.\n\t\t\teditor.setCursorPos( cursorPos );\n\t\t\teditor.setScrollPos( scrollPos.x, scrollPos.y );\n\t\t\t\n\t\t\t// Save file.\n\t\t\tCommandManager.execute( Commands.FILE_SAVE );\n\t\t\t\n\t\t\t// Prevent file from being processed multiple times.\n\t\t\tprocessed = true;\n\t\t} else {\n\t\t\tprocessed = false;\n\t\t}\n\t}", "function process_test(test, totals) {\n // We want to get all the counts, and we don't care about how it gets executed\n // so sum it all up\n function exec_count(data) {\n let sum = 0;\n for (let type in data)\n sum += data[type];\n return sum;\n }\n // Helper for default stuff\n function get_default(obj, prop, def) {\n return prop in obj ? obj[prop] : def;\n }\n // Each line is [base, summary, contents]\n let base_file = test.shift();\n for (let line of test) {\n // Ignore files that don't map to source code (e.g., eval inner scripts).\n let file = find_file(line[0].file, base_file);\n if (file == \"\") continue;\n if (!(file in totals))\n totals[file] = {funcs: {}, lines: {}};\n\n // If the contents isn't null\n // XXX? Still needed?\n if (line[1] !== null) {\n // pcccount data looks like:\n // {text: ''; opcodes: []}\n // Each opcode looks like:\n // {line: 123; counts: {typea: 13, typeb:12}, textOffset: 534, text: '',\n // name: ''} [textOffset/text isn't always present]\n let line_data = {};\n for (let opcodeData of line[1].opcodes) {\n //if (!('textOffset' in opcodeData) && !('text' in opcodeData)) {\n // continue;\n //}\n let counts = exec_count(opcodeData.counts);\n // There can be multiple opcodes per line. Instead of adding everything\n // up, just take the maximum of any operand in the line. Then add all\n // the data in one go to the output array\n line_data[opcodeData.line] = Math.max(counts,\n get_default(line_data, opcodeData.line, 0));\n }\n let lines = totals[file].lines;\n for (let line in line_data) {\n lines[line] = get_default(lines, line, 0) + line_data[line];\n }\n }\n\n // Process function coverage using the summary. This produces insane counts,\n // since it uses the sum of all codes, but it's simplest for now.\n let funcname = line[0].name;\n if (funcname) {\n let data = get_default(totals[file].funcs, funcname,\n {line: line[0].line, count: 0});\n data.count += exec_count(line[0].totals);\n totals[file].funcs[funcname] = data;\n }\n }\n}", "function transformTheOtherDeclarations(input,output,classesArray) {\r\n\r\n\t\t\t //alert('starting function declarations adjustments');\r\n\t\t\t //alert('input: ' + input);\r\n\t\t\t output.innerHTML = \"\";\r\n\r\n\t\t\t // first we remove comments\r\n\t\t\t //inputWithoutComments = removeComments(input);\t\t\t \r\n\r\n\t\t\t var lineCommentExp = \"((\\\\r|\\\\n)*\\\\/\\\\*lineNumber[1234567890]*\\\\*\\\\/(\\\\r|\\\\n)*\\\\s*)*\";\r\n\t\t\t var howManyClasses = classesArray.length;\r\n\t\t\t var myRe;\r\n\t\t\t var foundLeftSideArraysPlace;\r\n\t\t\t var foundLeftSideArrays;\r\n\t\t\t var foundLeftSideArraysLength;\r\n\t\t\t var secondPart;\r\n\t\t\t\t\t\t\r\n\t\t\t for ( var i=0; i<howManyClasses; i++ ){\r\n\r\n\t\t\t\tvar allMatches=0;\r\n\t\t\t\t\twhile ( true )\t{\r\n\t\t\t\t\t\tallMatches++;\r\n\t\t\t\t \r\n\t\t\t\t\t // let's find right side declarations of arrays\r\n\t\t\t\t\t // that is, anything that has a class name and actually contains something\r\n\t\t\t\t\t // after the opening square bracket\r\n\t\t\t\t\t\tsecondPart = classesArray[i] + \"\\\\s+\"+lineCommentExp+\"[a-zA-Z][a-zA-Z0-9_]*\\\\s*\"+lineCommentExp+\"[\\\\;\\\\,\\\\=]\";\r\n\t\t\t\t\t\t//alert('building regex for functions returning ' + classesArray[i]);\r\n\t\t\t\t\t\tmyRe = new RegExp(\"[^a-zA-Z0-9_]\"+secondPart);\r\n\t\t\t\t\t\t//alert('searching for type ' + classesArray[i]);\r\n\t\t\t\t\t\tfoundLeftSideArraysPlace = input.search(myRe);\r\n\r\n\t\t\t\t\t\t// go to the next class if there are no more results for this one\r\n\t\t\t\t\t\tif (foundLeftSideArraysPlace == -1){\r\n\t\t\t\t\t\t //alert('found no types ' + classesArray[i]);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tfoundLeftSideArraysPlace++;\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//alert('found one function returning ' + classesArray[i]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfoundLeftSideArrays = input.match(myRe);\r\n\t\t\t\t\t\tfoundLeftSideArraysLength = foundLeftSideArrays[0].length;\r\n\t\t\t\t\t\tfoundLeftSideArraysLength--;\r\n var untouchedPart = input.substring(foundLeftSideArraysPlace + foundLeftSideArraysLength);\r\n\t\t\t\t\t\t//alert('the untouched part is: ' + input.substring(foundLeftSideArraysPlace + foundLeftSideArraysLength));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfoundLeftSideArrays = foundLeftSideArrays[0].substring(1);\r\n\t\t\t\t\t\t//alert('here it is: ' + foundLeftSideArrays);\r\n \t\t\t\t\t\t\r\n\t\t\t\t\t\tvar regexsoonafterPar;\r\n\t\t\t\t\t\t//var foundLeftSideArraysPlace;\r\n\r\n\t\t\t\t\t\t for ( var j=0; j<howManyClasses; j++ ){\r\n\t\t\t\t\t\t\t//alert('eliminating the type ' + classesArray[j] + 'inside the parenthesys');\r\n\t\t\t\t\t\t // the type name is preceded by either an open parenthesys, a comma\r\n\t\t\t\t\t\t\t// or a space\r\n\t\t\t\t\t\t\tregexsoonafterPar = new RegExp(classesArray[j]+\"\\\\s\",\"g\");\r\n\t\t\t\t\t\t\tvar foundLeftSideArraysPlace2 = foundLeftSideArrays.search(regexsoonafterPar,'');\r\n\t\t\t\t\t\t\tfoundLeftSideArrays = foundLeftSideArrays.replace(regexsoonafterPar,'');\r\n\t\t\t\t\t\t\tif (foundLeftSideArraysPlace2 !== -1){\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t \r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t\t//alert('the replaced version is '+foundLeftSideArrays);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//alert('found a match for right side array declaration of class ' + );\r\n\r\n\t\t\t\t\t\t// in the line with the function declaration, now all types within\r\n\t\t\t\t\t\t// the parenthesys should be gone\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// substitute the function declaration in the program. Also remove the return type and change it into \"var\"\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tinput= input.substring(0,foundLeftSideArraysPlace) + \"var \" + foundLeftSideArrays + untouchedPart;\r\n\t\t\t\t\t\t//alert('substitution: '+input);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\toutput.innerHTML += input.replace( /\\n/g, '<br />\\n' );\r\n\t\t\t\treturn input;\r\n\r\n\t\t}", "function manageOutput() {\n runButton = document.getElementsByClassName(\"spellcheck_run\")[0];\n runButton.addEventListener(\"click\", () => {\n not_found = 0;\n correctable = 0;\n uncorrectable = 0;\n if(copyButton.disabled) {\n copyButton.classList.add(\"enabled\");\n copyButton.disabled = false;\n }\n if(AreaOutput.disabled) {\n AreaInput.classList.add(\"enabled\");\n AreaOutput.classList.add(\"enabled\");\n AreaOutput.disabled = false;\n }\n if(AreaOutput.childElementCount >= 1) {\n AreaOutput.innerHTML = '';\n }\n input = inputbox.value.replace(/ +/g,' ').replace(/\\n /g, '\\n').trim();\n tokens = tokenize(input);\n edits = getEditDistances(tokens);\n not_found = Object.keys(edits).length;\n out = []\n for( var i = 0; i < tokens.length; i++ ) {\n str = ''\n while(!(tokens[i] in edits) && i < tokens.length) {\n str += tokens[i++]\n }\n out.push(str);\n if(tokens[i] in edits) {\n token = {}\n token[tokens[i]] = edits[tokens[i]];\n out.push(token);\n }\n }\n output = document.createElement('span');\n output.className = \"spellcheck_output_inner\";\n out.forEach( o => {\n if (typeof(o) == 'string') {\n elem = document.createElement('span');\n elem.innerHTML = o;\n } else {\n elem = document.createElement('select');\n corrections = [];\n key = Object.keys(o)[0];\n for(var i = 1; i <= edit_distance; i++) {\n if(i in o[key]) {\n corrections = corrections.concat(o[key][i].slice(0, correction_count - corrections.length));\n }\n }\n for(var i = 0; i < corrections.length; i++) {\n e = document.createElement('option');\n e.value = i.toString();\n if( i == 0 ) {\n e.innerHTML = key;\n } else {\n e.innerHTML = corrections[i];\n }\n elem.appendChild(e);\n }\n }\n output.appendChild(elem);\n });\n AreaOutput.prepend(output);\n resizeBoxes();\n outputResults();\n });\n copyButton.addEventListener(\"click\", () => {\n el = document.createElement(\"textarea\");\n el.value = generateOutput();\n document.body.appendChild(el);\n el.select();\n document.execCommand(\"copy\");\n document.body.removeChild(el);\n });\n}", "analyze(lexer){\n var pos = lexer.pos\n var e = null\n var t = null\n for(var i=0; i<this.type_list.length && t==null; i++) {\n var current = lexer.current()\n if(this.parser.isRule(this.type_list[i]) && this.parser.rule(this.type_list[i]).startsWith(current)) {\n t = this.parser.rule(this.type_list[i]).analyze(lexer)\n if(t.isError()) {\n if(e==null || e.end < t.end) e = t\n t=null\n lexer.locate(pos)\n }\n }\n if(this.check_lexeme(current, i)) {\n lexer.next()\n return current\n }\n }\n if(t!=null) return t\n return e\n }", "function analyze(placeToAnalyze)\n {\n appstate.loading = true;\n appstate.loaded = false;\n\n currentPlace = {};\n currentPlace = jQuery.extend({}, place);\n\n var place_website_encoded = encodeURI(currentPlace.website);\n\n var API_URL = API_PAGESPEED + '?url=' + place_website_encoded + '&screenshot=true&strategy=mobile&key=' + API_KEY;\n\n if (currentPlace.website) {\n\n // Run PageSpeed analysis\n $.getJSON(API_URL, function (data) {\n appstate.loaded = true;\n appstate.loading = false;\n\n currentPlace.page_title = data.title;\n currentPlace.score_screenshot = data.screenshot.data;\n\n currentPlace.stats.score_speed = data.ruleGroups.SPEED.score;\n currentPlace.stats.score_usability = data.ruleGroups.USABILITY.score;\n currentPlace.stats.total_request_bytes = data.pageStats.totalRequestBytes;\n currentPlace.stats.num_js_ressources = data.pageStats.numberJsResources;\n currentPlace.stats.num_css_ressources = data.pageStats.numberCssResources;\n\n currentPlace.score_screenshot = currentPlace.score_screenshot.replace(/_/g, '/');\n currentPlace.score_screenshot = currentPlace.score_screenshot.replace(/-/g, '+');\n currentPlace.score_screenshot = 'data:image/jpeg;base64,' + currentPlace.score_screenshot;\n\n Vue.set(analyzeModuleData, 'details', currentPlace);\n\n analyzeObsolescenceIndicators(data.formattedResults.ruleResults);\n }).fail(function () {\n // impossible to fetch data: may be a DNS related error\n swal(translations.swal.error, translations.swal.analysis_error, \"error\");\n\n appstate.loading = false;\n appstate.loaded = false;\n });\n\n if ( permissions.cms ) {\n $.ajax({\n url: '/service/leads/getcms',\n method: 'POST',\n data: { 'url': currentPlace.website },\n success: function (data) {\n var cmsInfos = JSON.parse(data);\n var cms = cmsInfos.cms;\n var cmsID = cmsInfos.id;\n\n if (!cms) {\n cms = null;\n cmsInfos = null;\n }\n\n currentPlace.cms = cms;\n currentPlace.cmsID = cmsID;\n }\n }).fail(function (jqXHR, textStatus, error) {\n Raven.captureMessage('Unable to retrieve lead CMS.', {level: 'error'});\n });;\n }\n\n } else {\n Vue.set(analyzeModuleData, 'details', currentPlace);\n\n appstate.loaded = true;\n appstate.loading = false;\n }\n\n }", "function runAudits() {\n inputsSelectsTextareas =\n elementData.input.concat(elementData.select).concat(elementData.textarea);\n // console.log('inputsSelectsTextareas', inputsSelectsTextareas);\n runElementAudits();\n runAttributeAudits();\n runAutocompleteAudits();\n runLabelAudits();\n const numErrors = items.filter(item => item.type === 'error').length;\n const numWarnings = items.filter(item => item.type === 'warning').length;\n for (const item of items) {\n displayItem(item);\n }\n if (numErrors > 0) {\n const summary = document.querySelector('details#error summary');\n summary.classList.remove('inactive');\n summary.textContent = `${numErrors} error`;\n if (numErrors > 1) {\n summary.textContent += 's';\n }\n }\n if (numWarnings > 0) {\n const summary = document.querySelector('details#warning summary');\n summary.classList.remove('inactive');\n summary.textContent = `${numWarnings} warning`;\n if (numWarnings > 1) {\n summary.textContent += 's';\n }\n }\n}", "enumerateOwnFiles(callback) {\n const files = this.getOwnFiles();\n for (const file of files) {\n //either XML components or files without a typedef\n if ((0, reflection_1.isXmlFile)(file) || !file.hasTypedef) {\n callback(file);\n }\n }\n }", "analyze(lexer) {\n var pos = lexer.pos\n var current = lexer.current()\n if(current==null) return this.eof(lexer)\n if(!this.startsWith(current)) return this.error(lexer,current.toError(),pos)\n var start = current.start\n var end = current.end\n var list = []\n for( var i=0; i<this.type_list.length; i++) {\n pos = lexer.pos\n var t = this.check(this.type_list[i], this.value_list[i], lexer)\n if( t.isError() ) return this.error(lexer,t,pos)\n if(this.value_list[i]==null) list.push(t)\n end = t.end\n }\n return this.token(lexer.input(),start,end,list)\n }", "function compile() {\n //Return error-log to logger\n if (document.getElementById('error-log') !== null) {\n document.getElementById('error-log').innerHTML = \"\";\n document.getElementById('error-log').id = 'machine-code';\n }\n //Start lexical analysis\n lex();\n}", "function analyze(data, scope, ops) {\n // POSSIBLE TODOs:\n // - error checking for treesource on tree operators (BUT what if tree is upstream?)\n // - this is local analysis, perhaps some tasks better for global analysis...\n\n var output = [],\n source = null,\n modify = false,\n generate = false,\n upstream, i, n, t, m;\n\n if (data.values) {\n // hard-wired input data set\n output.push(source = collect({$ingest: data.values, $format: data.format}));\n } else if (data.url) {\n // load data from external source\n output.push(source = collect({$request: data.url, $format: data.format}));\n } else if (data.source) {\n // derives from one or more other data sets\n source = upstream = Object(__WEBPACK_IMPORTED_MODULE_4_vega_util__[\"g\" /* array */])(data.source).map(function(d) {\n return Object(__WEBPACK_IMPORTED_MODULE_2__util__[\"k\" /* ref */])(scope.getData(d).output);\n });\n output.push(null); // populate later\n }\n\n // scan data transforms, add collectors as needed\n for (i=0, n=ops.length; i<n; ++i) {\n t = ops[i];\n m = t.metadata;\n\n if (!source && !m.source) {\n output.push(source = collect());\n }\n output.push(t);\n\n if (m.generates) generate = true;\n if (m.modifies && !generate) modify = true;\n\n if (m.source) source = t;\n else if (m.changes) source = null;\n }\n\n if (upstream) {\n n = upstream.length - 1;\n output[0] = Object(__WEBPACK_IMPORTED_MODULE_3__transforms__[\"t\" /* Relay */])({\n derive: modify,\n pulse: n ? upstream : upstream[0]\n });\n if (modify || n) {\n // collect derived and multi-pulse tuples\n output.splice(1, 0, collect());\n }\n }\n\n if (!source) output.push(collect());\n output.push(Object(__WEBPACK_IMPORTED_MODULE_3__transforms__[\"w\" /* Sieve */])({}));\n return output;\n}", "*map_analyser_thread()\n\t{\t\n\t\tconsole.log(\"Started room \" + this.name + \" analysis\")\n\t\tvar [terrain, initialSpots] = readTerrain(this.name)\n\t\tthis.terrain = terrain\n\t\tthis.costmap = terrainToCostmap(terrain, 50, 50)\n\t\t\n\t\tyield* OS.break();\n\t\tvar calculator = new RoomSpotsCalculator(this.costmap, initialSpots, 50, 50);\n \tvar process = calculator.process(this)\n \t\n \tvar result = {}\n \tdo\n \t{\n \t\tresult = process.next();\n \t\tyield* OS.break();\n \t}while(result && !result.done)\n\t\t\n\t\t//this.save_memory()\n\t}", "function check_and_report() {\n \n }" ]
[ "0.5682125", "0.55620515", "0.5528616", "0.54487497", "0.5186837", "0.51358396", "0.50535023", "0.50306", "0.49961954", "0.49456286", "0.4872391", "0.48717216", "0.48588556", "0.48485678", "0.48256865", "0.48208138", "0.47816533", "0.4761912", "0.46887577", "0.46489328", "0.4623182", "0.46193558", "0.46093798", "0.46055996", "0.46006897", "0.45900068", "0.4583237", "0.45783898", "0.45715025", "0.45589852", "0.4538315", "0.4534906", "0.44806296", "0.4477223", "0.4476298", "0.44648793", "0.44542557", "0.44370824", "0.44165915", "0.44092613", "0.4395651", "0.43914035", "0.43799245", "0.43729103", "0.43691087", "0.4364212", "0.43640363", "0.43630943", "0.43561533", "0.4355602", "0.435318", "0.43508735", "0.4339655", "0.43358734", "0.4328434", "0.43253234", "0.43183702", "0.43083456", "0.43082738", "0.43029362", "0.4299346", "0.42916325", "0.42901754", "0.42899004", "0.42887914", "0.4281951", "0.42761928", "0.42732134", "0.42705747", "0.42682484", "0.42618462", "0.425834", "0.42581296", "0.42571992", "0.42539054", "0.4252852", "0.42507368", "0.4249874", "0.42487037", "0.42417735", "0.42409185", "0.42393973", "0.42306295", "0.423002", "0.4227247", "0.4226345", "0.42256415", "0.42249474", "0.42243415", "0.42168206", "0.4210724", "0.42094716", "0.42061043", "0.4203671", "0.42029426", "0.41951665", "0.41825837", "0.41813958", "0.41797876", "0.41796294" ]
0.59221
0
Generates the typings file and writes it to disk.
writeTypingsFile(dtsFilename, dtsKind) { const indentedWriter = new IndentedWriter_1.IndentedWriter(); this._generateTypingsFileContent(indentedWriter, dtsKind); node_core_library_1.FileSystem.writeFile(dtsFilename, indentedWriter.toString(), { convertLineEndings: "\r\n" /* CrLf */, ensureFolderExists: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function typings() {\n const tmpDir = './typings/tmp';\n const blocklySrcs = [\n \"core/\",\n \"core/components\",\n \"core/components/tree\",\n \"core/components/menu\",\n \"core/keyboard_nav\",\n \"core/renderers/common\",\n \"core/renderers/measurables\",\n \"core/theme\",\n \"core/utils\",\n \"msg/\"\n ];\n // Clean directory if exists.\n if (fs.existsSync(tmpDir)) {\n rimraf.sync(tmpDir);\n }\n fs.mkdirSync(tmpDir);\n\n // Find all files that will be included in the typings file.\n let files = [];\n blocklySrcs.forEach((src) => {\n files = files.concat(fs.readdirSync(src)\n .filter(fn => fn.endsWith('.js'))\n .map(fn => path.join(src, fn)));\n });\n\n // Generate typings file for each file.\n files.forEach((file) => {\n const typescriptFileName = `${path.join(tmpDir, file)}.d.ts`;\n if (file.indexOf('core/msg.js') > -1) {\n return;\n }\n const cmd = `node ./node_modules/typescript-closure-tools/definition-generator/src/main.js ${file} ${typescriptFileName}`;\n console.log(`Generating typings for ${file}`);\n execSync(cmd, { stdio: 'inherit' });\n });\n\n const srcs = [\n 'typings/parts/blockly-header.d.ts',\n 'typings/parts/blockly-interfaces.d.ts',\n `${tmpDir}/core/**`,\n `${tmpDir}/core/components/**`,\n `${tmpDir}/core/components/tree/**`,\n `${tmpDir}/core/components/menu/**`,\n `${tmpDir}/core/keyboard_nav/**`,\n `${tmpDir}/core/renderers/common/**`,\n `${tmpDir}/core/renderers/measurables/**`,\n `${tmpDir}/core/utils/**`,\n `${tmpDir}/core/theme/**`,\n `${tmpDir}/msg/**`\n ];\n return gulp.src(srcs)\n .pipe(gulp.concat('blockly.d.ts'))\n .pipe(gulp.dest('typings'))\n .on('end', function () {\n // Clean up tmp directory.\n if (fs.existsSync(tmpDir)) {\n rimraf.sync(tmpDir);\n }\n });\n}", "processTypings(files) {\n // Set hashes of the app's typings.\n files.forEach(file => {\n let isAppTypings = this.isDeclarationFile(file) &&\n !this.isPackageFile(file);\n\n let path = file.getPathInPackage();\n if (isAppTypings && !this._typingsMap.has(path)) {\n this._typingsMap.set(path, file.getSourceHash());\n }\n });\n\n let copiedFiles = [];\n // Process package typings.\n files.forEach(file => {\n // Check if it's a package declaration file.\n let isPkgTypings = this.isDeclarationFile(file) &&\n this.isPackageFile(file);\n\n if (isPkgTypings) {\n let path = file.getPathInPackage();\n // Check if the file is in the \"typings\" folder.\n if (!this._typingsRegEx.test(path)) {\n console.log('Typings path ${path} doesn\\'t start with \"typings\"');\n return;\n }\n\n let filePath = this._getStandardTypingsFilePath(file);\n let oldHash = this._typingsMap.get(filePath);\n let newHash = file.getSourceHash();\n // Copy file if it doesn't exist or has been updated.\n if (oldHash !== newHash) {\n this._copyTypings(filePath, file.getContentsAsString());\n this._typingsMap.set(filePath, newHash);\n copiedFiles.push(filePath);\n }\n }\n });\n\n if (copiedFiles.length) {\n // Report about added/updated typings.\n console.log(chalk.green('***** Typings that have been added/updated *****'));\n copiedFiles.forEach(filePath => {\n console.log(chalk.green(filePath));\n });\n console.log(chalk.green(\n 'Add typings in tsconfig.json or by references in files.'));\n }\n }", "function generateTypes(options = {}) {\n const { files, generateDocuments, generateSchemaTypes, schemaPath } = options;\n return new Promise((resolve, reject) => {\n gqlGenTool({\n file: schemaPath,\n template: 'typescript',\n // out: outPath,\n args: files,\n documents: generateDocuments,\n schema: generateSchemaTypes,\n }).then(\n value => {\n // console.log('end gen', value);\n const resultStr = value[0].content;\n\n // check for clashing namespace names\n const exportedNamespaces = (resultStr.match(/export namespace (\\S+) \\{/g) || []).map(\n m => m.match(/export namespace (\\S+) {/)[1],\n );\n\n if (exportedNamespaces.length !== _.uniq(exportedNamespaces).length) {\n const namesMap = exportedNamespaces.reduce((acc, v) => {\n acc[v] = acc[v] === undefined ? 1 : acc[v] + 1;\n return acc;\n }, {});\n const clashingNames = Object.keys(namesMap).filter(n => namesMap[n] > 1);\n return reject(new Error(`Query/Mutation names clash for ${clashingNames.join(', ')}`));\n }\n\n // prettify the result\n const prettifiedResultStr = prettier.format(\n resultStr,\n Object.assign(\n {\n parser: 'typescript',\n },\n prettierConfig,\n ),\n );\n\n resolve(prettifiedResultStr);\n },\n error => {\n console.log('yp-schema: types generation error', error);\n reject(error);\n },\n );\n });\n}", "function generateTypes(assetsFolder, silent = false) {\n if (!silent) {\n log(`generating new asset .d.ts files in \"${assetsFolder}\" . . .`);\n }\n const pattern = `${assetsFolder}/**/*.@(${extensionPattern})`;\n const fileNames = glob.sync(pattern, {}).map((f) => f + \".d.ts\");\n fileNames.forEach((fileName) => {\n fs.writeFileSync(fileName, getContent(fileName));\n if (!silent) {\n log(\" - created \" + fileName);\n }\n });\n if (fileNames.length === 0 && !silent) {\n log(\"No files to generate\");\n }\n\n generateManifest(assetsFolder, silent);\n\n return fileNames;\n}", "function writeDefs() {\n return sclang.interpret(`\n var descs = Dictionary.new;\n SynthDescLib.default.synthDescs\n .keysValuesDo({ arg defName, synthDesc;\n synthDesc.def.writeDefFile(\"` +\n dest +\n `\");\n descs[defName] = synthDesc.asJSON();\n });\n descs\n `);\n }", "generate() {\n // Make sure the temporary directory is empty before starting\n gen_utils_1.deleteDirRecursive(this.tempDir);\n fs_extra_1.default.mkdirsSync(this.tempDir);\n try {\n // Generate each model\n const models = [...this.models.values()];\n for (const model of models) {\n this.write('model', model, model.fileName, 'models');\n }\n // Generate each service\n const services = [...this.services.values()];\n for (const service of services) {\n this.write('service', service, service.fileName, 'services');\n }\n // Context object passed to general templates\n const general = {\n services: services,\n models: models\n };\n // Generate the general files\n this.write('configuration', general, this.globals.configurationFile);\n this.write('response', general, this.globals.responseFile);\n this.write('requestBuilder', general, this.globals.requestBuilderFile);\n this.write('baseService', general, this.globals.baseServiceFile);\n if (this.globals.moduleClass && this.globals.moduleFile) {\n this.write('module', general, this.globals.moduleFile);\n }\n const modelImports = this.globals.modelIndexFile || this.options.indexFile\n ? models.map(m => new imports_1.Import(m.name, './models', m.options)) : null;\n if (this.globals.modelIndexFile) {\n this.write('modelIndex', Object.assign(Object.assign({}, general), { modelImports }), this.globals.modelIndexFile);\n }\n if (this.globals.serviceIndexFile) {\n this.write('serviceIndex', general, this.globals.serviceIndexFile);\n }\n if (this.options.indexFile) {\n this.write('index', Object.assign(Object.assign({}, general), { modelImports }), 'index');\n }\n // Now synchronize the temp to the output folder\n gen_utils_1.syncDirs(this.tempDir, this.outDir, this.options.removeStaleFiles !== false);\n console.info(`Generation from ${this.options.input} finished with ${models.length} models and ${services.length} services.`);\n }\n finally {\n // Always remove the temporary directory\n gen_utils_1.deleteDirRecursive(this.tempDir);\n }\n }", "function generateDefs() {\n console.log(' + generating definitions')\n\n const dPath = path.resolve(process.env.DEFINITIONS)\n\n const definitions = require(path.resolve(`${process.env.LIB_DIR}definitions`))\n const spec = require(path.resolve(`${process.env.LIB_DIR}spec`)).load()\n\n fs.mkdirSync(dPath, { recursive: true })\n\n // Generate all Definitions\n for (const definition in spec.definitions) {\n definitions.generateFullDefinition(definition)\n }\n\n console.log(' - definitions generated')\n}", "function _scriptGen({ params: { c: optionsFile, write } }) {\n // console.log(\"gen sources for \", optionsFile);\n const options = _loadOptionsFile(optionsFile);\n const config = new Config(options);\n\n // console.log(config);\n const { value: valuePackages, type: typeOptions } = scanSourceDir(\n path.join(config.projectPath, config.rootPath)\n );\n // console.log(\"a\", optionsSource);\n\n const generatedOptions = {\n ...options,\n packages: {\n ...options.packages,\n ...valuePackages,\n },\n types: typeOptions,\n };\n\n delete generatedOptions.projectPath;\n\n const genFile = optionsFile.replace(\".json\", \".gen.json\");\n fs.writeFileSync(genFile, JSON.stringify(generatedOptions, null, 2));\n}", "function generateDocumentation(fileNames, options, docOptions) {\n if (docOptions === void 0) { docOptions = {}; }\n var dtsVueGeneratedFiles = [];\n generateVueTSFiles(fileNames);\n var tsOptions = getTsOptions(options);\n if (!checkFiles(fileNames, \"File for compiling is not found\"))\n return;\n var host = ts.createCompilerHost(tsOptions);\n // Build a program using the set of root file names in fileNames\n var program = ts.createProgram(fileNames, tsOptions, host);\n // Get the checker, we will use it to find more about classes\n var checker = program.getTypeChecker();\n var outputClasses = [];\n var outputPMEs = [];\n var pmesHash = {};\n var classesHash = {};\n var curClass = null;\n var curJsonName = null;\n var generateJSONDefinitionClasses = {};\n var dtsOutput = !!docOptions ? docOptions.dtsOutput : undefined;\n var generateDts = !!dtsOutput;\n var generateJSONDefinition = docOptions.generateJSONDefinition === true;\n var generateDocs = !generateDts || docOptions.generateDoc !== false;\n var outputDefinition = {};\n var dtsExportedClasses = {};\n var dtsExportClassesFromLibraries = [];\n var dtsImports = {};\n var dtsExcludeImports = docOptions.dtsExcludeImports === true;\n var dtsExportNames = [];\n if (!!docOptions.paths) {\n for (key in docOptions.paths)\n dtsExportNames.push(key);\n }\n var dtsImportDeclarations = {};\n var dtsFrameworksImportDeclarations = {};\n var dtsDeclarations = {};\n var dtsTypesParameters = {};\n var dtsTypesArgumentParameters = {};\n var dtsProductName = docOptions.name;\n var dtsLicense = docOptions.license;\n var dtsVersion = \"\";\n // Visit every sourceFile in the program\n for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {\n var sourceFile = _a[_i];\n if (sourceFile.fileName.indexOf(\"node_modules\") > 0)\n continue;\n if (isNonEnglishLocalizationFile(sourceFile.fileName))\n continue;\n // Walk the tree to search for classes\n ts.forEachChild(sourceFile, visit);\n }\n for (var i = 0; i < fileNames.length; i++) {\n var sourceFile = program.getSourceFile(fileNames[i]);\n if (!!sourceFile) {\n ts.forEachChild(sourceFile, visit);\n }\n }\n for (var key in classesHash) {\n setAllParentTypes(key);\n }\n if (generateDocs) {\n updateEventsDocumentation();\n // print out the doc\n fs.writeFileSync(process.cwd() + \"/docs/classes.json\", JSON.stringify(outputClasses, undefined, 4));\n fs.writeFileSync(process.cwd() + \"/docs/pmes.json\", JSON.stringify(outputPMEs, undefined, 4));\n }\n if (generateJSONDefinition) {\n outputDefinition[\"$schema\"] = \"http://json-schema.org/draft-07/schema#\";\n outputDefinition[\"title\"] = \"SurveyJS Library json schema\";\n addClassIntoJSONDefinition(\"SurveyModel\", true);\n fs.writeFileSync(process.cwd() + \"/docs/surveyjs_definition.json\", JSON.stringify(outputDefinition, undefined, 4));\n }\n if (generateDts) {\n prepareDtsInfo();\n dtsImportFiles(docOptions.paths);\n var text = \"\";\n if (!!dtsProductName) {\n dtsVersion = dtsGetVersion();\n text += dtsGetBanner();\n }\n text += dtsGetText();\n fs.writeFileSync(getAbsoluteFileName(dtsOutput), text);\n }\n deleteVueTSFiles();\n return;\n function generateVueTSFiles(fileNames) {\n for (var i = 0; i < fileNames.length; i++) {\n var fn = fileNames[i];\n var text = fs.readFileSync(getAbsoluteFileName(fn), 'utf8');\n var dir = path.dirname(fn);\n generateVueTSFile(text, dir);\n var matchArray = text.match(/(?<=export \\* from \")(.*)(?=\";)/gm);\n if (!Array.isArray(matchArray))\n continue;\n for (var i = 0; i < matchArray.length; i++) {\n var fnChild = path.join(dir, matchArray[i] + \".ts\");\n var absFnChild = getAbsoluteFileName(fnChild);\n if (!fs.existsSync(absFnChild))\n return;\n text = fs.readFileSync(absFnChild, 'utf8');\n generateVueTSFile(text, dir);\n }\n }\n }\n function generateVueTSFile(text, dir) {\n var matchArray = text.match(/(?<=\")(.*)(?=.vue\";)/gm);\n if (!Array.isArray(matchArray))\n return;\n for (var i = 0; i < matchArray.length; i++) {\n var fileName = path.join(dir, matchArray[i] + \".vue\");\n if (!fs.existsSync(fileName))\n continue;\n var absFileName = getAbsoluteFileName(fileName);\n var vueText = fs.readFileSync(absFileName, 'utf8');\n var startStr = \"<script lang=\\\"ts\\\">\";\n var endStr = \"</script>\";\n var startIndex = vueText.indexOf(startStr) + startStr.length;\n var endIndex = vueText.lastIndexOf(endStr);\n if (endIndex > startIndex && startIndex > 0) {\n var vue_tsText = vueText.substring(startIndex, endIndex);\n absFileName += \".ts\";\n dtsVueGeneratedFiles.push(absFileName);\n fs.writeFileSync(absFileName, vue_tsText);\n }\n }\n }\n function deleteVueTSFiles() {\n for (var i = 0; i < dtsVueGeneratedFiles.length; i++) {\n fs.unlinkSync(dtsVueGeneratedFiles[i]);\n }\n }\n function isNonEnglishLocalizationFile(fileName) {\n var dir = path.dirname(fileName);\n var name = path.basename(fileName);\n if (name === \"english\")\n return false;\n var loc = \"localization\";\n return dir.lastIndexOf(loc) > dir.length - loc.length - 3;\n }\n function dtsGetVersion() {\n var fileName = getAbsoluteFileName(\"package.json\");\n if (!fs.existsSync(fileName))\n return \"\";\n var text = fs.readFileSync(fileName, 'utf8');\n if (!text)\n return \"\";\n var matches = text.match(/(?<=\"version\":)(.*)(?=,)/gm);\n if (!Array.isArray(matches) || matches.length === 0)\n return \"\";\n var res = matches[0];\n if (!res)\n return \"\";\n return res.trim().replace(\"\\\"\", \"\").replace(\"\\\"\", \"\");\n }\n function dtsGetBanner() {\n var lines = [];\n lines.push(\"/*\");\n var paddging = \"* \";\n lines.push(paddging + dtsProductName + (dtsVersion ? \" v\" + dtsVersion : \"\"));\n lines.push(paddging + \"Copyright (c) 2015-\" + new Date().getFullYear() + \" Devsoft Baltic OÜ - https://surveyjs.io/\");\n if (dtsLicense) {\n lines.push(paddging + \"License: \" + dtsLicense);\n }\n lines.push(\"*/\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n }\n /** set allParentTypes */\n function setAllParentTypes(className) {\n if (!className)\n return;\n var cur = classesHash[className];\n if (cur.allTypes && cur.allTypes.length > 0)\n return;\n setAllParentTypesCore(cur);\n }\n function setAllParentTypesCore(cur) {\n cur.allTypes = [];\n cur.allTypes.push(cur.name);\n if (cur.entryType === DocEntryType.interfaceType && Array.isArray(cur.implements)) {\n cur.implements.forEach(function (item) { return addBaseAllTypesIntoCur(cur, item); });\n }\n if (!cur.baseType)\n return;\n addBaseAllTypesIntoCur(cur, cur.baseType);\n }\n function addBaseAllTypesIntoCur(cur, className) {\n if (!className)\n return;\n var baseClass = classesHash[className];\n if (!baseClass)\n return;\n if (!baseClass.allTypes) {\n setAllParentTypesCore(baseClass);\n }\n for (var i = 0; i < baseClass.allTypes.length; i++) {\n cur.allTypes.push(baseClass.allTypes[i]);\n }\n }\n /** visit nodes finding exported classes */\n function visit(node) {\n // Only consider exported nodes\n if (!isNodeExported(node))\n return;\n if (node.kind === ts.SyntaxKind.EnumDeclaration) {\n var enNode = node;\n var symbol = checker.getSymbolAtLocation(enNode.name);\n if (!!symbol && generateDts) {\n visitEnumNode(enNode, symbol);\n }\n }\n else if (node.kind === ts.SyntaxKind.FunctionDeclaration) {\n var fnNode = node;\n var symbol = checker.getSymbolAtLocation(fnNode.name);\n if (!!symbol && generateDts) {\n visitFunctionNode(fnNode, symbol);\n }\n }\n else if (node.kind === ts.SyntaxKind.VariableStatement) {\n var vsNode = node;\n if (vsNode.declarationList.declarations.length > 0) {\n var varNode = vsNode.declarationList.declarations[0];\n var symbol = checker.getSymbolAtLocation(varNode.name);\n if (!!symbol && (generateDts || isSymbolHasComments(symbol))) {\n visitVariableNode(varNode, symbol);\n }\n }\n }\n else if (node.kind === ts.SyntaxKind.ClassDeclaration) {\n // This is a top level class, get its symbol\n var symbol = checker.getSymbolAtLocation(node.name);\n if (!symbol)\n return;\n if (generateDts || isSymbolHasComments(symbol)) {\n visitDocumentedNode(node, symbol);\n }\n }\n else if (node.kind === ts.SyntaxKind.InterfaceDeclaration) {\n // This is a top level class, get its symbol\n var name_1 = node.name;\n var symbol = checker.getSymbolAtLocation(name_1);\n if (generateDts || isSymbolHasComments(symbol) || isOptionsInterface(name_1.text)) {\n visitDocumentedNode(node, symbol);\n }\n }\n else if (node.kind === ts.SyntaxKind.ModuleDeclaration) {\n // This is a namespace, visit its children\n ts.forEachChild(node, visit);\n }\n else if (node.kind === ts.SyntaxKind.ExportDeclaration) {\n visitExportDeclarationNode(node);\n }\n }\n function visitExportDeclarationNode(node) {\n if (!node.exportClause)\n return;\n if (isExportFromDtsFile(node))\n return;\n var els = node.exportClause.elements;\n if (!Array.isArray(els))\n return;\n var exportLibrary = getExportLibraryName(node);\n for (var i = 0; i < els.length; i++) {\n var el = els[i];\n if (!el.name || !el.propertyName && !exportLibrary)\n continue;\n var name_2 = el.name.text;\n if (!name_2)\n continue;\n if (!exportLibrary && dtsImportDeclarations[name_2])\n continue;\n var entry = { name: name_2 };\n if (!!el.propertyName) {\n entry.className = el.propertyName.text;\n }\n if (!!exportLibrary) {\n entry.fileName = exportLibrary;\n }\n dtsExportClassesFromLibraries.push(entry);\n }\n }\n function isExportFromDtsFile(node) {\n if (!node.parent)\n return false;\n var file = node.parent.getSourceFile();\n if (!file)\n return false;\n return file.fileName.indexOf(\".d.ts\") > -1;\n }\n function getExportLibraryName(node) {\n var name = !!node.moduleSpecifier ? node.moduleSpecifier.text : undefined;\n if (!name)\n return undefined;\n return dtsExportNames.indexOf(name) > -1 ? name : undefined;\n }\n function visitVariableNode(node, symbol) {\n var entry = serializeSymbol(symbol);\n entry.entryType = DocEntryType.variableType;\n dtsDeclarations[entry.name] = entry;\n visitVariableProperties(entry, node);\n if (generateDocs) {\n entry.allTypes = [entry.name];\n entry.isPublic = true;\n outputClasses.push(entry);\n entry.members = [];\n }\n }\n function visitEnumNode(node, symbol) {\n var modifier = ts.getCombinedModifierFlags(node);\n if ((modifier & ts.ModifierFlags.Export) === 0)\n return;\n var entry = {\n name: symbol.name,\n entryType: DocEntryType.enumType,\n members: []\n };\n dtsDeclarations[entry.name] = entry;\n for (var i = 0; i < node.members.length; i++) {\n var member = node.members[i];\n var sym = checker.getSymbolAtLocation(member.name);\n if (!!sym && !!sym.name) {\n var id = !!member.initializer ? member.initializer.text : undefined;\n entry.members.push({ name: sym.name, returnType: id });\n }\n }\n }\n function visitFunctionNode(node, symbol) {\n var modifier = ts.getCombinedModifierFlags(node);\n if ((modifier & ts.ModifierFlags.Export) === 0)\n return;\n var entry = serializeMethod(symbol, node);\n if (!entry)\n return;\n entry.entryType = DocEntryType.functionType;\n dtsDeclarations[entry.name] = entry;\n }\n function visitVariableProperties(entry, node) {\n if (!node.initializer)\n return;\n var children = node.initializer.properties;\n if (!Array.isArray(children))\n return;\n for (var i = 0; i < children.length; i++) {\n visitVariableMember(entry, children[i]);\n }\n }\n function visitVariableMember(entry, node) {\n var symbol = checker.getSymbolAtLocation(node.name);\n var memberEntry = serializeClass(symbol, node);\n if (memberEntry) {\n if (!entry.members)\n entry.members = [];\n entry.members.push(memberEntry);\n entry.members.push(memberEntry);\n if (generateDocs) {\n if (entry.entryType === DocEntryType.variableType) {\n outputPMEs.push(memberEntry);\n memberEntry.className = entry.name;\n memberEntry.pmeType = \"property\";\n memberEntry.isPublic = true;\n memberEntry.isField = true,\n memberEntry.hasSet = true;\n }\n }\n visitVariableProperties(memberEntry, node);\n }\n }\n function visitDocumentedNode(node, symbol) {\n curClass = serializeClass(symbol, node);\n classesHash[curClass.name] = curClass;\n var isOptions = curClass.name.indexOf(\"IOn\") === 0;\n if (!isOptions) {\n outputClasses.push(curClass);\n }\n curJsonName = null;\n ts.forEachChild(node, visitClassNode);\n if (isOptions)\n return;\n if (!curJsonName)\n return;\n curClass.jsonName = curJsonName;\n if (!jsonObjMetaData || !generateDocs)\n return;\n var properties = jsonObjMetaData.getProperties(curJsonName);\n for (var i = 0; i < outputPMEs.length; i++) {\n if (outputPMEs[i].className == curClass.name) {\n var propName = outputPMEs[i].name;\n for (var j = 0; j < properties.length; j++) {\n if (properties[j].name == propName) {\n outputPMEs[i].isSerialized = true;\n if (properties[j].defaultValue)\n outputPMEs[i].defaultValue = properties[j].defaultValue;\n if (properties[j].choices)\n outputPMEs[i].serializedChoices = properties[j].choices;\n if (properties[j].className)\n outputPMEs[i].jsonClassName = properties[j].className;\n break;\n }\n }\n }\n }\n }\n function visitClassNode(node) {\n var symbol = null;\n if (node.kind === ts.SyntaxKind.MethodDeclaration)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.FunctionDeclaration)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.PropertyDeclaration)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.GetAccessor)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.SetAccessor)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.PropertySignature)\n symbol = checker.getSymbolAtLocation(node.name);\n if (node.kind === ts.SyntaxKind.MethodSignature)\n symbol = checker.getSymbolAtLocation(node.name);\n if (!symbol)\n return;\n if (!isPMENodeExported(node, symbol))\n return;\n var ser = serializeMember(symbol, node);\n var fullName = ser.name;\n if (curClass) {\n ser.className = curClass.name;\n ser.jsonName = curClass.jsonName;\n fullName = curClass.name + \".\" + fullName;\n if (!curClass.members)\n curClass.members = [];\n curClass.members.push(ser);\n }\n ser.pmeType = getPMEType(node.kind);\n var modifier = ts.getCombinedModifierFlags(node);\n if ((modifier & ts.ModifierFlags.Static) !== 0) {\n ser.isStatic = true;\n }\n if ((modifier & ts.ModifierFlags.Protected) !== 0) {\n ser.isProtected = true;\n }\n if (node.kind === ts.SyntaxKind.PropertyDeclaration\n && !ser.isLocalizable\n && ser.isField === undefined) {\n ser.isField = true;\n }\n if (node.kind === ts.SyntaxKind.PropertySignature) {\n ser.isField = true;\n ser.isOptional = checker.isOptionalParameter(node);\n }\n if (isSurveyEventType(ser.type)) {\n ser.pmeType = \"event\";\n updateEventOptionInterfaceName(node, ser);\n if (!ser.documentation && (ser.eventSenderName === \"__type\" || !ser.eventOptionsName)) {\n ser = null;\n }\n }\n if (node.kind === ts.SyntaxKind.GetAccessor) {\n ser.isField = false;\n var serSet = pmesHash[fullName];\n if (serSet) {\n ser.hasSet = serSet.hasSet;\n }\n else\n ser.hasSet = false;\n }\n if (node.kind === ts.SyntaxKind.SetAccessor) {\n var serGet = pmesHash[fullName];\n if (serGet) {\n serGet.hasSet = true;\n ser.isField = false;\n }\n ser = null;\n }\n if (ser) {\n if (!ser.parameters)\n ser.parameters = [];\n pmesHash[fullName] = ser;\n outputPMEs.push(ser);\n }\n if (ser && ser.name === \"getType\") {\n curJsonName = getJsonTypeName(node);\n }\n }\n function getJsonTypeName(node) {\n var body = node.getFullText();\n if (body) {\n var pos = body.indexOf('return \"');\n if (pos > 0) {\n body = body.substr(pos + 'return \"'.length);\n pos = body.indexOf('\"');\n return body.substr(0, pos);\n }\n }\n return null;\n }\n function isSurveyEventType(type) {\n return !!type && (type.indexOf(\"Event\") === 0 || type.indexOf(\"CreatorEvent\") === 0);\n }\n function getPMEType(nodeKind) {\n if (nodeKind === ts.SyntaxKind.MethodDeclaration || nodeKind === ts.SyntaxKind.MethodSignature)\n return \"method\";\n if (nodeKind === ts.SyntaxKind.FunctionDeclaration)\n return \"function\";\n return \"property\";\n }\n function getTypeOfSymbol(symbol) {\n if (symbol.valueDeclaration)\n return checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);\n return checker.getDeclaredTypeOfSymbol(symbol);\n }\n function updateEventOptionInterfaceName(node, ser) {\n var typeObj = checker.getTypeAtLocation(node);\n if (!typeObj)\n return;\n var args = typeObj.typeArguments;\n if (!Array.isArray(args) || args.length < 2)\n return;\n ser.eventSenderName = getSymbolName(args[args.length - 2].symbol);\n ser.eventOptionsName = getSymbolName(args[args.length - 1].symbol);\n }\n function getSymbolName(symbol) {\n return !!symbol && !!symbol.name ? symbol.name : \"\";\n }\n /** Serialize a symbol into a json object */\n function serializeSymbol(symbol) {\n var type = getTypeOfSymbol(symbol);\n var docParts = symbol.getDocumentationComment(undefined);\n var modifiedFlag = !!symbol.valueDeclaration ? ts.getCombinedModifierFlags(symbol.valueDeclaration) : 0;\n var isPublic = (modifiedFlag & ts.ModifierFlags.Public) !== 0;\n var res = {\n name: symbol.getName(),\n documentation: !!docParts ? ts.displayPartsToString(docParts) : \"\",\n type: checker.typeToString(type),\n isPublic: isPublic\n };\n var jsTags = symbol.getJsDocTags();\n if (jsTags) {\n var seeArray = [];\n for (var i = 0; i < jsTags.length; i++) {\n if (jsTags[i].name == \"title\") {\n res[\"metaTitle\"] = jsTags[i].text;\n }\n if (jsTags[i].name == \"description\") {\n res[\"metaDescription\"] = jsTags[i].text;\n }\n if (jsTags[i].name == \"see\") {\n seeArray.push(jsTags[i].text);\n }\n if (jsTags[i].name == \"returns\") {\n res[\"returnDocumentation\"] = jsTags[i].text;\n }\n }\n if (seeArray.length > 0) {\n res[\"see\"] = seeArray;\n }\n }\n return res;\n }\n /** Serialize a class symbol information */\n function serializeClass(symbol, node) {\n var details = serializeSymbol(symbol);\n details.implements = getImplementedTypes(node, details.name);\n setTypeParameters(details.name, node);\n if (node.kind === ts.SyntaxKind.InterfaceDeclaration) {\n details.entryType = DocEntryType.interfaceType;\n }\n if (node.kind !== ts.SyntaxKind.ClassDeclaration)\n return details;\n // Get the construct signatures\n var constructorType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);\n details.entryType = DocEntryType.classType;\n details.constructors = getConstructors(constructorType);\n createPropertiesFromConstructors(details);\n var firstHeritageClauseType = getFirstHeritageClauseType(node);\n details.baseType = getBaseType(firstHeritageClauseType);\n setTypeParameters(details.baseType, firstHeritageClauseType, details.name);\n return details;\n }\n function getConstructors(constructorType) {\n var res = [];\n var signitures = constructorType.getConstructSignatures();\n for (var i = 0; i < signitures.length; i++) {\n if (!signitures[i].declaration)\n continue;\n res.push(serializeSignature(signitures[i]));\n }\n return res;\n }\n function createPropertiesFromConstructors(entry) {\n if (!Array.isArray(entry.constructors))\n return;\n for (var i = 0; i < entry.constructors.length; i++) {\n createPropertiesFromConstructor(entry, entry.constructors[i]);\n }\n }\n function createPropertiesFromConstructor(classEntry, entry) {\n if (!Array.isArray(entry.parameters))\n return;\n for (var i = 0; i < entry.parameters.length; i++) {\n var param = entry.parameters[i];\n if (!param.isPublic)\n continue;\n if (!classEntry.members)\n classEntry.members = [];\n classEntry.members.push({ name: param.name, pmeType: \"property\", isField: true, isPublic: true, type: param.type });\n }\n }\n function getHeritageClause(node, index) {\n if (!node || !node.heritageClauses || node.heritageClauses.length <= index)\n return undefined;\n return node.heritageClauses[index];\n }\n function getFirstHeritageClauseType(node) {\n var clause = getHeritageClause(node, 0);\n return !!clause ? clause.types[0] : undefined;\n }\n function getImplementedTypes(node, className) {\n if (!node || !node.heritageClauses)\n return undefined;\n var clauses = node.heritageClauses;\n if (!Array.isArray(clauses) || clauses.length == 0)\n return undefined;\n var res = [];\n for (var i = 0; i < clauses.length; i++) {\n getImplementedTypesForClause(res, clauses[i], className);\n }\n return res;\n }\n function getImplementedTypesForClause(res, clause, className) {\n if (!clause || !Array.isArray(clause.types))\n return undefined;\n for (var i = 0; i < clause.types.length; i++) {\n var name_3 = getBaseType(clause.types[i]);\n if (!!name_3) {\n res.push(name_3);\n setTypeParameters(name_3, clause.types[i], className);\n }\n }\n }\n function getBaseType(firstHeritageClauseType) {\n if (!firstHeritageClauseType)\n return \"\";\n var extendsType = checker.getTypeAtLocation(firstHeritageClauseType.expression);\n var expression = firstHeritageClauseType.expression;\n if (extendsType && extendsType.symbol) {\n var name_4 = extendsType.symbol.name;\n if (!!expression.expression && expression.expression.escapedText)\n return expression.expression.escapedText + \".\" + name_4;\n return name_4;\n }\n if (!!expression.text)\n return expression.text;\n if (!!expression.expression && !!expression.expression.text && !!expression.name && !!expression.name.text)\n return expression.expression.text + \".\" + expression.name.text;\n return \"\";\n }\n function setTypeParameters(typeName, node, forTypeName) {\n if (!typeName || !node)\n return;\n var parameters = getTypedParameters(node, !!forTypeName);\n if (!parameters)\n return;\n if (!forTypeName) {\n dtsTypesParameters[typeName] = parameters;\n }\n else {\n var args = dtsTypesArgumentParameters[typeName];\n if (!args) {\n args = {};\n dtsTypesArgumentParameters[typeName] = args;\n }\n args[forTypeName] = parameters;\n }\n }\n function getTypedParameters(node, isArgument) {\n var params = getTypeParametersDeclaration(node, isArgument);\n if (!params || !Array.isArray(params))\n return undefined;\n var res = [];\n for (var i = 0; i < params.length; i++) {\n var name_5 = getTypeParameterName(params[i], isArgument);\n var extendsType = getTypeParameterConstrains(params[i]);\n res.push(name_5 + extendsType);\n }\n return res.length > 0 ? res : undefined;\n }\n function getTypeParameterName(node, isArgument) {\n var symbol = checker.getSymbolAtLocation(isArgument ? node.typeName : node.name);\n if (!!symbol && symbol.name)\n return symbol.name;\n return \"any\";\n }\n function getTypeParameterConstrains(node) {\n if (!node[\"default\"])\n return \"\";\n var first = getTypeParameterName(node[\"default\"], true);\n var second = !!node.constraint ? getTypeParameterName(node.constraint, true) : \"\";\n if (!first)\n return \"\";\n if (!!second)\n return \" extends \" + first + \" = \" + second;\n return \" = \" + first;\n }\n function getTypeParametersDeclaration(node, isArgument) {\n if (!node)\n return undefined;\n if (!isArgument && !!node.typeParameters)\n return node.typeParameters;\n if (isArgument && !!node.typeArguments)\n return node.typeArguments;\n if (isArgument && !!node.elementType)\n return [node.elementType];\n return undefined;\n }\n function serializeMember(symbol, node) {\n var details = serializeSymbol(symbol);\n if (getPMEType(node.kind) !== \"property\") {\n setupMethodInfo(details, symbol, node);\n }\n else {\n details.isLocalizable = getIsPropertyLocalizable(node);\n if (details.isLocalizable) {\n details.hasSet = true;\n }\n }\n return details;\n }\n /** Serialize a method symbol infomration */\n function serializeMethod(symbol, node) {\n var details = serializeSymbol(symbol);\n setupMethodInfo(details, symbol, node);\n return details;\n }\n function setupMethodInfo(entry, symbol, node) {\n var signature = checker.getSignatureFromDeclaration(node);\n var funDetails = serializeSignature(signature);\n entry.parameters = funDetails.parameters;\n entry.returnType = funDetails.returnType;\n entry.typeGenerics = getTypedParameters(node, false);\n entry.returnTypeGenerics = getTypedParameters(node.type, true);\n if (entry.returnType === \"Array\" && !entry.returnTypeGenerics) {\n entry.returnTypeGenerics = [\"any\"];\n }\n }\n function getIsPropertyLocalizable(node) {\n if (!Array.isArray(node.decorators))\n return false;\n for (var i = 0; i < node.decorators.length; i++) {\n var decor = node.decorators[i];\n var expression = decor.expression[\"expression\"];\n var decor_arguments = decor.expression[\"arguments\"];\n if (!expression || !Array.isArray(decor_arguments))\n continue;\n var sym = checker.getSymbolAtLocation(expression);\n if (!sym || sym.name !== \"property\")\n continue;\n for (var j = 0; j < decor_arguments.length; j++) {\n var arg = decor_arguments[j];\n var props = arg[\"properties\"];\n if (!Array.isArray(props))\n continue;\n for (var k = 0; k < props.length; k++) {\n var name_6 = props[k][\"name\"];\n if (!name_6)\n continue;\n var symName = checker.getSymbolAtLocation(name_6);\n if (!!symName && symName.name === \"localizable\")\n return true;\n }\n }\n }\n return false;\n }\n /** Serialize a signature (call or construct) */\n function serializeSignature(signature) {\n var params = signature.parameters;\n var res = {\n parameters: params.map(serializeSymbol),\n returnType: getReturnType(signature),\n documentation: ts.displayPartsToString(signature.getDocumentationComment(undefined))\n };\n for (var i = 0; i < params.length; i++) {\n var node = params[i].valueDeclaration;\n if (!!node) {\n res.parameters[i].isOptional = checker.isOptionalParameter(node);\n }\n }\n return res;\n }\n function getReturnType(signature) {\n var res = checker.typeToString(signature.getReturnType());\n if (res === \"{}\")\n res = \"any\";\n if (res !== \"any\")\n return res;\n var type = signature.declaration.type;\n if (!type)\n return res;\n if (type.kind === ts.SyntaxKind.ArrayType)\n return \"Array\";\n if (!type[\"typeName\"])\n return res;\n var name = type[\"typeName\"].text;\n return !!name ? name : res;\n }\n /** True if this is visible outside this file, false otherwise */\n function isNodeExported(node) {\n return ((node.flags & ts.NodeFlags[\"Export\"]) !== 0 ||\n (node.parent && node.parent.kind === ts.SyntaxKind.SourceFile));\n }\n function isPMENodeExported(node, symbol) {\n var modifier = ts.getCombinedModifierFlags(node);\n if ((modifier & ts.ModifierFlags.Public) !== 0)\n return true;\n if (generateDts && modifier === 0)\n return true;\n if (generateDts && (modifier & ts.ModifierFlags.Protected) !== 0)\n return true;\n if (node.kind === ts.SyntaxKind.PropertyDeclaration)\n return true;\n if (isSymbolHasComments(symbol))\n return true;\n /*\n let docTags = symbol.getJsDocTags();\n if(Array.isArray(docTags) && docTags.length > 0) return true;\n if(!!symbol.valueDeclaration) {\n docTags = symbol.valueDeclaration[\"jsDoc\"];\n if(Array.isArray(docTags) && docTags.length > 0) return true;\n }\n */\n var parent = node.parent;\n return parent && parent.kind === ts.SyntaxKind.InterfaceDeclaration;\n }\n /** True if there is a comment before declaration */\n function isSymbolHasComments(symbol) {\n var com = symbol.getDocumentationComment(undefined);\n return com && com.length > 0;\n }\n function isOptionsInterface(name) {\n return name.indexOf(\"Options\") > -1 || name.indexOf(\"Event\") > -1;\n }\n function addClassIntoJSONDefinition(className, isRoot) {\n if (isRoot === void 0) { isRoot = false; }\n if (className == \"IElement\") {\n className = \"SurveyElement\";\n }\n if (!!generateJSONDefinitionClasses[className])\n return;\n generateJSONDefinitionClasses[className] = true;\n var cur = classesHash[className];\n if (!isRoot && (!cur || !hasSerializedProperties(className))) {\n addChildrenClasses(className);\n return;\n }\n if (!cur || (!isRoot && hasClassInJSONDefinition(className)))\n return;\n var root = outputDefinition;\n if (!isRoot) {\n if (!outputDefinition[\"definitions\"]) {\n outputDefinition[\"definitions\"] = {};\n }\n outputDefinition[\"definitions\"][cur.jsonName] = {};\n root = outputDefinition[\"definitions\"][cur.jsonName];\n root[\"$id\"] = \"#\" + cur.jsonName;\n }\n root[\"type\"] = \"object\";\n addPropertiesIntoJSONDefinion(cur, root);\n if (!isRoot) {\n addParentClass(cur, root);\n addChildrenClasses(cur.name);\n }\n }\n function addParentClass(cur, root) {\n if (!cur.baseType)\n return;\n addClassIntoJSONDefinition(cur.baseType);\n var parentClass = classesHash[cur.baseType];\n if (!!parentClass && hasClassInJSONDefinition(parentClass.jsonName)) {\n var properties = root[\"properties\"];\n delete root[\"properties\"];\n root[\"allOff\"] = [\n { $ref: \"#\" + parentClass.jsonName },\n { properties: properties },\n ];\n }\n }\n function addChildrenClasses(className) {\n for (var i = 0; i < outputClasses.length; i++) {\n if (outputClasses[i].baseType == className) {\n addClassIntoJSONDefinition(outputClasses[i].name);\n }\n }\n }\n function hasClassInJSONDefinition(className) {\n return (!!outputDefinition[\"definitions\"] &&\n !!outputDefinition[\"definitions\"][className]);\n }\n function addPropertiesIntoJSONDefinion(cur, jsonDef) {\n for (var i = 0; i < outputPMEs.length; i++) {\n var property = outputPMEs[i];\n if (property.className !== cur.name || !property.isSerialized)\n continue;\n addPropertyIntoJSONDefinion(property, jsonDef);\n }\n }\n function hasSerializedProperties(className) {\n for (var i = 0; i < outputPMEs.length; i++) {\n var property = outputPMEs[i];\n if (property.className == className && property.isSerialized)\n return true;\n }\n return false;\n }\n function addPropertyIntoJSONDefinion(property, jsonDef) {\n if (!jsonDef.properties) {\n jsonDef.properties = {};\n }\n var properties = jsonDef.properties;\n var typeName = property.type;\n var isArray = !!typeName && typeName.indexOf(\"[]\") > -1;\n if (!!property.jsonClassName || isArray) {\n addClassIntoJSONDefinition(typeName.replace(\"[]\", \"\"));\n }\n var typeInfo = getTypeValue(property);\n var propInfo = { type: typeInfo };\n if (isArray) {\n propInfo = { type: \"array\", items: typeInfo };\n }\n if (!!property.serializedChoices &&\n Array.isArray(property.serializedChoices) &&\n property.serializedChoices.length > 1) {\n propInfo[\"enum\"] = property.serializedChoices;\n }\n properties[property.name] = propInfo;\n }\n function getTypeValue(property) {\n var propType = property.type;\n if (propType.indexOf(\"|\") > 0)\n return [\"boolean\", \"string\"];\n if (propType == \"any\")\n return [\"string\", \"numeric\", \"boolean\"];\n if (propType == \"string\" || propType == \"numeric\" || propType == \"boolean\")\n return propType;\n var childrenTypes = [];\n addChildrenTypes(propType.replace(\"[]\", \"\"), childrenTypes);\n if (childrenTypes.length == 1)\n return getReferenceType(childrenTypes[0]);\n if (childrenTypes.length > 1) {\n var res = [];\n for (var i = 0; i < childrenTypes.length; i++) {\n res.push(getReferenceType(childrenTypes[i]));\n }\n return res;\n }\n return getReferenceType(propType.replace(\"[]\", \"\"));\n }\n function addChildrenTypes(type, childrenTypes) {\n if (type == \"IElement\")\n type = \"SurveyElement\";\n for (var i = 0; i < outputClasses.length; i++) {\n if (outputClasses[i].baseType == type) {\n var count = childrenTypes.length;\n addChildrenTypes(outputClasses[i].name, childrenTypes);\n if (count == childrenTypes.length) {\n childrenTypes.push(outputClasses[i].name);\n }\n }\n }\n }\n function updateEventsDocumentation() {\n for (var i_1 = 0; i_1 < outputPMEs.length; i_1++) {\n var ser = outputPMEs[i_1];\n if (!ser.eventSenderName || !ser.eventOptionsName)\n continue;\n if (!ser.documentation)\n ser.documentation = \"\";\n if (ser.documentation.indexOf(\"- `sender`:\") > -1)\n continue;\n var lines = [];\n lines.push(\"\");\n lines.push(\"Parameters:\");\n lines.push(\"\");\n updateEventDocumentationSender(ser, lines);\n updateEventDocumentationOptions(ser, lines);\n var replacedTextIndex = ser.documentation.indexOf(EventDescriptReplacedText);\n if (replacedTextIndex > -1) {\n ser.documentation = ser.documentation.replace(EventDescriptReplacedText, lines.join(\"\\n\"));\n }\n else {\n lines.unshift(\"\");\n ser.documentation += lines.join(\"\\n\");\n }\n }\n }\n function updateEventDocumentationSender(ser, lines) {\n if (!ser.eventSenderName)\n return;\n var desc = \"\";\n if (ser.eventSenderName === \"SurveyModel\") {\n desc = SurveyModelSenderDescription;\n }\n lines.push(\" - `sender`: `\" + ser.eventSenderName + \"`\" + (!!desc ? \" \" : \"\"));\n if (!!desc) {\n lines.push(desc);\n }\n }\n function updateEventDocumentationOptions(ser, lines) {\n if (!ser.eventOptionsName)\n return;\n var members = {};\n fillEventMembers(ser.eventOptionsName, members);\n for (var key_1 in members) {\n var m = members[key_1];\n var doc = m.documentation;\n if (isHiddenEntryByDoc(doc))\n continue;\n lines.push(\"- `options.\" + m.name + \"`: `\" + m.type + \"`\" + (!!doc ? \" \" : \"\"));\n if (!!doc) {\n lines.push(doc);\n }\n }\n ;\n }\n function isHiddenEntryByDoc(doc) {\n if (!doc)\n return true;\n doc = doc.toLocaleLowerCase();\n return doc.startsWith(\"obsolete\") || doc.startsWith(\"for internal use\");\n }\n function fillEventMembers(interfaceName, members) {\n var classEntry = classesHash[interfaceName];\n if (!classEntry)\n return;\n if (Array.isArray(classEntry.implements)) {\n for (var i_2 = 0; i_2 < classEntry.implements.length; i_2++) {\n fillEventMembers(classEntry.implements[i_2], members);\n }\n }\n if (!Array.isArray(classEntry.members))\n return;\n for (var i_3 = 0; i_3 < classEntry.members.length; i_3++) {\n var m = classEntry.members[i_3];\n members[m.name] = m;\n }\n }\n function getReferenceType(type) {\n var curClass = classesHash[type];\n if (!curClass)\n return type;\n return { $href: \"#\" + curClass.jsonName };\n }\n function dtsImportFiles(imports) {\n if (!imports)\n return;\n for (var key in imports) {\n var arr = imports[key];\n if (!Array.isArray(arr))\n continue;\n for (var i = 0; i < arr.length; i++) {\n importDtsFile(key, arr[i]);\n }\n }\n }\n function importDtsFile(moduleName, fileName) {\n var text = fs.readFileSync(getAbsoluteFileName(fileName), 'utf8');\n var regExStrs = [{ regex: /(?<=export interface)(.*)(?={)/gm, type: DocEntryType.interfaceType },\n { regex: /(?<=export declare var)(.*)(?=:)/gm, type: DocEntryType.variableType },\n { regex: /(?<=export declare function)(.*)(?=\\()/gm, type: DocEntryType.functionType },\n { regex: /(?<=export declare class)(.*)(?={)/gm, type: DocEntryType.classType },\n { regex: /(?<=export declare class)(.*)(?=extends)/gm, type: DocEntryType.classType },\n { regex: /(?<=export declare class)(.*)(?=implements)/gm, type: DocEntryType.classType },\n { regex: /(?<=export declare class)(.*)(?=<)/gm, type: DocEntryType.classType }];\n var removedWords = [\" extends \", \"<\"];\n var _loop_1 = function () {\n var item = regExStrs[i];\n var mathArray = text.match(item.regex);\n if (!Array.isArray(mathArray))\n return \"continue\";\n mathArray.forEach(function (name) {\n if (!!name && !!name.trim()) {\n for (var rI = 0; rI < removedWords.length; rI++) {\n var index = name.indexOf(removedWords[rI]);\n if (index > -1) {\n name = name.substring(0, index);\n }\n }\n dtsImports[name.trim()] = { name: name.trim(), moduleName: moduleName, entryType: item.type };\n }\n });\n };\n for (var i = 0; i < regExStrs.length; i++) {\n _loop_1();\n }\n }\n function prepareDtsInfo() {\n for (var key in classesHash) {\n proccessDtsClass(classesHash[key]);\n }\n }\n function proccessDtsClass(curClass) {\n dtsDeclarations[curClass.name] = curClass;\n }\n function dtsGetText() {\n var lines = [];\n dtsRenderDeclarations(lines);\n return lines.join(\"\\n\");\n }\n function dtsRenderDeclarations(lines) {\n var classes = [];\n var interfaces = [];\n var functions = [];\n var variables = [];\n var enums = [];\n for (var key in dtsDeclarations) {\n if (dtsExcludeImports && !!dtsImports[key])\n continue;\n var cur = dtsDeclarations[key];\n if (cur.entryType === DocEntryType.classType) {\n classes.push(cur);\n }\n if (cur.entryType === DocEntryType.interfaceType) {\n interfaces.push(cur);\n }\n if (cur.entryType === DocEntryType.variableType) {\n variables.push(cur);\n }\n if (cur.entryType === DocEntryType.functionType) {\n functions.push(cur);\n }\n if (cur.entryType === DocEntryType.enumType) {\n enums.push(cur);\n }\n }\n for (var i = 0; i < dtsExportClassesFromLibraries.length; i++) {\n dtsRenderExportClassFromLibraries(lines, dtsExportClassesFromLibraries[i]);\n }\n if (dtsExportClassesFromLibraries.length > 0) {\n lines.push(\"\");\n }\n dtsSortClasses(classes);\n for (var i = 0; i < enums.length; i++) {\n dtsRenderDeclarationEnum(lines, enums[i]);\n }\n for (var i = 0; i < interfaces.length; i++) {\n dtsRenderDeclarationInterface(lines, interfaces[i]);\n }\n for (var i = 0; i < classes.length; i++) {\n dtsRenderDeclarationClass(lines, classes[i]);\n }\n for (var i = 0; i < functions.length; i++) {\n dtsRenderDeclarationFunction(lines, functions[i]);\n }\n for (var i = 0; i < variables.length; i++) {\n dtsRenderDeclarationVariable(lines, variables[i], 0);\n }\n dtsRenderImports(lines);\n }\n function dtsSortClasses(classes) {\n classes.sort(function (a, b) {\n if (a.allTypes.indexOf(b.name) > -1)\n return 1;\n if (b.allTypes.indexOf(a.name) > -1)\n return -1;\n if (a.allTypes.length !== b.allTypes.length) {\n return a.allTypes.length > b.allTypes.length ? 1 : -1;\n }\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;\n });\n }\n function dtsRenderImports(lines) {\n var modules = {};\n for (key in dtsImportDeclarations) {\n var entry = dtsImportDeclarations[key];\n var arr = modules[entry.moduleName];\n if (!arr) {\n arr = [];\n modules[entry.moduleName] = arr;\n }\n arr.push(key);\n }\n var importLines = [];\n for (key in modules) {\n var arr = modules[key];\n while (arr.length > 0) {\n var renderedArr = arr.splice(0, 5);\n var str = \"import { \" + renderedArr.join(\", \") + \" } from \\\"\" + key + \"\\\";\";\n importLines.push(str);\n }\n }\n for (var key in dtsFrameworksImportDeclarations) {\n importLines.push(dtsFrameworksImportDeclarations[key] + \" from \\\"\" + key + \"\\\";\");\n }\n if (importLines.length > 0) {\n lines.unshift(\"\");\n }\n for (var i_4 = importLines.length - 1; i_4 >= 0; i_4--) {\n lines.unshift(importLines[i_4]);\n }\n }\n function dtsRenderExportClassFromLibraries(lines, entry) {\n if (!!dtsExportedClasses[entry.name])\n return;\n dtsExportedClasses[entry.name] = true;\n var str = \"export { \";\n if (!!entry.className) {\n str += entry.className + \" as \";\n }\n str += entry.name + \" }\";\n if (!!entry.fileName) {\n str += \" from \\\"\" + entry.fileName + \"\\\"\";\n }\n str += \";\";\n lines.push(str);\n }\n function dtsRenderDeclarationClass(lines, entry) {\n if (entry.name === \"default\")\n return;\n dtsRenderDoc(lines, entry);\n var line = \"export declare \";\n line += \"class \" + entry.name + dtsGetTypeGeneric(entry.name) + dtsRenderClassExtend(entry) + \" {\";\n lines.push(line);\n dtsRenderDeclarationConstructor(lines, entry);\n dtsRenderDeclarationBody(lines, entry);\n lines.push(\"}\");\n }\n function dtsRenderDeclarationInterface(lines, entry) {\n dtsRenderDoc(lines, entry);\n var impl = dtsRenderImplementedInterfaces(entry, false);\n var line = \"export interface \" + dtsGetType(entry.name) + dtsGetTypeGeneric(entry.name) + impl + \" {\";\n lines.push(line);\n dtsRenderDeclarationBody(lines, entry);\n lines.push(\"}\");\n }\n function dtsRenderDeclarationVariable(lines, entry, level) {\n dtsRenderDoc(lines, entry, level);\n var line = (level === 0 ? \"export declare var \" : dtsAddSpaces(level)) + entry.name + \": \";\n var hasMembers = Array.isArray(entry.members);\n var comma = level === 0 ? \";\" : \",\";\n line += hasMembers ? \"{\" : (dtsGetType(entry.type) + comma);\n lines.push(line);\n if (hasMembers) {\n for (var i = 0; i < entry.members.length; i++) {\n if (dtsIsPrevMemberTheSame(entry.members, i))\n continue;\n dtsRenderDeclarationVariable(lines, entry.members[i], level + 1);\n }\n lines.push(dtsAddSpaces(level) + \"}\" + comma);\n }\n }\n function dtsRenderDeclarationEnum(lines, entry) {\n if (!Array.isArray(entry.members) || entry.members.length === 0)\n return;\n lines.push(\"export enum \" + entry.name + \" {\");\n for (var i = 0; i < entry.members.length; i++) {\n var m = entry.members[i];\n var comma = i < entry.members.length - 1 ? \",\" : \"\";\n lines.push(dtsAddSpaces() + m.name + (!!m.returnType ? \" = \" + m.returnType : \"\") + comma);\n }\n lines.push(\"}\");\n }\n function dtsRenderDeclarationFunction(lines, entry) {\n lines.push(\"export declare function \" + dtsGetFunctionDeclaration(entry));\n }\n function dtsRenderClassExtend(cur) {\n if (!cur.baseType)\n return \"\";\n if (!dtsGetHasClassType(cur.baseType))\n return \"\";\n var entry = dtsDeclarations[cur.baseType];\n if (!entry) {\n entry = dtsImports[cur.baseType];\n }\n var isInteface = !!entry && entry.entryType === DocEntryType.interfaceType;\n var impl = dtsRenderImplementedInterfaces(cur, !isInteface);\n if (isInteface)\n return impl;\n var generic = dtsGetTypeGeneric(cur.baseType, cur.name);\n return \" extends \" + cur.baseType + generic + impl;\n }\n function dtsRenderImplementedInterfaces(entry, isBaseClass) {\n if (!Array.isArray(entry.implements))\n return \"\";\n var impls = entry.implements;\n if (impls.length === 0)\n return \"\";\n var res = [];\n for (var i = 0; i < impls.length; i++) {\n if (isBaseClass && impls[i] === entry.baseType)\n continue;\n var generic = dtsGetTypeGeneric(impls[i], entry.name);\n dtsAddImportDeclaration(impls[i]);\n res.push(impls[i] + generic);\n }\n if (res.length === 0)\n return \"\";\n var ext = entry.entryType === DocEntryType.interfaceType ? \" extends \" : \" implements \";\n return ext + res.join(\", \");\n }\n function dtsRenderDeclarationBody(lines, entry) {\n if (!Array.isArray(entry.members))\n return;\n var members = [].concat(entry.members);\n for (var i = 0; i < members.length; i++) {\n if (dtsIsPrevMemberTheSame(members, i))\n continue;\n var member = members[i];\n dtsRenderDeclarationMember(lines, member);\n if (member.isLocalizable) {\n var name_7 = \"loc\" + member.name[0].toUpperCase() + member.name.substring(1);\n if (dtsHasMemberInEntry(entry, name_7))\n continue;\n var locMember = { name: name_7, type: \"LocalizableString\", hasSet: false, pmeType: \"property\" };\n dtsRenderDeclarationMember(lines, locMember);\n }\n }\n }\n function dtsHasMemberInEntry(entry, name) {\n if (!Array.isArray(entry.members))\n return;\n for (var i = 0; i < entry.members.length; i++) {\n if (entry.members[i].name === name)\n return true;\n }\n return false;\n }\n function dtsRenderDeclarationConstructor(lines, entry) {\n if (!Array.isArray(entry.constructors))\n return;\n for (var i = 0; i < entry.constructors.length; i++) {\n var parameters = dtsGetParameters(entry.constructors[i]);\n lines.push(dtsAddSpaces() + \"constructor(\" + parameters + \");\");\n }\n }\n function dtsRenderDeclarationMember(lines, member) {\n var prefix = dtsAddSpaces() + (member.isProtected ? \"protected \" : \"\") + (member.isStatic ? \"static \" : \"\");\n dtsRenderDoc(lines, member, 1);\n var importType = \"\";\n if (member.pmeType === \"function\" || member.pmeType === \"method\") {\n importType = member.returnType;\n lines.push(prefix + dtsGetFunctionDeclaration(member));\n }\n if (member.pmeType === \"property\") {\n var propType = dtsGetType(member.type);\n importType = member.type;\n if (member.isField) {\n lines.push(prefix + member.name + (member.isOptional ? \"?\" : \"\") + \": \" + propType + \";\");\n }\n else {\n lines.push(prefix + \"get \" + member.name + \"(): \" + propType + \";\");\n if (member.hasSet) {\n lines.push(prefix + \"set \" + member.name + \"(val: \" + propType + \");\");\n }\n }\n }\n if (member.pmeType === \"event\") {\n importType = member.type;\n lines.push(prefix + member.name + \": \" + member.type + \";\");\n }\n dtsAddImportDeclaration(removeGenerics(importType));\n }\n function dtsGetFunctionDeclaration(entry) {\n var parStr = dtsGetFunctionParametersDeclaration(entry);\n return entry.name + dtsGetGenericTypes(entry.typeGenerics) + parStr + \";\";\n }\n function dtsGetFunctionParametersDeclaration(entry, isParameter) {\n if (isParameter === void 0) { isParameter = false; }\n var returnType = removeGenerics(entry.returnType);\n returnType = dtsGetType(returnType);\n if (returnType !== \"any\") {\n returnType += dtsGetGenericTypes(entry.returnTypeGenerics);\n }\n var parameters = dtsGetParameters(entry);\n return \"(\" + parameters + \")\" + (isParameter ? \" => \" : \": \") + returnType;\n }\n function removeGenerics(typeName) {\n if (!typeName)\n return typeName;\n if (typeName[typeName.length - 1] !== \">\")\n return typeName;\n var index = typeName.indexOf(\"<\");\n if (index < 0)\n return typeName;\n return typeName.substring(0, index);\n }\n function dtsGetGenericTypes(generic) {\n if (!Array.isArray(generic) || generic.length === 0)\n return \"\";\n return \"<\" + generic.join(\", \") + \">\";\n }\n function dtsRenderDoc(lines, entry, level) {\n if (level === void 0) { level = 0; }\n if (!entry.documentation)\n return;\n var docLines = entry.documentation.split(\"\\n\");\n lines.push(dtsAddSpaces(level) + \"/*\");\n for (var i = 0; i < docLines.length; i++) {\n lines.push(dtsAddSpaces(level) + \"* \" + docLines[i]);\n }\n lines.push(dtsAddSpaces(level) + \"*/\");\n }\n function dtsGetType(type) {\n if (!type)\n return \"void\";\n if (type === \"T\")\n return type;\n if (type.indexOf(\"|\") > -1) {\n return type.indexOf(\"(\") > -1 ? \"any\" : type;\n }\n var str = type.replace(\"[\", \"\").replace(\"]\", \"\");\n if (str === \"number\" || str === \"boolean\" || str === \"string\" || str === \"any\" || str === \"void\")\n return type;\n if (type[0] === \"(\" && type.indexOf(callbackFuncResultStr) > -1)\n return dtsGetTypeAsFunc(type);\n return dtsPlatformType(str, type);\n }\n function dtsPlatformType(str, type) {\n if (!dtsGetHasClassType(str))\n return \"any\";\n if (isReactElement(type))\n return \"JSX.Element\";\n return type;\n }\n function dtsGetTypeAsFunc(type) {\n var index = type.indexOf(callbackFuncResultStr);\n var entry = {};\n entry.returnType = type.substring(index + callbackFuncResultStr.length);\n var paramsStr = type.substring(1, index).split(\",\");\n entry.parameters = [];\n for (var i = 0; i < paramsStr.length; i++) {\n var par = paramsStr[i];\n var parIndex = par.indexOf(\":\");\n if (parIndex < 0)\n return \"any\";\n entry.parameters.push({ name: par.substring(0, parIndex).trim(), type: par.substring(parIndex + 1).trim() });\n }\n return dtsGetFunctionParametersDeclaration(entry, true);\n }\n function dtsGetTypeGeneric(type, typeFor) {\n if (!type)\n return \"\";\n if (!typeFor)\n return dtsGetTypeGenericByParameters(dtsTypesParameters[type]);\n var args = dtsTypesArgumentParameters[type];\n if (!args)\n return \"\";\n return dtsGetTypeGenericByParameters(args[typeFor]);\n }\n function dtsGetTypeGenericByParameters(params) {\n if (!Array.isArray(params))\n return \"\";\n for (var i = 0; i < params.length; i++) {\n dtsAddImportDeclaration(params[i]);\n }\n return \"<\" + params.join(\", \") + \">\";\n }\n function isReactElement(type) {\n return isExportingReact && type === \"Element\";\n }\n function dtsGetHasClassType(type) {\n if (dtsAddImportDeclaration(type))\n return true;\n if (type === \"Array\")\n return true;\n if (isReactElement(type))\n return true;\n return !!dtsDeclarations[type];\n }\n function dtsAddImportDeclaration(type) {\n if (!type)\n return false;\n if (type.indexOf(\"React.\") === 0) {\n dtsFrameworksImportDeclarations[\"react\"] = \"import * as React\";\n isExportingReact = true;\n return true;\n }\n if (type === \"Vue\") {\n dtsFrameworksImportDeclarations[\"vue\"] = \"import Vue\";\n return true;\n }\n if (!dtsExcludeImports && !!dtsDeclarations[type])\n return false;\n var entry = dtsImports[type];\n if (!entry)\n return false;\n dtsImportDeclarations[type] = entry;\n return true;\n }\n function dtsIsPrevMemberTheSame(members, index) {\n return index > 0 && members[index].name === members[index - 1].name;\n }\n function dtsGetParameters(member) {\n if (!Array.isArray(member.parameters))\n return \"\";\n var strs = [];\n var params = member.parameters;\n for (var i = 0; i < params.length; i++) {\n var p = params[i];\n var typeStr = dtsGetType(p.type);\n //We have Event in library core and there is Event in DOM.\n if (typeStr === \"Event\")\n typeStr = \"any\";\n strs.push(p.name + (p.isOptional ? \"?\" : \"\") + \": \" + typeStr);\n }\n return strs.join(\", \");\n }\n function dtsAddSpaces(level) {\n if (level === void 0) { level = 1; }\n var str = \"\";\n for (var i = 0; i < level; i++)\n str += \" \";\n return str;\n }\n}", "async function main() {\n const modelManager = await ModelLoader.loadModelManagerFromModelFiles([metaModelCto], {strict: true});\n const visitor = new TypescriptVisitor();\n const fileWriter = new FileWriter(path.resolve(__dirname, '..', 'src', 'generated'));\n const parameters = { fileWriter };\n modelManager.accept(visitor, parameters);\n}", "async writing() {\n // read async from fs\n const reader = async (filepath) => {\n console.log(`read ${filepath}`)\n return fs.promises\n .readFile(this.templatePath(filepath))\n .then((b) => b.toString())\n }\n\n // write sync to memfs\n const writer = (filepath, content) =>\n this.fs.write(this.destinationPath(filepath), content)\n\n // filter git ignored files\n const gitDir = await scaffold.GitDir.New(this.sourceRoot())\n await scaffold.ScaffoldProcessGeneric(\n gitDir.walk(),\n reader,\n writer,\n this.answers\n )\n\n const content = this.fs.readJSON(this.destinationPath('package.json'))\n content.name = this.answers.name\n content.description = this.answers.description\n content.author = this.answers.author\n content.repository.url = this.answers.repository_url\n this.fs.writeJSON(this.destinationPath('package.json'), content, null, 2)\n\n }", "function createIndexFile() {\n let indexTS = '';\n for(let filepath of protoImportList) {\n const dir = path.parse(filepath).dir;\n const filename = path.parse(filepath).name + '_pb';\n const indexpath = path.join(dir, filename);\n indexTS += \"export * from './functions/\" + indexpath + \"';\\n\";\n }\n fs.writeFileSync(path.join(exportProtoPath, 'index.ts'), indexTS);\n\n onLoad();\n }", "async write() {\r\n\t\t// Don't bother writing an empty material library.\r\n\t\tif (this.isEmpty)\r\n\t\t\treturn;\r\n\r\n\t\tawait generics.createDirectory(path.dirname(this.out));\r\n\t\tconst writer = new FileWriter(this.out);\r\n\r\n\t\tfor (const material of this.materials) {\r\n\t\t\twriter.writeLine('newmtl ' + material.name);\r\n\t\t\twriter.writeLine('illum 1');\r\n\t\t\twriter.writeLine('map_Kd ' + material.file);\r\n\t\t}\r\n\r\n\t\tawait writer.close();\r\n\t}", "async generated () {\n // @todo check context.markdown.$data.typeLinks for existence\n return fs.copy(metadataDir, path.resolve(context.outDir, 'metadata'))\n }", "function writePackage(answers, configLocation) {\n // script\n var pkgPath = path_1.resolve(process.cwd(), 'package.json');\n var pkgContent = fs_1.readFileSync(pkgPath, {\n encoding: 'utf-8'\n });\n var pkg = JSON.parse(pkgContent);\n var indent = detectIndent(pkgContent).indent;\n if (!pkg.scripts) {\n pkg.scripts = {};\n }\n pkg.scripts[answers.script] = \"gql-gen --config \" + configLocation;\n // plugin\n if (!pkg.devDependencies) {\n pkg.devDependencies = {};\n }\n // read codegen's version\n var version = JSON.parse(fs_1.readFileSync(path_1.resolve(__dirname, '../package.json'), {\n encoding: 'utf-8'\n })).version;\n answers.plugins.forEach(function (plugin) {\n pkg.devDependencies[plugin.package] = version;\n });\n fs_1.writeFileSync(pkgPath, JSON.stringify(pkg, null, indent));\n}", "function toClosureJS(options, fileNames, isUntyped) {\n // Parse and load the program without tsickle processing.\n // This is so:\n // - error messages point at the original source text\n // - tsickle can use the result of typechecking for annotation\n var program = ts.createProgram(fileNames, options);\n var errors = ts.getPreEmitDiagnostics(program);\n if (errors.length > 0) {\n return { errors: errors };\n }\n var tsickleOptions = {\n untyped: isUntyped,\n };\n // Process each input file with tsickle and save the output.\n var tsickleOutput = {};\n var tsickleExterns = '';\n for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {\n var fileName = fileNames_1[_i];\n var _a = tsickle.annotate(program, program.getSourceFile(fileName), tsickleOptions), output = _a.output, externs = _a.externs, diagnostics_1 = _a.diagnostics;\n if (diagnostics_1.length > 0) {\n return { errors: diagnostics_1 };\n }\n tsickleOutput[ts.sys.resolvePath(fileName)] = output;\n if (externs) {\n tsickleExterns += externs;\n }\n }\n // Reparse and reload the program, inserting the tsickle output in\n // place of the original source.\n var host = createSourceReplacingCompilerHost(tsickleOutput, ts.createCompilerHost(options));\n program = ts.createProgram(fileNames, options, host);\n errors = ts.getPreEmitDiagnostics(program);\n if (errors.length > 0) {\n return { errors: errors };\n }\n // Emit, creating a map of fileName => generated JS source.\n var jsFiles = {};\n function writeFile(fileName, data) { jsFiles[fileName] = data; }\n var diagnostics = program.emit(undefined, writeFile).diagnostics;\n if (diagnostics.length > 0) {\n return { errors: diagnostics };\n }\n for (var _b = 0, _c = Object.keys(jsFiles); _b < _c.length; _b++) {\n var fileName = _c[_b];\n if (path.extname(fileName) !== '.map') {\n var output = tsickle.convertCommonJsToGoogModule(fileName, jsFiles[fileName], cli_support.pathToModuleName).output;\n jsFiles[fileName] = output;\n }\n }\n return { jsFiles: jsFiles, externs: tsickleExterns };\n}", "function generateJsDriver() {\n const fileNames = fs.readdirSync(consts.TEXT_DIR);\n\n const driverExport = fileNames.reduce((obj, fileName) => {\n const [name, extension] = fileName.split(\".\");\n\n if (extension === \"json\") {\n return {\n ...obj,\n [name]: `require('./${fileName}')`,\n };\n }\n\n return obj;\n }, {});\n\n let dataString = `module.exports = ${JSON.stringify(driverExport, null, 2)}`\n // remove quotes around require statements\n .replace(/\"require\\((.*)\\)\"/g, \"require($1)\");\n\n const filePath = path.resolve(consts.TEXT_DIR, \"index.js\");\n fs.writeFileSync(filePath, dataString, { encoding: \"utf8\" });\n\n return `Generated .js SDK driver at ${output.info(filePath)}..`;\n}", "async function definition(transformFn = (content) => content) {\n\tlog.bold('> definition.js')\n\n\tconst CWD = process.cwd()\n\tconst PKG = await fs.readJson(path.join(CWD, 'package.json'))\n\tconst DEF_FILE = path.join(CWD, 'typings', 'app.d.ts')\n\tconst config = {\n\t\tname: `${PKG.name}/dist`,\n\t\tindent: ' ',\n\t\tproject: CWD,\n\t\tout: DEF_FILE,\n\t\tsendMessage: console.log,\n\t\texterns: ['./global.d.ts'],\n\t\texclude: ['test/**/*.*'],\n\t\tverbose: false,\n\t}\n\n\tawait fs.remove(DEF_FILE)\n\tawait dts(config)\n\n\tconst content = await fs.readFile(DEF_FILE, 'utf8')\n\n\tconst newContent = transformFn(content.replace(/([\\t\\f\\v]*)private(.*)[\\r\\n]*/g, '')\n\t\t.replace(/\\/src\\//g, '/dist/')\n\t\t.replace(/\\/dist\\/app\\/index'/g, \"'\"))\n\n\tawait fs.writeFile(DEF_FILE, newContent)\n\tlog.success('Definition generated')\n}", "function outputOntology(){\n var arrayRep = graph.toArray().map(function(stmt){\n return stmt.toTurtle(profile);\n });\n fs.appendFileSync(outputPath, arrayRep.join('\\n'));\n }", "_getStandardTypingsFilePath(file) {\n let filePath = file.getPathInPackage();\n let dirPath = ts.getDirectoryPath(\n ts.normalizePath(filePath)).replace(/^typings\\/?/, '');\n let pkgName = file.getPackageName();\n if (pkgName.indexOf(':') != -1) {\n pkgName = pkgName.split(':')[1];\n }\n let pkgTest = new RegExp(`^\\/?${pkgName}(\\/.+|$)`);\n // Check if the path starts with the package name.\n if (pkgTest.test(dirPath) === false) {\n let pkgDirPath = ts.combinePaths(\n ts.combinePaths('typings', pkgName), dirPath);\n let fileName = ts.getBaseFileName(filePath);\n filePath = ts.combinePaths(pkgDirPath, fileName);\n }\n\n return filePath;\n }", "function createOutput(json: SwaggerInput) {\n\n switch (options.outputType) {\n case OutputTypes.Single: {\n // tslint:disable-next-line\n return console.log(createDefs(json, options));\n }\n case OutputTypes.Multi: {\n const res = createSplitDefs(json, options);\n const defOutput = join(options.outDir, res.definitions[0].displayName);\n\n res.modules.concat(res.definitions).forEach((item) => {\n outputFileSync(join(options.outDir, item.displayName), item.content);\n });\n // tslint:disable-next-line\n console.log(`${res.modules.length} module(s) written to '${options.outDir}'`);\n // tslint:disable-next-line\n console.log(`1 definition file written to '${defOutput}'`);\n\n break;\n }\n default: {\n // tslint:disable-next-line\n return console.error(\"Output type not supported\");\n }\n }\n}", "function generateFile(data) {\n FileReader.writeFile(\"compiled.js\", data, (err) => {\n if (err) {\n console.log(\"File write err\");\n }\n });\n}", "instantiateAll () {\n const files = this.findGeneratorFiles('./templates', /\\.js$/);\n\n files.forEach((filename) => {\n const Constructor = require(filename);\n const object = new Constructor();\n this.viewGenerators[object.constructor.name] = object;\n if (!this.viewGeneratorsContentType[object.getName()]) {\n this.viewGeneratorsContentType[object.getName()] = [];\n }\n this.viewGeneratorsContentType[object.getName()] = this.viewGeneratorsContentType[object.getName()].concat(object.getContentTypes());\n });\n }", "function writeTxtFiles() { //调用前面的写方法\n\n\t// could've written these as one function,\n\t// left em separate for easy customization,\n\t// e.g., could've written writeCsv()\n\n\n\n\n\n\twriteHtml();\n\twriteCss();\n\t// writeJson();\n\twriteManifest();\n\n\n}", "function generate() {\n fs.writeFileSync(outputPath, render(teamMembers), \"utf-8\");\n process.exit(0);\n}", "saveTemplates(callback){\n var fs = require('fs')\n var file = __dirname + '/../assets/data/templates.json'\n fs.writeFile(file, JSON.stringify(this.templates), function(err) {\n if(err) {\n return callback(err)\n }\n else{\n return callback(undefined, true)\n }\n })\n }", "build() {\n const inputPath = first(this.inputPaths);\n this.exporters.forEach(([fileName, exporter]) => {\n const srcPath = path.join(inputPath, fileName);\n if (fs.existsSync(srcPath)) {\n const sourceCode = exporter.processSourceCode(fs.readFileSync(srcPath, 'utf8'));\n const destPath = path.join(this.outputPath, fileName);\n\n // Make sure the directory exists before writing it.\n mkdirpSync(path.dirname(destPath));\n fs.writeFileSync(destPath, sourceCode);\n }\n });\n }", "function main(): void {\n const cli = new commander.Command();\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n cli.version(require(\"../package.json\").version)\n .description(\n \"CLI to convert CDS models to Typescript interfaces and enumerations\"\n )\n .option(\"-c, --cds <file.cds>\", \"CDS file to convert\")\n .option(\n \"-o, --output ./<path>/\",\n \"Output location in which the generated *.ts files are written to. Make sure the path ends with '/'.\"\n )\n .option(\"-p, --prefix <I>\", \"Interface prefix\", \"\")\n .option(\n \"-j, --json\",\n \"Prints the compiled JSON representation of the CDS sources\"\n )\n .option(\n \"-d, --debug\",\n \"Prints JavaScript error message, should be used for issue reporting => https://github.com/mrbandler/cds2types/issues\"\n )\n .option(\n \"-f, --format\",\n \"Flag, whether to format the outputted source code or not (will try to format with prettier rules in the project)\"\n )\n .option(\n \"-s, --sort\",\n \"Flag, whether to sort outputted source code or not\"\n )\n .parse(process.argv);\n\n if (!process.argv.slice(2).length) {\n cli.outputHelp();\n } else {\n const options = cli.opts() as IOptions;\n new Program().run(options).catch((error: Error) => {\n const debugHint =\n \"Please use the debug flag (-d, --debug) for a detailed error message.\";\n console.log(\n `Unable to write types. ${options.debug ? \"\" : debugHint}`\n );\n\n if (options.debug) console.error(\"Error:\", error.message);\n process.exit(-1);\n });\n }\n}", "function initEntryFile(){\n\n\tvar entries = [];\n\tfor(var i=0;i<2;i++){\n\t\tentries.push(gener.randomEntry());\n\t}\n\tvar data = { \"entries\": entries, \"tags\": [] };\n\tfs.writeFile('./SampleEntries.js', JSON.stringify(data, null, 2), function(err){ if(err){ console.log(\"Harness initEntryFile encountered err while writing.\");} });\n}", "function packageDTS() {\n return gulp.src('./typings/blockly.d.ts')\n .pipe(gulp.dest(`${packageDistribution}`));\n}", "function createPackage(next) {\n var pkg = JSON.parse(fs.readFileSync(path.join(scaffold, 'package.json'), 'utf8'));\n\n pkg.name = name;\n pkg.dependencies.flatiron = flatiron.version;\n\n app.log.info('Writing ' + 'package.json'.grey);\n fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2) + '\\n', next);\n }", "function makeApiFiles(api, apiOutputDir, sourceDir, libname) {\n var apiHeaderTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.h.ejs\")));\n var apiCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.cpp.ejs\")));\n var apiPlayFabModelTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.h.ejs\")));\n var apiPlayFabModelCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.cpp.ejs\")));\n var apiPlayFabModelDecoderHTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.h.ejs\")));\n var apiPlayFabModelDecoderCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.cpp.ejs\")));\n \n var generatedHeader;\n var generatedBody;\n var apiLocals = {};\n apiLocals.api = api;\n apiLocals.hasClientOptions = api.name === \"Client\";\n apiLocals.sdkVersion = exports.sdkVersion;\n apiLocals.libname = libname;\n \n generatedHeader = apiHeaderTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"API.h\"), generatedHeader);\n generatedBody = apiCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"API.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"Models.h\"), generatedHeader);\n generatedBody = apiPlayFabModelCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"Models.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelDecoderHTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"ModelDecoder.h\"), generatedHeader);\n generatedBody = apiPlayFabModelDecoderCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"ModelDecoder.cpp\"), generatedBody);\n}", "function importTypes(_fileList) {\n print(\"\");\n print(\"Import Types\");\n print(\"~~~~~~~~~~~~\");\n for (indx in _fileList) {\n var fileName = new File(_fileList[indx]);\n if (fileName.getName().startsWith(Type.prototype.FILE_PREFIX) && fileName.getName().endsWith(\".js\")) {\n var objName = new String(fileName.getName().substring(5, fileName.getName().length()-3));\n var type = new Type(objName);\n if (type.getOid()==null || type.getOid()==\"\" || type.getOid()==\"0\") {\n print(\"Create Type '\"+objName+\"'\");\n type._create(objName);\n }\n }\n }\n for (indx in _fileList) {\n importType(_fileList[indx]);\n }\n print(\"\");\n}", "function MakeDatatype(tabbing, datatype, sourceDir, extendsFrom) {\n var enumTemplate = GetCompiledTemplate(path.resolve(sourceDir, \"templates/Enum.d.ts.ejs\"));\n var interfaceTemplate = GetCompiledTemplate(path.resolve(sourceDir, \"templates/Interface.d.ts.ejs\"));\n \n var locals = {\n datatype: datatype,\n tabbing: tabbing\n };\n \n if (datatype.isenum) {\n locals.enumvalues = datatype.enumvalues;\n return enumTemplate(locals);\n } else {\n locals.extendsFrom = extendsFrom;\n locals.properties = datatype.properties;\n locals.GenerateSummary = GenerateSummary;\n locals.GetProperty = GetProperty;\n return interfaceTemplate(locals);\n }\n}", "writeToFile () {\n let data = this.ghostToJson();\n\n fs.writeFileSync(this.ghostFileOutput, data, 'utf8');\n console.log( logSuccess('Ghost JSON generated successfully!') );\n }", "function makeSharedHeaders(baseFileName)\n{\n // Build the shared type definitions header output file name and include\n // flag\n var sharedFileName = ccdd.getOutputPath() + baseFileName + \".h\";\n var headerIncludeFlag = \"_\" + baseFileName.toUpperCase() + \"_H_\";\n\n // Open the shared type definitions header output file\n var sharedFile = ccdd.openOutputFile(sharedFileName);\n\n // Check if the shared type definitions header file successfully opened\n if (sharedFile != null)\n {\n // Add the build information to the output file\n outputFileCreationInfo(sharedFile);\n\n // Add the header include to prevent loading the file more than once\n ccdd.writeToFileLn(sharedFile, \"#ifndef \" + headerIncludeFlag);\n ccdd.writeToFileLn(sharedFile, \"#define \" + headerIncludeFlag);\n ccdd.writeToFileLn(sharedFile, \"#include <stdint.h>\");\n ccdd.writeToFileLn(sharedFile, \"\");\n\n // Step through each structure. This list is in order so that base\n // structures are created before being referenced in another structure\n for (struct = 0; struct < structureNames.length; struct++)\n {\n // Check if the structure is referenced by more than one structure\n if (ccdd.isStructureShared(structureNames[struct]))\n {\n // Output the structure's type definition to the shared types\n // file\n outputStructure(sharedFile, struct);\n }\n }\n\n // Finish and close the shared type definitions header output file\n ccdd.writeToFileLn(sharedFile, \"\");\n ccdd.writeToFileLn(sharedFile, \"#endif /* #ifndef \" + headerIncludeFlag + \" */\");\n ccdd.closeFile(sharedFile);\n }\n // The shared type definitions header file failed to open\n else\n {\n // Display an error dialog\n ccdd.showErrorDialog(\"<html><b>Error opening types header output file '</b>\" + sharedFileName + \"<b>'\");\n }\n}", "function writeToFile(filetype, data) {\n fs.writeFile(filetype, data, (err) =>\n err ? console.log(err) : console.log('Created your README!')\n )\n}", "function write() {\n fs.writeFileSync(wordLength + filename, JSON.stringify(object), 'utf8');\n}", "createTypes(){\n }", "function makeFile(info) {\n const { comment, upstream, config } = info\n return (\n `// ${comment}\\n` +\n '//\\n' +\n `// Auto-generated by ${packageJson.name}\\n` +\n `// based on rules from ${upstream}\\n` +\n '\\n' +\n '\"use strict\";\\n' +\n '\\n' +\n `module.exports = ${JSON.stringify(sortJson(config), null, 2)};\\n`\n )\n}", "async function generateResourceSpecification(inputDir, outFile) {\n const spec = { PropertyTypes: {}, ResourceTypes: {}, Fingerprint: '' };\n const files = await fs.readdir(inputDir);\n for (const file of files.filter(n => n.endsWith('.json')).sort()) {\n const data = await fs.readJson(path.join(inputDir, file));\n if (file.indexOf('patch') === -1) {\n massage_spec_1.decorateResourceTypes(data);\n massage_spec_1.forEachSection(spec, data, massage_spec_1.merge);\n }\n else {\n massage_spec_1.forEachSection(spec, data, massage_spec_1.patch);\n }\n }\n massage_spec_1.massageSpec(spec);\n spec.Fingerprint = md5(JSON.stringify(massage_spec_1.normalize(spec)));\n await fs.mkdirp(path.dirname(outFile));\n await fs.writeJson(outFile, spec, { spaces: 2 });\n}", "async function convertFromDirectory(settings) {\n const appSettings = defaultSettings(settings);\n const filesInDirectory = await convertFilesInDirectory_1.convertFilesInDirectory(appSettings, path_1.default.resolve(appSettings.typeOutputDirectory));\n if (!filesInDirectory.types || filesInDirectory.types.length === 0) {\n throw new Error('No schemas found, cannot generate interfaces');\n }\n for (const exportType of filesInDirectory.types) {\n writeInterfaceFile_1.writeInterfaceFile(appSettings, exportType.typeFileName, filesInDirectory.types);\n }\n if (appSettings.indexAllToRoot || appSettings.flattenTree) {\n // Write index.ts\n writeIndexFile(appSettings, filesInDirectory.typeFileNames);\n }\n return true;\n}", "function makeManifest(exercises, dest, done) {\n var dir = path.join(dest, 'types');\n async.parallel({\n files: fs.readdir.bind(null, dir),\n tags: getTags\n }, function (err, data) {\n if (err) {\n return done(err);\n }\n var manifest = processExercises(exercises, processTags(data.tags), data.files);\n var dest = path.join(dir, 'problemTypes.json');\n console.log('manu', dest);\n fs.writeFile(dest, JSON.stringify(manifest, null, 4), done);\n });\n}", "async function writeTemplates(collectedData) {\n console.info(heading(\"Creating Templates\"));\n const destinations = await getFilesToInclude(collectedData);\n const successfulWrites = [];\n for (let [from, to] of destinations) {\n if (await fileExists(to)) {\n console.warn(\n `${y(\" ⚠️ skipping\")} ${gr(path.basename(to))} (already exists)`\n );\n continue;\n }\n const rawData = await fs.readFile(from, \"utf8\");\n const data = populateTemplate(rawData, collectedData, path.basename(from));\n try {\n await fs.writeFile(to, data);\n const basename = path.basename(to);\n console.log(` ${chk} ${g(\"created\")} ${gr(basename)}`);\n successfulWrites.push(basename);\n } catch (err) {\n console.error(\n ` 💥 ${r(\"error: \")} could not create ${gr(path.basename(to))}`\n );\n }\n }\n if (successfulWrites.length) {\n await git(`add ${successfulWrites.join(\" \")}`);\n await git(`commit -am \"feat: add WICG files.\"`);\n console.info(\n g(`\\nCommitted changes to \"${collectedData.mainBranch}\" branch.`)\n );\n }\n return collectedData;\n}", "function buildFile() {\n const asList = Object.keys(data).reduce((arr, tag) => {\n return [...arr, { tag, bundles: data[tag].bundles }]\n }, [])\n const stringified = JSON.stringify(asList, null, 2)\n fs.writeFileSync(`sizes-${Date.now()}.json`, stringified)\n}", "async function generate() {\n console.log(chalk.blue.bold('Generating commands and events documentation for Poinz:'));\n console.log(\n ` Expecting commandHandlers in \"${settings.cmdHandlersDirPath}\"\\n Expecting eventHandlers in \"${settings.evtHandlersDirPath}\"\\n\\n`\n );\n\n const data = await gatherData(settings.cmdHandlersDirPath, settings.evtHandlersDirPath);\n\n const markdownString = await renderDocu(data);\n await fs.promises.writeFile(\n path.join(settings.docuOutputDirPath, './commandAndEventDocu.md'),\n markdownString,\n 'utf-8'\n );\n\n console.log(chalk.blue.bold('\\n\\nGenerating svg graphics from diagrams...\\n'));\n await downloadMermaidDiagramsAsSvg();\n}", "function genTsRefs(target, sources) {\n var target = gulp.src(target);\n var sources = gulp.src([sources], { read: false });\n\n return target.pipe(inject(sources, {\n starttag: '//{',\n endtag: '//}',\n transform: function (filepath) {\n return '/// <reference path=\"..' + filepath + '\" />';\n }\n })).pipe(gulp.dest(config.typings));\n}", "async function generateJavascript() {\r\n\r\n //read the Kantu commands into a JSON object from the given json file\r\n fs.readFile(fileToParse, 'utf8', function (err, data) {\r\n if (err) return console.log(err);\r\n\r\n //trim and parse to json\r\n data = data.trim();\r\n events = JSON.parse(data);\r\n\r\n //turn into a script\r\n var functionCalls = extractFunctionCalls(events);\r\n functionCalls = labelFunctionCalls(functionCalls, events);\r\n var output = accumulateOutput(functionCalls);\r\n\r\n //write the script under the given filename\r\n fs.writeFile(fileToWrite, output, function (err) {\r\n if (err) {\r\n console.log(\"Error while writing file: \");\r\n return console.log(err);\r\n }\r\n });\r\n });\r\n}", "_writing() {\n return {\n writeAngularFiles,\n cleanupAngular,\n writeReactFiles,\n cleanupReact,\n writeVueFiles,\n };\n }", "async function makePot() {\n const { package: pkg, paths } = await getData(false);\n const tmpSrc = path.join(paths.temp, 'src');\n const tmpTwigDir = path.join(paths.root, '.temp-twig');\n\n try {\n // We back up the original source files inside a temporary directory\n await fs.copy(paths.src, tmpSrc);\n\n // All `import()` calls will just be commented out\n await replace({\n files: path.join(paths.src, '**/*.js'),\n from: /.+import\\(.+\\);?/g,\n to: match => `// ${match}`,\n });\n\n /**\n * The wp cli command will ignore twig files. We therefore convert all twig\n * files to php files replacing translation functions with normal php\n * translation functions.\n * And also convert all .twig-files into .php-files that wp-cli will\n * recognize and extract translations from.\n */\n await convertTwigFiles(tmpTwigDir);\n\n // When replacemnets are done wp-cli can do it's work\n const potPath = path.join(\n paths.dist,\n `${pkg.name.replace(/^(@\\w+\\/)/, '')}.pot`,\n );\n await execa('wp', ['i18n', 'make-pot', '.', potPath, '--exclude=dist']);\n\n /**\n * After wp cli has extracted all translation string the pot will point to\n * missing files for twig views. We will replace all temporary pointers\n * to their original versions.\n */\n await updateTwigFilePaths(tmpTwigDir, potPath);\n } catch (error) {\n console.error('An error occured while generating a .pot-file');\n console.error(error);\n } finally {\n /**\n * We use the finally block to make sure that orginal files are always\n * copied back to its source, event if an error occurs.\n *\n * We catch any errors from these calls since they're not important and will\n * most likely mean that we didn't even reach a point where we backed up the\n * src directory.\n */\n await fs.copy(tmpSrc, paths.src).catch(() => {});\n await fs.remove(tmpSrc).catch(() => {});\n await fs.remove(tmpTwigDir).catch(() => {});\n }\n}", "function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) {\n if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {\n ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles);\n }\n if (sourceMapDataList) {\n sourceMapDataList.push(sourceMap.getSourceMapData());\n }\n ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles);\n }", "function writeToFile(filetype, data) {\n fs.writeFile(filetype, data, (err) =>\n err ? console.log(err) : console.log('Created your Team Page!')\n )\n}", "function writeToFile( data) {\n fs.writeFile(\"./generated-files/README.md\",generateMarkdown(data), err =>{\n if(err){\n throw err;\n }\n console.log(\"file generated!\")\n })\n}", "function createSketchType(name, code) {\n // server.writeFile('sketches/' + name + '.js', code);\n }", "function handlePackageFile({path, scope, componentName}) {\n const packageJson = require(path);\n packageJson.name = `${scope}/${componentName}`;\n fs.writeFileSync(path, packageJson);\n}", "setupSchema() {\n\t\tfor (const type in this.Definition) {\n\t\t\tif (this.Definition.hasOwnProperty(type)) {\n\t\t\t\t// console.log(type);\n\t\t\t\tconst typeDef = this.Definition[type];\n\t\t\t\tthis.Schema[type] = oas.compile(typeDef);\n\t\t\t}\n\t\t}\n\t\tfor (const type in this.precompiled) {\n\t\t\tif (this.precompiled.hasOwnProperty(type)) {\n\t\t\t\t// console.log(type);\n\t\t\t\tconst typeDef = this.precompiled[type];\n\t\t\t\tthis.Schema[type] = typeDef;\n\t\t\t}\n\t\t}\n\t}", "generateFile(path) {\n return fs.writeFileSync(path, this.template);\n }", "async function main() {\n const sclang = await index_1.boot({ stdin: false, debug: false });\n function removeAll() {\n return sclang.interpret(\"SynthDescLib.default.synthDescs.removeAll();\");\n }\n function interpretFiles() {\n return Promise.all(sources.map(src => {\n return sclang.executeFile(src).catch(error => {\n console.error(`${src} ${error}`, error);\n throw error;\n });\n }));\n }\n // returns SynthDescs as a JSON-ready dict\n function writeDefs() {\n return sclang.interpret(`\n var descs = Dictionary.new;\n SynthDescLib.default.synthDescs\n .keysValuesDo({ arg defName, synthDesc;\n synthDesc.def.writeDefFile(\"` +\n dest +\n `\");\n descs[defName] = synthDesc.asJSON();\n });\n descs\n `);\n }\n function writeDescs(descs) {\n return fs_1.promises.writeFile(path_1.default.join(dest, \"synthDefs.json\"), JSON.stringify(descs, null, 2));\n }\n await removeAll();\n await interpretFiles();\n const descs = await writeDefs();\n await writeDescs(descs);\n}", "function run() {\n const filename = __dirname + path.sep + \"schema.json\";\n\n const schema = JSON.parse(fs.readFileSync(filename, \"utf8\"));\n\n const descriptions = {};\n for (const d in schema.definitions) {\n const description = schema.definitions[d].description;\n if (d.endsWith(\"Conf\") && description === undefined) {\n console.log(\"Missing jsdoc description: \" + d);\n process.exit(1);\n } else if (description !== undefined) {\n descriptions[d] = description;\n }\n }\n\n const rules = schema.definitions.IConfig.properties.rules.properties;\n for (const rule in rules) {\n const name = rules[rule].anyOf[0][\"$ref\"].split(\"/\")[2];\n rules[rule].description = descriptions[name];\n }\n\n fs.writeFileSync(filename, JSON.stringify(schema, null, 2));\n}", "async function main () {\n const styles = buildStyles()\n const targetDir = path.join(__dirname, '../node_modules/.cache/emoji-picker-element')\n await mkdirp(targetDir)\n await writeFile(\n path.join(targetDir, 'styles.js'),\n `const styles = ${JSON.stringify(styles)}; module.exports = styles;`,\n 'utf8'\n )\n}", "function generatePlaceholder(name, dir) {\n const packagePath = path.join(dir, 'package.json');\n if (fs.existsSync(packagePath)) { return; }\n execSync(`mkdir -p \"${dir}\"`, { stdio: 'inherit' });\n fs.writeFileSync(packagePath, JSON.stringify({\n name,\n version: '1.0.0',\n dependencies: { '@griffins/api-client-support': '*', 'io-ts': '^1.10.3' },\n devDependencies: { typescript: '^3.5.2' },\n }), 'utf8');\n}", "_writingScript() {\n this.fs.copy(\n this.templatePath('src_script_body.js'),\n this.destinationPath('src/script/body.js')\n );\n this.fs.copy(\n this.templatePath('src_script_head.js'),\n this.destinationPath('src/script/head.js')\n );\n }", "function genTemplates() {\n console.log(\"Generating client-side jade javascript functions.\");\n let templatePath = path.normalize(path.join(__dirname.substr(0, __dirname.lastIndexOf(path.sep)), 'views', 'app-search-entry.pug'));\n fs.readFile(templatePath, \"ASCII\", function (err, data) {\n console.log(\"Generating client-side search entry templates.\");\n if (err !== null) console.log(\"Error from file read:\", err);\n else searchFn = jade.compileClient(data, null);\n });\n templatePath = path.normalize(path.join(__dirname.substr(0, __dirname.lastIndexOf(path.sep)), 'views', 'app-sidebar-entry.pug'));\n fs.readFile(templatePath, \"ASCII\", function (err, data) {\n console.log(\"Generating client-side sidebar entry templates.\");\n if (err !== null) console.log(\"Error from file read:\", err);\n else sidebarFn = jade.compileClient(data, null);\n });\n templatePath = path.normalize(path.join(__dirname.substr(0, __dirname.lastIndexOf(path.sep)), 'views', 'app-profile-owned-entry.pug'));\n fs.readFile(templatePath, \"ASCII\", function (err, data) {\n console.log(\"Generating client-side sidebar entry templates.\");\n if (err !== null) console.log(\"Error from file read:\", err);\n else profileOwnedFn = jade.compileClient(data, null);\n });\n templatePath = path.normalize(path.join(__dirname.substr(0, __dirname.lastIndexOf(path.sep)), 'views', 'app-profile-subscribed-entry.pug'));\n fs.readFile(templatePath, \"ASCII\", function (err, data) {\n console.log(\"Generating client-side sidebar entry templates.\");\n if (err !== null) console.log(\"Error from file read:\", err);\n else profileSubscribedFn = jade.compileClient(data, null);\n });\n}", "function makeTeam (){\n fs.writeFileSync(outputPath, render(team), \"utf-8\");\n}", "function gulpFontgen(options) {\n\n\t// Creating a stream through which each file will pass\n\tvar stream = through.obj(function(file, enc, callback) {\n\n\t\toptions.source = file.path;\n\n\t\tvar font = file.path;\n\t\tvar extension = path.extname(font);\n var fontname = path.basename(font, extension);\n\n\t\toptions.css = options.fontface + '/' + fontname + options.ext;\n\t\toptions.css_fontpath = options.relative;\n\n mkdirp(options.fontface);\n\n\t\tfontface(options);\n\n\t\tthis.push(file);\n\t\treturn callback();\n\n\t});\n\n\treturn stream;\n}", "function convert() {\n const { fileName: sdfObjectFileName } = utils.getConsoleArguments();\n\n const sdfObject = utils.getDataFromFile(sdfObjectFileName);\n\n const sdfObjectConverter = new SDFObjectConverter(sdfObject);\n const thingModel = sdfObjectConverter.convert();\n const thingModelJSON = JSON.stringify(thingModel, null, \"\\t\");\n fs.writeFileSync(\"./generated-thing-model.json\", thingModelJSON);\n}", "function writeJekyllInfoFiles() {\n console.log('Writing jekyll info files.');\n jsonfile.spaces = 2;\n jsonfile.writeFile(dataFile, _.sortBy(profileData, 'last'), function (err) {\n if (err != null) {\n console.error(err);\n }\n });\n\n filterInterest.writeToFile();\n hallOfFameGenerator.generateHallOfFameTemplate(profileData);\n}", "function writeConvertCall() {\n console.log(\"HTML: Replace ___PKG___ variables in generated file: \"+pkg.build.html);\n codegen.write_convert_json(pkg.build.html, pkg.build.html, pkg);\n console.log(\"CSS: Replace ___PKG___ variables in generated file: \"+pkg.build.css);\n codegen.write_convert_json(pkg.build.css, pkg.build.css, pkg);\n console.log(\"README: Replace ___PKG___ variables in generated file: \"+pkg.build.readme);\n codegen.write_convert_json(pkg.build.readme, pkg.build.readme, pkg);\n console.log(\"LIB: Replace ___PKG___ variables in generated file: \"+pkg.build.readme);\n codegen.write_convert_json(vLibOut, vLibOut, pkg);\n codegen.write_convert_json(vLibDist, vLibDist, pkg);\n console.log(\"Replacing ___PKG___ variables in generated files DONE: \"+vLibOut);\n\n //window = window || {};\n console.log(\"Require Constructor\");\n var vConstructor = require(\"./jscc/constructor.js\");\n //console.log(\"Constructor: \" + vConstructor);\n b4c.js2uml(pkg.exportvar,vConstructor,pkg);\n\n codegen.log_done(pkg);\n\n}", "static make(options) {\n if (!options.baseDir) {\n throw new Error('You must provide a \\'baseDir\\' property');\n }\n\n return class extends BaseGenerator {\n constructor(args, opts) {\n super(args, opts, options.options, options.prompts);\n\n this._templatesPath = path.join(options.baseDir, options.templatesDir || 'templates');\n this._prefixRules = options.prefixRules || {};\n\n // Base methods\n const proto = Object.getPrototypeOf(this);\n ['prompting', 'writing'].forEach(method => proto[method] = super[method]);\n\n // Additional methods\n const generatorBase = options.generator;\n if (generatorBase) {\n Object.getOwnPropertyNames(generatorBase.prototype)\n .filter(method => method.charAt(0) !== '_' && method !== 'constructor')\n .forEach(method => proto[method] = generatorBase.prototype[method]);\n }\n }\n };\n }", "function EndofPrompts() {\r\n fs.writeFileSync(genFilePath, \"\");\r\n let markupData = genStartHtml();\r\n\r\n for (var a in staff) {\r\n markupData += staffHtml(staff[a]);\r\n }\r\n markupData += genFinalHtml();\r\n fs.writeFileSync(genFilePath, markupData);\r\n\r\n }", "function writeFile(file, content, header, fileType = 'ts', disableFlags = []) {\n if (fileType === 'ts') {\n disableFlags.unshift('max-line-length');\n const disable = `/* tslint:disable:${disableFlags.join(' ')} */`;\n content = `${disable}\\n${header}\\n${content}`;\n }\n fs.writeFileSync(file, content);\n out(`${file} generated`, TermColors.green);\n}", "function fileSystem$2(context, file, fileSet, next) {\n var destinationPath;\n\n if (!context.output) {\n debug$2('Ignoring writing to file-system');\n return next()\n }\n\n if (!file.data.unifiedEngineGiven) {\n debug$2('Ignoring programmatically added file');\n return next()\n }\n\n destinationPath = file.path;\n\n if (!destinationPath) {\n debug$2('Cannot write file without a `destinationPath`');\n return next(new Error('Cannot write file without an output path'))\n }\n\n if (stats(file).fatal) {\n debug$2('Cannot write file with a fatal error');\n return next()\n }\n\n destinationPath = path$4.resolve(context.cwd, destinationPath);\n debug$2('Writing document to `%s`', destinationPath);\n\n file.stored = true;\n\n fs$4.writeFile(destinationPath, file.toString(), next);\n}", "function writeToFile(fileName, data) {\n fs.writeFileSync('./generated/'+fileName, generateMarkdown(data), error => {\n console.log(\"Generating README\");\n if (error) throw error;\n console.log(\"README generated.\");\n });\n \n}", "function writeToFile(genReadMe, data) {\n fs.writeFile(genReadMe, data, (err) => {\n console.log(err);\n });\n console.log(\"README.md successfully made!\");\n}", "generateConfigs() {\n this._createDirs();\n this._readFiles(this.source)\n .then(files => {\n console.log('Loaded ', files.length, ' files');\n const configs = this._loadConfigs(files);\n const common = this._getCommonJson(configs);\n\n this._writeData(common, 'default', 'json');\n this._generateFilesWithoutCommon(configs, common);\n this._generateCustomEnvironmentVariablesJson();\n })\n .catch(error => console.log(error));\n }", "async function main() {\n const children = await readdir(apiPath);\n const dirs = children.filter(x => {\n return !x.endsWith('.ts') && !x.includes('compute');\n });\n const contents = nunjucks.render(templatePath, { apis: dirs });\n await writeFile(indexPath, contents);\n const q = new p_queue_1.default({ concurrency: 50 });\n console.log(`Generating docs for ${dirs.length} APIs...`);\n let i = 0;\n const promises = dirs.map(dir => {\n return q\n .add(() => execa(process.execPath, [\n '--max-old-space-size=8192',\n './node_modules/.bin/compodoc',\n `src/apis/${dir}`,\n '-d',\n `./docs/${dir}`,\n ]))\n .then(() => {\n i++;\n console.log(`[${i}/${dirs.length}] ${dir}`);\n });\n });\n await Promise.all(promises);\n}", "function compileTypeDocTheme() {\n\tconsole.log('Compile TypeDoc theme');\n\texecSync(\n\t\t`${path.normalize(\n\t\t\tENV_NODE\n\t\t)} ./node_modules/typescript/lib/tsc.js -p ${TYPEDOC_THEME_PATH}`\n\t);\n}", "function downloadGrammar() {\n saveJSON(grammar, 'haiku_grammar.json');\n}", "compileOneFile(inputFile) {\n\t\tvar pathInPackage = inputFile.getPathInPackage();\n\t\tvar packageName = inputFile.getPackageName();\n\t\tif (packageName) {\n\t\t\tpackageName = packageName.replace('local-test:', '');\n\t\t}\n\t\tvar fullPath = pathInPackage;\n\t\tif (packageName) {\n\t\t\tfullPath = path.join(packagesPath, packageName, fullPath);\n\t\t}\n\n\t\t// console.log('Compiling...', (packageName || 'app') + '/' + pathInPackage);\n\n\t\tif (pathInPackage.indexOf('node_modules/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in node_modules');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.indexOf('typings/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in typings');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.substr(-5) === '.d.ts') {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its a definition');\n\t\t\treturn {};\n\t\t}\n\n\t\t// generatePackageRefs();\n\t\tif (\n\t\t\tpackageName &&\n\t\t\ttypescriptPackages[packageName].client.files.indexOf(pathInPackage) === -1 &&\n\t\t\ttypescriptPackages[packageName].server.files.indexOf(pathInPackage) === -1\n\t\t) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its not added to package.js');\n\t\t\treturn {};\n\t\t}\n\n\t\t// cache check\n\t\tvar cachePath = path.join(cacheDir, isApp && !disableInApp ? path.relative('../', fullPath) : path.relative(meteorPath, fullPath));\n\t\tvar baseName = path.basename(fullPath, '.ts');\n\t\tvar changeTime = fs.statSync(fullPath).mtime;\n\t\tvar jsPath = path.join(path.dirname(cachePath), baseName + '.js');\n\t\tvar error;\n\n\t\t// references\n\t\tvar dir = path.dirname(path.relative('./', fullPath));\n\t\tif (!packageName) {\n\t\t\tif (appDirs.indexOf(dir) == -1) {\n\t\t\t\tappDirs.push(dir);\n\t\t\t}\n\t\t\tif (appRefs.indexOf(pathInPackage) == -1) {\n\t\t\t\tappRefs.push(pathInPackage);\n\t\t\t\tappDirs.forEach(function (dir) {\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"server.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-server.d.ts')) + '\" />\\n');\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"client.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-client.d.ts')) + '\" />\\n');\n\t\t\t\t});\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-server.d.ts'), getAppRefs('server'));\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-client.d.ts'), getAppRefs('client'));\n\t\t\t}\n\t\t}\n\n\t\tvar doesntExists = !fs.existsSync(jsPath);\n\t\tvar existingTime = !doesntExists && fs.statSync(jsPath).mtime;\n\t\tvar isTooOld = existingTime && changeTime.getTime() > existingTime.getTime();\n\t\tif (doesntExists || isTooOld) {\n\n\t\t\tif (doesntExists) {\n\t\t\t\tconsole.log('Compiling because doesnt exist:', fullPath);\n\t\t\t\t// console.log(\n\t\t\t\t// \ttypescriptPackages[packageName].client.files,\n\t\t\t\t// \ttypescriptPackages[packageName].server.files\n\t\t\t\t// );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('Compiling because too old:', fullPath);\n\t\t\t}\n\n\t\t\tvar exec = Npm.require('child_process').exec;\n\t\t\tvar Future = Npm.require('fibers/future');\n\n\t\t\tfunction execSync(command) {\n\t\t\t\tvar fut = new Future();\n\t\t\t\texec(command, function (error, stdout, stderr) {\n\t\t\t\t\tfut.return({\n\t\t\t\t\t\tstdout: stdout,\n\t\t\t\t\t\tstderr: stderr || error\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\treturn fut.wait();\n\t\t\t}\n\n\t\t\tvar compileCommand = 'node ' + compilerPath + ' ' +\n\t\t\t\t'--target ES5 ' +\n\t\t\t\t'--sourcemap ' +\n\t\t\t\t'--module amd ' +\n\t\t\t\t'--experimentalDecorators ' +\n\t\t\t\t'--emitDecoratorMetadata ' +\n\t\t\t\t//'--pretty ' +\n\t\t\t\t'--emitVerboseMetadata ' +\n\t\t\t\t'--skipEmitVarForModule ' +\n\t\t\t\t'--outDir ' + cacheDir + ' ' + (disableInApp ? meteorAllPath : allPath);\n\n\t\t\t// console.log(compileCommand);\n\t\t\ttry {\n\t\t\t\tvar result = execSync(compileCommand);\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t}\n\n\t\t\tif (result.stderr) {\n\t\t\t\tvar lines = (typeof result.stderr === 'string' ? result.stderr : result.stdout).split('\\n');\n\t\t\t\tvar errors = [];\n\t\t\t\tfor (var i = 0; i < lines.length; i++) {\n\t\t\t\t\tif (!lines[i]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\terrors.push(lines[i]);\n\t\t\t\t}\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\terror = errors.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!error && !fs.existsSync(jsPath)) {\n\t\t\t\terror = 'File was not created: ' + jsPath;\n\t\t\t}\n\t\t\tif (error) {\n\t\t\t\ttry {\n\t\t\t\t\tfs.unlinkSync(jsPath);\n\t\t\t\t\tfs.unlinkSync(cachePath + '.map');\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t\t// ../meteor/packages/marketing/TransactionServer.ts(1078,10)\n\t\t\t\terror = error\n\t\t\t\t\t.replace(/(\\x1b\\[30m)/g, '\\n$1')\n\t\t\t\t\t// .replace(/([a-zA-Z0-9\\.\\/_-]+)\\(([0-9]+),([0-9]+)\\)/g, '\\n\\x1b[42;1m' + process.cwd().replace(new RegExp('^/Users/' + process.env.USER, 'g'), '~') + '/$1:$2 $3\\x1b[0m');\n\t\t\t\tinputFile.error({\n\t\t\t\t\tmessage: error\n\t\t\t\t});\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tvar data = fs.readFileSync(jsPath).toString();\n\n\t\t//console.log('adding: ' + jsPath)\n\t\t// couple of hacks for meteor namespacing\n\t\tvar prep = '';\n\t\tdata = data\n\t\t//.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1' + prep)\n\t\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n(\\/\\*(.|\\n)+\\*\\/\\n)?)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t//.replace(/(var __decorate[\\w\\s!=\"\\(\\)&|,.;:}{]*};\\n)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, prep)\n\t\t\t.replace(/\\/\\/# sourceMappingURL=.+/, '');\n\t\t//\t\t.replace(/\\}\\)\\(([a-zA-Z0-9_]+) \\|\\| \\(([a-zA-Z0-9_]+) = \\{\\}\\)\\);(\\n\\/\\/# sourceMappingURL)/, '})($1);$3');\n\t\t//\tdata = data\n\t\t//\t\t.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, 'this.$1 = this.$1 || {};\\nvar $1 = this.$1;');\n\n\t\tvar map = fs.readFileSync(jsPath + '.map')\n\t\t\t.toString()\n\t\t\t.replace(/\"sources\":\\[\"[0-9a-zA-Z-\\/\\.-]+\"]/, '\"sources\":[\"' + inputFile.getDisplayPath() + '\"]');\n\t\tmap = map.substr(0, map.length - 1) + ',\"sourcesContent\":[\"' + fs.readFileSync(fullPath)\n\t\t\t\t.toString()\n\t\t\t\t.replace(/[\\\\]/g, '\\\\\\\\')\n\t\t\t\t.replace(/[\"]/g, '\\\\\"')\n\t\t\t\t.replace(/[\\b]/g, '\\\\b')\n\t\t\t\t.replace(/[\\f]/g, '\\\\f')\n\t\t\t\t.replace(/[\\n]/g, '\\\\n')\n\t\t\t\t.replace(/[\\r]/g, '\\\\r')\n\t\t\t\t.replace(/[\\t]/g, '\\\\t') + '\"]}';\n\t\treturn {\n\t\t\tpath: pathInPackage + \".js\",\n\t\t\tdata: data,\n\t\t\tsourceMap: map\n\t\t};\n\t}", "function writeToFile(fileName, data) {\n fs.writeFile(\"./Generator/\"+fileName, data, function(err) {\n if (err) {\n return console.log(err);\n }\n console.log (\"Successfully wrote: \" + fileName);\n })\n \n}", "function write_rdf_type(file, res, tag) {\n return [' <rdf:Description rdf:about=\"' + file + '\">\\n', ' <rdf:type rdf:resource=\"http://docs.oasis-open.org/ns/office/1.2/meta/' + (tag || \"odf\") + '#' + res + '\"/>\\n', ' </rdf:Description>\\n'].join(\"\");\n }", "function createTeam() {\n\n fs.writeFileSync(outputPath, render(myTeam), 'utf-8');\n\n}", "async function main() {\n // get all .svelte files\n glob(path.join(srcPath, \"**/*.svelte\"), null, async function (err, files) {\n if (err) throw err;\n // process them\n await Promise.all(files.map((filePath) => preprocessSvelte(path.resolve(filePath))));\n });\n\n // move .d.ts files into /dist/ts\n glob(path.join(distPath, \"**/*.d.ts\"), null, async function (err, files) {\n if (err) throw err;\n const tsPath = path.join(distPath, \"ts\");\n\n await Promise.all(\n files.map(async (filePath) => {\n filePath = path.resolve(filePath);\n // ignore anything in /dist/ts (could probably make a better glob pattern)\n if (!filePath.includes(tsPath)) {\n await fs.move(filePath, filePath.replace(distPath, tsPath), {\n overwrite: true,\n });\n }\n })\n );\n });\n}", "function build() {\n //conditional statement that checks if the output directory has been created\n if(!fs.existsSync(OUTPUT_DIR)) {\n fs.mkdirSync(OUTPUT_DIR)\n\n }\n //validation of dir and path variables\nconsole.log(OUTPUT_DIR, outputPath)\n//this writes the html file\nfs.writeFileSync(outputPath, render(members), \"utf-8\")\n\n}", "function run () {\n // get category folders and functions\n var fcns = {};\n var mainpath = './../';\n var folders = fs.readdirSync(mainpath + 'lib','utf8');\n\n for (var i = 0;i < folders.length; i++) {\n\n if (folders[i].lastIndexOf('.js') === -1) {\n\n var files = fs.readdirSync(mainpath + 'lib/' + folders[i],'utf8');\n var outpath = mainpath + 'doc/' + folders[i];\n mkdirp(outpath, function(err) {\n if (err) console.log(err) \n });\n\n for (var j = 0;j < files.length; j++) {\n // generate doc\n var fundoc = gendoc(files[j],folders[i]);\n\n // generaye markdown\n var funmd = genmd(fundoc);\n\n // generate test\n gentest(fundoc);\n name = fundoc.name;\n fcns[name] = {\n name: name,\n category: fundoc.category,\n link: '/' + folders[i] + '/' + name + '.md',\n summary: fundoc.summary,\n md: funmd\n }\n try {\n fs.writeFileSync(outpath + '/' + name + '.md',funmd);\n } catch (err) {\n console.log(err)\n }\n }\n }\n }\n\n // set categories\n var catgs = {};\n for (var k in fcns) {\n var fn = fcns[k];\n var categ = catgs[fn.category];\n if (!categ) {\n catgs[fn.category] = {};\n }\n catgs[fn.category][k] = fcns[k];\n }\n \n // create CONTENTS.md for Markdown docs\n function categmd(catgs) {\n var categorical = \"## Contents\\n\\n\";\n categorical += Object.keys(catgs).sort().map(function(a) {\n var fn = catgs[a];\n return '### ' + a + '\\n\\n' +\n Object.keys(fn).sort().map(function(b) {\n return '- [' + fn[b].name + '](/doc' + fn[b].link + ')' + ' - ' + fn[b].summary;\n }).join('\\n') + '\\n';\n }).join('\\n');\n fs.writeFileSync(mainpath + 'doc/contents.md',categorical);\n }\n \n // create CONTENTS.md for HTML docs\n // ex. - [isarray](/doc/apiref.html#-test-isarray)\n function categhtml(catgs) {\n var categorical = \"# Contents\\n\\n\";\n categorical += Object.keys(catgs).sort().map(function(a) {\n var fn = catgs[a];\n return '## ' + a + '\\n\\n' +\n Object.keys(fn).sort().map(function(b) {\n var labcat = fn[b].category.toLowerCase().replace(/ /g,'-');\n return '- [' + fn[b].name + '](/doc/apidoc.html#-' + labcat + '-' + fn[b].name + ')' + ' - ' + fn[b].summary;\n }).join('\\n') + '\\n';\n }).join('\\n');\n fs.writeFileSync('../../maxto.github.io/doc/contentshtml.md',categorical);\n }\n \n // create APIDOC.md\n function apidoc(catgs) {\n var categorical = '';\n categorical += Object.keys(catgs).sort().map(function(a) {\n var fn = catgs[a];\n return '## ' + a + '\\n\\n' +\n Object.keys(fn).sort().map(function(b) {\n return fn[b].md;\n }).join('\\n') + '\\n';\n }).join('\\n');\n fs.writeFileSync('../../maxto.github.io/doc/apidochtml.md',categorical);\n }\n\n\n // build\n categmd(catgs);\n categhtml(catgs);\n apidoc(catgs);\n\n}", "async function toJsonSchema(outputPath) {\n let schemas = [];\n //Pages V2\n let paths = [];\n paths.push(path_1.join('src', 'specification', 'v2', 'pages'));\n convertPagesOfFEVersion(schemas, paths, common_1.FioriElementsVersion.v2, outputPath);\n //Pages V4\n paths = [];\n paths.push(path_1.join('src', 'specification', 'v4', 'pages'));\n convertPagesOfFEVersion(schemas, paths, common_1.FioriElementsVersion.v4, outputPath);\n //App V2\n schemas = convertInterfaces(path_1.join('src', 'specification', 'v2'), ['ApplicationV2.ts'], common_1.FioriElementsVersion.v2);\n writeSchemasToFile(outputPath, schemas, 'v2');\n //App V4\n schemas = convertInterfaces(path_1.join('src', 'specification', 'v4'), ['ApplicationV4.ts'], common_1.FioriElementsVersion.v4);\n writeSchemasToFile(outputPath, schemas, 'v4');\n}", "function cleanTypescriptDeclarationFiles(filePath) {\n if (filePath) {\n let isDir = fs.statSync(filePath);\n const dir = isDir.isDirectory() ? filePath : path.dirname(filePath);\n const subDirs = fs.readdirSync(dir);\n\n if (subDirs.length) {\n for (let i = 0; i <= subDirs.length; i++) {\n if (subDirs[i]) {\n const dirPath = `${dir}/${subDirs[i]}`;\n isDir = fs.statSync(dirPath);\n if (isDir?.isDirectory() && subDirs[i].startsWith('hippy-')) {\n fs.rmSync(dirPath, {\n force: true,\n recursive: true,\n });\n }\n }\n }\n }\n }\n}", "_writingMarkup() {\n this.fs.copy(\n this.templatePath('src_markup_layouts_default.html'),\n this.destinationPath('src/markup/layouts/default.html')\n );\n this.fs.copy(\n this.templatePath('src_markup_pages_index.html'),\n this.destinationPath('src/markup/pages/index.html')\n );\n this.fs.copy(\n this.templatePath('src_markup_partials_area_footer.html'),\n this.destinationPath('src/markup/partials/area/footer.html')\n );\n this.fs.copy(\n this.templatePath('src_markup_partials_area_header.html'),\n this.destinationPath('src/markup/partials/area/header.html')\n );\n this.fs.copy(\n this.templatePath('src_markup_index.html'),\n this.destinationPath('src/markup/index.html')\n );\n }", "function figureBedGen() {\n hexo.extend.filter.register(\"after_generate\", function () {\n log.info(\"---- START GENERATING PICTURE FILES ----\");\n try {\n var arr = [];\n const LinkFilePath = figureBedLinkFilePath;\n const output = targetPhotoListDir;\n (function toJson(path) {\n let linklistfile = fs.readFileSync(path);\n var cache = linklistfile.toString().split('\\n');\n if (!cache) {\n log.info(\"LinkList file is empty!\");\n return;\n }\n var content = JSON.stringify(cache, null, \"\\t\");\n fs.writeFile(output, content);\n })(LinkFilePath);\n } catch (err) {\n log.info(err);\n }\n var photojslibPath = pathFn.join(__dirname, \"lib/figureBed.js\");\n var photoJsContent = fs.readFileSync(photojslibPath);\n fs.writeFile(photoPubPath, photoJsContent);\n log.info(\"---- END GENERATING PICTURE FILES ----\");\n });\n\n}", "function writePage() {\n readFiles(src);\n\n const page = src + \"/index.html\";\n const content = getContent(filesArr);\n const data = template.replace(\"<% code %>\", content);\n\n fs.writeFile(page, data, (err) => {\n if (err) throw err;\n console.log(\"It's saved!\");\n });\n}", "function createType(m) {\n var typeDef = 'type ' + m.modelName + ' { \\n';\n //console.log(m);\n Object.keys(m.definition.properties).forEach((k, index) => {\n var p = m.definition.properties[k];\n var s = null;\n if (k === 'id' && p.id && p.generated) {\n s = k + ': ID' + '\\n';\n }\n else {\n s = k + ': ' + convertFromLoopbackType(p) + '\\n';\n }\n typeDef += s;\n });\n typeDef += ' }\\n\\n';\n return typeDef;\n}", "function buildTeam() {\n\n //this function uses the file system to create an html file with the data collected from user prompts. It puts the file in the directory specified by the output\n //path argument. It uses the render function to inject the collected user data sitting in the teamArray into the template js file, and uses that to generate the html\n fs.writeFileSync(output_path, render(teamArray), \"utf-8\");\n}", "function initTypedJs() {\r\n new Typed(\".typed\", {\r\n strings: [\"A Coder.\",\"Frontend.\", \"Analytical.\", \"A Web Developer.\", \"A Gamer.\"],\r\n typeSpeed: 85,\r\n loop: true,\r\n });\r\n}", "function ioOTF_exportOTFfont() {\n\t\t// debug('\\n ioOTF_exportOTFfont - START');\n\t\t// debug('\\t combineshapesonexport = ' + _GP.projectsettings.combineshapesonexport);\n\t\t\n\t\tfunction firstExportStep() {\n\t\t\t// debug('\\n firstExportStep - START');\n\n\t\t\t// Add metadata\n\t\t\tvar md = _GP.metadata;\n\t\t\tvar ps = _GP.projectsettings;\n\n\t\t\toptions.unitsPerEm = ps.upm || 1000;\n\t\t\toptions.ascender = ps.ascent || 0.00001;\n\t\t\toptions.descender = (-1 * Math.abs(ps.descent)) || -0.00001;\n\t\t\toptions.familyName = (md.font_family) || ' ';\n\t\t\toptions.styleName = (md.font_style) || ' ';\n\t\t\toptions.designer = (md.designer) || ' ';\n\t\t\toptions.designerURL = (md.designerURL) || ' ';\n\t\t\toptions.manufacturer = (md.manufacturer) || ' ';\n\t\t\toptions.manufacturerURL = (md.manufacturerURL) || ' ';\n\t\t\toptions.license = (md.license) || ' ';\n\t\t\toptions.licenseURL = (md.licenseURL) || ' ';\n\t\t\toptions.version = (md.version) || 'Version 0.001';\n\t\t\toptions.description = (md.description) || ' ';\n\t\t\toptions.copyright = (md.copyright) || ' ';\n\t\t\toptions.trademark = (md.trademark) || ' ';\n\t\t\toptions.glyphs = [];\n\n\t\t\t// debug('\\t NEW options ARG BEFORE GLYPHS');\n\t\t\t// debug(options);\n\t\t\t// debug('\\t options.version ' + options.version);\n\n\t\t\t// Add Notdef\n\t\t\tvar notdef = new Glyph({'name': 'notdef', 'shapes':JSON.parse(_UI.notdefglyphshapes)});\n\t\t\tif(_GP.upm !== 1000){\n\t\t\t\tvar delta = _GP.upm / 1000;\n\t\t\t\tnotdef.updateGlyphSize(delta, delta, true);\n\t\t\t}\n\n\t\t\tvar ndpath = notdef.makeOpenTypeJSpath();\n\n\t\t\toptions.glyphs.push(new opentype.Glyph({\n\t\t\t\tname: '.notdef',\n\t\t\t\tunicode: 0,\n\t\t\t\tindex: getNextGlyphIndex(),\n\t\t\t\tadvanceWidth: round(notdef.getAdvanceWidth()),\n\t\t\t\txMin: round(notdef.maxes.xmin),\n\t\t\t\txMax: round(notdef.maxes.xmax),\n\t\t\t\tyMin: round(notdef.maxes.ymin),\n\t\t\t\tyMax: round(notdef.maxes.ymax),\n\t\t\t\tpath: ndpath\n\t\t\t}));\n\n\t\t\t// debug(' firstExportStep - END\\n');\n\t\t}\n\n\t\tfunction getNextGlyphIndex() { return glyphIndex++; }\n\n\t\tvar privateUseArea = [];\n\n\t\tfunction getNextLigatureCodePoint() {\n\t\t\twhile(ligatureCodePoint < 0xF8FF){\n\t\t\t\tif(privateUseArea.includes(ligatureCodePoint)){\n\t\t\t\t\tligatureCodePoint++;\n\t\t\t\t} else {\n\t\t\t\t\tprivateUseArea.push(ligatureCodePoint);\n\t\t\t\t\treturn ligatureCodePoint;\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fallback. This really shouldn't happen... but if somebody\n\t\t\t// has used the entire Private Use area, I guess we'll just\n\t\t\t// start throwing Ligatures into the Korean block?\n\n\t\t\tconsole.warn('The entire Unicode Private Use Area (U+E000 to U+F8FF) seems to be taken. Ligatures will now be added to the block starting at U+AC00.');\n\t\t\tligatureCodePoint = 0xAC00;\n\t\t\treturn getNextLigatureCodePoint();\n\t\t}\n\n\t\tfunction populateExportLists() {\n\t\t\t// debug('\\n populateExportLists - START');\n\n\t\t\t// Add Glyphs\n\t\t\tvar ranges = assembleActiveRanges();\n\n\t\t\tfor(var c in _GP.glyphs){ if(_GP.glyphs.hasOwnProperty(c) && isGlyphInActiveRange(c, ranges)){\n\t\t\t\tif(parseInt(c)){\n\t\t\t\t\ttg = new Glyph(clone(_GP.glyphs[c]));\n\t\t\t\t\tdebug(`\\t adding glyph ${c} \"${tg.name}\"`);\n\t\t\t\t\texportGlyphs.push({xg:tg, xc: c});\n\t\t\t\t\tif(parseInt(c) >= 0xE000) privateUseArea.push(parseInt(c));\n\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn('Skipped exporting Glyph ' + c + ' - non-numeric key value.');\n\t\t\t\t}\n\t\t\t}}\n\t\t\t\n\t\t\texportGlyphs.sort(function(a,b){ return a.xc - b.xc; });\n\t\t\t\n\t\t\t// Add Ligatures\n\t\t\tvar ligWithCodePoint;\n\t\t\tfor(var l in _GP.ligatures){ if(_GP.ligatures.hasOwnProperty(l)){\n\t\t\t\ttg = new Glyph(clone(_GP.ligatures[l]));\n\t\t\t\t// debug(`\\t adding ligature \"${tg.name}\"`);\n\t\t\t\texportLigatures.push({xg:tg, xc: l});\n\n\t\t\t\tligWithCodePoint = doesLigatureHaveCodePoint(l);\n\t\t\t\tif(ligWithCodePoint) exportGlyphs.push({xg:tg, xc:ligWithCodePoint.point});\t\t\t\t\n\t\t\t}}\n\n\t\t\t// debug(' populateExportLists - END\\n');\n\t\t}\n\n\t\tfunction generateOneGlyph() {\n\t\t\t// debug('\\n generateOneGlyph - START');\n\t\t\t// export this glyph\n\t\t\tvar glyph = currentExportItem.xg;\n\t\t\tvar num = currentExportItem.xc;\n\t\t\tvar comb = _GP.projectsettings.combineshapesonexport;\n\t\t\tvar name = getUnicodeShortName(''+decToHex(num));\n\n\t\t\tshowToast('Exporting<br>'+glyph.name, 999999);\n\n\t\t\tif(comb && glyph.shapes.length <= _GP.projectsettings.maxcombineshapesonexport) glyph.combineAllShapes(true);\n\n\t\t\tif(glyph.isautowide) {\n\t\t\t\tglyph.updateGlyphPosition(glyph.getLSB(), 0, true);\n\t\t\t\tglyph.leftsidebearing = 0;\n\t\t\t}\n\n\t\t\tvar tgpath = glyph.makeOpenTypeJSpath(new opentype.Path());\n\n\t\t\tvar index = getNextGlyphIndex();\n\n\t\t\tvar glyphInfo = {\n\t\t\t\tname: name,\n\t\t\t\tunicode: parseInt(num),\n\t\t\t\tindex: index,\n\t\t\t\tadvanceWidth: round(glyph.getAdvanceWidth() || 1),\t// has to be non-zero\n\t\t\t\tpath: tgpath\n\t\t\t};\n\t\t\t\n\t\t\tcodePointGlyphIndexTable[''+decToHex(num)] = index;\n\n\t\t\t// debug(glyphInfo);\n\t\t\t// debug(glyphInfo.path);\n\n\t\t\t// Add this finshed glyph\n\t\t\toptions.glyphs.push(new opentype.Glyph(glyphInfo));\n\n\n\t\t\t// start the next one\n\t\t\tcurrentExportNumber++;\n\n\t\t\tif(currentExportNumber < exportGlyphs.length){\n\t\t\t\tcurrentExportItem = exportGlyphs[currentExportNumber];\n\t\t\t\tsetTimeout(generateOneGlyph, 10);\n\n\t\t\t} else {\n\n\t\t\t\tif(exportLigatures.length){\n\t\t\t\t\t// debug('\\t codePointGlyphIndexTable');\n\t\t\t\t\t// debug(codePointGlyphIndexTable);\n\n\t\t\t\t\tcurrentExportNumber = 0;\n\t\t\t\t\tcurrentExportItem = exportLigatures[0];\n\t\t\t\t\tsetTimeout(generateOneLigature, 10);\n\t\t\t\t} else {\n\t\t\t\t\tshowToast('Finalizing...', 10);\n\t\t\t\t\tsetTimeout(lastExportStep, 10);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// debug(' generateOneGlyph - END\\n');\n\t\t}\n\t\t\n\t\tfunction generateOneLigature(){\n\t\t\t// debug('\\n generateOneLigature - START');\n\t\t\t// export this glyph\n\t\t\tvar liga = currentExportItem.xg;\n\t\t\tvar ligaID = currentExportItem.xc;\n\t\t\tvar comb = _GP.projectsettings.combineshapesonexport;\n\t\t\t\n\t\t\t// debug('\\t doing ' + ligaID + ' ' + liga.name);\n\n\t\t\tshowToast('Exporting<br>'+liga.name, 999999);\n\n\t\t\tif(comb && liga.shapes.length <= _GP.projectsettings.maxcombineshapesonexport) liga.combineAllShapes(true);\n\n\t\t\tif(liga.isautowide) {\n\t\t\t\tliga.updateGlyphPosition(liga.getLSB(), 0, true);\n\t\t\t\tliga.leftsidebearing = 0;\n\t\t\t}\n\n\t\t\tvar tgpath = liga.makeOpenTypeJSpath(new opentype.Path());\n\t\t\t\n\t\t\tvar ligaCodePoint = getNextLigatureCodePoint();\n\t\t\tvar index = getNextGlyphIndex();\n\n\t\t\tvar glyphInfo = {\n\t\t\t\tname: liga.name,\n\t\t\t\tunicode: ligaCodePoint,\n\t\t\t\tindex: index,\n\t\t\t\tadvanceWidth: round(liga.getAdvanceWidth() || 1),\t// has to be non-zero\n\t\t\t\tpath: tgpath\n\t\t\t};\n\t\t\t\n\t\t\t// Add ligature glyph to the font\n\t\t\toptions.glyphs.push(new opentype.Glyph(glyphInfo));\n\n\t\t\t// Add substitution info to font\n\t\t\tvar subList = hexToChars(ligaID).split('');\n\t\t\tvar indexList = subList.map(function(v){ return codePointGlyphIndexTable[charToHex(v)]; });\n\t\t\t// debug('\\t INDEX sub: [' + indexList + '] by: ' + index + ' which is ' + ligaCodePoint);\n\t\t\tligatureSubstitutions.push({sub: indexList, by: index});\n\n\t\t\t// debug(glyphInfo);\n\n\t\t\t// start the next one\n\t\t\tcurrentExportNumber++;\n\n\t\t\tif(currentExportNumber < exportLigatures.length){\n\t\t\t\tcurrentExportItem = exportLigatures[currentExportNumber];\n\t\t\t\tsetTimeout(generateOneLigature, 10);\n\t\t\t} else {\n\t\t\t\tshowToast('Finalizing...', 10);\n\t\t\t\tsetTimeout(lastExportStep, 10);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction lastExportStep() {\t\n\t\t\t// Export\n\t\t\t_UI.stoppagenavigation = false;\n\t\t\t\n\t\t\toptions.glyphs.sort(function(a,b){ return a.unicode - b.unicode; });\n\t\t\tvar font = new opentype.Font(options);\n\n\t\t\tfor(var s=0; s<ligatureSubstitutions.length; s++) {\n\t\t\t\tfont.substitution.addLigature('liga', ligatureSubstitutions[s]);\n\t\t\t}\n\n\t\t\t// debug('\\t Font object:');\n\t\t\t// debug(font.glyphs);\n\t\t\t// debug(font.toTables());\n\n\t\t\tfont.download();\n\t\t\tsetTimeout(function(){_UI.stoppagenavigation = true;}, 2000);\n\t\t\t// debug(' lastExportStep - END\\n');\n\t\t}\n\n\n\n\t\t/*\n\t\t\tMAIN EXPORT LOOP\n\t\t*/\n\t\tvar options = {};\n\t\tvar codePointGlyphIndexTable = {};\n\t\tvar glyphIndex = 0;\n\t\tvar ligatureCodePoint = 0xE000;\n\t\tvar ligatureSubstitutions = [];\n\t\tvar exportGlyphs = [];\n\t\tvar exportLigatures = [];\n\t\tvar currentExportNumber = 0;\n\t\tvar currentExportItem ={};\n\n\t\tfirstExportStep();\n\t\tpopulateExportLists();\n\t\tcurrentExportItem = exportGlyphs[0];\n\t\tgenerateOneGlyph();\n\n\n\t\t// debug(' ioOTF_exportOTFfont - END\\n');\n\t}", "function buildTeam() {\n fs.writeFileSync(outputPath, render(team), \"utf-8\");\n }", "generate (type) {\n return generate(type)\n }", "function doTemplating(pkg, dry_run, choice, tdir, willDo, nextFunc) {\n const basedir = process.cwd() + `/${choice.app}/`\n\n // if (opts.debug)\n // \tconsole.log(\"cwd=\"+process.cwd());\n\n recursive(tdir, [], function (err, files) {\n if (err) {\n console.error('Recursion error: ', err)\n }\n // Files is an array of filename\n // if (opts.debug)\n // console.log(files);\n files.forEach(function (f) {\n const destf = f.replace('templates/', basedir)\n console.info(`${willDo}Templating file ${f} => ${destf}`)\n const t = fs.readFileSync(f, 'utf8')\n // if (opts.debug)\n // console.log(\"template=\",t);\n const tt = _.template(t)\n const variables = {\n version: pkg.version,\n publications: Object.keys(modules)\n .map((key) => `import '/imports/api/${key}/server/publications'`)\n .join('\\n'),\n factoryImports: Object.keys(modules)\n .map((key) => `import './factory.${key}'`)\n .join('\\n'),\n routeImports: Object.keys(modules)\n .map(\n (key) =>\n `import ${modules[key]}List from '/imports/ui/${key}/lister'`\n )\n .join('\\n'),\n routeMarkup: Object.keys(modules)\n .map(\n (key) =>\n `<Route path=\"/admin/${key}\" component={${modules[key]}List} />`\n )\n .join('\\n'),\n }\n const buf = tt(variables)\n // if (opts.debug) {\n // console.log(`${willDo}writing ${destf}`);\n // }\n if (!dry_run) fs.writeFileSync(destf, buf)\n })\n nextFunc() // Call the next step in this async world\n })\n}", "function writeToFile(fileName, userInput) {\n fs.writeFile(`` + fileName, generatesite(userInput), function (err) {\n if (err) {\n return console.log(err);\n }\n\n console.log(\"Generating HTML...\");\n });\n}", "async function main() {\n // Process 1) Display Program Directions\n displayDirections();\n\n // Process 2) Get Template File Name\n if (argv.length < 3) { // A template file was not passed, verify default is okay to use\n const answer = await inquirer.prompt([\n {\n type: \"input\",\n name: \"inputFile\",\n message: `Enter Template File to Use (ENTER for Default of ${defaultInputFile}): `,\n validate(value) {\n if (value == \"\" || value === undefined) {\n return true;\n } else return checkFile(value);\n }\n }]);\n if (answer.inputFile == \"\" || answer.inputFile === undefined) { // Use default input file name\n inputFile = baseInputDirectory + defaultInputFile;\n } else {\n inputFile = baseInputDirectory + answer.inputFile;\n }\n } else {\n inputFile = baseInputDirectory + argv[2];\n }\n\n // Process 3) Get Output file name\n // Output file is passed in argsv[3]\n if (argv.length < 4) { // An output file was not passed, verify default is okay to use\n const answer = await inquirer.prompt([\n {\n type: \"input\",\n name: \"outputFile\",\n message: `Enter Output File to Use (ENTER for Default of ${defaultOutputFile}): `,\n validate(value) {\n return true;\n }\n }]);\n\n if (answer.outputFile == \"\" || answer.outputFile === undefined) { // Use default output file name\n outputFile = baseOutputDirectory + defaultOutputFile;\n } else {\n outputFile = baseOutputDirectory + answer.outputFile;\n }\n } else {\n outputFile = baseOutputDirectory + argv[3];\n }\n\n\n // Process 4) Process Template - breakout questions and output skeleton\n await fileGenerator.processTemplate(fs, inputFile);\n\n\n // Process 5) Ask Questions - store results in array\n await fileGenerator.askQuestions(inquirer);\n \n\n // Process 6) Write Output file - substitute answers in placeholders\n await fileGenerator.writeOutputFile(fs, outputFile);\n\n\n // Process 7) Close File Stream\n // This is not needed since we will not reuse fs and will be reclaimed by program ending\n //fs.close();\n\n \n // Process 8) ** Future Release **\n // Clean up local storage (will have to write a function called local storage that writes to disk)\n // localStorage.removeItem(\"Generator_Questions\");\n\n\n console.log(`${outputFile} has been created.`)\n return;\n}", "function makeTheFile(name, data){\n fs.writeFile('README.md', data, (err) => {\n if (err){\n console.log(err);\n }\n console.log(\"README has been successfully generated.\")\n })\n }" ]
[ "0.7189702", "0.6461203", "0.6074944", "0.5802386", "0.57882553", "0.5659313", "0.55635446", "0.5557573", "0.54775023", "0.5312856", "0.52679414", "0.52399546", "0.5210028", "0.51979256", "0.51685524", "0.51669836", "0.5165133", "0.5160877", "0.5146327", "0.51181906", "0.5097286", "0.5080064", "0.5075169", "0.50613487", "0.5027183", "0.49705744", "0.49672416", "0.4959075", "0.49346077", "0.49170345", "0.49154076", "0.49061477", "0.48869523", "0.48845837", "0.48711506", "0.4857919", "0.48530838", "0.48523095", "0.4843793", "0.48271906", "0.48263782", "0.481481", "0.48128292", "0.48120636", "0.4799737", "0.47879162", "0.477707", "0.47520563", "0.4738904", "0.4731458", "0.47268608", "0.4723752", "0.47088882", "0.4708496", "0.4703235", "0.4695428", "0.46912754", "0.466166", "0.46540308", "0.46540174", "0.4648854", "0.4645012", "0.4642136", "0.4631749", "0.46305224", "0.4629223", "0.46291214", "0.46245298", "0.46142593", "0.46135154", "0.46049052", "0.4601091", "0.45997933", "0.45964688", "0.4594057", "0.4592552", "0.45817047", "0.45795467", "0.4576422", "0.4572727", "0.45719096", "0.45617756", "0.45598155", "0.45591584", "0.4558859", "0.45586145", "0.45544356", "0.4536848", "0.4533869", "0.450834", "0.45000416", "0.44967312", "0.44875345", "0.44814816", "0.44800812", "0.4476675", "0.447369", "0.44678196", "0.44622594", "0.4460783" ]
0.729225
0
Ensures a unique name for each item in the package typings file.
_makeUniqueNames() { const usedNames = new Set(); // First collect the explicit package exports for (const dtsEntry of this._dtsEntries) { if (dtsEntry.exported) { if (usedNames.has(dtsEntry.originalName)) { // This should be impossible throw new Error(`Program bug: a package cannot have two exports with the name ${dtsEntry.originalName}`); } dtsEntry.nameForEmit = dtsEntry.originalName; usedNames.add(dtsEntry.nameForEmit); } } // Next generate unique names for the non-exports that will be emitted for (const dtsEntry of this._dtsEntries) { if (!dtsEntry.exported) { let suffix = 1; dtsEntry.nameForEmit = dtsEntry.originalName; while (usedNames.has(dtsEntry.nameForEmit)) { dtsEntry.nameForEmit = `${dtsEntry.originalName}_${++suffix}`; } usedNames.add(dtsEntry.nameForEmit); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processTypings(files) {\n // Set hashes of the app's typings.\n files.forEach(file => {\n let isAppTypings = this.isDeclarationFile(file) &&\n !this.isPackageFile(file);\n\n let path = file.getPathInPackage();\n if (isAppTypings && !this._typingsMap.has(path)) {\n this._typingsMap.set(path, file.getSourceHash());\n }\n });\n\n let copiedFiles = [];\n // Process package typings.\n files.forEach(file => {\n // Check if it's a package declaration file.\n let isPkgTypings = this.isDeclarationFile(file) &&\n this.isPackageFile(file);\n\n if (isPkgTypings) {\n let path = file.getPathInPackage();\n // Check if the file is in the \"typings\" folder.\n if (!this._typingsRegEx.test(path)) {\n console.log('Typings path ${path} doesn\\'t start with \"typings\"');\n return;\n }\n\n let filePath = this._getStandardTypingsFilePath(file);\n let oldHash = this._typingsMap.get(filePath);\n let newHash = file.getSourceHash();\n // Copy file if it doesn't exist or has been updated.\n if (oldHash !== newHash) {\n this._copyTypings(filePath, file.getContentsAsString());\n this._typingsMap.set(filePath, newHash);\n copiedFiles.push(filePath);\n }\n }\n });\n\n if (copiedFiles.length) {\n // Report about added/updated typings.\n console.log(chalk.green('***** Typings that have been added/updated *****'));\n copiedFiles.forEach(filePath => {\n console.log(chalk.green(filePath));\n });\n console.log(chalk.green(\n 'Add typings in tsconfig.json or by references in files.'));\n }\n }", "_makeUniqueNames() {\n // The following examples illustrate the nameForEmit heuristics:\n //\n // Example 1:\n // class X { } <--- nameForEmit should be \"A\" to simplify things and reduce possibility of conflicts\n // export { X as A };\n //\n // Example 2:\n // class X { } <--- nameForEmit should be \"X\" because choosing A or B would be nondeterministic\n // export { X as A };\n // export { X as B };\n //\n // Example 3:\n // class X { } <--- nameForEmit should be \"X_1\" because Y has a stronger claim to the name\n // export { X as A };\n // export { X as B };\n // class Y { } <--- nameForEmit should be \"X\"\n // export { Y as X };\n // Set of names that should NOT be used when generating a unique nameForEmit\n const usedNames = new Set();\n // First collect the names of explicit package exports, and perform a sanity check.\n for (const entity of this._entities) {\n for (const exportName of entity.exportNames) {\n if (usedNames.has(exportName)) {\n // This should be impossible\n throw new node_core_library_1.InternalError(`A package cannot have two exports with the name \"${exportName}\"`);\n }\n usedNames.add(exportName);\n }\n }\n // Ensure that each entity has a unique nameForEmit\n for (const entity of this._entities) {\n // What name would we ideally want to emit it as?\n let idealNameForEmit;\n // If this entity is exported exactly once, then we prefer the exported name\n if (entity.singleExportName !== undefined &&\n entity.singleExportName !== ts.InternalSymbolName.Default) {\n idealNameForEmit = entity.singleExportName;\n }\n else {\n // otherwise use the local name\n idealNameForEmit = entity.astEntity.localName;\n }\n // If the idealNameForEmit happens to be the same as one of the exports, then we're safe to use that...\n if (entity.exportNames.has(idealNameForEmit)) {\n // ...except that if it conflicts with a global name, then the global name wins\n if (!this.globalVariableAnalyzer.hasGlobalName(idealNameForEmit)) {\n // ...also avoid \"default\" which can interfere with \"export { default } from 'some-module;'\"\n if (idealNameForEmit !== 'default') {\n entity.nameForEmit = idealNameForEmit;\n continue;\n }\n }\n }\n // Generate a unique name based on idealNameForEmit\n let suffix = 1;\n let nameForEmit = idealNameForEmit;\n // Choose a name that doesn't conflict with usedNames or a global name\n while (usedNames.has(nameForEmit) || this.globalVariableAnalyzer.hasGlobalName(nameForEmit)) {\n nameForEmit = `${idealNameForEmit}_${++suffix}`;\n }\n entity.nameForEmit = nameForEmit;\n usedNames.add(nameForEmit);\n }\n }", "function generateItemNames() {\n for (let item of itemList) {\n itemNames.push(item.name);\n }\n}", "function UniqueTypeNamesRule(context) {\n var knownTypeNames = Object.create(null);\n var schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName\n };\n\n function checkTypeName(node) {\n var typeName = node.name.value;\n\n if (schema !== null && schema !== void 0 && schema.getType(typeName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type \\\"\".concat(typeName, \"\\\" already exists in the schema. It cannot also be defined in this type definition.\"), node.name));\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one type named \\\"\".concat(typeName, \"\\\".\"), [knownTypeNames[typeName], node.name]));\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}", "function UniqueTypeNamesRule(context) {\n var knownTypeNames = Object.create(null);\n var schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName\n };\n\n function checkTypeName(node) {\n var typeName = node.name.value;\n\n if (schema !== null && schema !== void 0 && schema.getType(typeName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Type \\\"\".concat(typeName, \"\\\" already exists in the schema. It cannot also be defined in this type definition.\"), node.name));\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one type named \\\"\".concat(typeName, \"\\\".\"), [knownTypeNames[typeName], node.name]));\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}", "function UniqueTypeNamesRule(context) {\n var knownTypeNames = Object.create(null);\n var schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName\n };\n\n function checkTypeName(node) {\n var typeName = node.name.value;\n\n if (schema === null || schema === void 0 ? void 0 : schema.getType(typeName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type \\\"\".concat(typeName, \"\\\" already exists in the schema. It cannot also be defined in this type definition.\"), node.name));\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one type named \\\"\".concat(typeName, \"\\\".\"), [knownTypeNames[typeName], node.name]));\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}", "function UniqueTypeNamesRule(context) {\n var knownTypeNames = Object.create(null);\n var schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName\n };\n\n function checkTypeName(node) {\n var typeName = node.name.value;\n\n if (schema === null || schema === void 0 ? void 0 : schema.getType(typeName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Type \\\"\".concat(typeName, \"\\\" already exists in the schema. It cannot also be defined in this type definition.\"), node.name));\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one type named \\\"\".concat(typeName, \"\\\".\"), [knownTypeNames[typeName], node.name]));\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}", "async function generateAlias() {\n const dirents = await promises.readdir(PACKAGE_PATH);\n\n return Object.fromEntries(\n await Promise.all(\n dirents.map(async d => {\n const packageJSON = JSON.parse(await promises.readFile(path.resolve(PACKAGE_PATH, d, 'package.json')));\n return [packageJSON['name'], path.resolve(PACKAGE_PATH, d)];\n }),\n ),\n );\n}", "function UniqueTypeNames(context) {\n var knownTypeNames = Object.create(null);\n var schema = context.getSchema();\n return {\n ScalarTypeDefinition: checkTypeName,\n ObjectTypeDefinition: checkTypeName,\n InterfaceTypeDefinition: checkTypeName,\n UnionTypeDefinition: checkTypeName,\n EnumTypeDefinition: checkTypeName,\n InputObjectTypeDefinition: checkTypeName\n };\n\n function checkTypeName(node) {\n var typeName = node.name.value;\n\n if (schema && schema.getType(typeName)) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](existedTypeNameMessage(typeName), node.name));\n return;\n }\n\n if (knownTypeNames[typeName]) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](duplicateTypeNameMessage(typeName), [knownTypeNames[typeName], node.name]));\n } else {\n knownTypeNames[typeName] = node.name;\n }\n\n return false;\n }\n}", "function typings() {\n const tmpDir = './typings/tmp';\n const blocklySrcs = [\n \"core/\",\n \"core/components\",\n \"core/components/tree\",\n \"core/components/menu\",\n \"core/keyboard_nav\",\n \"core/renderers/common\",\n \"core/renderers/measurables\",\n \"core/theme\",\n \"core/utils\",\n \"msg/\"\n ];\n // Clean directory if exists.\n if (fs.existsSync(tmpDir)) {\n rimraf.sync(tmpDir);\n }\n fs.mkdirSync(tmpDir);\n\n // Find all files that will be included in the typings file.\n let files = [];\n blocklySrcs.forEach((src) => {\n files = files.concat(fs.readdirSync(src)\n .filter(fn => fn.endsWith('.js'))\n .map(fn => path.join(src, fn)));\n });\n\n // Generate typings file for each file.\n files.forEach((file) => {\n const typescriptFileName = `${path.join(tmpDir, file)}.d.ts`;\n if (file.indexOf('core/msg.js') > -1) {\n return;\n }\n const cmd = `node ./node_modules/typescript-closure-tools/definition-generator/src/main.js ${file} ${typescriptFileName}`;\n console.log(`Generating typings for ${file}`);\n execSync(cmd, { stdio: 'inherit' });\n });\n\n const srcs = [\n 'typings/parts/blockly-header.d.ts',\n 'typings/parts/blockly-interfaces.d.ts',\n `${tmpDir}/core/**`,\n `${tmpDir}/core/components/**`,\n `${tmpDir}/core/components/tree/**`,\n `${tmpDir}/core/components/menu/**`,\n `${tmpDir}/core/keyboard_nav/**`,\n `${tmpDir}/core/renderers/common/**`,\n `${tmpDir}/core/renderers/measurables/**`,\n `${tmpDir}/core/utils/**`,\n `${tmpDir}/core/theme/**`,\n `${tmpDir}/msg/**`\n ];\n return gulp.src(srcs)\n .pipe(gulp.concat('blockly.d.ts'))\n .pipe(gulp.dest('typings'))\n .on('end', function () {\n // Clean up tmp directory.\n if (fs.existsSync(tmpDir)) {\n rimraf.sync(tmpDir);\n }\n });\n}", "get name() {\n return pkg.name;\n }", "function duplicateTypeNameMessage(typeName) {\n return \"There can be only one type named \\\"\".concat(typeName, \"\\\".\");\n}", "ensure(types) {\n return {\n name: types.string.isRequired\n }\n }", "function generatePlaceholder(name, dir) {\n const packagePath = path.join(dir, 'package.json');\n if (fs.existsSync(packagePath)) { return; }\n execSync(`mkdir -p \"${dir}\"`, { stdio: 'inherit' });\n fs.writeFileSync(packagePath, JSON.stringify({\n name,\n version: '1.0.0',\n dependencies: { '@griffins/api-client-support': '*', 'io-ts': '^1.10.3' },\n devDependencies: { typescript: '^3.5.2' },\n }), 'utf8');\n}", "_createItemClass(name)\n {\n const _Item = class extends CollectionItem\n {\n static get KEY()\n {\n return name;\n }\n };\n CollectionItem.register(_Item.KEY, _Item);\n }", "function itemNameGenerator() {\n var storage = [\n \"Slow Cooker Coq au Vin\",\n \"Golden Beet & Beet Greens Pasta\",\n \"Meatballs with onion gravy\",\n \"Beef Curry\",\n \"Super Mom Stir Fry\",\n \"Almond-Thyme-Crusted Mahi Mahi\",\n \"Contest-Winning Parmesan\",\n \"Creamy Baked Risotto\",\n \"Chicken Cacciatore\",\n \"Bird's Nest Egg Salad\",\n \"Tofu Kabobs with Barbecue Sauce\",\n \"Grilled Chicken, and Quinoa Salad\",\n \"Grilled Pork Chops\",\n \"One Pot Garlic Butter Chicken\",\n \"Instant Pot Turkey Chili\",\n \"Chicken Fajita Burgers\",\n \"Fruit Salad\",\n \"Chicken Grilled Cheese Sandwich\",\n \"Steak Sandwiches\",\n \"Coconut & tamarind chicken curry\",\n \"Smoked Salmon Carbonara\",\n \"Pan-Seared Cod\",\n \"Guinea fowl tagine\",\n \"Kale Pesto Avocado Grilled Cheese\",\n \"Mexican Chicken Taco Skillet\",\n \"Skinnified Pork Burrito\",\n \"Calamari\",\n \"Bang-Bang Shrimp\",\n \"Chicken Fajita Casserole\",\n \"The TJ Hooker Pizza\",\n \"Seared Scallops\",\n \"Spinach Burrata Omelet\",\n \"Roasted Macaroni and Cheese\",\n \"Chicken and Corn Chowder\",\n \"Mediterranean Crab\",\n \"Creamy chicken & mango curry\",\n \"Grilled chicken\",\n \"Homemade Creamy Chicken Soup\",\n \"Flattened Chicken\",\n \"Skirt Steak With Arugula Salad\",\n \"Healthy Chicken Burgers\",\n \"Stir-Fried Udon Noodles\",\n \"Pan-seared Salmon\",\n \"Penne and Vegetable Casserole\",\n \"Grilled Watermelon Salad\",\n \"Slow Cooker Chicken Soup\",\n \"Creamy Chile Chicken Enchiladas\",\n \"Caprese Mac and Cheese\",\n \"Oven Baked Chicken Tacos\",\n \"Thai Peanut Chicken\"\n ];\n return storage[Math.floor(storage.length * Math.random())];\n}", "function makeUniqueName(baseName) {\n // Find the first unique 'name_n', where n is a positive number\n if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) {\n baseName += \"_\";\n }\n var i = 1;\n while (true) {\n var generatedName = baseName + i;\n if (isUniqueName(generatedName)) {\n return generatedNameSet[generatedName] = generatedName;\n }\n i++;\n }\n }", "generateUniquePackageSlug(pkg) {\n let slug = pkg.name;\n\n slug = slug.replace(/[^@a-z0-9]+/g, '-');\n slug = slug.replace(/^-+|-+$/g, '');\n\n if (pkg.registry) {\n slug = `${pkg.registry}-${slug}`;\n } else {\n slug = `unknown-${slug}`;\n }\n\n const hash = pkg.remote.hash;\n\n\n if (pkg.version) {\n slug += `-${pkg.version}`;\n }\n\n if (pkg.uid && pkg.version !== pkg.uid) {\n slug += `-${pkg.uid}`;\n } else if (hash) {\n slug += `-${hash}`;\n }\n\n if (pkg.remote.integrity) {\n slug += `-integrity`;\n }\n\n return slug;\n }", "function KnownTypeNamesRule(context) {\n var schema = context.getSchema();\n var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if ((0, _predicates.isTypeDefinitionNode)(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n\n var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes));\n return {\n NamedType: function NamedType(node, _1, parent, _2, ancestors) {\n var typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var _ancestors$;\n\n var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent;\n var isSDL = definitionNode != null && isSDLNode(definitionNode);\n\n if (isSDL && isStandardTypeName(typeName)) {\n return;\n }\n\n var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames);\n context.reportError(new _GraphQLError.GraphQLError(\"Unknown type \\\"\".concat(typeName, \"\\\".\") + (0, _didYouMean.default)(suggestedTypes), node));\n }\n }\n };\n}", "function KnownTypeNamesRule(context) {\n var schema = context.getSchema();\n var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if ((0, _predicates.isTypeDefinitionNode)(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n\n var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes));\n return {\n NamedType: function NamedType(node, _1, parent, _2, ancestors) {\n var typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var _ancestors$;\n\n var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent;\n var isSDL = definitionNode != null && isSDLNode(definitionNode);\n\n if (isSDL && isStandardTypeName(typeName)) {\n return;\n }\n\n var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames);\n context.reportError(new _GraphQLError.GraphQLError(\"Unknown type \\\"\".concat(typeName, \"\\\".\") + (0, _didYouMean.default)(suggestedTypes), node));\n }\n }\n };\n}", "function addItemsByName(c){\n c.itemsByName = {};\n c.items.forEach(function(item){\n c.itemsByName[item.name] = item;\n });\n}", "function UniqueFieldDefinitionNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness\n };\n\n function checkFieldUniqueness(node) {\n var _node$fields;\n\n var typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];\n var fieldNames = knownFieldNames[typeName];\n\n for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) {\n var fieldDef = fieldNodes[_i2];\n var fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), fieldDef.name));\n } else if (fieldNames[fieldName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" can only be defined once.\"), [fieldNames[fieldName], fieldDef.name]));\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n\n return false;\n }\n}", "function UniqueFieldDefinitionNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness\n };\n\n function checkFieldUniqueness(node) {\n var _node$fields;\n\n var typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];\n var fieldNames = knownFieldNames[typeName];\n\n for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) {\n var fieldDef = fieldNodes[_i2];\n var fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), fieldDef.name));\n } else if (fieldNames[fieldName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" can only be defined once.\"), [fieldNames[fieldName], fieldDef.name]));\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n\n return false;\n }\n}", "function suggestUniqueFileName(aIdentifier, aType, aExistingNames) {\n let suffix = 1;\n let base = validateFileName(aIdentifier);\n let suggestion = base + aType;\n while (true) {\n if (!aExistingNames.has(suggestion)) {\n break;\n }\n\n suggestion = base + suffix + aType;\n suffix++;\n }\n\n return suggestion;\n}", "__init25() {this.forceRenames = new Map()}", "function ItemName(obj) { this.obj = obj; }", "['@_name']() {\n let value = this._findTagValue(['@_name', '@external']);\n if (!value) {\n logger.w(`can not resolve name.`);\n }\n\n this._value.name = value;\n\n let tags = this._findAll(['@_name', '@external']);\n if (!tags) {\n logger.w(`can not resolve name.`);\n return;\n }\n\n let name;\n for (let tag of tags) {\n let {tagName, tagValue} = tag;\n if (tagName === '@_name') {\n name = tagValue;\n } else if (tagName === '@external') {\n let {typeText, paramDesc} = ParamParser.parseParamValue(tagValue, true, false, true);\n name = typeText;\n this._value.externalLink = paramDesc;\n }\n }\n\n this._value.name = name;\n }", "function publishNamespace(name) {\n var exportName = name.substr(1);\n var body = namespaceBodyTbl[name];\n var bodyWrapped = '(function(' + name + '){' + body + '})' + '(' + name + ')';\n evil(name + '={};');\n evil('__extends=' + __extends.toString() + ';');\n var lib = {\n _decorate: evil('__decorate'),\n defineHidden: defineHidden\n };\n for (var _i = 0, _a = Object.keys(namespaceDepTbl[name]); _i < _a.length; _i++) {\n var depName = _a[_i];\n lib[depName] = namespaceDepTbl[name][depName];\n }\n lib[exportName + '__deps'] = Object.keys(lib);\n lib[exportName + '__postset'] = bodyWrapped;\n mergeInto(LibraryManager.library, lib);\n}", "function inferName(x) {\n\t\tif (x.isDefault && !hasOwnProp.call(names, x.module.id) && !hasOwnProp.call(used, x.as)) {\n\t\t\tnames[x.module.id] = x.as;\n\t\t\tused[x.as] = true;\n\t\t}\n\t}", "function UniqueFieldDefinitionNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness\n };\n\n function checkFieldUniqueness(node) {\n var _node$fields;\n\n var typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];\n var fieldNames = knownFieldNames[typeName];\n\n for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) {\n var fieldDef = fieldNodes[_i2];\n var fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), fieldDef.name));\n } else if (fieldNames[fieldName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" can only be defined once.\"), [fieldNames[fieldName], fieldDef.name]));\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n\n return false;\n }\n}", "function UniqueFieldDefinitionNamesRule(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness\n };\n\n function checkFieldUniqueness(node) {\n var _node$fields;\n\n var typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')\n\n\n var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];\n var fieldNames = knownFieldNames[typeName];\n\n for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) {\n var fieldDef = fieldNodes[_i2];\n var fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" already exists in the schema. It cannot also be defined in this type extension.\"), fieldDef.name));\n } else if (fieldNames[fieldName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" can only be defined once.\"), [fieldNames[fieldName], fieldDef.name]));\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n\n return false;\n }\n}", "function KnownTypeNamesRule(context) {\n var schema = context.getSchema();\n var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if (Object(_language_predicates_mjs__WEBPACK_IMPORTED_MODULE_3__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n\n var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes));\n return {\n NamedType: function NamedType(node, _1, parent, _2, ancestors) {\n var typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var _ancestors$;\n\n var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent;\n var isSDL = definitionNode != null && isSDLNode(definitionNode);\n\n if (isSDL && isStandardTypeName(typeName)) {\n return;\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](\"Unknown type \\\"\".concat(typeName, \"\\\".\") + Object(_jsutils_didYouMean_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes), node));\n }\n }\n };\n}", "enterImport_as_names(ctx) {\n\t}", "function ensureGrammarForPackages (...names) {\n for (const name of names) {\n if (atom.packages.isPackageActive(name)) {\n addOurGrammarToPackage(name)\n }\n }\n}", "async function mangle_name(name) {\n return '__' + name;\n}", "register() {\n Object.keys(this._nameMapping).forEach(newName => {\n this.target[newName] = this.require(newName);\n });\n }", "function GetItemTypeForListName(name) {\n return \"SP.Data.\" + name.charAt(0).toUpperCase() + name.split(\" \").join(\"\").slice(1) + \"ListItem\";\n}", "nameElements() {\n for (const propName in this) {\n const propValue = this[propName];\n if (propValue instanceof UiElement) {\n propValue.setName(propName);\n }\n }\n }", "function UniqueFieldDefinitionNames(context) {\n var schema = context.getSchema();\n var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null);\n var knownFieldNames = Object.create(null);\n return {\n InputObjectTypeDefinition: checkFieldUniqueness,\n InputObjectTypeExtension: checkFieldUniqueness,\n InterfaceTypeDefinition: checkFieldUniqueness,\n InterfaceTypeExtension: checkFieldUniqueness,\n ObjectTypeDefinition: checkFieldUniqueness,\n ObjectTypeExtension: checkFieldUniqueness\n };\n\n function checkFieldUniqueness(node) {\n var typeName = node.name.value;\n\n if (!knownFieldNames[typeName]) {\n knownFieldNames[typeName] = Object.create(null);\n }\n\n if (node.fields) {\n var fieldNames = knownFieldNames[typeName];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = node.fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var fieldDef = _step.value;\n var fieldName = fieldDef.name.value;\n\n if (hasField(existingTypeMap[typeName], fieldName)) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](existedFieldDefinitionNameMessage(typeName, fieldName), fieldDef.name));\n } else if (fieldNames[fieldName]) {\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](duplicateFieldDefinitionNameMessage(typeName, fieldName), [fieldNames[fieldName], fieldDef.name]));\n } else {\n fieldNames[fieldName] = fieldDef.name;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n\n return false;\n }\n}", "async function tag(dry: boolean, nProcesses: number, name?: string) {\n const log = loggerWithErrors()[0];\n const options = { definitelyTypedPath: \"../DefinitelyTyped\", progress: true, parseInParallel: true };\n await parseDefinitions(\n await getDefinitelyTyped(options, log),\n { nProcesses: nProcesses || os.cpus().length, definitelyTypedPath: \"../DefinitelyTyped\" },\n log\n );\n\n const token = process.env.NPM_TOKEN as string;\n\n const publishClient = await NpmPublishClient.create(token, {});\n if (name) {\n const pkg = await AllPackages.readSingle(name);\n const version = await getLatestTypingVersion(pkg);\n await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);\n await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);\n } else {\n await nAtATime(5, await AllPackages.readLatestTypings(), async (pkg) => {\n // Only update tags for the latest version of the package.\n const version = await getLatestTypingVersion(pkg);\n await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);\n await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);\n });\n }\n // Don't tag notNeeded packages\n}", "name() {\n return ['combine', 'scripts', 'babel', 'styles', 'minify'];\n }", "_getStandardTypingsFilePath(file) {\n let filePath = file.getPathInPackage();\n let dirPath = ts.getDirectoryPath(\n ts.normalizePath(filePath)).replace(/^typings\\/?/, '');\n let pkgName = file.getPackageName();\n if (pkgName.indexOf(':') != -1) {\n pkgName = pkgName.split(':')[1];\n }\n let pkgTest = new RegExp(`^\\/?${pkgName}(\\/.+|$)`);\n // Check if the path starts with the package name.\n if (pkgTest.test(dirPath) === false) {\n let pkgDirPath = ts.combinePaths(\n ts.combinePaths('typings', pkgName), dirPath);\n let fileName = ts.getBaseFileName(filePath);\n filePath = ts.combinePaths(pkgDirPath, fileName);\n }\n\n return filePath;\n }", "function createPackage(next) {\n var pkg = JSON.parse(fs.readFileSync(path.join(scaffold, 'package.json'), 'utf8'));\n\n pkg.name = name;\n pkg.dependencies.flatiron = flatiron.version;\n\n app.log.info('Writing ' + 'package.json'.grey);\n fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2) + '\\n', next);\n }", "function _TypeMeta(name,kind,cfg) {\r\n\t\tthis._needs = [];\r\n\t\tthis._props = null;\r\n\t\tthis._protos = null;\r\n\t\tthis._satisfies = [];\r\n\t\tthis._mixins = [];\r\n\t\tthis._inherits = [];\r\n\t\tthis._globals = null;\r\n\t\tthis._scopeForGlobals = null;\r\n\t\tthis._inits = null;\r\n\t\tthis._expects = [];\r\n\t\tthis._completed = false;\r\n\t\tthis._isInner = (name)? false : true;\r\n\t\tthis._name = name;\r\n\t\tthis._kind = kind;\r\n\t\tthis._options = {autoConstruct:true}; //default options\r\n\t\tthis._isMetaType = false;\r\n\t\tthis.init(cfg);\r\n\t\tthis.setup();\r\n\t}", "function subjectName(item) {\n if (!item || typeof item === \"string\") {\n return item\n }\n return item.__type\n}", "['@_name']() {\n super['@_name']();\n if (this._value.name) return;\n\n this._value.name = this._node.declarations[0].id.name;\n }", "_updatePackage() {\n let dest = this.destinationPath('package.json');\n let template = this.templatePath('dependencies.stub');\n let pkg = program.helpers.readJson(this, dest);\n\n let deps = JSON.parse(program.helpers.readTpl(this, template, {\n relationalDB: program.helpers.isRelationalDB(this.answers.database),\n answers: this.answers\n }));\n\n pkg.dependencies = Object.assign(pkg.dependencies, deps);\n this.fs.writeJSON(dest, pkg);\n }", "generateSchema() {\n const that = this;\n\n _.keys(this).forEach(function(k) {\n if (_.startsWith(k, '_')) {\n return;\n }\n\n // Normalize the type format\n that._schema[k] = normalizeType(that[k]);\n\n // Assign a default if needed\n if (isArray(that._schema[k].type)) {\n that[k] = that.getDefault(k) || [];\n } else {\n that[k] = that.getDefault(k);\n }\n });\n }", "additionalNametags(self) { return []; }", "function getTypescriptPackages() {\n\tvar packages = getPackages();\n\tfor (var i in packages) {\n\t\tvar package = packages[i];\n\t\tif (!usesTypescript(package) && i !== 'typescript') {\n\t\t\tdelete packages[i];\n\t\t}\n\t\telse {\n\t\t\tfor (var j in package.server.uses) {\n\t\t\t\tvar item = package.server.uses[j];\n\t\t\t\tif (!usesTypescript(item) && j !== 'typescript') {\n\t\t\t\t\tdelete package.server.uses[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var j in package.client.uses) {\n\t\t\t\tvar item = package.client.uses[j];\n\t\t\t\tif (!usesTypescript(item) && j !== 'typescript') {\n\t\t\t\t\tdelete package.client.uses[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var j in package.server.imply) {\n\t\t\t\tvar item = package.server.imply[j];\n\t\t\t\tif (!usesTypescript(item) && j !== 'typescript') {\n\t\t\t\t\tdelete package.server.imply[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var j in package.client.imply) {\n\t\t\t\tvar item = package.client.imply[j];\n\t\t\t\tif (!usesTypescript(item) && j !== 'typescript') {\n\t\t\t\t\tdelete package.client.imply[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tdelete packages.typescript;\n\tfor (var i in packages) {\n\t\tvar package = packages[i];\n\t\tdelete package.server.uses.typescript;\n\t\tdelete package.client.uses.typescript;\n\t\tdelete package.server.imply.typescript;\n\t\tdelete package.client.imply.typescript;\n\t}\n\n\treturn packages;\n\n\tfunction usesTypescript(package) {\n\t\tif (package.server.uses.typescript || package.client.uses.typescript) {\n\t\t\treturn true;\n\t\t}\n\t\tfor (var i in package.server.uses) {\n\t\t\tif (checkImpliesServer(package.server.uses[i])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tfor (var i in package.client.uses) {\n\t\t\tif (checkImpliesClient(package.client.uses[i])) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\n\t\tfunction checkImpliesServer(package) {\n\t\t\tif (package.server.imply.typescript) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfor (var i in package.server.imply) {\n\t\t\t\tif (checkImpliesServer(package.server.imply[i])) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tfunction checkImpliesClient(package) {\n\t\t\tif (package.client.imply.typescript) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfor (var i in package.client.imply) {\n\t\t\t\tif (checkImpliesServer(package.client.imply[i])) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n}", "_getTypedName(spec) {\n if (spec.namespaced)\n return spec.id;\n if (spec.name[0] === \"[\")\n return spec.name;\n switch (spec.type) {\n case DeclarationFileParser_1.SpecNodeType.TypeOrEnum:\n return \"type \" + spec.name;\n case DeclarationFileParser_1.SpecNodeType.FunctionDeclaration:\n return spec.name + \"()\";\n case DeclarationFileParser_1.SpecNodeType.DecoratorFunction:\n return \"@\" + spec.name;\n case DeclarationFileParser_1.SpecNodeType.ClassDeclaration:\n return \"class \" + spec.name;\n case DeclarationFileParser_1.SpecNodeType.InterfaceDeclaration:\n return \"interface \" + spec.name;\n case DeclarationFileParser_1.SpecNodeType.MethodDeclaration:\n return \".\" + spec.name + \"()\";\n case DeclarationFileParser_1.SpecNodeType.PropertyDeclaration:\n return \".\" + spec.name;\n case DeclarationFileParser_1.SpecNodeType.Namespace:\n return \"namespace \" + spec.name;\n default:\n return spec.name;\n }\n }", "get_type_id( name ){ return this.names.get( name ); }", "function subjectName(item) {\n if (!item || typeof item === 'string') {\n return item\n }\n\n return item.__type\n}", "function generateTypes(assetsFolder, silent = false) {\n if (!silent) {\n log(`generating new asset .d.ts files in \"${assetsFolder}\" . . .`);\n }\n const pattern = `${assetsFolder}/**/*.@(${extensionPattern})`;\n const fileNames = glob.sync(pattern, {}).map((f) => f + \".d.ts\");\n fileNames.forEach((fileName) => {\n fs.writeFileSync(fileName, getContent(fileName));\n if (!silent) {\n log(\" - created \" + fileName);\n }\n });\n if (fileNames.length === 0 && !silent) {\n log(\"No files to generate\");\n }\n\n generateManifest(assetsFolder, silent);\n\n return fileNames;\n}", "function uniq(id_str){\n // Attribute and tag uniquer - to avoid conflict with host page\n return PACKAGE + \"_\" + id_str;\n}", "function KnownTypeNamesRule(context) {\n var schema = context.getSchema();\n var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n var definedTypes = Object.create(null);\n\n for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) {\n var def = _context$getDocument$2[_i2];\n\n if (Object(_language_predicates_mjs__WEBPACK_IMPORTED_MODULE_3__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n\n var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes));\n return {\n NamedType: function NamedType(node, _1, parent, _2, ancestors) {\n var typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var _ancestors$;\n\n var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent;\n var isSDL = definitionNode != null && isSDLNode(definitionNode);\n\n if (isSDL && isSpecifiedScalarName(typeName)) {\n return;\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList_mjs__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeName, isSDL ? specifiedScalarsNames.concat(typeNames) : typeNames);\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_2__[\"GraphQLError\"](\"Unknown type \\\"\".concat(typeName, \"\\\".\") + Object(_jsutils_didYouMean_mjs__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(suggestedTypes), node));\n }\n }\n };\n}", "function standaloneName(schema, keyNameFromDefinition, usedNames) {\n var name = schema.title || schema.id || keyNameFromDefinition;\n if (name) {\n return utils_1.generateName(name, usedNames);\n }\n}", "function createPkg(name, root) {\n return root[name] = createDict();\n }", "assertNames(recipeNames) {\n _.each(recipeNames, recipeName => this.assertName(recipeName));\n }", "function mergeTypings(typingNames) {\n if (!typingNames) {\n return;\n }\n for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) {\n var typing = typingNames_1[_i];\n if (!(typing in inferredTypings)) {\n inferredTypings[typing] = undefined;\n }\n }\n }", "function processEntriesToTyposDef(entries) {\n const def = isIterable(entries) ? reduceToTyposDef(entries) : entries;\n const result = sanitizeIntoTypoDef(def);\n (0, assert_1.default)(result);\n return result;\n}", "function createItemString(data) {\n\t var len = (0, _getOwnPropertyNames2['default'])(data).length;\n\t return len + ' ' + (len !== 1 ? 'keys' : 'key');\n\t}", "function hasElementsWithUniqueNames() {\n let duplicates = findDuplicates(inputsSelectsTextareas, 'name', 'formAncestorID')\n // Radio buttons have duplicate names.\n .filter(field => field.type !== 'radio');\n let problemFields = duplicates.map(field => stringifyElement(field));\n // Deduplicate items with same tagName and id.\n problemFields = [...new Set(problemFields)];\n if (problemFields.length) {\n const item = {\n // description: 'Autocomplete values must be valid.',\n details: 'Found fields in the same form with duplicate <code>name</code> attributes:<br>• ' +\n `${problemFields.join('<br>• ')}`,\n learnMore: 'Learn more: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname\">The input element name attribute</a>',\n title: 'Fields in the same form must have unique <code>name</code> values.',\n type: 'error',\n };\n items.push(item);\n }\n}", "idType () {\n const name = this.currentAstNode.value\n const nextResults = this.initialItems.filter(node =>\n (name === node.name) || (name === node.package.name)\n )\n this.processPendingCombinator(nextResults)\n }", "function KnownTypeNames(context) {\n var schema = context.getSchema();\n var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null);\n var definedTypes = Object.create(null);\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = context.getDocument().definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var def = _step.value;\n\n if (Object(_language_predicates__WEBPACK_IMPORTED_MODULE_3__[\"isTypeDefinitionNode\"])(def)) {\n definedTypes[def.name.value] = true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes));\n return {\n NamedType: function NamedType(node, _1, parent, _2, ancestors) {\n var typeName = node.name.value;\n\n if (!existingTypesMap[typeName] && !definedTypes[typeName]) {\n var definitionNode = ancestors[2] || parent;\n var isSDL = isSDLNode(definitionNode);\n\n if (isSDL && isSpecifiedScalarName(typeName)) {\n return;\n }\n\n var suggestedTypes = Object(_jsutils_suggestionList__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(typeName, isSDL ? specifiedScalarsNames.concat(typeNames) : typeNames);\n context.reportError(new _error_GraphQLError__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](unknownTypeMessage(typeName, suggestedTypes), node));\n }\n }\n };\n}", "function createItemString(data) {\n var len = (0, _getOwnPropertyNames2['default'])(data).length;\n return len + ' ' + (len !== 1 ? 'keys' : 'key');\n}", "function createItemString(data) {\n var len = (0, _getOwnPropertyNames2['default'])(data).length;\n return len + ' ' + (len !== 1 ? 'keys' : 'key');\n}", "function createItemString(data) {\n var len = (0, _getOwnPropertyNames2['default'])(data).length;\n return len + ' ' + (len !== 1 ? 'keys' : 'key');\n}", "function createItemString(data) {\n var len = (0, _getOwnPropertyNames2['default'])(data).length;\n return len + ' ' + (len !== 1 ? 'keys' : 'key');\n}", "function UniqueDirectiveNamesRule(context) {\n var knownDirectiveNames = Object.create(null);\n var schema = context.getSchema();\n return {\n DirectiveDefinition: function DirectiveDefinition(node) {\n var directiveName = node.name.value;\n\n if (schema !== null && schema !== void 0 && schema.getDirective(directiveName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Directive \\\"@\".concat(directiveName, \"\\\" already exists in the schema. It cannot be redefined.\"), node.name));\n return;\n }\n\n if (knownDirectiveNames[directiveName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one directive named \\\"@\".concat(directiveName, \"\\\".\"), [knownDirectiveNames[directiveName], node.name]));\n } else {\n knownDirectiveNames[directiveName] = node.name;\n }\n\n return false;\n }\n };\n}", "function UniqueDirectiveNamesRule(context) {\n var knownDirectiveNames = Object.create(null);\n var schema = context.getSchema();\n return {\n DirectiveDefinition: function DirectiveDefinition(node) {\n var directiveName = node.name.value;\n\n if (schema !== null && schema !== void 0 && schema.getDirective(directiveName)) {\n context.reportError(new _GraphQLError.GraphQLError(\"Directive \\\"@\".concat(directiveName, \"\\\" already exists in the schema. It cannot be redefined.\"), node.name));\n return;\n }\n\n if (knownDirectiveNames[directiveName]) {\n context.reportError(new _GraphQLError.GraphQLError(\"There can be only one directive named \\\"@\".concat(directiveName, \"\\\".\"), [knownDirectiveNames[directiveName], node.name]));\n } else {\n knownDirectiveNames[directiveName] = node.name;\n }\n\n return false;\n }\n };\n}", "GetAllAssetNames() {}", "getGlobalNames() {\n return new Set([\n ...this.identifierReplacements.keys(),\n ...this.exportBindingsByLocalName.keys(),\n ]);\n }", "createTypes(){\n }", "itemToName(item) {\n return item.template.full_name;\n }", "function UniqueDirectiveNamesRule(context) {\n var knownDirectiveNames = Object.create(null);\n var schema = context.getSchema();\n return {\n DirectiveDefinition: function DirectiveDefinition(node) {\n var directiveName = node.name.value;\n\n if (schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Directive \\\"@\".concat(directiveName, \"\\\" already exists in the schema. It cannot be redefined.\"), node.name));\n return;\n }\n\n if (knownDirectiveNames[directiveName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one directive named \\\"@\".concat(directiveName, \"\\\".\"), [knownDirectiveNames[directiveName], node.name]));\n } else {\n knownDirectiveNames[directiveName] = node.name;\n }\n\n return false;\n }\n };\n}", "function UniqueDirectiveNamesRule(context) {\n var knownDirectiveNames = Object.create(null);\n var schema = context.getSchema();\n return {\n DirectiveDefinition: function DirectiveDefinition(node) {\n var directiveName = node.name.value;\n\n if (schema === null || schema === void 0 ? void 0 : schema.getDirective(directiveName)) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"Directive \\\"@\".concat(directiveName, \"\\\" already exists in the schema. It cannot be redefined.\"), node.name));\n return;\n }\n\n if (knownDirectiveNames[directiveName]) {\n context.reportError(new _error_GraphQLError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"GraphQLError\"](\"There can be only one directive named \\\"@\".concat(directiveName, \"\\\".\"), [knownDirectiveNames[directiveName], node.name]));\n } else {\n knownDirectiveNames[directiveName] = node.name;\n }\n\n return false;\n }\n };\n}", "function tidyDATATYPES_DEFINITIONS() {\n var defaultVal = {\n formula: false,\n icon: \"fas fa-asterisk\",\n color: \"primary\",\n format: (num, maxN) => {\n let n = (parseFloat(num)||0)\n if(n>999 || (maxN && maxN>999)) n = Math.round(n)\n return n.toLocaleString()\n },\n userParser: parseInt,\n filterable: true,\n selectable: true\n }\n for(var k in DATATYPES_DEFINITIONS) DATATYPES_DEFINITIONS[k] = {suffixName: k.toLowerCase(), ...defaultVal, ...DATATYPES_DEFINITIONS[k]}\n \n }", "static slats(slotTypeName) {\n const slats= [];\n const all= allTypes.all;\n for (const typeName in all) {\n const type= all[typeName];\n if (type.uses === 'flow') {\n const spec= type.with;\n const slots= spec.slots;\n if (slots && slots.includes(slotTypeName)) {\n slats.push(type);\n }\n }\n }\n return slats;\n }", "itemDef() {\n\t\treturn {\n\t\t\t\"$schema\": \"http://json-schema.org/draft-07/schema#\",\n\t\t\t\"$id\": \"#/schema/draft-07/item\",\n\t\t\t\"type\": \"object\",\n\t\t\t\"properties\": {\n\t\t\t\t\"$id\": {\"type\": \"string\"},\n\t\t\t\t\"$ref\": {\"type\": \"string\"},\n\t\t\t\t\"classList\": {\"type\": \"array\"},\n\t\t\t\t\"label\": {\"type\": \"string\"},\n\t\t\t\t\"id\": {\"type\": \"string\"},\n\t\t\t\t\"icon\": {\"type\": \"string\"},\n\t\t\t\t\"icon-src\": {\"type\": \"string\"},\n\t\t\t\t\"icon-position\": {\"type\": \"string\"},\n\t\t\t\t\"kind\": {\"type\": \"string\"},\n\t\t\t\t\"mirrored\": {\"type\": \"boolean\"},\n\t\t\t\t\"events\": {\n\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\"properties\": {\n\t\t\t\t\t\t\"event\": {\"type\": \"string\"},\n\t\t\t\t\t\t\"fn\": {\"type\": \"string\"},\n\t\t\t\t\t},\n\t\t\t\t\t\"required\": [\"event\", \"fn\"]\n\t\t\t\t}\n\t\t\t},\n\t\t\t// \"required\": []\n\t\t};\n\t}", "writeTypingsFile(dtsFilename, dtsKind) {\n const indentedWriter = new IndentedWriter_1.IndentedWriter();\n this._generateTypingsFileContent(indentedWriter, dtsKind);\n node_core_library_1.FileSystem.writeFile(dtsFilename, indentedWriter.toString(), {\n convertLineEndings: \"\\r\\n\" /* CrLf */,\n ensureFolderExists: true\n });\n }", "function checkNames(fields) {\n const usedNames = {};\n for (const field of fields) {\n if (usedNames[field.name]) {\n // eslint-disable-next-line\n console.warn('Schema: duplicated field name', field.name, field);\n }\n usedNames[field.name] = true;\n }\n}", "function packIndex(pkgName) {\n packages[\"@angular/\" + pkgName] = { main: \"index.js\" };\n }", "function getNameTypeItemInfo(element, newItem) {\n let itemWrap = $(element).find('div.clearfix.info-wrap > div.item-cont > div.item-wrap').get()[0];\n let spanWrap = $(itemWrap).find('span.info-msg > div.m-bottom10 > span.bold').get()[0];\n let name = $(spanWrap).text();\n if (name.indexOf('The') == 0) {name = name.slice(4);}\n\n let infoMsg = $(itemWrap).find('span.info-msg > div.m-bottom10').get()[0];\n let type = $(infoMsg).text();\n\n // May be 'are a' or 'is a', search both\n let at = type.indexOf('are a ');\n if (at == -1) {at = type.indexOf('is a ');}\n let end = type.indexOf('Weapon.');\n if (end == -1) {end = type.indexOf('.');}\n if (end < 0) {end = 0;}\n if (at >= 0) {type = type.slice(at+6, end-1);}\n\n newItem.name = name;\n newItem.type = type;\n }", "function getNameTypeItemInfo(element, newItem) {\n let itemWrap = $(element).find('div.clearfix.info-wrap > div.item-cont > div.item-wrap').get()[0];\n let spanWrap = $(itemWrap).find('span.info-msg > div.m-bottom10 > span.bold').get()[0];\n let name = $(spanWrap).text();\n if (name.indexOf('The') == 0) {name = name.slice(4);}\n\n let infoMsg = $(itemWrap).find('span.info-msg > div.m-bottom10').get()[0];\n let type = $(infoMsg).text();\n\n // May be 'are a' or 'is a', search both\n let at = type.indexOf('are a ');\n if (at == -1) {at = type.indexOf('is a ');}\n let end = type.indexOf('Weapon.');\n if (end == -1) {end = type.indexOf('.');}\n if (end < 0) {end = 0;}\n if (at >= 0) {type = type.slice(at+6, end-1);}\n\n newItem.name = name;\n newItem.type = type;\n }", "function NameAnonymizer() {\n this.chance = new Chance();\n\n this.chance.set('firstNames', {\n 'male' : Names,\n 'female' : Names\n });\n }", "compileOneFile(inputFile) {\n\t\tvar pathInPackage = inputFile.getPathInPackage();\n\t\tvar packageName = inputFile.getPackageName();\n\t\tif (packageName) {\n\t\t\tpackageName = packageName.replace('local-test:', '');\n\t\t}\n\t\tvar fullPath = pathInPackage;\n\t\tif (packageName) {\n\t\t\tfullPath = path.join(packagesPath, packageName, fullPath);\n\t\t}\n\n\t\t// console.log('Compiling...', (packageName || 'app') + '/' + pathInPackage);\n\n\t\tif (pathInPackage.indexOf('node_modules/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in node_modules');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.indexOf('typings/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in typings');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.substr(-5) === '.d.ts') {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its a definition');\n\t\t\treturn {};\n\t\t}\n\n\t\t// generatePackageRefs();\n\t\tif (\n\t\t\tpackageName &&\n\t\t\ttypescriptPackages[packageName].client.files.indexOf(pathInPackage) === -1 &&\n\t\t\ttypescriptPackages[packageName].server.files.indexOf(pathInPackage) === -1\n\t\t) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its not added to package.js');\n\t\t\treturn {};\n\t\t}\n\n\t\t// cache check\n\t\tvar cachePath = path.join(cacheDir, isApp && !disableInApp ? path.relative('../', fullPath) : path.relative(meteorPath, fullPath));\n\t\tvar baseName = path.basename(fullPath, '.ts');\n\t\tvar changeTime = fs.statSync(fullPath).mtime;\n\t\tvar jsPath = path.join(path.dirname(cachePath), baseName + '.js');\n\t\tvar error;\n\n\t\t// references\n\t\tvar dir = path.dirname(path.relative('./', fullPath));\n\t\tif (!packageName) {\n\t\t\tif (appDirs.indexOf(dir) == -1) {\n\t\t\t\tappDirs.push(dir);\n\t\t\t}\n\t\t\tif (appRefs.indexOf(pathInPackage) == -1) {\n\t\t\t\tappRefs.push(pathInPackage);\n\t\t\t\tappDirs.forEach(function (dir) {\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"server.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-server.d.ts')) + '\" />\\n');\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"client.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-client.d.ts')) + '\" />\\n');\n\t\t\t\t});\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-server.d.ts'), getAppRefs('server'));\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-client.d.ts'), getAppRefs('client'));\n\t\t\t}\n\t\t}\n\n\t\tvar doesntExists = !fs.existsSync(jsPath);\n\t\tvar existingTime = !doesntExists && fs.statSync(jsPath).mtime;\n\t\tvar isTooOld = existingTime && changeTime.getTime() > existingTime.getTime();\n\t\tif (doesntExists || isTooOld) {\n\n\t\t\tif (doesntExists) {\n\t\t\t\tconsole.log('Compiling because doesnt exist:', fullPath);\n\t\t\t\t// console.log(\n\t\t\t\t// \ttypescriptPackages[packageName].client.files,\n\t\t\t\t// \ttypescriptPackages[packageName].server.files\n\t\t\t\t// );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('Compiling because too old:', fullPath);\n\t\t\t}\n\n\t\t\tvar exec = Npm.require('child_process').exec;\n\t\t\tvar Future = Npm.require('fibers/future');\n\n\t\t\tfunction execSync(command) {\n\t\t\t\tvar fut = new Future();\n\t\t\t\texec(command, function (error, stdout, stderr) {\n\t\t\t\t\tfut.return({\n\t\t\t\t\t\tstdout: stdout,\n\t\t\t\t\t\tstderr: stderr || error\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\treturn fut.wait();\n\t\t\t}\n\n\t\t\tvar compileCommand = 'node ' + compilerPath + ' ' +\n\t\t\t\t'--target ES5 ' +\n\t\t\t\t'--sourcemap ' +\n\t\t\t\t'--module amd ' +\n\t\t\t\t'--experimentalDecorators ' +\n\t\t\t\t'--emitDecoratorMetadata ' +\n\t\t\t\t//'--pretty ' +\n\t\t\t\t'--emitVerboseMetadata ' +\n\t\t\t\t'--skipEmitVarForModule ' +\n\t\t\t\t'--outDir ' + cacheDir + ' ' + (disableInApp ? meteorAllPath : allPath);\n\n\t\t\t// console.log(compileCommand);\n\t\t\ttry {\n\t\t\t\tvar result = execSync(compileCommand);\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t}\n\n\t\t\tif (result.stderr) {\n\t\t\t\tvar lines = (typeof result.stderr === 'string' ? result.stderr : result.stdout).split('\\n');\n\t\t\t\tvar errors = [];\n\t\t\t\tfor (var i = 0; i < lines.length; i++) {\n\t\t\t\t\tif (!lines[i]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\terrors.push(lines[i]);\n\t\t\t\t}\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\terror = errors.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!error && !fs.existsSync(jsPath)) {\n\t\t\t\terror = 'File was not created: ' + jsPath;\n\t\t\t}\n\t\t\tif (error) {\n\t\t\t\ttry {\n\t\t\t\t\tfs.unlinkSync(jsPath);\n\t\t\t\t\tfs.unlinkSync(cachePath + '.map');\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t\t// ../meteor/packages/marketing/TransactionServer.ts(1078,10)\n\t\t\t\terror = error\n\t\t\t\t\t.replace(/(\\x1b\\[30m)/g, '\\n$1')\n\t\t\t\t\t// .replace(/([a-zA-Z0-9\\.\\/_-]+)\\(([0-9]+),([0-9]+)\\)/g, '\\n\\x1b[42;1m' + process.cwd().replace(new RegExp('^/Users/' + process.env.USER, 'g'), '~') + '/$1:$2 $3\\x1b[0m');\n\t\t\t\tinputFile.error({\n\t\t\t\t\tmessage: error\n\t\t\t\t});\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tvar data = fs.readFileSync(jsPath).toString();\n\n\t\t//console.log('adding: ' + jsPath)\n\t\t// couple of hacks for meteor namespacing\n\t\tvar prep = '';\n\t\tdata = data\n\t\t//.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1' + prep)\n\t\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n(\\/\\*(.|\\n)+\\*\\/\\n)?)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t//.replace(/(var __decorate[\\w\\s!=\"\\(\\)&|,.;:}{]*};\\n)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, prep)\n\t\t\t.replace(/\\/\\/# sourceMappingURL=.+/, '');\n\t\t//\t\t.replace(/\\}\\)\\(([a-zA-Z0-9_]+) \\|\\| \\(([a-zA-Z0-9_]+) = \\{\\}\\)\\);(\\n\\/\\/# sourceMappingURL)/, '})($1);$3');\n\t\t//\tdata = data\n\t\t//\t\t.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, 'this.$1 = this.$1 || {};\\nvar $1 = this.$1;');\n\n\t\tvar map = fs.readFileSync(jsPath + '.map')\n\t\t\t.toString()\n\t\t\t.replace(/\"sources\":\\[\"[0-9a-zA-Z-\\/\\.-]+\"]/, '\"sources\":[\"' + inputFile.getDisplayPath() + '\"]');\n\t\tmap = map.substr(0, map.length - 1) + ',\"sourcesContent\":[\"' + fs.readFileSync(fullPath)\n\t\t\t\t.toString()\n\t\t\t\t.replace(/[\\\\]/g, '\\\\\\\\')\n\t\t\t\t.replace(/[\"]/g, '\\\\\"')\n\t\t\t\t.replace(/[\\b]/g, '\\\\b')\n\t\t\t\t.replace(/[\\f]/g, '\\\\f')\n\t\t\t\t.replace(/[\\n]/g, '\\\\n')\n\t\t\t\t.replace(/[\\r]/g, '\\\\r')\n\t\t\t\t.replace(/[\\t]/g, '\\\\t') + '\"]}';\n\t\treturn {\n\t\t\tpath: pathInPackage + \".js\",\n\t\t\tdata: data,\n\t\t\tsourceMap: map\n\t\t};\n\t}", "function displayTypes(the_array){\n\tthe_array.forEach(function(the_item){\n\t\tvar the_type = `\n\t\t${the_item.name}`\n\t\t$(\".js-pkmn-types\").text(the_type);\n\t})\n}", "name() {\n return ['extract', 'extractVendors'];\n }", "name() {\n return ['extract', 'extractVendors'];\n }", "_filterDuplicatesAsFullyQualifiedNames(files, similarNames) {\n const outputNames = [];\n const groups = similarNames.reduce((obj, cur) => {\n obj[cur] = obj[cur] ? obj[cur] + 1 : 1;\n return obj;\n }, {});\n for (const [name, occurrences] of Object.entries(groups)) {\n if (occurrences > 1) {\n for (const file of files) {\n if (path.basename(file) === `${name}.json`) {\n outputNames.push(this._getFullyQualifiedNameFromPath(file));\n }\n }\n continue;\n }\n outputNames.push(name);\n }\n return outputNames;\n }", "function handlePackageFile({path, scope, componentName}) {\n const packageJson = require(path);\n packageJson.name = `${scope}/${componentName}`;\n fs.writeFileSync(path, packageJson);\n}", "function checkValidRenameInput(\n event,\n input,\n type,\n oldName,\n newName,\n itemElement\n // myBootboxDialog\n) {\n double_extensions = [\n \".ome.tiff\",\n \".ome.tif\",\n \".ome.tf2,\",\n \".ome.tf8\",\n \".ome.btf\",\n \".ome.xml\",\n \".brukertiff.gz\",\n \".mefd.gz\",\n \".moberg.gz\",\n \".nii.gz\",\n \".mgh.gz\",\n \".tar.gz\",\n \".bcl.gz\",\n ];\n\n var duplicate = false;\n // if renaming a file\n if (type === \"files\") {\n let double_ext_present = false;\n for (let index in double_extensions) {\n if (oldName.search(double_extensions[index]) != -1) {\n newName =\n input.trim() +\n path.parse(path.parse(oldName).name).ext +\n path.parse(oldName).ext;\n double_ext_present = true;\n break;\n }\n }\n if (double_ext_present == false) {\n newName = input.trim() + path.parse(oldName).ext;\n }\n // check for duplicate or files with the same name\n for (var i = 0; i < itemElement.length; i++) {\n if (!itemElement[i].innerText.includes(\"-DELETED\")) {\n if (newName === path.parse(itemElement[i].innerText).base) {\n duplicate = true;\n break;\n }\n }\n }\n if (duplicate) {\n Swal.fire({\n icon: \"error\",\n text: `The file name: ${newName} already exists, please rename to a different name!`,\n backdrop: \"rgba(0,0,0, 0.4)\",\n heightAuto: false,\n });\n newName = \"\";\n }\n //// if renaming a folder\n } else {\n newName = input.trim();\n // check for duplicate folder as shown in the UI\n for (var i = 0; i < itemElement.length; i++) {\n if (input.trim() === itemElement[i].innerText) {\n duplicate = true;\n break;\n }\n }\n if (duplicate) {\n Swal.fire({\n icon: \"error\",\n text: `The folder name: ${newName} already exists, please rename to a different name!`,\n backdrop: \"rgba(0,0,0, 0.4)\",\n heightAuto: false,\n });\n newName = \"\";\n }\n }\n return newName;\n}", "function validateNaming(onboardingNode, log, filepath) {\n const NAME_PREFIX = 'opent2t-onboarding-';\n var id = xpath.select1(\"@id\", onboardingNode);\n var expectedDependencyName = NAME_PREFIX + id.value.replace(/\\./g, '-');\n var packagePath = path.join(path.dirname(filepath), 'package.json');\n var metadata = JSON.parse(fs.readFileSync(packagePath).toString());\n\n if(!metadata.dependencies.hasOwnProperty(expectedDependencyName)) {\n log.error(filepath, 'package.json is missing onboarding dependency: ' + expectedDependencyName);\n }\n}", "function sameItemName()\n {\n items.each(function() {\n var name = $(this).data(\"name\").toString();\n\n var sameItemId = container.find(\"[data-name='\" + name + \"']\");\n\n if(sameItemId.length > 1) {\n console.error(\"There are items with the same name: \" + name);\n console.log(sameItemId);\n }\n });\n }", "buildFileName ( type ) {\n return JSON_ROOT + type + '.json';\n }", "function generateBower() {\n\t\treturn JSON.stringify( {\n\t\t\tname: pkg.name,\n\t\t\tmain: pkg.main,\n\t\t\tlicense: \"MIT\",\n\t\t\tignore: [\n\t\t\t\t\"package.json\"\n\t\t\t],\n\t\t\tkeywords: pkg.keywords\n\t\t}, null, 2 );\n\t}", "function packageDTS() {\n return gulp.src('./typings/blockly.d.ts')\n .pipe(gulp.dest(`${packageDistribution}`));\n}", "enterImport_as_name(ctx) {\n\t}", "function getTypingNamesFromJson(jsonPath, filesToWatch) {\n var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); });\n if (result.config) {\n var jsonConfig = result.config;\n filesToWatch.push(jsonPath);\n if (jsonConfig.dependencies) {\n mergeTypings(ts.getOwnKeys(jsonConfig.dependencies));\n }\n if (jsonConfig.devDependencies) {\n mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies));\n }\n if (jsonConfig.optionalDependencies) {\n mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies));\n }\n if (jsonConfig.peerDependencies) {\n mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies));\n }\n }\n }" ]
[ "0.58403444", "0.57442", "0.5719649", "0.5575649", "0.5575649", "0.5556027", "0.5556027", "0.5552457", "0.5389013", "0.52895075", "0.5261061", "0.5215282", "0.5211531", "0.5206816", "0.5181104", "0.50838786", "0.50370914", "0.50254107", "0.49946228", "0.49946228", "0.4979858", "0.4941961", "0.4941961", "0.49307412", "0.49047184", "0.4901247", "0.49009246", "0.48917654", "0.4888727", "0.48833472", "0.48833472", "0.4864455", "0.48611218", "0.48585644", "0.48565522", "0.4830985", "0.48154727", "0.47543868", "0.47517067", "0.4744427", "0.47407463", "0.47349924", "0.47302473", "0.4730185", "0.47260237", "0.47235438", "0.4714988", "0.47141758", "0.47107682", "0.47083357", "0.47032028", "0.47022083", "0.46970004", "0.46840122", "0.4680889", "0.46666715", "0.46643808", "0.46534702", "0.4647924", "0.46145546", "0.46000305", "0.45965686", "0.45949432", "0.45920086", "0.45885855", "0.45771158", "0.45771158", "0.45771158", "0.45771158", "0.45738414", "0.45738414", "0.45656598", "0.4564264", "0.45608118", "0.45513695", "0.45476866", "0.45476866", "0.4537716", "0.45376834", "0.45327872", "0.45305568", "0.4529691", "0.45283818", "0.452717", "0.452717", "0.45249605", "0.45226276", "0.45209542", "0.45209417", "0.45209417", "0.45204952", "0.45154357", "0.4514087", "0.45053494", "0.45024747", "0.4500912", "0.449987", "0.4497579", "0.44952103", "0.44946232" ]
0.68521297
0
Before writing out a declaration, _modifySpan() applies various fixups to make it nice.
_modifySpan(span, dtsEntry, astDeclaration, dtsKind) { const previousSpan = span.previousSibling; let recurseChildren = true; switch (span.kind) { case ts.SyntaxKind.JSDocComment: // If the @packagedocumentation comment seems to be attached to one of the regular API items, // omit it. It gets explictly emitted at the top of the file. if (span.node.getText().match(/(?:\s|\*)@packagedocumentation(?:\s|\*)/g)) { span.modification.skipAll(); } // For now, we don't transform JSDoc comment nodes at all recurseChildren = false; break; case ts.SyntaxKind.ExportKeyword: case ts.SyntaxKind.DefaultKeyword: case ts.SyntaxKind.DeclareKeyword: // Delete any explicit "export" or "declare" keywords -- we will re-add them below span.modification.skipAll(); break; case ts.SyntaxKind.InterfaceKeyword: case ts.SyntaxKind.ClassKeyword: case ts.SyntaxKind.EnumKeyword: case ts.SyntaxKind.NamespaceKeyword: case ts.SyntaxKind.ModuleKeyword: case ts.SyntaxKind.TypeKeyword: case ts.SyntaxKind.FunctionKeyword: // Replace the stuff we possibly deleted above let replacedModifiers = ''; // Add a declare statement for root declarations (but not for nested declarations) if (!astDeclaration.parent) { replacedModifiers += 'declare '; } if (dtsEntry.exported) { replacedModifiers = 'export ' + replacedModifiers; } if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) { // If there is a previous span of type SyntaxList, then apply it before any other modifiers // (e.g. "abstract") that appear there. previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix; } else { // Otherwise just stick it in front of this span span.modification.prefix = replacedModifiers + span.modification.prefix; } break; case ts.SyntaxKind.VariableDeclaration: if (!span.parent) { // The VariableDeclaration node is part of a VariableDeclarationList, however // the Entry.followedSymbol points to the VariableDeclaration part because // multiple definitions might share the same VariableDeclarationList. // // Since we are emitting a separate declaration for each one, we need to look upwards // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList // content (e.g. "var" from "var x=1, y=2"). const list = TypeScriptHelpers_1.TypeScriptHelpers.matchAncestor(span.node, [ts.SyntaxKind.VariableDeclarationList, ts.SyntaxKind.VariableDeclaration]); if (!list) { throw new Error('Unsupported variable declaration'); } const listPrefix = list.getSourceFile().text .substring(list.getStart(), list.declarations[0].getStart()); span.modification.prefix = 'declare ' + listPrefix + span.modification.prefix; span.modification.suffix = ';'; } break; case ts.SyntaxKind.Identifier: let nameFixup = false; const identifierSymbol = this._typeChecker.getSymbolAtLocation(span.node); if (identifierSymbol) { const followedSymbol = TypeScriptHelpers_1.TypeScriptHelpers.followAliases(identifierSymbol, this._typeChecker); const referencedDtsEntry = this._dtsEntriesBySymbol.get(followedSymbol); if (referencedDtsEntry) { if (!referencedDtsEntry.nameForEmit) { // This should never happen throw new Error('referencedEntry.uniqueName is undefined'); } span.modification.prefix = referencedDtsEntry.nameForEmit; nameFixup = true; // For debugging: // span.modification.prefix += '/*R=FIX*/'; } } if (!nameFixup) { // For debugging: // span.modification.prefix += '/*R=KEEP*/'; } break; } if (recurseChildren) { for (const child of span.children) { let childAstDeclaration = astDeclaration; // Should we trim this node? let trimmed = false; if (SymbolAnalyzer_1.SymbolAnalyzer.isAstDeclaration(child.kind)) { childAstDeclaration = this._astSymbolTable.getChildAstDeclarationByNode(child.node, astDeclaration); const releaseTag = this._getReleaseTagForAstSymbol(childAstDeclaration.astSymbol); if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) { const modification = child.modification; // Yes, trim it and stop here const name = childAstDeclaration.astSymbol.localName; modification.omitChildren = true; modification.prefix = `/* Excluded from this release type: ${name} */`; modification.suffix = ''; if (child.children.length > 0) { // If there are grandchildren, then keep the last grandchild's separator, // since it often has useful whitespace modification.suffix = child.children[child.children.length - 1].separator; } if (child.nextSibling) { // If the thing we are trimming is followed by a comma, then trim the comma also. // An example would be an enum member. if (child.nextSibling.kind === ts.SyntaxKind.CommaToken) { // Keep its separator since it often has useful whitespace modification.suffix += child.nextSibling.separator; child.nextSibling.modification.skipAll(); } } trimmed = true; } } if (!trimmed) { this._modifySpan(child, dtsEntry, childAstDeclaration, dtsKind); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n\t\t if (line.markedSpans)\n\t\t { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n\t\t ++n;\n\t\t });\n\t\t }", "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t\t if (line.markedSpans)\n\t\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t\t ++n;\n\t\t });\n\t\t }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\r\n if (line.markedSpans)\r\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\r\n ++n;\r\n });\r\n }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\n\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n\t if (line.markedSpans)\n\t (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n\t ++n;\n\t });\n\t }", "function attachLocalSpans(doc, change, from, to) {\r\n var existing = change[\"spans_\" + doc.id], n = 0;\r\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\r\n if (line.markedSpans)\r\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\r\n ++n;\r\n });\r\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans }\n ++n\n })\n}", "function adjustSpanBegin(beginPosition) {\n var pos = beginPosition;\n while (isNonEdgeCharacter(sourceDoc.charAt(pos))) {pos++}\n while (!isDelimiter(sourceDoc.charAt(pos)) && pos > 0 && !isDelimiter(sourceDoc.charAt(pos - 1))) {pos--}\n return pos;\n }", "function adjustSpanBegin2(beginPosition) {\n var pos = beginPosition;\n while ((pos < sourceDoc.length) && (isNonEdgeCharacter(sourceDoc.charAt(pos)) || !isDelimiter(sourceDoc.charAt(pos - 1)))) {pos++}\n return pos;\n }", "recomputeDecorations() {\r\n this.uglyDecorationRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n this.grammarState = [];\r\n for (const subst of this.prettyDecorations.unscoped)\r\n subst.ranges = new DisjointRangeSet_1.DisjointRangeSet();\r\n for (const subst of this.prettyDecorations.scoped)\r\n subst.ranges = new DisjointRangeSet_1.DisjointRangeSet();\r\n this.debugDecorations.forEach((val) => val.ranges = []);\r\n const docRange = new vscode.Range(0, 0, this.document.getLineCount(), 0);\r\n this.reparsePretties(docRange);\r\n }", "function setSpan(context, span) {\n return api.trace.setSpan(context, span);\n}", "function setSpan(context, span) {\n return api.trace.setSpan(context, span);\n}", "function addParseSpanInfo(node, span) {\n var commentText;\n if (span instanceof compiler_1.AbsoluteSourceSpan) {\n commentText = span.start + \",\" + span.end;\n }\n else {\n commentText = span.start.offset + \",\" + span.end.offset;\n }\n ts.addSyntheticTrailingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, commentText, /* hasTrailingNewLine */ false);\n }", "_patchAppendApply(patchInfo) {\n let oldText = this.cssText;\n this.cssText = oldText + patchInfo.value;\n this.endOffset = this.endOffset + this.cssText.length - oldText.length;\n /*istanbul ignore else*/\n if (patchInfo.reparse) this._parseInvoke();\n }", "function setSpan(context, span) {\n return context.setValue(SPAN_KEY, span);\n}", "function setSpan(context, span) {\n return context.setValue(SPAN_KEY, span);\n}", "fixProblem(\n editor,\n range,\n fix,\n getFunctionsMatchingTypeFunction,\n showFunctionsMatchingTypeFunction\n ) {\n switch (fix.type) {\n case 'Replace with':\n editor.setTextInBufferRange(fix.range ? fix.range : range, fix.text);\n break;\n\n case 'Add type annotation':\n // Insert type annotation above the line.\n const leadingSpaces = new Array(range.start.column).join(' ');\n editor.setTextInBufferRange(\n [range.start, range.start],\n fix.text + '\\n' + leadingSpaces\n );\n // Remove type annotation marker, if any.\n const markers = editor.findMarkers({\n fixType: 'Add type annotation',\n fixRange: range,\n });\n if (markers) {\n markers.forEach(marker => {\n marker.destroy();\n });\n }\n break;\n\n case 'Remove unused import':\n editor.buffer.deleteRow(range.start.row);\n break;\n\n case 'Add import':\n // Insert below the last import, or module declaration (unless already imported (as when using `Quick Fix All`)).\n let alreadyImported = false;\n const allImportsRegex = /((?:^|\\n)import\\s([\\w\\.]+)(?:\\s+as\\s+(\\w+))?(?:\\s+exposing\\s*\\(((?:\\s*(?:\\w+|\\(.+\\))\\s*,)*)\\s*((?:\\.\\.|\\w+|\\(.+\\)))\\s*\\))?)+/m;\n editor.scanInBufferRange(\n allImportsRegex,\n [[0, 0], editor.getEofBufferPosition()],\n ({ matchText, range, stop }) => {\n if (!new RegExp('^' + fix.text + '$', 'm').test(matchText)) {\n const insertPoint = range.end.traverse([1, 0]);\n editor.setTextInBufferRange(\n [insertPoint, insertPoint],\n fix.text + '\\n'\n );\n }\n alreadyImported = true;\n stop();\n }\n );\n if (!alreadyImported) {\n const moduleRegex = /(?:^|\\n)((effect|port)\\s+)?module\\s+([\\w\\.]+)(?:\\s+exposing\\s*\\(((?:\\s*(?:\\w+|\\(.+\\))\\s*,)*)\\s*((?:\\.\\.|\\w+|\\(.+\\)))\\s*\\))?(\\s*^{-\\|([\\s\\S]*?)-}\\s*|)/m;\n editor.scanInBufferRange(\n moduleRegex,\n [[0, 0], editor.getEofBufferPosition()],\n ({ range, stop }) => {\n const insertPoint = range.end.traverse([1, 0]);\n editor.setTextInBufferRange(\n [insertPoint, insertPoint],\n '\\n' + fix.text + '\\n'\n );\n alreadyImported = true;\n stop();\n }\n );\n }\n if (!alreadyImported) {\n editor.setTextInBufferRange([[0, 0], [0, 0]], fix.text + '\\n');\n }\n break;\n\n case 'Add missing patterns':\n editor.transact(() => {\n const leadingSpaces =\n new Array(fix.range.start.column + 1).join(' ') +\n helper.tabSpaces();\n editor.setCursorBufferPosition(fix.range.end);\n const patternsString = fix.patterns\n .map(pattern => {\n return (\n '\\n\\n' +\n leadingSpaces +\n pattern +\n ' ->\\n' +\n leadingSpaces +\n helper.tabSpaces() +\n 'Debug.crash \"TODO\"'\n );\n })\n .join('');\n editor.insertText(patternsString);\n });\n break;\n\n case 'Remove redundant patterns':\n // TODO\n break;\n\n case 'Fix module name':\n atom.workspace.open(fix.filePath).then(editor => {\n editor.scanInBufferRange(\n /(?:^|\\n)((?:(?:effect|port)\\s+)?module(?:\\s+))(\\S+)\\s/,\n [[0, 0], editor.getEofBufferPosition()],\n ({ match, range, replace, stop }) => {\n if (match && match.length > 1) {\n const prefix = match[1];\n replace(prefix + fix.text + ' ');\n editor.setCursorBufferPosition([\n range.start.row,\n range.start.column + prefix.length + fix.text.length,\n ]);\n stop();\n }\n }\n );\n });\n break;\n\n case 'Run `elm package install`':\n helper.runElmPackageInstall(fix.directory);\n break;\n\n case 'Define top-level':\n if (fix.filePath) {\n if (fs.existsSync(fix.filePath)) {\n atom.workspace.open(fix.filePath).then(editor => {\n editor.transact(() => {\n editor.setCursorBufferPosition(editor.getEofBufferPosition());\n editor.insertText('\\n\\n' + fix.name + ' =\\n ');\n });\n });\n } else {\n fs.writeFileSync(\n fix.filePath,\n 'module ' +\n fix.moduleName +\n ' exposing (..)\\n\\n' +\n fix.name +\n ' =\\n '\n );\n atom.notifications.addInfo('Created ' + fix.filePath, {\n dismissable: true,\n });\n atom.workspace.open(fix.filePath).then(editor => {\n editor.setCursorBufferPosition(editor.getEofBufferPosition());\n });\n }\n } else {\n let topLevelEnd = editor.getEofBufferPosition();\n if (fix.kind !== 'type') {\n // Look for next top-level position.\n editor.scanInBufferRange(\n helper.blockRegex(),\n [range.end, editor.getEofBufferPosition()],\n ({ matchText, range, stop }) => {\n stop();\n topLevelEnd = range.start;\n }\n );\n }\n const atEndOfFile = topLevelEnd.isEqual(\n editor.getEofBufferPosition()\n );\n editor.transact(() => {\n editor.setCursorBufferPosition(topLevelEnd);\n editor.insertText(\n (atEndOfFile ? '\\n\\n' : '') +\n (fix.kind === 'type' ? 'type ' : '') +\n fix.name +\n (fix.kind === 'type' ? '\\n = ' : ' =\\n ') +\n '\\n\\n\\n'\n );\n editor.setCursorBufferPosition([\n topLevelEnd.row + (atEndOfFile ? 3 : 1),\n fix.kind === 'type' ? 6 : 4,\n ]);\n });\n }\n break;\n\n case 'Change type annotation':\n editor.backwardsScanInBufferRange(\n typeAnnotationRegex(fix.name),\n [range.start, [0, 0]],\n ({ stop, range, replace }) => {\n stop();\n replace(fix.text + '\\n' + fix.name);\n editor.setCursorBufferPosition(range.start);\n }\n );\n break;\n\n case 'Search for functions matching type':\n if (getFunctionsMatchingTypeFunction) {\n const projectDirectory = helper.lookupElmPackage(\n path.dirname(fix.filePath),\n fix.filePath\n );\n getFunctionsMatchingTypeFunction(\n fix.text,\n projectDirectory,\n fix.filePath\n ).then(functions => {\n showFunctionsMatchingTypeFunction(editor, range, functions);\n });\n }\n break;\n\n case 'Convert to port module':\n let moduleNameRange = null;\n editor.scanInBufferRange(\n helper.moduleNameRegex(),\n [[0, 0], editor.getEofBufferPosition()],\n ({ matchText, range, stop, replace }) => {\n moduleNameRange = range;\n replace('port ' + matchText);\n editor.setCursorBufferPosition(moduleNameRange.start);\n stop();\n }\n );\n if (moduleNameRange) {\n } else {\n editor.buffer.setTextViaDiff(\n 'port module Main exposing (..)' + '\\n\\n' + editor.getText()\n );\n editor.setCursorBufferPosition([0, 0]);\n }\n break;\n }\n }", "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span) {\n\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t span.marker.attachLine(line);\n\t }", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span, op) {\n\t\t var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n\t\t if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n\t\t line.markedSpans.push(span);\n\t\t } else {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t if (inThisOp) { inThisOp.add(line.markedSpans); }\n\t\t }\n\t\t span.marker.attachLine(line);\n\t\t }", "_patchReplaceApply(patchInfo) {\n let head, trail, oldText = this.cssText;\n head = this.cssText.substring(0, patchInfo.start);\n trail = this.cssText.substring(patchInfo.end);\n this.cssText = head + patchInfo.value + trail;\n this.endOffset = this.endOffset + this.cssText.length - oldText.length;\n /*istanbul ignore else*/\n if (patchInfo.reparse) this._parseInvoke();\n }", "function replaceWithOffset(text, offset, STATE) {\r\n if (offset < 0) {\r\n text = text\r\n .replace(/\\t/g, ' '.repeat(STATE.CONFIG.tabSize))\r\n .replace(new RegExp(\"^ {\" + Math.abs(offset) + \"}\"), '');\r\n if (!STATE.CONFIG.insertSpaces) {\r\n text = replaceSpacesOrTabs(text, STATE, false);\r\n }\r\n }\r\n else {\r\n text = text.replace(/^/, STATE.CONFIG.insertSpaces ? ' '.repeat(offset) : '\\t'.repeat(offset / STATE.CONFIG.tabSize));\r\n }\r\n return text;\r\n}", "function spanAffectsWrapping() { return false; }", "function spanAffectsWrapping() { return false; }", "function spanAffectsWrapping() { return false; }", "function spanAffectsWrapping() { return false; }", "function refineDeclaration(declaration, context) {\n if (declaration.jsDoc == null || declaration.jsDoc.tags == null) {\n return undefined;\n }\n // Applies the \"@deprecated\" jsdoc tag\n var deprecatedTag = declaration.jsDoc.tags.find(function (t) { return t.tag === \"deprecated\"; });\n if (deprecatedTag != null) {\n return __assign(__assign({}, declaration), { deprecated: deprecatedTag.comment || true });\n }\n return undefined;\n}", "function addMarkedSpan(line, span) {\r\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\r\n span.marker.attachLine(line);\r\n }", "reparsePretties(range) {\r\n range = this.document.validateRange(range);\r\n const startCharacter = 0;\r\n const newUglyRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n const newStyledRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n const newScopedRanges = [];\r\n const newUnscopedRanges = [];\r\n const newConditionalRanges = new RangeSet_1.RangeSet();\r\n // initialize an empty range set for every id\r\n this.prettyDecorations.unscoped.forEach(() => newUnscopedRanges.push(new DisjointRangeSet_1.DisjointRangeSet()));\r\n this.prettyDecorations.scoped.forEach(() => newScopedRanges.push(new DisjointRangeSet_1.DisjointRangeSet()));\r\n let invalidatedTokenState = false;\r\n // Collect new pretties\r\n const lineCount = this.document.getLineCount();\r\n let lineIdx;\r\n for (lineIdx = range.start.line; lineIdx <= range.end.line || (invalidatedTokenState && lineIdx < lineCount); ++lineIdx) {\r\n const line = this.document.getLine(lineIdx);\r\n const { tokens: tokens, invalidated: invalidated } = this.refreshTokensOnLine(line, lineIdx);\r\n invalidatedTokenState = invalidated;\r\n for (let ugly of this.iterateLineUglies(line, tokens)) {\r\n const uglyRange = new vscode.Range(lineIdx, ugly.start, lineIdx, ugly.end);\r\n newConditionalRanges.add(new vscode.Range(lineIdx, ugly.matchStart, lineIdx, ugly.matchEnd));\r\n if (ugly.type === \"scoped\") {\r\n if (this.prettyDecorations.scoped[ugly.id].pretty)\r\n newUglyRanges.insert(uglyRange);\r\n else\r\n newStyledRanges.insert(uglyRange);\r\n newScopedRanges[ugly.id].insert(uglyRange);\r\n }\r\n else if (ugly.type === \"unscoped\") {\r\n if (this.prettyDecorations.unscoped[ugly.id].pretty)\r\n newUglyRanges.insert(uglyRange);\r\n else\r\n newStyledRanges.insert(uglyRange);\r\n newUnscopedRanges[ugly.id].insert(uglyRange);\r\n }\r\n }\r\n }\r\n if (lineIdx - 1 > range.end.line) {\r\n // console.info('Aditional tokens reparsed: ' + (lineIdx-range.end.line) + ' lines');\r\n range = range.with({ end: range.end.with({ line: lineIdx, character: 0 }) });\r\n }\r\n // compute the total reparsed range\r\n // use this to clear any preexisting substitutions\r\n const newUglyTotalRange = newUglyRanges.getTotalRange();\r\n const newStyledTotalRange = newStyledRanges.getTotalRange();\r\n let hiddenOverlap = range.with({ start: range.start.with({ character: startCharacter }) });\r\n let styledOverlap = range.with({ start: range.start.with({ character: startCharacter }) });\r\n if (!newUglyTotalRange.isEmpty)\r\n hiddenOverlap = hiddenOverlap.union(newUglyRanges.getTotalRange());\r\n if (!newStyledTotalRange.isEmpty)\r\n styledOverlap = styledOverlap.union(newStyledRanges.getTotalRange());\r\n const overlap = hiddenOverlap.union(styledOverlap);\r\n this.conditionalRanges.removeOverlapping(overlap, { includeTouchingStart: false, includeTouchingEnd: false });\r\n this.uglyDecorationRanges.removeOverlapping(hiddenOverlap);\r\n // this.styledDecorationRanges.removeOverlapping(styledOverlap);\r\n this.prettyDecorations.unscoped.forEach(r => r.ranges.removeOverlapping(overlap));\r\n this.prettyDecorations.scoped.forEach(r => r.ranges.removeOverlapping(overlap));\r\n // add the new pretties & ugly ducklings\r\n newConditionalRanges.getRanges().forEach(r => this.conditionalRanges.add(r));\r\n this.uglyDecorationRanges.insertRanges(newUglyRanges);\r\n this.prettyDecorations.unscoped.forEach((pretty, idx) => pretty.ranges.insertRanges(newUnscopedRanges[idx]));\r\n this.prettyDecorations.scoped.forEach((pretty, idx) => {\r\n pretty.ranges.insertRanges(newScopedRanges[idx]);\r\n });\r\n if (!newStyledRanges.isEmpty() || !newUglyRanges.isEmpty())\r\n this.changedUglies = true;\r\n return hiddenOverlap.union(styledOverlap);\r\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length\n line++\n\n return ''\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length;\n line++;\n\n return '';\n }", "set(decl, prefix) {\n let spec = flexSpec(prefix)[0]\n if (spec === 2009 || spec === 2012) {\n decl.value = AlignItems.oldValues[decl.value] || decl.value\n }\n return super.set(decl, prefix)\n }" ]
[ "0.57268137", "0.57213247", "0.5699011", "0.56869346", "0.56869346", "0.56869346", "0.5681026", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.56591445", "0.56591445", "0.56591445", "0.56591445", "0.56591445", "0.56591445", "0.56591445", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5655021", "0.5631059", "0.5631059", "0.5512342", "0.5509657", "0.5355896", "0.52350706", "0.52350706", "0.5093727", "0.5092012", "0.5030749", "0.5030749", "0.4959716", "0.49531358", "0.49501133", "0.49501133", "0.49501133", "0.49447203", "0.49447203", "0.49403873", "0.49353433", "0.49313316", "0.48819584", "0.48816398", "0.48816398", "0.48816398", "0.48816398", "0.48760262", "0.4862003", "0.48600182", "0.48556465", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48516485", "0.48390925", "0.48390925", "0.48390925", "0.48390925", "0.48390925", "0.48390925", "0.48354876" ]
0.73561174
0
NOTE: THIS IS A TEMPORARY WORKAROUND. In the near future we will overhaul the AEDoc parser to separate syntactic/semantic analysis, at which point this will be wired up to the same ApiDocumentation layer used for the API Review files
_getReleaseTagForDeclaration(declaration) { let releaseTag = ReleaseTag_1.ReleaseTag.None; // We don't want to match "[email protected]". But we do want to match "/**@public*/". // So for now we require whitespace or a star before/after the string. const releaseTagRegExp = /(?:\s|\*)@(internal|alpha|beta|public)(?:\s|\*)/g; const sourceFileText = declaration.getSourceFile().text; for (const commentRange of TypeScriptHelpers_1.TypeScriptHelpers.getJSDocCommentRanges(declaration, sourceFileText) || []) { // NOTE: This string includes "/**" const comment = sourceFileText.substring(commentRange.pos, commentRange.end); let match; while (match = releaseTagRegExp.exec(comment)) { let foundReleaseTag = ReleaseTag_1.ReleaseTag.None; switch (match[1]) { case 'internal': foundReleaseTag = ReleaseTag_1.ReleaseTag.Internal; break; case 'alpha': foundReleaseTag = ReleaseTag_1.ReleaseTag.Alpha; break; case 'beta': foundReleaseTag = ReleaseTag_1.ReleaseTag.Beta; break; case 'public': foundReleaseTag = ReleaseTag_1.ReleaseTag.Public; break; } if (releaseTag !== ReleaseTag_1.ReleaseTag.None && foundReleaseTag !== releaseTag) { // this._analyzeWarnings.push('WARNING: Conflicting release tags found for ' + symbol.name); return releaseTag; } releaseTag = foundReleaseTag; } } return releaseTag; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exportIodocs(src){\n var obj = clone(src,false);\n obj.swagger = '2.0';\n obj.info = {};\n obj.info.version = obj.version || '1';\n obj.info.title = obj.name;\n obj.info.description = obj.description;\n obj.paths = {};\n\n var u = url.parse(obj.basePath+obj.publicPath);\n obj.schemes = [];\n obj.schemes.push(u.protocol.replace(':',''));\n obj.host = u.host;\n obj.basePath = u.path;\n\n delete obj.version;\n delete obj.title;\n delete obj.description;\n delete obj.publicPath;\n delete obj.privatePath; // for oauth etc\n delete obj.protocol;\n delete obj.name;\n delete obj.auth; // TODO\n delete obj.oauth; // TODO\n delete obj.headers; // TODO\n rename(obj,'schemas','definitions');\n if (obj.definitions) fixSchema(obj.definitions);\n\n for (var r in obj.resources) {\n var resource = obj.resources[r];\n // do tags\n for (var m in resource.methods) {\n var method = resource.methods[m];\n method.path = fixPathParameters(method.path);\n\n if (!obj.paths[method.path]) obj.paths[method.path] = {};\n var path = obj.paths[method.path];\n\n var httpMethod = method.httpMethod.toLowerCase();\n if (!path[httpMethod]) path[httpMethod] = {};\n\n var op = path[httpMethod];\n op.operationId = m;\n op.description = method.description;\n op.parameters = [];\n\n for (var p in method.parameters) {\n var param = method.parameters[p];\n param.name = p;\n if (param.title) rename(param,'title','name');\n if ((param.type == 'textarea') || (param.type == 'enumerated')) param.type = 'string';\n if (param.type == 'long') param.type = 'number';\n if (param.type == 'string[]') {\n param.type = 'array';\n param.items = {};\n param.items.type = 'string';\n }\n rename(param,'location','in');\n if (!param[\"in\"]) {\n if (method.path.indexOf('{'+param.name+'}')>=0) {\n param[\"in\"] = 'path';\n }\n else {\n param[\"in\"] = 'query';\n }\n }\n if ((param[\"in\"] == 'body') && (param.type != 'object')) {\n param[\"in\"] = 'formData'; // revalidate\n }\n if (param[\"in\"] == 'pathReplace') {\n param[\"in\"] = 'path';\n }\n if (param[\"in\"] == 'path') {\n param.required = true;\n }\n if (typeof param.required == 'string') {\n param.required = (param.required === 'true');\n }\n if (param.properties) {\n delete param.type;\n param.schema = {};\n param.schema.type = 'object';\n param.schema.properties = param.properties;\n delete param.properties;\n delete param[\"default\"];\n fixSchema(param.schema);\n }\n if (param.items) fixSchema(param.items);\n op.parameters.push(param);\n }\n op.tags = [];\n op.tags.push(r);\n\n op.responses = {};\n op.responses[\"200\"] = {};\n op.responses[\"200\"].description = 'Success';\n\n }\n }\n\n delete obj.resources;\n return obj;\n}", "static bindDocs(api){\n\t\treturn (ctx,next)=>{\n\t\t\tctx.swaggerDocs = api;\n\t\t\tctx.define={\n\t\t\t\tmodel:{\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\tparams:{\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn next();\n\t\t}\n\t}", "function preprocessAPIDocs(options, page, md, addTitle) {\n\tif (addTitle) {\n\t\tlet title = (page.parent ? page.parent.name : \"\") + \" API\";\n\t\tmd = \"# \" + title + \"\\n\" + md;\n\t}\n\tlet t = \"\";\n\tfor (let line of md.split(\"\\n\")) {\n\t\t// This matches:\n\t\t// # GET /my/api\n\t\t// # POST /my/api\n\t\t// # POST|PATCH /my/api\n\t\t// # POST,PATCH /my/api\n\t\t// # POST/PATCH /my/api\n\t\t// # POST\\PATCH /my/api\n\t\tlet m = line.match(/^#\\s((?:GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH)(?:\\||\\/|\\\\|,)?)+\\s(.+)/)\n\t\tif (m) {\n\t\t\tt += \"#\".repeat(options.apiHeaderLevel) + \" $-API-$ `\" + m[1] + \"` \" + m[2] + \"\\n\";\n\t\t} else {\n\t\t\tt += line + \"\\n\";\n\t\t}\n\t}\n\treturn t;\n}", "function convertLiveDocs(apiInfo){\n rename(apiInfo,'title','name');\n rename(apiInfo,'prefix','publicPath');\n rename(apiInfo,'server','basePath');\n apiInfo.resources = {};\n for (var e in apiInfo.endpoints) {\n var ep = apiInfo.endpoints[e];\n var eName = ep.name ? ep.name : 'Default';\n\n if (!apiInfo.resources[eName]) apiInfo.resources[eName] = {};\n apiInfo.resources[eName].description = ep.description;\n\n for (var m in ep.methods) {\n var lMethod = ep.methods[m];\n if (!apiInfo.resources[eName].methods) apiInfo.resources[eName].methods = {};\n var mName = lMethod.MethodName ? lMethod.MethodName : 'Default';\n if (mName.endsWith('.')) mName = mName.substr(0,mName.length-1);\n mName = mName.split(' ').join('_');\n rename(lMethod,'HTTPMethod','httpMethod');\n rename(lMethod,'URI','path');\n rename(lMethod,'Synopsis','description');\n rename(lMethod,'MethodName','name');\n\n lMethod.path = fixPathParameters(lMethod.path);\n\n var params = {};\n for (var p in lMethod.parameters) {\n var lParam = lMethod.parameters[p];\n if (!lParam.type) lParam.type = 'string';\n if (lParam.type == 'json') lParam.type = 'string';\n if (!lParam.location) {\n if (lMethod.path.indexOf(':'+lParam.name)>=0) {\n lParam.location = 'path';\n }\n else {\n lParam.location = 'query';\n }\n }\n if (lParam.location == 'boddy') lParam.location = 'body'; // ;)\n params[lParam.name] = lParam;\n delete lParam.name;\n delete lParam.input; // TODO checkbox to boolean?\n delete lParam.label;\n rename(lParam,'options','enum');\n }\n lMethod.parameters = params;\n if (Object.keys(params).length==0) delete lMethod.parameters;\n\n apiInfo.resources[eName].methods[mName] = lMethod;\n }\n\n }\n delete apiInfo.endpoints; // to keep size down\n return apiInfo;\n}", "function Doc(filename,abspath, grunt) {\n this.grunt = grunt;\n this.filename = filename;\n this.abspath = abspath;\n this.base = undefined;\n this.baseDoc = undefined;\n this.folder = abspath.substring(0,abspath.length - filename.length).replace(\"apidoc/\",\"api/\");\n this.schemefolder = abspath.substring(0,abspath.length - filename.length).replace(\"apidoc/\",\"database/schemes/\");\n this.testfolder = this.folder.replace(\"api/\",\"test/\");\n this.generatedDocsFolder = this.folder.replace(\"api/\",\"generated/\");\n this.version = undefined;\n this.filetitle = undefined;\n this.model = undefined;\n this.json = {};\n this.supportedMethods = [];\n this.readFile(grunt);\n}", "function SwaggerParser () {\n $RefParser.apply(this, arguments);\n}", "function iodocsUpgrade(data){\n \tvar data = data['endpoints'];\n\tvar newResource = {};\n\tnewResource.resources = {};\n\tfor (var index2 = 0; index2 < data.length; index2++) {\n\t\tvar resource = data[index2];\n\t\tvar resourceName = resource.name;\n\t\tnewResource.resources[resourceName] = {};\n\t\tnewResource.resources[resourceName].methods = {};\n\t\tvar methods = resource.methods;\n\t\tfor (var index3 = 0; index3 < methods.length; index3++) {\n\t\t\tvar method = methods[index3];\n\t\t\tvar methodName = method['MethodName'];\n\t\t\tvar methodName = methodName.split(' ').join('_');\n\t\t\tnewResource.resources[resourceName].methods[methodName] = {};\n\t\t\tnewResource.resources[resourceName].methods[methodName].name = method['MethodName'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['httpMethod'] = method['HTTPMethod'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['path'] = method['URI'];\n\t\t\tnewResource.resources[resourceName].methods[methodName].parameters = {};\n\t\t\tif (!method.parameters) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar parameters = method.parameters;\n\t\t\tfor (var index4 = 0; index4 < parameters.length; index4++) {\n\t\t\t\tvar param = parameters[index4];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name] = {};\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['title'] = param.name;\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['required'] = (param['Required'] == 'Y');\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['default'] = param['Default'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['type'] = param['Type'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['description'] = param['Description'];\n\t\t\t}\n\t\t}\n\t}\n return newResource;\n}", "function getDocs(fn) {\n let msg = \"API documentation\\n\" + \"-----------------\\n\";\n for(let idx in fn.__metadata) {\n const methodDefinition = fn.__metadata[idx];\n if(!methodDefinition.returnType) {\n methodDefinition.returnType = 'unknown';\n }\n let apifn = \"* \" + methodDefinition.name + '(' + generateParamList(methodDefinition) + ') => ' + methodDefinition.returnType + '\\n';\n apifn += methodDefinition.description + '\\n';\n apifn += generateParamDocs(methodDefinition);\n msg += apifn + '\\n\\n';\n }\n return msg;\n }", "function getDocs(fn) {\n var msg = \"API documentation\\n\" +\n \"-----------------\\n\";\n for (var idx in fn.__metadata) {\n var methodDefinition = fn.__metadata[idx];\n if (!methodDefinition.returnType) {\n methodDefinition.returnType = 'unknown';\n }\n var apifn = \"* \" + methodDefinition.name + '(' + generateParamList(methodDefinition) + ') => ' + methodDefinition.returnType + '\\n';\n apifn += methodDefinition.description + '\\n';\n apifn += generateParamDocs(methodDefinition);\n msg += apifn + '\\n\\n';\n }\n return msg;\n }", "function Docs() {}", "jsdocPeldaPrivate() {}", "function asciidoc(hljs) {\n return {\n name: 'AsciiDoc',\n aliases: ['adoc'],\n contains: [\n // block comment\n hljs.COMMENT(\n '^/{4,}\\\\n',\n '\\\\n/{4,}$',\n // can also be done as...\n //'^/{4,}$',\n //'^/{4,}$',\n {\n relevance: 10\n }\n ),\n // line comment\n hljs.COMMENT(\n '^//',\n '$',\n {\n relevance: 0\n }\n ),\n // title\n {\n className: 'title',\n begin: '^\\\\.\\\\w.*$'\n },\n // example, admonition & sidebar blocks\n {\n begin: '^[=\\\\*]{4,}\\\\n',\n end: '\\\\n^[=\\\\*]{4,}$',\n relevance: 10\n },\n // headings\n {\n className: 'section',\n relevance: 10,\n variants: [\n {begin: '^(={1,5}) .+?( \\\\1)?$'},\n {begin: '^[^\\\\[\\\\]\\\\n]+?\\\\n[=\\\\-~\\\\^\\\\+]{2,}$'},\n ]\n },\n // document attributes\n {\n className: 'meta',\n begin: '^:.+?:',\n end: '\\\\s',\n excludeEnd: true,\n relevance: 10\n },\n // block attributes\n {\n className: 'meta',\n begin: '^\\\\[.+?\\\\]$',\n relevance: 0\n },\n // quoteblocks\n {\n className: 'quote',\n begin: '^_{4,}\\\\n',\n end: '\\\\n_{4,}$',\n relevance: 10\n },\n // listing and literal blocks\n {\n className: 'code',\n begin: '^[\\\\-\\\\.]{4,}\\\\n',\n end: '\\\\n[\\\\-\\\\.]{4,}$',\n relevance: 10\n },\n // passthrough blocks\n {\n begin: '^\\\\+{4,}\\\\n',\n end: '\\\\n\\\\+{4,}$',\n contains: [\n {\n begin: '<', end: '>',\n subLanguage: 'xml',\n relevance: 0\n }\n ],\n relevance: 10\n },\n // lists (can only capture indicators)\n {\n className: 'bullet',\n begin: '^(\\\\*+|\\\\-+|\\\\.+|[^\\\\n]+?::)\\\\s+'\n },\n // admonition\n {\n className: 'symbol',\n begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\\\s+',\n relevance: 10\n },\n // inline strong\n {\n className: 'strong',\n // must not follow a word character or be followed by an asterisk or space\n begin: '\\\\B\\\\*(?![\\\\*\\\\s])',\n end: '(\\\\n{2}|\\\\*)',\n // allow escaped asterisk followed by word char\n contains: [\n {\n begin: '\\\\\\\\*\\\\w',\n relevance: 0\n }\n ]\n },\n // inline emphasis\n {\n className: 'emphasis',\n // must not follow a word character or be followed by a single quote or space\n begin: '\\\\B\\'(?![\\'\\\\s])',\n end: '(\\\\n{2}|\\')',\n // allow escaped single quote followed by word char\n contains: [\n {\n begin: '\\\\\\\\\\'\\\\w',\n relevance: 0\n }\n ],\n relevance: 0\n },\n // inline emphasis (alt)\n {\n className: 'emphasis',\n // must not follow a word character or be followed by an underline or space\n begin: '_(?![_\\\\s])',\n end: '(\\\\n{2}|_)',\n relevance: 0\n },\n // inline smart quotes\n {\n className: 'string',\n variants: [\n {begin: \"``.+?''\"},\n {begin: \"`.+?'\"}\n ]\n },\n // inline code snippets (TODO should get same treatment as strong and emphasis)\n {\n className: 'code',\n begin: '(`.+?`|\\\\+.+?\\\\+)',\n relevance: 0\n },\n // indented literal block\n {\n className: 'code',\n begin: '^[ \\\\t]',\n end: '$',\n relevance: 0\n },\n // horizontal rules\n {\n begin: '^\\'{3,}[ \\\\t]*$',\n relevance: 10\n },\n // images and links\n {\n begin: '(link:)?(http|https|ftp|file|irc|image:?):\\\\S+\\\\[.*?\\\\]',\n returnBegin: true,\n contains: [\n {\n begin: '(link|image:?):',\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\w',\n end: '[^\\\\[]+',\n relevance: 0\n },\n {\n className: 'string',\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n }\n ],\n relevance: 10\n }\n ]\n };\n}", "function asciidoc(hljs) {\n return {\n name: 'AsciiDoc',\n aliases: ['adoc'],\n contains: [\n // block comment\n hljs.COMMENT(\n '^/{4,}\\\\n',\n '\\\\n/{4,}$',\n // can also be done as...\n //'^/{4,}$',\n //'^/{4,}$',\n {\n relevance: 10\n }\n ),\n // line comment\n hljs.COMMENT(\n '^//',\n '$',\n {\n relevance: 0\n }\n ),\n // title\n {\n className: 'title',\n begin: '^\\\\.\\\\w.*$'\n },\n // example, admonition & sidebar blocks\n {\n begin: '^[=\\\\*]{4,}\\\\n',\n end: '\\\\n^[=\\\\*]{4,}$',\n relevance: 10\n },\n // headings\n {\n className: 'section',\n relevance: 10,\n variants: [\n {begin: '^(={1,5}) .+?( \\\\1)?$'},\n {begin: '^[^\\\\[\\\\]\\\\n]+?\\\\n[=\\\\-~\\\\^\\\\+]{2,}$'},\n ]\n },\n // document attributes\n {\n className: 'meta',\n begin: '^:.+?:',\n end: '\\\\s',\n excludeEnd: true,\n relevance: 10\n },\n // block attributes\n {\n className: 'meta',\n begin: '^\\\\[.+?\\\\]$',\n relevance: 0\n },\n // quoteblocks\n {\n className: 'quote',\n begin: '^_{4,}\\\\n',\n end: '\\\\n_{4,}$',\n relevance: 10\n },\n // listing and literal blocks\n {\n className: 'code',\n begin: '^[\\\\-\\\\.]{4,}\\\\n',\n end: '\\\\n[\\\\-\\\\.]{4,}$',\n relevance: 10\n },\n // passthrough blocks\n {\n begin: '^\\\\+{4,}\\\\n',\n end: '\\\\n\\\\+{4,}$',\n contains: [\n {\n begin: '<', end: '>',\n subLanguage: 'xml',\n relevance: 0\n }\n ],\n relevance: 10\n },\n // lists (can only capture indicators)\n {\n className: 'bullet',\n begin: '^(\\\\*+|\\\\-+|\\\\.+|[^\\\\n]+?::)\\\\s+'\n },\n // admonition\n {\n className: 'symbol',\n begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\\\s+',\n relevance: 10\n },\n // inline strong\n {\n className: 'strong',\n // must not follow a word character or be followed by an asterisk or space\n begin: '\\\\B\\\\*(?![\\\\*\\\\s])',\n end: '(\\\\n{2}|\\\\*)',\n // allow escaped asterisk followed by word char\n contains: [\n {\n begin: '\\\\\\\\*\\\\w',\n relevance: 0\n }\n ]\n },\n // inline emphasis\n {\n className: 'emphasis',\n // must not follow a word character or be followed by a single quote or space\n begin: '\\\\B\\'(?![\\'\\\\s])',\n end: '(\\\\n{2}|\\')',\n // allow escaped single quote followed by word char\n contains: [\n {\n begin: '\\\\\\\\\\'\\\\w',\n relevance: 0\n }\n ],\n relevance: 0\n },\n // inline emphasis (alt)\n {\n className: 'emphasis',\n // must not follow a word character or be followed by an underline or space\n begin: '_(?![_\\\\s])',\n end: '(\\\\n{2}|_)',\n relevance: 0\n },\n // inline smart quotes\n {\n className: 'string',\n variants: [\n {begin: \"``.+?''\"},\n {begin: \"`.+?'\"}\n ]\n },\n // inline code snippets (TODO should get same treatment as strong and emphasis)\n {\n className: 'code',\n begin: '(`.+?`|\\\\+.+?\\\\+)',\n relevance: 0\n },\n // indented literal block\n {\n className: 'code',\n begin: '^[ \\\\t]',\n end: '$',\n relevance: 0\n },\n // horizontal rules\n {\n begin: '^\\'{3,}[ \\\\t]*$',\n relevance: 10\n },\n // images and links\n {\n begin: '(link:)?(http|https|ftp|file|irc|image:?):\\\\S+\\\\[.*?\\\\]',\n returnBegin: true,\n contains: [\n {\n begin: '(link|image:?):',\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\w',\n end: '[^\\\\[]+',\n relevance: 0\n },\n {\n className: 'string',\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n }\n ],\n relevance: 10\n }\n ]\n };\n}", "function asciidoc(hljs) {\n return {\n name: 'AsciiDoc',\n aliases: ['adoc'],\n contains: [\n // block comment\n hljs.COMMENT(\n '^/{4,}\\\\n',\n '\\\\n/{4,}$',\n // can also be done as...\n // '^/{4,}$',\n // '^/{4,}$',\n {\n relevance: 10\n }\n ),\n // line comment\n hljs.COMMENT(\n '^//',\n '$',\n {\n relevance: 0\n }\n ),\n // title\n {\n className: 'title',\n begin: '^\\\\.\\\\w.*$'\n },\n // example, admonition & sidebar blocks\n {\n begin: '^[=\\\\*]{4,}\\\\n',\n end: '\\\\n^[=\\\\*]{4,}$',\n relevance: 10\n },\n // headings\n {\n className: 'section',\n relevance: 10,\n variants: [\n {\n begin: '^(={1,5}) .+?( \\\\1)?$'\n },\n {\n begin: '^[^\\\\[\\\\]\\\\n]+?\\\\n[=\\\\-~\\\\^\\\\+]{2,}$'\n }\n ]\n },\n // document attributes\n {\n className: 'meta',\n begin: '^:.+?:',\n end: '\\\\s',\n excludeEnd: true,\n relevance: 10\n },\n // block attributes\n {\n className: 'meta',\n begin: '^\\\\[.+?\\\\]$',\n relevance: 0\n },\n // quoteblocks\n {\n className: 'quote',\n begin: '^_{4,}\\\\n',\n end: '\\\\n_{4,}$',\n relevance: 10\n },\n // listing and literal blocks\n {\n className: 'code',\n begin: '^[\\\\-\\\\.]{4,}\\\\n',\n end: '\\\\n[\\\\-\\\\.]{4,}$',\n relevance: 10\n },\n // passthrough blocks\n {\n begin: '^\\\\+{4,}\\\\n',\n end: '\\\\n\\\\+{4,}$',\n contains: [{\n begin: '<',\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n }],\n relevance: 10\n },\n // lists (can only capture indicators)\n {\n className: 'bullet',\n begin: '^(\\\\*+|-+|\\\\.+|[^\\\\n]+?::)\\\\s+'\n },\n // admonition\n {\n className: 'symbol',\n begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\\\s+',\n relevance: 10\n },\n // inline strong\n {\n className: 'strong',\n // must not follow a word character or be followed by an asterisk or space\n begin: '\\\\B\\\\*(?![\\\\*\\\\s])',\n end: '(\\\\n{2}|\\\\*)',\n // allow escaped asterisk followed by word char\n contains: [{\n begin: '\\\\\\\\*\\\\w',\n relevance: 0\n }]\n },\n // inline emphasis\n {\n className: 'emphasis',\n // must not follow a word character or be followed by a single quote or space\n begin: '\\\\B\\'(?![\\'\\\\s])',\n end: '(\\\\n{2}|\\')',\n // allow escaped single quote followed by word char\n contains: [{\n begin: '\\\\\\\\\\'\\\\w',\n relevance: 0\n }],\n relevance: 0\n },\n // inline emphasis (alt)\n {\n className: 'emphasis',\n // must not follow a word character or be followed by an underline or space\n begin: '_(?![_\\\\s])',\n end: '(\\\\n{2}|_)',\n relevance: 0\n },\n // inline smart quotes\n {\n className: 'string',\n variants: [\n {\n begin: \"``.+?''\"\n },\n {\n begin: \"`.+?'\"\n }\n ]\n },\n // inline code snippets (TODO should get same treatment as strong and emphasis)\n {\n className: 'code',\n begin: '(`.+?`|\\\\+.+?\\\\+)',\n relevance: 0\n },\n // indented literal block\n {\n className: 'code',\n begin: '^[ \\\\t]',\n end: '$',\n relevance: 0\n },\n // horizontal rules\n {\n begin: '^\\'{3,}[ \\\\t]*$',\n relevance: 10\n },\n // images and links\n {\n begin: '(link:)?(http|https|ftp|file|irc|image:?):\\\\S+?\\\\[[^[]*?\\\\]',\n returnBegin: true,\n contains: [\n {\n begin: '(link|image:?):',\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\w',\n end: '[^\\\\[]+',\n relevance: 0\n },\n {\n className: 'string',\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n }\n ],\n relevance: 10\n }\n ]\n };\n}", "function asciidoc(hljs) {\n return {\n name: 'AsciiDoc',\n aliases: ['adoc'],\n contains: [\n // block comment\n hljs.COMMENT(\n '^/{4,}\\\\n',\n '\\\\n/{4,}$',\n // can also be done as...\n // '^/{4,}$',\n // '^/{4,}$',\n {\n relevance: 10\n }\n ),\n // line comment\n hljs.COMMENT(\n '^//',\n '$',\n {\n relevance: 0\n }\n ),\n // title\n {\n className: 'title',\n begin: '^\\\\.\\\\w.*$'\n },\n // example, admonition & sidebar blocks\n {\n begin: '^[=\\\\*]{4,}\\\\n',\n end: '\\\\n^[=\\\\*]{4,}$',\n relevance: 10\n },\n // headings\n {\n className: 'section',\n relevance: 10,\n variants: [\n {\n begin: '^(={1,5}) .+?( \\\\1)?$'\n },\n {\n begin: '^[^\\\\[\\\\]\\\\n]+?\\\\n[=\\\\-~\\\\^\\\\+]{2,}$'\n }\n ]\n },\n // document attributes\n {\n className: 'meta',\n begin: '^:.+?:',\n end: '\\\\s',\n excludeEnd: true,\n relevance: 10\n },\n // block attributes\n {\n className: 'meta',\n begin: '^\\\\[.+?\\\\]$',\n relevance: 0\n },\n // quoteblocks\n {\n className: 'quote',\n begin: '^_{4,}\\\\n',\n end: '\\\\n_{4,}$',\n relevance: 10\n },\n // listing and literal blocks\n {\n className: 'code',\n begin: '^[\\\\-\\\\.]{4,}\\\\n',\n end: '\\\\n[\\\\-\\\\.]{4,}$',\n relevance: 10\n },\n // passthrough blocks\n {\n begin: '^\\\\+{4,}\\\\n',\n end: '\\\\n\\\\+{4,}$',\n contains: [{\n begin: '<',\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n }],\n relevance: 10\n },\n // lists (can only capture indicators)\n {\n className: 'bullet',\n begin: '^(\\\\*+|-+|\\\\.+|[^\\\\n]+?::)\\\\s+'\n },\n // admonition\n {\n className: 'symbol',\n begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\\\s+',\n relevance: 10\n },\n // inline strong\n {\n className: 'strong',\n // must not follow a word character or be followed by an asterisk or space\n begin: '\\\\B\\\\*(?![\\\\*\\\\s])',\n end: '(\\\\n{2}|\\\\*)',\n // allow escaped asterisk followed by word char\n contains: [{\n begin: '\\\\\\\\*\\\\w',\n relevance: 0\n }]\n },\n // inline emphasis\n {\n className: 'emphasis',\n // must not follow a word character or be followed by a single quote or space\n begin: '\\\\B\\'(?![\\'\\\\s])',\n end: '(\\\\n{2}|\\')',\n // allow escaped single quote followed by word char\n contains: [{\n begin: '\\\\\\\\\\'\\\\w',\n relevance: 0\n }],\n relevance: 0\n },\n // inline emphasis (alt)\n {\n className: 'emphasis',\n // must not follow a word character or be followed by an underline or space\n begin: '_(?![_\\\\s])',\n end: '(\\\\n{2}|_)',\n relevance: 0\n },\n // inline smart quotes\n {\n className: 'string',\n variants: [\n {\n begin: \"``.+?''\"\n },\n {\n begin: \"`.+?'\"\n }\n ]\n },\n // inline code snippets (TODO should get same treatment as strong and emphasis)\n {\n className: 'code',\n begin: '(`.+?`|\\\\+.+?\\\\+)',\n relevance: 0\n },\n // indented literal block\n {\n className: 'code',\n begin: '^[ \\\\t]',\n end: '$',\n relevance: 0\n },\n // horizontal rules\n {\n begin: '^\\'{3,}[ \\\\t]*$',\n relevance: 10\n },\n // images and links\n {\n begin: '(link:)?(http|https|ftp|file|irc|image:?):\\\\S+?\\\\[[^[]*?\\\\]',\n returnBegin: true,\n contains: [\n {\n begin: '(link|image:?):',\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\w',\n end: '[^\\\\[]+',\n relevance: 0\n },\n {\n className: 'string',\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n }\n ],\n relevance: 10\n }\n ]\n };\n}", "function mainImpl(doc) {\n\n}", "atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }", "function $a844886672f03c92$var$asciidoc(hljs) {\n return {\n name: \"AsciiDoc\",\n aliases: [\n \"adoc\"\n ],\n contains: [\n // block comment\n hljs.COMMENT(\"^/{4,}\\\\n\", \"\\\\n/{4,}$\", // can also be done as...\n // '^/{4,}$',\n // '^/{4,}$',\n {\n relevance: 10\n }),\n // line comment\n hljs.COMMENT(\"^//\", \"$\", {\n relevance: 0\n }),\n // title\n {\n className: \"title\",\n begin: \"^\\\\.\\\\w.*$\"\n },\n // example, admonition & sidebar blocks\n {\n begin: \"^[=\\\\*]{4,}\\\\n\",\n end: \"\\\\n^[=\\\\*]{4,}$\",\n relevance: 10\n },\n // headings\n {\n className: \"section\",\n relevance: 10,\n variants: [\n {\n begin: \"^(={1,5}) .+?( \\\\1)?$\"\n },\n {\n begin: \"^[^\\\\[\\\\]\\\\n]+?\\\\n[=\\\\-~\\\\^\\\\+]{2,}$\"\n }\n ]\n },\n // document attributes\n {\n className: \"meta\",\n begin: \"^:.+?:\",\n end: \"\\\\s\",\n excludeEnd: true,\n relevance: 10\n },\n // block attributes\n {\n className: \"meta\",\n begin: \"^\\\\[.+?\\\\]$\",\n relevance: 0\n },\n // quoteblocks\n {\n className: \"quote\",\n begin: \"^_{4,}\\\\n\",\n end: \"\\\\n_{4,}$\",\n relevance: 10\n },\n // listing and literal blocks\n {\n className: \"code\",\n begin: \"^[\\\\-\\\\.]{4,}\\\\n\",\n end: \"\\\\n[\\\\-\\\\.]{4,}$\",\n relevance: 10\n },\n // passthrough blocks\n {\n begin: \"^\\\\+{4,}\\\\n\",\n end: \"\\\\n\\\\+{4,}$\",\n contains: [\n {\n begin: \"<\",\n end: \">\",\n subLanguage: \"xml\",\n relevance: 0\n }\n ],\n relevance: 10\n },\n // lists (can only capture indicators)\n {\n className: \"bullet\",\n begin: \"^(\\\\*+|-+|\\\\.+|[^\\\\n]+?::)\\\\s+\"\n },\n // admonition\n {\n className: \"symbol\",\n begin: \"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\\\s+\",\n relevance: 10\n },\n // inline strong\n {\n className: \"strong\",\n // must not follow a word character or be followed by an asterisk or space\n begin: \"\\\\B\\\\*(?![\\\\*\\\\s])\",\n end: \"(\\\\n{2}|\\\\*)\",\n // allow escaped asterisk followed by word char\n contains: [\n {\n begin: \"\\\\\\\\*\\\\w\",\n relevance: 0\n }\n ]\n },\n // inline emphasis\n {\n className: \"emphasis\",\n // must not follow a word character or be followed by a single quote or space\n begin: \"\\\\B'(?!['\\\\s])\",\n end: \"(\\\\n{2}|')\",\n // allow escaped single quote followed by word char\n contains: [\n {\n begin: \"\\\\\\\\'\\\\w\",\n relevance: 0\n }\n ],\n relevance: 0\n },\n // inline emphasis (alt)\n {\n className: \"emphasis\",\n // must not follow a word character or be followed by an underline or space\n begin: \"_(?![_\\\\s])\",\n end: \"(\\\\n{2}|_)\",\n relevance: 0\n },\n // inline smart quotes\n {\n className: \"string\",\n variants: [\n {\n begin: \"``.+?''\"\n },\n {\n begin: \"`.+?'\"\n }\n ]\n },\n // inline code snippets (TODO should get same treatment as strong and emphasis)\n {\n className: \"code\",\n begin: \"(`.+?`|\\\\+.+?\\\\+)\",\n relevance: 0\n },\n // indented literal block\n {\n className: \"code\",\n begin: \"^[ \\\\t]\",\n end: \"$\",\n relevance: 0\n },\n // horizontal rules\n {\n begin: \"^'{3,}[ \\\\t]*$\",\n relevance: 10\n },\n // images and links\n {\n begin: \"(link:)?(http|https|ftp|file|irc|image:?):\\\\S+?\\\\[[^[]*?\\\\]\",\n returnBegin: true,\n contains: [\n {\n begin: \"(link|image:?):\",\n relevance: 0\n },\n {\n className: \"link\",\n begin: \"\\\\w\",\n end: \"[^\\\\[]+\",\n relevance: 0\n },\n {\n className: \"string\",\n begin: \"\\\\[\",\n end: \"\\\\]\",\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n }\n ],\n relevance: 10\n }\n ]\n };\n}", "atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }", "function FreeTextDocumentationView() {\r\n}", "generate() {\n let content = [];\n // add 'top' content above all other content\n if (this._top)\n content.push(this._addIdLinks(this._top), \"\");\n // piece all content together\n for (let i = 0; i < this.doc.content.length; i++) {\n let c = this.doc.content[i];\n // skip non-root namespace node\n if (c.id === this.doc.id + \".\" && i > 0)\n continue;\n // add horizontal line above all namespaced nodes\n if (c.spec.namespaced)\n content.push(\"---\", \"\");\n // add heading with icon and tag(s)\n let icon = \"/assets/icons/spec-\" + c.spec.type + \".svg\";\n let tags = \"\";\n if (c.spec.abstractModifier)\n tags += ` <span class=\"spec_tag\">abstract</span>`;\n if (c.spec.staticModifier)\n tags += ` <span class=\"spec_tag\">static</span>`;\n if (c.spec.protectedModifier)\n tags += ` <span class=\"spec_tag\">protected</span>`;\n if (c.spec.deprecated)\n tags += ` <span class=\"spec_tag spec_tag--deprecated\">deprecated</span>`;\n let name = this._getTypedName(c.spec).replace(/_/g, \"\\\\_\");\n content.push(`## ![](${icon})${name}${tags} {.spec ${navId(c.id)}}`, \"\");\n // add declaration spec and further documentation\n content.push(...(c.spec.spec && c.spec.type !== DeclarationFileParser_1.SpecNodeType.ClassDeclaration\n ? [\n \"\",\n c.spec.spec\n .split(\"\\n\")\n .map((s) => this._addIdLinks(\"`\" + s + \"`\"))\n .join(\"<br>\"),\n \"\",\n ]\n : c.spec.inherit\n ? [\n \"\",\n c.spec.inherit\n .map((s) => this._addIdLinks(\"`\" + s + \"`\"))\n .join(\"<code> </code>\"),\n \"\",\n ]\n : []));\n let params = [];\n let notes = [];\n for (let d of c.docs) {\n let txt = this._addIdLinks(d.doc).replace(/\\n(?!\\n)/g, \"\\n\\n\") + \"\\n\\n\";\n switch (d.tag) {\n case \"param\":\n params.push(`- \\`${d.name}\\` — ${txt}`);\n break;\n case \"return\":\n notes.push(`**Returns:** ${txt}`, \"\");\n break;\n case \"note\":\n notes.push(`**Note:** ${txt}`, \"\");\n break;\n case \"deprecated\":\n notes.push(`**Deprecated:** ${txt}`, \"\");\n break;\n default:\n notes.push(txt, \"\");\n }\n }\n content.push(...params, \"\", ...notes);\n // add miscellaneous content\n let misc = this._misc.getContentFor(c.id);\n if (misc) {\n content.push(this._addIdLinks(misc), \"\");\n }\n if (c.spec.spec && c.spec.type === DeclarationFileParser_1.SpecNodeType.ClassDeclaration) {\n content.push(\"### Constructor\", \"\", this._addIdLinks(\"`\" + c.spec.spec + \"`\"), \"\");\n }\n }\n // add nav and pageintro properties\n this._addNav();\n this._addPageIntro();\n // return markdown content itself\n return content;\n }", "function convertSwagger(source){\n var apiInfo = clone(source,false);\n apiInfo.resources = {};\n\n\tif (apiInfo.servers && apiInfo.servers.length) {\n\t\tvar u = url.parse(apiInfo.servers[0].url);\n\t\tapiInfo.host = u.host;\n\t\tapiInfo.basePath = u.path;\n\t\tapiInfo.schemes = [];\n\t\tapiInfo.schemes.push(u.protocol.replace(':',''));\n\t}\n\n for (var p in apiInfo.paths) {\n for (var m in apiInfo.paths[p]) {\n if ('.get.post.put.delete.head.patch.options.trace.'.indexOf(m)>=0) {\n var sMethod = apiInfo.paths[p][m];\n var ioMethod = {};\n ioMethod.httpMethod = m.toUpperCase();\n var sMethodUniqueName = sMethod.operationId ? sMethod.operationId : m+'_'+p.split('/').join('_');\n sMethodUniqueName = sMethodUniqueName.split(' ').join('_'); // TODO {, } and : ?\n ioMethod.name = sMethodUniqueName;\n ioMethod.summary = sMethod.summary;\n ioMethod.description = sMethod.description;\n ioMethod.parameters = {};\n var sParams = sMethod.parameters ? sMethod.parameters : [];\n if (apiInfo.paths[p].parameters) {\n sParams = sParams.concat(apiInfo.paths[p].parameters);\n }\n for (var p2 in sParams) {\n var param = sParams[p2];\n var ptr = param[\"$ref\"];\n if (ptr && ptr.startsWith('#/parameters/')) {\n ptr = ptr.replace('#/parameters/','');\n param = clone(apiInfo.parameters[ptr],false);\n }\n if (ptr && ptr.startsWith('#/components/parameters/')) {\n ptr = ptr.replace('#/components/parameters/','');\n param = clone(apiInfo.components.parameters[ptr],false);\n }\n param.location = param[\"in\"];\n delete param[\"in\"];\n\t\t\t\t\tif (!param.type && param.schema && param.schema.type) {\n\t\t\t\t\t\tparam.type = param.schema.type;\n\t\t\t\t\t}\n ioMethod.parameters[param.name] = param;\n }\n ioMethod.path = p;\n ioMethod.responses = sMethod.responses;\n var tagName = 'Default';\n if (sMethod.tags && sMethod.tags.length>0) {\n tagName = sMethod.tags[0];\n }\n if (!apiInfo.resources[tagName]) {\n apiInfo.resources[tagName] = {};\n if (apiInfo.tags) {\n for (var t in apiInfo.tags) {\n var tag = apiInfo.tags[t];\n if (tag.name == tagName) {\n apiInfo.resources[tagName].description = tag.description;\n apiInfo.resources[tagName].externalDocs = tag.externalDocs;\n }\n }\n }\n }\n if (!apiInfo.resources[tagName].methods) apiInfo.resources[tagName].methods = {};\n apiInfo.resources[tagName].methods[sMethodUniqueName] = ioMethod;\n }\n }\n }\n delete apiInfo.paths; // to keep size down\n if (apiInfo.definitions) rename(apiInfo,'definitions','schemas');\n if (apiInfo.components && apiInfo.components.schemas) rename(apiInfo,'components.schemas','schemas');\n return apiInfo;\n}", "function buildApiDocs(targetLanguage) {\n var ALLOWED_LANGUAGES = ['ts', 'js', 'dart'];\n var GENERATE_API_LANGUAGES = ['ts', 'js'];\n checkAngularProjectPath();\n try {\n // Build a specialized package to generate different versions of the API docs\n var package = new Package('apiDocs', [require(path.resolve(TOOLS_PATH, 'api-builder/angular.io-package'))]);\n package.config(function(log, targetEnvironments, writeFilesProcessor, readTypeScriptModules, linkDocsInlineTagDef) {\n log.level = _dgeniLogLevel;\n ALLOWED_LANGUAGES.forEach(function(target) { targetEnvironments.addAllowed(target); });\n if (targetLanguage) {\n targetEnvironments.activate(targetLanguage);\n\n if (GENERATE_API_LANGUAGES.indexOf(targetLanguage) === -1) {\n // Don't read TypeScript modules if we are not generating API docs - Dart I am looking at you!\n readTypeScriptModules.$enabled = false;\n }\n linkDocsInlineTagDef.lang = targetLanguage;\n linkDocsInlineTagDef.vers = 'latest';\n writeFilesProcessor.outputFolder = path.join(targetLanguage, linkDocsInlineTagDef.vers, 'api');\n }\n });\n\n var dgeni = new Dgeni([package]);\n return dgeni.generate();\n } catch(err) {\n console.error(err);\n console.error(err.stack);\n throw err;\n }\n}", "function remarkSwagger (spec, opts) {\n opts = opts || {}\n\n assert.equal(typeof opts, 'object', 'opts is an object')\n\n const title = opts.title || 'API'\n const position = opts.position || 4\n\n if (opts.yaml) spec = yaml.parse(spec)\n if (opts.json) spec = JSON.parse(spec)\n\n assert.equal(typeof spec, 'object', 'spec is object')\n\n return function attacher () {\n return function transformer (ast, file) {\n const table = createTable(spec)\n const heading = u('heading', { depth: 2 }, [\n u('text', { value: title })\n ])\n\n const head = ast.children[position]\n if (head.type === 'header' && head.children[0].value === title) {\n // inject code into existing node\n ast.children[position + 1] = table\n } else {\n // inject code into new node\n ast.children.splice(position, 0, table)\n ast.children.splice(position, 0, heading)\n }\n }\n }\n}", "function convertToOpenAPI(info, data) {\n const builder = new openapi3_ts_1.OpenApiBuilder();\n builder.addInfo(Object.assign(Object.assign({}, info.base), { title: info.base.title || '[untitled]', version: info.base.version || '0.0.0' }));\n info.contact && builder.addContact(info.contact);\n const tags = [];\n const paths = {};\n let typeCount = 1;\n const schemas = {};\n data.forEach(item => {\n [].concat(item.url).forEach(url => {\n if (typeof url !== 'string') {\n // TODO\n return;\n }\n url = url\n .split('/')\n .map((item) => (item.startsWith(':') ? `{${item.substr(1)}}` : item))\n .join('/');\n if (!tags.find(t => t.name === item.typeGlobalName)) {\n const ctrlMeta = controller_1.getControllerMetadata(item.typeClass);\n tags.push({\n name: item.typeGlobalName,\n description: (ctrlMeta && [ctrlMeta.name, ctrlMeta.description].filter(s => s).join(' ')) ||\n undefined,\n });\n }\n if (!paths[url]) {\n paths[url] = {};\n }\n [].concat(item.method).forEach((method) => {\n method = method.toLowerCase();\n function paramFilter(p) {\n if (p.source === 'Any') {\n return ['post', 'put'].every(m => m !== method);\n }\n return p.source !== 'Body';\n }\n function convertValidateToSchema(validateType) {\n if (validateType === 'string') {\n return {\n type: 'string',\n };\n }\n if (validateType === 'int' || validateType === 'number') {\n return {\n type: 'number',\n };\n }\n if (validateType.type === 'object' && validateType.rule) {\n let properties = {};\n const required = [];\n Object.keys(validateType.rule).forEach(key => {\n const rule = validateType.rule[key];\n properties[key] = convertValidateToSchema(rule);\n if (rule.required !== false) {\n required.push(key);\n }\n });\n const typeName = `GenType_${typeCount++}`;\n builder.addSchema(typeName, {\n type: validateType.type,\n required: required,\n properties,\n });\n return {\n $ref: `#/components/schemas/${typeName}`,\n };\n }\n if (validateType.type === 'enum') {\n return {\n type: 'string',\n };\n }\n return {\n type: validateType.type,\n items: validateType.itemType\n ? validateType.itemType === 'object'\n ? convertValidateToSchema({ type: 'object', rule: validateType.rule })\n : { type: validateType.itemType }\n : undefined,\n enum: Array.isArray(validateType.values)\n ? validateType.values.map(v => convertValidateToSchema(v))\n : undefined,\n maximum: validateType.max,\n minimum: validateType.min,\n };\n }\n function getTypeSchema(p) {\n if (p.schema) {\n return p.schema;\n }\n else if (p.validateType && p.validateType.type) {\n return convertValidateToSchema(p.validateType);\n }\n else {\n const type = utils_1.getGlobalType(p.type);\n const isSimpleType = ['array', 'boolean', 'integer', 'number', 'object', 'string'].some(t => t === type.toLowerCase());\n // TODO complex type process\n return {\n type: isSimpleType ? type.toLowerCase() : 'object',\n items: type === 'Array'\n ? {\n type: 'object',\n }\n : undefined,\n };\n }\n }\n // add schema\n const components = item.schemas.components || {};\n Object.keys(components).forEach(typeName => {\n if (schemas[typeName] && schemas[typeName].hashCode !== components[typeName].hashCode) {\n console.warn(`[egg-controller] type: [${typeName}] has multi defined!`);\n return;\n }\n schemas[typeName] = components[typeName];\n });\n // param\n const inParam = item.paramTypes.filter(paramFilter);\n // req body\n const inBody = item.paramTypes.filter(p => !paramFilter(p));\n let requestBody;\n if (inBody.length) {\n const requestBodySchema = {\n type: 'object',\n properties: {},\n };\n inBody.forEach(p => {\n if (p.required || util_1.getValue(() => p.validateType.required)) {\n if (!requestBodySchema.required) {\n requestBodySchema.required = [];\n }\n requestBodySchema.required.push(p.paramName);\n }\n requestBodySchema.properties[p.paramName] = getTypeSchema(p);\n });\n const reqMediaType = 'application/json';\n requestBody = {\n content: {\n [reqMediaType]: {\n schema: requestBodySchema,\n },\n },\n };\n }\n // res\n let responseSchema = item.schemas.response || {};\n const refTypeName = responseSchema.$ref;\n if (refTypeName) {\n const definition = item.schemas.components[refTypeName.replace('#/components/schemas/', '')];\n if (definition) {\n responseSchema = { $ref: refTypeName };\n }\n else {\n console.warn(`[egg-controller] NotFound {${refTypeName}} in components.`);\n responseSchema = { type: 'any' };\n }\n }\n const responses = {\n default: {\n description: 'default',\n content: {\n 'application/json': {\n schema: responseSchema,\n },\n },\n },\n };\n paths[url][method] = {\n operationId: item.functionName,\n tags: [item.typeGlobalName],\n summary: item.name,\n description: item.description,\n parameters: inParam.length\n ? inParam.map(p => {\n const source = p.source === 'Header' ? 'header' : p.source === 'Param' ? 'path' : 'query';\n return {\n name: p.paramName,\n in: source,\n required: source === 'path' || p.required || util_1.getValue(() => p.validateType.required),\n schema: getTypeSchema(p),\n };\n })\n : undefined,\n requestBody,\n responses,\n };\n });\n });\n });\n // add schema\n Object.keys(schemas).forEach(key => {\n delete schemas[key].hashCode;\n builder.addSchema(key, schemas[key]);\n });\n tags.forEach(tag => builder.addTag(tag));\n Object.keys(paths).forEach(path => builder.addPath(path, paths[path]));\n return JSON.parse(builder.getSpecAsJson());\n}", "apiDefinationGeneratorTest(obj) {\n let newProps = {};\n newProps['methods'] = {};\n newProps['properties'] = {};\n newProps['name'] = obj.constructor.name;\n\n if (obj.version) {\n newProps['version'] = obj.version;\n }\n\n newProps['events'] = {\n 'listening': [this, this.listening],\n 'wssError': [this, this.wssError],\n 'wssConnection': [this, this.wssOnConnection],\n 'wssMessage': [this, this.wssOnMessage],\n };\n\n do {\n //console.log(obj);\n for (let index of Object.getOwnPropertyNames(obj)) {\n if (obj[index]) {\n if ((typeof obj[index]) == 'function') {\n let jsDoc = ''\n\n // The constructor function contains all the code for the class,\n // including the comments between functions which is where the\n // jsDoc definition for the function lives.\n if (obj['constructor']) {\n let done = false;\n\n // The first line of this specific function will be the last line\n // in the constructor we need to look at. The relevant jsDoc\n // should be right above.\n let firstLine = obj[index].toString().split(/\\n/)[0];\n\n // We are going to parse every line of the constructor until we\n // find the first line of the function we're looking for.\n for (let line of obj['constructor'].toString().split(/\\n/)) {\n if (!done) {\n // Start of a new jsDoc segment. Anything we already have is\n // not related to this function.\n if (line.match(/\\/\\*\\*/)) {\n jsDoc = line + '\\n';\n }\n\n // There should be no lines that start with a \"}\" within the\n // jsDoc definition so if we find one we've meandered out of\n // the jsDoc definition. This makes sure that later\n // functions that have no jsDoc defition don't get jsDoc\n // definitions from earlier functions (the earlier functions\n // will end with \"}\").\n else if (line.replace(/^\\s*/g, '').match(/^}/)) {\n jsDoc = '';\n }\n\n // If this line from the constructor matches the first line\n // from this function (with leading whitespace removed), we\n // have what we came for. Don't process future lines.\n else if (line.replace(/^\\s*/g, '') == firstLine) {\n done = true;\n }\n\n // Either this line is part of the jsDoc or it's junk, Either\n // way, append it to the jsDoc we're extracting. If it's\n // junk it will be cleared by the start of the next jsDoc\n // segment or the end of a function.\n else {\n jsDoc += line + '\\n';\n }\n }\n }\n }\n\n // Now we just tidy up the jsDoc fragment we extracted. More to do\n // here.\n if (jsDoc.match(/\\/\\*\\*/)) {\n jsDoc = jsDoc.split(/\\/\\*\\*/)[1];\n }\n else {\n jsDoc = '';\n }\n if (jsDoc.match(/\\*\\//)) {\n jsDoc = jsDoc.split(/\\*\\//)[0];\n }\n\n let functionProperties = obj[index];\n functionProperties['namedArguments'] = {};\n functionProperties['numberedArguments'] = [];\n functionProperties['private'] = false;\n functionProperties['description'] = '';\n functionProperties['returns'] = '';\n if (jsDoc.length > 0) {\n jsDoc = jsDoc.replace(/^\\s*/mg, '');\n for (let line of (jsDoc.split(/\\n/))) {\n if (line.match(/^\\@private/i)) {\n functionProperties['private'] = true;\n }\n else if (line.match(/^\\@param/i)) {\n let parsedLine = this.parseJsDocLine(line);\n functionProperties['numberedArguments'].push(parsedLine)\n functionProperties['namedArguments'][parsedLine[0]] = parsedLine;\n }\n else if (line.match(/^\\@return/i)) {\n functionProperties['returns'] = line;\n }\n else {\n functionProperties['description'] += line;\n }\n }\n //console.log(index);\n //console.log(jsDoc);\n //console.log(functionProperties);\n newProps['methods'][index] = functionProperties;\n newProps['methods'][index]['uri'] = index;\n }\n }\n else if (typeof obj[index] != 'object') {\n newProps['properties'][index] = {\n 'uri': index,\n 'getter': 'TODO'\n }\n }\n else {\n //console.log(\"not a function: \", index, typeof obj[index]);\n }\n }\n }\n } while (obj = Object.getPrototypeOf(obj));\n\n return newProps;\n }", "function DocScannerConfig() { }", "function gendoc(filename,folder) {\n // load js method\n var path = './../lib/';\n var code = fs.readFileSync(path + folder + '/' + filename,'utf8');\n\n // function arguments\n var funstr = /\\$u[.][^{]+/.exec(code)[0].trim();\n var funargs = funstr.split('function')[1];\n\n // comments\n var re = /\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\//g;\n var arr = re.exec(code);\n var out = [];\n while (arr !== null) {\n out.push(arr);\n arr = re.exec(code);\n re.lastIndex;\n }\n // category\n var category = out[0][0].replace('/**', '')\n .replace('*/', '')\n .replace(/\\n\\s*\\* ?/g, '\\n')\n .replace(/\\r/g, '');\n\n var txtline = category.split('\\n');\n var catname = txtline[1];\n\n var comment = out[1][0].replace('/**', '')\n .replace('*/', '')\n .replace(/\\n\\s*\\* ?/g, '\\n')\n .replace(/\\r/g, '');\n\n var lines = comment.split('\\n');\n \n doc = {\n 'funargs': funargs,\n 'syntax': '',\n 'category': catname,\n 'name': '',\n 'summary': '',\n 'description': '',\n 'param': [],\n 'returns': [],\n 'example': {},\n 'folder': folder,\n 'filename': filename\n }\n\n \n var count = 0,\n tagdesc = false,\n tagex = false;\n while (count < lines.length) {\n var line = lines[count];\n if (line === '') {\n line = line.replace('','\\n');\n }\n if (line !== '') {\n // method\n if (/^@method/.test(line)) {\n var match = line.replace('@method','');\n doc.name = match.trim();\n }\n // summary\n if (/^@summary/.test(line)) {\n var match = line.replace('@summary','');\n doc.summary = match.trim();\n }\n // description\n if (/^@description/.test(line)) {\n var match = line.replace('@description','');\n doc.description = match.trim();\n tagdesc = true;\n } else\n if (tagdesc === true) {\n if (!/^@/.test(line)) {\n doc.description += ' \\n' + line.trim();\n }\n }\n // parameters\n if (/^@param/.test(line)) {\n tagdesc = false;\n var match = line.replace('@param','')\n .replace('{','')\n .replace('}','')\n .replace(/\\|/g,'/')\n .trim()\n .replace(' ','\\n')\n .replace(' ','\\n')\n .split('\\n');\n doc.param.push(match);\n }\n // returns\n if (/^@return/.test(line)) {\n var match = line.replace('@return','')\n .replace('{','`')\n .replace('}','`')\n .replace(/\\|/g,'/')\n .trim()\n .replace(' ','\\n')\n .replace(' ','\\n')\n .split('\\n');\n doc.returns.push(match);\n }\n // examples\n if (/^@example/.test(line)) {\n var i = 1, txt = [], vars = [],funs = [];\n while (lines[count + i] !== undefined) {\n var tmp = lines[count + i];\n if (/^var/.test(tmp)) {\n vars.push(tmp.trim());\n }\n if (/^ubique/.test(tmp)) {\n funs.push(tmp.trim());\n }\n txt.push(tmp.trim());\n i++;\n }\n doc.example = {'txt':txt, 'vars': vars, 'funs': funs}\n }\n\n }\n count++;\n }\n return doc;\n\n}", "extendCli (cli) {\n cli\n .command('metadata <targetDir> [...inputPaths]', 'Generate required metadata for the API reference docs')\n .option('-o <dir>', 'Output directory. Defaults to <targetDir>/api/')\n .action(async (targetDir, inputPaths, options) => {\n if (inputPaths.length === 0) {\n throw new Error('Please specify at least one path to a folder containing API docs.')\n }\n\n const outputPath = options.o ? path.resolve(options.o) : path.resolve(context.sourceDir, 'api')\n const docgenMainScript = require.resolve('titanium-docgen')\n const command = [\n 'node',\n docgenMainScript,\n '-f', 'json-raw',\n inputPaths.shift(),\n ...inputPaths.reduce((acc, cur) => {\n acc.push('-a', cur)\n return acc\n }, []),\n '-o', outputPath\n ]\n logger.wait('Generating API metadata file...')\n try {\n logger.debug(`Running command ${command.join(' ')}`)\n await execAsync(command.join(' '))\n logger.success(`Done! Metadata file generated to ${path.join(outputPath, 'api.json')}`)\n } catch (e) {\n logger.error('Failed to generate API metadata.')\n throw e\n }\n })\n }", "_getDesiredDocInfo(originalRequest, docInfoFromJsonFile) {\n if (!docInfoFromJsonFile) return null // We're not psychics!\n\n // so now we care about the following parts of originalRequest:\n // symbolType: \"method|variable|class\",\n // symbol: \"stringOfTheSymbol\" as a longname including the class\n // ..and we should have the correct JSON api doc to look at to get this\n let retval = null\n let symbolElementArray = originalRequest.symbol.split('.')\n originalRequest._leafOfSymbol = _.last(symbolElementArray)\n\n if (originalRequest.symbolType === 'method') {\n // We don't have a clear definition (yet) from tern that this is a NEW invocation on a constructor,\n // so there's some mild hackery here to make things mostly work before coming back and handling the\n // constructor vs invocation issue more robustly.. For now we do this, which at least works for Phaser\n // since it mostly constructed of big-ass top-level classes\n\n let methodIsClassConstructorInvocation =\n originalRequest.frameworkName === 'phaser' && symbolElementArray.length === 2\n\n if (methodIsClassConstructorInvocation) {\n // we want to return class. It doesn't have 'returns' so renderer must be aware of that.\n if (docInfoFromJsonFile.class) {\n retval = docInfoFromJsonFile.class\n retval.__typeIs = 'classConstructor'\n }\n } else {\n if (originalRequest.frameworkName === 'lodash') {\n let c_ = docInfoFromJsonFile.classes[0]\n retval = _.find(c_.functions, { name: originalRequest._leafOfSymbol })\n if (retval) retval.__typeIs = 'functionOrMethod'\n }\n\n if (originalRequest.frameworkName === 'phaser') {\n if (docInfoFromJsonFile.methods && docInfoFromJsonFile.methods.public) {\n retval = _.find(docInfoFromJsonFile.methods.public, { name: originalRequest._leafOfSymbol })\n if (retval) retval.__typeIs = 'functionOrMethod'\n }\n }\n }\n }\n return retval\n }", "function Documentation(jsonDoc) {\n this.id = jsonDoc.id;\n this.serviceName = jsonDoc.serviceName;\n this.serviceDescription = jsonDoc.serviceDescription;\n this.serviceHost = jsonDoc.serviceHost;\n this.swaggerUiUrl = jsonDoc.swaggerUiUrl;\n this.swaggerSpecUrl = jsonDoc.swaggerSpecUrl;\n this.environment = jsonDoc.environment;\n this.category = jsonDoc.category;\n this.displayName = ko.computed(function() {\n return this.serviceName + \" (\" + this.environment + \")\";\n }, this);\n this.displayHost = ko.computed(function() {\n var displayHost = this.serviceHost;\n if(displayHost.indexOf(\"http://\") < 0) {\n displayHost = \"http://\" + displayHost;\n }\n return displayHost;\n }, this);\n this.displaySwaggerSpec = ko.computed(function() {\n return this.displayHost() + this.swaggerSpecUrl;\n }, this);\n this.displaySwaggerUi = ko.computed(function() {\n return this.displayHost() + this.swaggerUiUrl;\n }, this);\n this.iframeUrl = ko.computed(function() {\n var swaggerUI = this.displaySwaggerUi();\n if(swaggerUI.indexOf(\"?\") > -1) {\n swaggerUI = swaggerUI + \"&\";\n } else {\n swaggerUI = swaggerUI + \"?\"\n }\n return swaggerUI + \"hideHeader=true\";\n }, this);\n}", "__doc__() {\n return this.doc;\n }", "function extendSwagger2(baucisInstance, sw2Root) {\t\n\tconsole.log(\" plugin- extendSwagger2()\");\t\n}", "function buildParsed(lines, pos) {\n // EXAMPLE DOC\n /**/// Public: does_something\n /**///\n /**/// Args\n /**/// arg1 - the_arg_value\n /**/// arg2 - the_arg_value\n /**///\n /**/// Returns\n /**/// return - the_return_value\n /**///\n /**/// Notes\n /**/// note - note_multi_line_requires\n /**/// a_set_of_doc_markers\n var docList = []\n , currentDoc = null\n , argMark = false\n , returnMark = false\n , noteMark = false\n for (i=0;i<pos.length;i++) {\n var line = lines[pos[i]]\n //handle initial line\n if ( line.indexOf('Public') > 0\n || line.indexOf('Private') > 0) {\n // if the object exists, we are at a new object so push the current\n if (currentDoc)\n docList.push(currentDoc)\n // start a new object\n var priv = (line.indexOf('Public') > 0) ? 'Public' : 'Private'\n , split = line.split(':')\n , name = split[1].trim()\n currentDoc = new section(priv, name)\n } else if (line.indexOf('Args') > 0) {\n argMark = true\n } else if (line.indexOf('Returns') > 0) {\n returnMark = true\n } else if (line.indexOf('Notes') > 0) {\n noteMark = true\n } else {\n var j = i\n while (argMark) {\n var argLine = lines[pos[j]]\n if (argLine) {\n if ( argLine.indexOf('Returns') > 0\n || argLine.indexOf('Notes') > 0\n || argLine.indexOf('Public') > 0\n || argLine.indexOf('Private') > 0) {\n argMark = false\n i = j - 1\n } else {\n currentDoc.argList.push(argLine.replace('/**/// ',''))\n j++\n }\n } else {\n argMark = false\n i = j - 1\n }\n }\n while (returnMark) {\n var returnLine = lines[pos[j]]\n if (returnLine) {\n if ( returnLine.indexOf('Notes') > 0\n || returnLine.indexOf('Public') > 0\n || returnLine.indexOf('Private') > 0) {\n returnMark = false\n i = j - 1\n } else {\n currentDoc.ret += returnLine.replace('/**/// ','')\n j++\n }\n } else {\n i = j - 1\n returnMark = false\n }\n }\n while (noteMark) {\n var noteLine = lines[pos[j]]\n if (noteLine) {\n if ( noteLine.indexOf('Public') > 0\n || noteLine.indexOf('Private') > 0) {\n noteMark = false\n i = j - 1\n } else {\n currentDoc.notes += noteLine.replace('/**/// ','')\n j++\n }\n } else {\n i = j -1\n noteMark = false\n }\n }\n }\n } // END for\n if (currentDoc)\n docList.push(currentDoc)\n /*\n DEBUG\n */\n //console.log(docList)\n\n return docList\n}", "_addIdLinks(str) {\n return str.replace(/`[^`\\n]+`/g, (code) => code\n .replace(\n // v-- symbols or start, v-- keywords v-- token v-- brackets\n /((?:(?:[\\:|>,]\\s+)|\\<|`)(?:extends\\s+|implements\\s+|typeof\\s+)?)([\\@\\w\\.]+(?:\\(\\))?)(\\s+)?/g, (s, impl, token, spaces) => {\n let t = token.replace(/^[\\@\\.]/, \"\").replace(/\\(\\)$/, \"\");\n spaces = spaces ? \"<code>\" + spaces + \"</code>\" : \"\";\n if (t !== this.doc.id) {\n token = token.replace(/_/g, \"\\\\_\");\n if (this._parser.isDefined(t)) {\n let url = this._baseUrl +\n (token.startsWith(\"@\") ? \"_\" : \"\") +\n t.replace(/\\..*/, \"\");\n if (t.indexOf(\".\") > 0)\n url += navId(t);\n return `${impl || \"\"}\\`[\\`${token}\\`](${url})${spaces}\\``;\n }\n else if (this._parser.isDefined(this.doc.id + \".\" + t)) {\n return `${impl || \"\"}\\`[\\`${token}\\`](${navId(this.doc.id + \".\" + t)})${spaces}\\``;\n }\n else if (s.length === code.length + 2) {\n (this.data.warnings || (this.data.warnings = [])).push(`NOT DEFINED ${t} (${this.doc.id})`);\n }\n }\n return s;\n })\n .replace(/^``/, \"\")\n .replace(/``$/, \"\"));\n }", "parse() {\n const basePath = path.join(this.iotjs, 'docs/api');\n\n fs.readdir(basePath, (err, files) => {\n this.verboseLog(`Read '${basePath}' directory.`);\n\n if (err) {\n console.error(err.message);\n return false;\n }\n\n const promises = files.filter(file => !file.includes('reference')).map(file => {\n const name = file.slice(\n config.docname.pre.length,\n -config.docname.post.length\n ).toLowerCase().replace('file-system', 'fs');\n\n this.addModuleToOutput(name);\n\n return new Promise((resolve, reject) => {\n const filePath = path.join(basePath, file);\n\n fs.readFile(filePath, 'utf8', (error, data) => {\n this.verboseLog(`- Read '${filePath}' --> ${name} module`);\n\n if (error) {\n reject(error.message);\n } else {\n resolve({ name, data });\n }\n });\n });\n });\n\n Promise.all(promises).then((data) => {\n this.verboseLog('\\nParse each read file content to get their available functions list.');\n\n data.forEach((file) => {\n this.verboseLog(`- Parse ${file.name} module:`);\n\n let doc = false;\n let label = '';\n let detail = '';\n let insertText = '';\n let documentation = [];\n\n file.data.split('\\n').forEach(line => {\n // Prototype line match.\n if (!config.regex.new.test(line) && config.regex.proto.test(line)) {\n // Found a new prototype before an example, save the last known prototype if necessary.\n if (doc) {\n this.addFunctionToModule(file.name, {\n label: label,\n kind: 2,\n detail: detail,\n documentation: documentation.join('\\n'),\n insertText: insertText,\n });\n }\n\n const functionName = line.substring(4).replace(config.regex.args, '').split('.').pop();\n const functionDetail = line.substring(4);\n\n label = functionName;\n detail = functionDetail;\n insertText = functionName;\n documentation = [];\n doc = true;\n\n this.verboseLog(` = ${functionDetail}`);\n\n return;\n }\n\n // Documentation line match.\n if (!config.regex.event.test(line) &&\n !config.regex.exDef.test(line) &&\n !config.regex.exLess.test(line) &&\n !config.regex.proto.test(line) && doc) {\n documentation.push(line);\n } else {\n // Store the function documentation.\n if (doc) {\n this.addFunctionToModule(file.name, {\n label: label,\n kind: 2,\n detail: detail,\n documentation: documentation.join('\\n'),\n insertText: insertText,\n });\n }\n\n documentation = [];\n doc = false;\n }\n });\n });\n\n this.verboseLog('Modules are parsed.\\n');\n\n this.writeOutputToDestonation();\n }).catch((error) => {\n console.error(error);\n });\n });\n }", "function transformDocs(filePath) {\n let data = [];\n\n data.dirName = path.dirname(filePath.replace(path.join(__dirname, 'node_modules/nsis-docs'), 'html'));\n data.prettyName = path.basename(filePath, path.extname(filePath));\n\n data.pageTitle = [];\n data.bundle = \"Nullsoft Scriptable Install System\";\n\n if (data.dirName.endsWith('Callbacks') && data.prettyName.startsWith(\"on\")) {\n data.name = \".\" + data.prettyName;\n data.type = \"Function\";\n } else if (data.dirName.endsWith('Callbacks') && data.prettyName.startsWith(\"un.on\")) {\n data.name = data.prettyName;\n data.type = \"Function\";\n } else if (data.prettyName.startsWith(\"__\") && data.prettyName.endsWith(\"__\")) {\n data.name = \"${\" + data.prettyName + \"}\";\n data.type = \"Constant\";\n } else if (data.prettyName.startsWith(\"NSIS\") && data.dirName.endsWith('Variables')) {\n data.name = \"${\" + data.prettyName + \"}\";\n data.type = \"Constant\";\n } else if (data.dirName.endsWith('Variables')) {\n data.name = \"$\" + data.prettyName;\n data.type = \"Variable\";\n } else if (data.dirName.startsWith('html/Includes')) {\n data.name = \"${\" + data.prettyName + \"}\";\n data.type = \"Library\";\n data.bundle = path.basename(data.dirName + \".nsh\");\n } else {\n data.name = data.prettyName;\n data.type = \"Command\";\n }\n\n data.pageTitle.push(data.bundle);\n data.pageTitle.push(data.name);\n data.pageTitle = data.pageTitle.reverse().join(\" | \");\n\n return data;\n}", "function PageDocumentation() {\n\tComponentBase.call(this);\n}", "function parseJavadocFlavorTag (docstr, scopeParent, rootPath, argv, logger) {\n var lines = docstr.split (/\\r?\\n/g);\n var mount;\n if (scopeParent[MOUNT]) {\n mount = scopeParent[MOUNT];\n if (!mount.modifiers) {\n mount.modifiers = [];\n mount.extras = [];\n }\n } else {\n mount = scopeParent[MOUNT] = Object.create (null);\n mount.valtype = [];\n mount.modifiers = [];\n mount.extras = [];\n }\n\n var children = [];\n var currentChild;\n var tagname;\n var outputDocstr = '';\n for (var i=0,j=lines.length; i<j; i++) {\n var cleanLine = lines[i].match (Patterns.jdocLeadSplitter)[1] || '';\n if (cleanLine[0] !== '@') {\n if (currentChild)\n currentChild[DOCSTR][currentChild[DOCSTR].length-1] += cleanLine + ' \\n';\n else {\n cleanLine = cleanLine.replace (Patterns.jLink, function (match, $1, $2) {\n var newPath = parseJavadocFlavorPath ($2);\n if (argv.jTrap) {\n var ok, clip;\n for (var i=rootPath.length-1; i>=0; i--) {\n clip = i;\n if (rootPath[i][0] === newPath[0][0] && rootPath[i][1] === newPath[0][1]) {\n ok = true;\n for (var k=1,l=Math.min (rootPath.length - i, newPath.length); k<l; k++)\n if (rootPath[i+k] !== newPath[k]) {\n ok = false;\n break;\n }\n if (ok)\n break;\n }\n if (ok)\n newPath = rootPath.slice (0, clip).concat (newPath);\n else\n newPath = rootPath.concat (newPath);\n }\n }\n return (\n $1\n + '('\n // + (parseJavadocFlavorPath ($2).map (function(a){return a.join('');}).join(''))\n + tools.pathStr (newPath)\n + ')'\n );\n });\n outputDocstr += cleanLine + ' \\n';\n }\n continue;\n }\n\n // starting a new tag\n // wrap up the previous one\n if (currentChild) {\n if (tagname === 'example')\n outputDocstr += currentChild[DOCSTR][currentChild[DOCSTR].length-1] + '```\\n\\n';\n\n delete tagname;\n delete currentChild;\n }\n // consume the tag\n var match = cleanLine.match (/@([a-zA-Z]+)(?:[ \\t]+(.*))?/);\n tagname = match[1];\n cleanLine = match[2] || '';\n\n // work the tag\n if (tagname === 'example') {\n outputDocstr += '\\n### Example\\n```javascript\\n';\n continue;\n }\n\n // // use this to consume errant doc text\n var dummy = {};\n dummy[DOCSTR] = [ '' ];\n currentChild = dummy;\n\n // // simple flag modifiers\n if (Object.hasOwnProperty.call (JDOC_MOD_FLAG, tagname)) {\n mount.modifiers.push ({ mod:JDOC_MOD_FLAG[tagname] });\n continue;\n }\n\n // // modifiers that accept a single mandatory path\n if (Object.hasOwnProperty.call (JDOC_MOD_PATH, tagname)) {\n // consume a path\n var pathMatch = cleanLine.match (Patterns.jpathConsumer);\n if (!pathMatch || !pathMatch[1] || !pathMatch[1].length) {\n logger.trace ({ tag:tagname, raw:lines[i] }, 'invalid javadoc tag');\n continue;\n }\n var path = parseJavadocFlavorPath (pathMatch[1]);\n mount.modifiers.push ({ mod:JDOC_MOD_PATH[tagname], path:path });\n continue;\n }\n\n // modify the target's ctype\n if (Object.hasOwnProperty.call (JDOC_CTYPE, tagname)) {\n mount.ctype = JDOC_CTYPE[tagname];\n continue;\n }\n\n // add hacky flag properties to the target's EXTRAS property\n if (Object.hasOwnProperty.call (JDOC_EXTRAS, tagname)) {\n if (!mount.extras)\n mount.extras = [ JDOC_EXTRAS[targetNode] ];\n else if (mount.extras.indexOf(JDOC_EXTRAS[tagname]) < 0)\n mount.extras.push (JDOC_EXTRAS[tagname]);\n continue;\n }\n\n // creates a flag and optionally alters the target's mount.type and mount.path\n if (Object.hasOwnProperty.call (JDOC_MOUNT_FLAG, tagname)) {\n // try to consume either a path or type(s) and a path\n var match = cleanLine.match (Patterns.jtagPaths);\n if (!match) {\n logger.trace ({ tag:tagname, raw:lines[i] }, 'invalid javadoc tag');\n continue;\n }\n mount.modifiers.push ({ mod:JDOC_MOUNT_FLAG[tagname] });\n var types = match[1];\n if (types)\n mount.valtype.push.apply (\n mount.valtype,\n types.split ('|').map (function (typeStr) {\n return { path:parseJavadocFlavorPath (typeStr) };\n })\n );\n var mountPath = match[2];\n if (mountPath) {\n var renamePath = parseJavadocFlavorPath (mountPath);\n if (renamePath.length === 1)\n if (scopeParent[NAME])\n scopeParent[NAME][1] = renamePath[0][1];\n else\n scopeParent[NAME] = [ '.', renamePath[0][1] ];\n }\n continue;\n }\n\n // creates a hacky flag property in the target's EXTRAS property\n // and optionally alters the target's mount.type and mount.path\n if (Object.hasOwnProperty.call (JDOC_MOUNT_EXTRA, tagname)) {\n // try to consume either a path or type(s) and a path\n var match = cleanLine.match (Patterns.jtagPaths);\n if (!match) {\n logger.trace ({ tag:tagname, raw:lines[i] }, 'invalid javadoc tag');\n continue;\n }\n if (mount.extras.indexOf (JDOC_MOUNT_EXTRA[tagname]) < 0)\n mount.extras.push (JDOC_MOUNT_EXTRA[tagname]);\n var types = match[1];\n if (types)\n mount.valtype.push.apply (\n mount.valtype,\n types.split ('|').map (function (typeStr) {\n return { path:parseJavadocFlavorPath (typeStr) };\n })\n );\n var mountPath = match[2];\n if (mountPath)\n mount.path = parseJavadocFlavorPath (mountPath);\n continue;\n }\n\n // opens a new child tag and begins consuming documentation\n if (Object.hasOwnProperty.call (JDOC_CHILD, tagname)) {\n\n }\n\n // special tags\n if (Object.hasOwnProperty.call (JDOC_SPECIAL, tagname)) {\n JDOC_SPECIAL[tagname] (cleanLine, mount, scopeParent, rootPath, argv);\n continue;\n }\n\n logger.trace (\n { tag:tagname, line:cleanLine, raw:lines[i] },\n 'unrecognized javadoc-flavor tag'\n );\n }\n\n // wrap up the last subtag\n if (tagname === 'example')\n outputDocstr += currentChild[DOCSTR][currentChild[DOCSTR].length-1] + '```\\n\\n';\n\n if (mount.docstr)\n mount.docstr.push (outputDocstr);\n else\n mount.docstr = [ outputDocstr ];\n}", "function main() {\n\n // Sets AsciiDoc file from url query string \n const params = new URLSearchParams(location.search);\n let aDocName = params.get('aDoc');\n if (aDocName === null || aDocName === '') {\n aDocName = 'indice';\n }\n aDoc = aDocs.find(aDoc => aDoc.name === aDocName);\n \n // Updates UI with HTML content from AsciiDoc file\n updateDocContents(aDoc);\n}", "function apply_autodetected(m, ast, inheritable) {\n docset = find_docset(ast);\n var inheritable = inheritable || true;\n \n if (!docset || docset[\"type\"] != \"doc_comment\") {\n if (inheritable)\n m[\"inheritdoc\"] = {};\n else\n m[\"private\"] = true;\n \n m[\"autodetected\"] = true;\n }\n\n if (docset) {\n docset[\"code\"] = m;\n return false;\n }\n else {\n // Get line number from third place at range array.\n // This third item exists in forked EsprimaJS at\n // https://github.com/nene/esprima/tree/linenr-in-range\n m[\"linenr\"] = ast[\"range\"][2];\n return true;\n }\n}", "document (source) {\n this.documentation = new Documentation(source, this);\n return this;\n }", "function loadDocumentation(loadedCallback) {\n $.getJSON(API_PATH, function (jsonDoc) {\n var documentationArray = [];\n for (var i = 0; i < jsonDoc.length; i++) {\n documentationArray.push(new Documentation(jsonDoc[i]));\n }\n loadedCallback(documentationArray);\n });\n}", "newDoclet({doclet}) {\n\t\t\t\t\tif (typeof doclet.description === 'string') {\n\t\t\t\t\t\tdoclet.description = doclet.description.toUpperCase();\n\t\t\t\t\t}\n\t\t\t\t}", "_validate (schema){\n return SwaggerParser.validate(schema);\n }", "get documentation () {\n\t\treturn this._documentation;\n\t}", "get documentation () {\n\t\treturn this._documentation;\n\t}", "*next(token) {\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }", "static describe (module) {\n\t\tconst description = GetRequest.describe(module);\n\t\tdescription.description = 'Returns the review; also returns the referencing post, if any';\n\t\tdescription.access = 'User must be a member of the stream that owns the review';\n\t\tdescription.returns.summary = 'A review object, along with any referencing post',\n\t\tObject.assign(description.returns.looksLike, {\n\t\t\treview: '<the fetched @@#review object#review@@>',\n\t\t\tpost: '<the @@#post object#post@@ that references this review, if any>'\n\t\t});\n\t\treturn description;\n\t}", "function asy_advanced(geogebra){\r\n asy_advanced_FLAG = true;\r\n return asy_basic(geogebra // pre-formatting\r\n \r\n /* post-formatting: add documentation comments */ \r\n ).replace(/\\ndraw\\(/, \"\\n\\n /* segments and figures */\\ndraw(\") \r\n .replace(/\\n(dot|label)/, \"\\n\\n /* points and labels */\\n$1\");\r\n}", "function API(){}", "function API(){}", "constructor(doc) {\n super(doc);\n }", "function Doc(xml, json, conf) {\n this.xml = xml;\n this.json = json;\n this.conf = conf;\n }", "function docFromChanges(options, changes) {\n const doc = init(options)\n const [state, _] = Backend.applyChanges(Backend.init(), changes)\n const patch = Backend.getPatch(state)\n patch.state = state\n return Frontend.applyPatch(doc, patch)\n}", "parseDocument() {\n return this.node(this._lexer.token, {\n kind: Kind.DOCUMENT,\n definitions: this.many(\n TokenKind.SOF,\n this.parseDefinition,\n TokenKind.EOF,\n ),\n });\n }", "function Annotate() {\r\n}", "_onOpen(doc) {\r\n if (doc.languageId !== 'python') {\r\n return;\r\n }\r\n let params = { processId: process.pid, uri: doc.uri, requestEventType: request_1.RequestEventType.OPEN };\r\n let cb = (result) => {\r\n if (!result.succesful) {\r\n console.error(\"Lintings failed on open\");\r\n console.error(`File: ${params.uri.toString()}`);\r\n console.error(`Message: ${result.message}`);\r\n }\r\n };\r\n this._doRequest(params, cb);\r\n }", "function formatAst(ast) {\n return (0, _language.visit)(ast, { leave: printDocASTReducer });\n}", "function postRespec() {\n\taddTextSemantics();\n\tswapInDefinitions();\n\ttermTitles();\n\tlinkUnderstanding();\n}", "function backportKibanaDoc(doc) {\n doc.type = doc.body.type;\n /*\n * Strip the '{type}:' prefix from the id\n */\n doc.id = doc.id.slice(doc.body.type.length + 1);\n doc.body = doc.body[doc.body.type];\n}", "validate(input) {\r\n return new Promise((resolve, reject) => {\r\n SwaggerParser.validate(input+'.yaml').then((api) => {\r\n resolve(true);\r\n }).catch((err) => {\r\n \t\t console.log(err);\r\n resolve('You must provide an existing OpenAPI spec (yaml file in working directory) and the spec MUST be valid');\r\n });\r\n });\r\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "mainLogic() {\n this.apexParser = new ApexParser(this.accessModifiers,this.sourceDirectory);\n const filesArray = this.getClassFilesFromPackageDirectories();\n\n //Create a new array of ClassModels\n const classModels = this.getClassModelsFromFiles(filesArray);\n const mapGroupNameToClassGroup = this.createMapGroupNameToClassGroup(classModels, this.sourceDirectory);\n\n const projectDetail = this.fm.parseHTMLFile(this.bannerFilePath);\n const homeContents = this.fm.parseHTMLFile(this.homefilepath);\n this.fm.createDoc(mapGroupNameToClassGroup, classModels, projectDetail, homeContents, this.hostedSourceUrl);\n console.log('ApexDoc has completed!');\n }", "_addNav() {\n // add nav for any anchored headings at the top of the page\n let nav = [];\n let topLinks = this._top.match(/#[^{}\\#\\r\\n]+\\s+\\{#[^\\}]+}$/m);\n if (topLinks) {\n nav.push(\"\\n #### About\");\n for (let ref of topLinks) {\n let [name, link] = ref.split(\"{#\");\n name = name.replace(/^#+/, \"\").trim();\n link = link.slice(0, -1);\n nav.push(` * [${name}](#${link})`);\n }\n }\n // add nav for all other entries\n let declHeader = false, inheritHeader = false, nsHeader = false;\n for (let c of this.doc.content) {\n // skip non-root namespace nodes\n if (c.id === this.doc.id + \".\" && declHeader)\n continue;\n // add subheadings\n if (!inheritHeader && c.spec.inherited) {\n nav.push(\"\\n #### Inherited\");\n inheritHeader = true;\n }\n else if (!declHeader && !c.spec.namespaced) {\n nav.push(\"\\n #### Declarations\");\n declHeader = true;\n }\n else if (!nsHeader && c.spec.namespaced) {\n nav.push(\"\\n #### Namespaced\");\n nsHeader = true;\n }\n // add nav entry for this node\n let name = this._getTypedName(c.spec).replace(/_/g, \"\\\\_\");\n if (c.spec.type === DeclarationFileParser_1.SpecNodeType.ClassDeclaration ||\n c.spec.type === DeclarationFileParser_1.SpecNodeType.InterfaceDeclaration ||\n c.spec.type === DeclarationFileParser_1.SpecNodeType.Namespace)\n name = \"**\" + name + \"**\";\n nav.push(` * [${name}](${navId(c.id)})`);\n }\n this.data.nav = nav.join(\"\\n\");\n }", "static loadDocs() {\n try {\n HelpGenerator.docs = yaml.load(fs.readFileSync('./help.yaml', 'utf8'));\n } catch (e) {\n console.error(`[HelpGenerator] ${e}`);\n }\n }", "function axapta(hljs) {\n const BUILT_IN_KEYWORDS = [\n 'anytype',\n 'boolean',\n 'byte',\n 'char',\n 'container',\n 'date',\n 'double',\n 'enum',\n 'guid',\n 'int',\n 'int64',\n 'long',\n 'real',\n 'short',\n 'str',\n 'utcdatetime',\n 'var'\n ];\n\n const LITERAL_KEYWORDS = [\n 'default',\n 'false',\n 'null',\n 'true',\n ];\n\n const NORMAL_KEYWORDS = [\n 'abstract',\n 'as',\n 'asc',\n 'avg',\n 'break',\n 'breakpoint',\n 'by',\n 'byref',\n 'case',\n 'catch',\n 'changecompany',\n 'class',\n 'client',\n 'client',\n 'common',\n 'const',\n 'continue',\n 'count',\n 'crosscompany',\n 'delegate',\n 'delete_from',\n 'desc',\n 'display',\n 'div',\n 'do',\n 'edit',\n 'else',\n 'eventhandler',\n 'exists',\n 'extends',\n 'final',\n 'finally',\n 'firstfast',\n 'firstonly',\n 'firstonly1',\n 'firstonly10',\n 'firstonly100',\n 'firstonly1000',\n 'flush',\n 'for', \n 'forceliterals',\n 'forcenestedloop',\n 'forceplaceholders',\n 'forceselectorder',\n 'forupdate',\n 'from',\n 'generateonly',\n 'group', \n 'hint',\n 'if',\n 'implements',\n 'in',\n 'index',\n 'insert_recordset',\n 'interface',\n 'internal',\n 'is',\n 'join',\n 'like',\n 'maxof',\n 'minof',\n 'mod',\n 'namespace',\n 'new',\n 'next',\n 'nofetch',\n 'notexists',\n 'optimisticlock',\n 'order',\n 'outer',\n 'pessimisticlock',\n 'print',\n 'private',\n 'protected',\n 'public',\n 'readonly',\n 'repeatableread',\n 'retry',\n 'return',\n 'reverse',\n 'select',\n 'server',\n 'setting',\n 'static', \n 'sum',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'try',\n 'ttsabort',\n 'ttsbegin',\n 'ttscommit',\n 'unchecked',\n 'update_recordset',\n 'using',\n 'validtimestate',\n 'void',\n 'where',\n 'while',\n ];\n\n const KEYWORDS = {\n keyword: NORMAL_KEYWORDS.join(' '),\n built_in: BUILT_IN_KEYWORDS.join(' '),\n literal: LITERAL_KEYWORDS.join(' ')\n };\n\n return {\n name: 'X++',\n aliases: ['x++'],\n keywords: KEYWORDS,\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'meta',\n begin: '#', end: '$'\n },\n {\n className: 'class',\n beginKeywords: 'class interface', end: '{', excludeEnd: true,\n illegal: ':',\n contains: [\n {beginKeywords: 'extends implements'},\n hljs.UNDERSCORE_TITLE_MODE\n ]\n }\n ]\n };\n}", "function componentDocblockHandler(documentation, path, importer) {\n documentation.set('description', getDocblockFromComponent(path, importer) || '');\n}", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "constructor(doc) {\n super(doc);\n }", "onSwaggerButtonClicked() {\n this.context.editor.showSwaggerViewForService(this.props.model);\n }", "function p(doc) {\n return doc.map((i) => {\n return {\n label: i.label,\n detail: (i.detail ? i.detail : null),\n insertText: (i.insertText ? i.insertText : i.label),\n documentation: (i.documentation ? i.documentation : null),\n kind: (i.kind ? i.kind : 17), // 17 = Keyword, 18 = Text, 25 = Snippet\n insertTextRules: (i.insertTextRules ? i.insertTextRules : null),\n };\n });\n}", "function axapta(hljs) {\n const BUILT_IN_KEYWORDS = [\n 'anytype',\n 'boolean',\n 'byte',\n 'char',\n 'container',\n 'date',\n 'double',\n 'enum',\n 'guid',\n 'int',\n 'int64',\n 'long',\n 'real',\n 'short',\n 'str',\n 'utcdatetime',\n 'var'\n ];\n\n const LITERAL_KEYWORDS = [\n 'default',\n 'false',\n 'null',\n 'true'\n ];\n\n const NORMAL_KEYWORDS = [\n 'abstract',\n 'as',\n 'asc',\n 'avg',\n 'break',\n 'breakpoint',\n 'by',\n 'byref',\n 'case',\n 'catch',\n 'changecompany',\n 'class',\n 'client',\n 'client',\n 'common',\n 'const',\n 'continue',\n 'count',\n 'crosscompany',\n 'delegate',\n 'delete_from',\n 'desc',\n 'display',\n 'div',\n 'do',\n 'edit',\n 'else',\n 'eventhandler',\n 'exists',\n 'extends',\n 'final',\n 'finally',\n 'firstfast',\n 'firstonly',\n 'firstonly1',\n 'firstonly10',\n 'firstonly100',\n 'firstonly1000',\n 'flush',\n 'for',\n 'forceliterals',\n 'forcenestedloop',\n 'forceplaceholders',\n 'forceselectorder',\n 'forupdate',\n 'from',\n 'generateonly',\n 'group',\n 'hint',\n 'if',\n 'implements',\n 'in',\n 'index',\n 'insert_recordset',\n 'interface',\n 'internal',\n 'is',\n 'join',\n 'like',\n 'maxof',\n 'minof',\n 'mod',\n 'namespace',\n 'new',\n 'next',\n 'nofetch',\n 'notexists',\n 'optimisticlock',\n 'order',\n 'outer',\n 'pessimisticlock',\n 'print',\n 'private',\n 'protected',\n 'public',\n 'readonly',\n 'repeatableread',\n 'retry',\n 'return',\n 'reverse',\n 'select',\n 'server',\n 'setting',\n 'static',\n 'sum',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'try',\n 'ttsabort',\n 'ttsbegin',\n 'ttscommit',\n 'unchecked',\n 'update_recordset',\n 'using',\n 'validtimestate',\n 'void',\n 'where',\n 'while'\n ];\n\n const KEYWORDS = {\n keyword: NORMAL_KEYWORDS.join(' '),\n built_in: BUILT_IN_KEYWORDS.join(' '),\n literal: LITERAL_KEYWORDS.join(' ')\n };\n\n return {\n name: 'X++',\n aliases: ['x++'],\n keywords: KEYWORDS,\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'meta',\n begin: '#',\n end: '$'\n },\n {\n className: 'class',\n beginKeywords: 'class interface',\n end: /\\{/,\n excludeEnd: true,\n illegal: ':',\n contains: [\n {\n beginKeywords: 'extends implements'\n },\n hljs.UNDERSCORE_TITLE_MODE\n ]\n }\n ]\n };\n}", "function axapta(hljs) {\n const BUILT_IN_KEYWORDS = [\n 'anytype',\n 'boolean',\n 'byte',\n 'char',\n 'container',\n 'date',\n 'double',\n 'enum',\n 'guid',\n 'int',\n 'int64',\n 'long',\n 'real',\n 'short',\n 'str',\n 'utcdatetime',\n 'var'\n ];\n\n const LITERAL_KEYWORDS = [\n 'default',\n 'false',\n 'null',\n 'true'\n ];\n\n const NORMAL_KEYWORDS = [\n 'abstract',\n 'as',\n 'asc',\n 'avg',\n 'break',\n 'breakpoint',\n 'by',\n 'byref',\n 'case',\n 'catch',\n 'changecompany',\n 'class',\n 'client',\n 'client',\n 'common',\n 'const',\n 'continue',\n 'count',\n 'crosscompany',\n 'delegate',\n 'delete_from',\n 'desc',\n 'display',\n 'div',\n 'do',\n 'edit',\n 'else',\n 'eventhandler',\n 'exists',\n 'extends',\n 'final',\n 'finally',\n 'firstfast',\n 'firstonly',\n 'firstonly1',\n 'firstonly10',\n 'firstonly100',\n 'firstonly1000',\n 'flush',\n 'for',\n 'forceliterals',\n 'forcenestedloop',\n 'forceplaceholders',\n 'forceselectorder',\n 'forupdate',\n 'from',\n 'generateonly',\n 'group',\n 'hint',\n 'if',\n 'implements',\n 'in',\n 'index',\n 'insert_recordset',\n 'interface',\n 'internal',\n 'is',\n 'join',\n 'like',\n 'maxof',\n 'minof',\n 'mod',\n 'namespace',\n 'new',\n 'next',\n 'nofetch',\n 'notexists',\n 'optimisticlock',\n 'order',\n 'outer',\n 'pessimisticlock',\n 'print',\n 'private',\n 'protected',\n 'public',\n 'readonly',\n 'repeatableread',\n 'retry',\n 'return',\n 'reverse',\n 'select',\n 'server',\n 'setting',\n 'static',\n 'sum',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'try',\n 'ttsabort',\n 'ttsbegin',\n 'ttscommit',\n 'unchecked',\n 'update_recordset',\n 'using',\n 'validtimestate',\n 'void',\n 'where',\n 'while'\n ];\n\n const KEYWORDS = {\n keyword: NORMAL_KEYWORDS.join(' '),\n built_in: BUILT_IN_KEYWORDS.join(' '),\n literal: LITERAL_KEYWORDS.join(' ')\n };\n\n return {\n name: 'X++',\n aliases: ['x++'],\n keywords: KEYWORDS,\n contains: [\n hljs.C_LINE_COMMENT_MODE,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n hljs.C_NUMBER_MODE,\n {\n className: 'meta',\n begin: '#',\n end: '$'\n },\n {\n className: 'class',\n beginKeywords: 'class interface',\n end: /\\{/,\n excludeEnd: true,\n illegal: ':',\n contains: [\n {\n beginKeywords: 'extends implements'\n },\n hljs.UNDERSCORE_TITLE_MODE\n ]\n }\n ]\n };\n}", "constructor () {\n this.emitter = new Emitter()\n this.description = null\n this.docsVer = 'master'\n this.release = null\n // if false latest satisfied version should be used\n this.hasDocs = null\n this.setVersion(atom.config.get('atom-aframe.project.defaultAframeVersion'))\n }", "get documentation() {\n\t\treturn this.__documentation;\n\t}", "get documentation() {\n\t\treturn this.__documentation;\n\t}", "get documentation() {\n\t\treturn this.__documentation;\n\t}", "function lookupDoc(request) {\n\tvar path = request.path.split('/').slice(1);\n\tif (!path[0])\n\t\treturn docInterface(Documentation, path, request);\n\tvar node = Documentation;\n\tfor (var i=0; i < path.length; i++) {\n\t\tnode = node[path[i]];\n\t\tif (!node)\n\t\t\treturn null;\n\t}\n\treturn docInterface(node, path, request);\n}", "function asciidocToHTML(content) {\n return asciidoctor.convert(content, { safe: \"server\", attributes: { showtitle: \"\", icons: \"font@\" } });\n}", "formatDoc(doc, options) {\n return format(printDocToDebug(doc), Object.assign({}, options, {\n parser: \"babel\"\n })).formatted;\n }", "function updateDocContents(aDoc) {\n\n // Updates UI\n let html = Asciidoctor().convert(aDoc.contents);\n html = html\n .replaceAll('<div class=\"title\">Important</div>', '<div class=\"title\" style=\"color:red\">❗ IMPORTANTE</div>')\n .replaceAll('<div class=\"title\">Warning</div>', '<div class=\"title\" style=\"color:orange\">⚠️ ATENCIÓN</div>');\n document.getElementById('adoc-contents').innerHTML = html;\n\n // Updates UI for 'Índice' section\n if (aDoc.name === 'indice') {\n html = '';\n index.forEach(doc => {\n html += `<tr>\n <td>${doc.source}</td>\n <td><a href=\"#\" onclick=\"goToDocSec('${doc.id}', '')\" title=\"Ir a ejercicio\">${doc.number} - ${doc.title}</a></td>\n <td>${doc.units.join(', ')}</td>\n <td>${doc.topics.join(', ')}</td>\n </tr>`;\n });\n document.getElementById('tabla-ejercicios-body').innerHTML = html;\n }\n \n // Updates Latex rendering\n MathJax.typeset();\n}", "parseDefinition() {\n if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } // Many definitions begin with a description and require a lookahead.\n\n const hasDescription = this.peekDescription();\n const keywordToken = hasDescription\n ? this._lexer.lookahead()\n : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n\n if (hasDescription) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n 'Unexpected description, descriptions are supported only on type definitions.',\n );\n }\n\n switch (keywordToken.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }", "function extractJavadoc(str) {\n var lines = str\n .replace(/^[ \\t]+|[ \\t]+$/g, '') // Trim whitespace.\n .split('\\n').map(function (line, i) {\n return i ? line.replace(/^\\s*\\*\\s?/, '') : line;\n });\n while (lines.length && !lines[0]) {\n lines.shift();\n }\n while (lines.length && !lines[lines.length - 1]) {\n lines.pop();\n }\n return lines.join('\\n');\n}", "function concatAST(documents) {\n var definitions = [];\n\n for (var _i2 = 0; _i2 < documents.length; _i2++) {\n var doc = documents[_i2];\n definitions = definitions.concat(doc.definitions);\n }\n\n return {\n kind: 'Document',\n definitions: definitions\n };\n}", "function concatAST(documents) {\n var definitions = [];\n\n for (var _i2 = 0; _i2 < documents.length; _i2++) {\n var doc = documents[_i2];\n definitions = definitions.concat(doc.definitions);\n }\n\n return {\n kind: 'Document',\n definitions: definitions\n };\n}", "function concatAST(documents) {\n var definitions = [];\n\n for (var _i2 = 0; _i2 < documents.length; _i2++) {\n var doc = documents[_i2];\n definitions = definitions.concat(doc.definitions);\n }\n\n return {\n kind: 'Document',\n definitions: definitions\n };\n}", "_bundle (schema){\n return SwaggerParser.bundle(schema);\n }", "function buildDocViews(sources, contractsPath, idToHyperlink, version, repoBaseUrl) {\n var state = { docs: [], contractsPath: contractsPath, idToHyperlink: idToHyperlink, version: version, repoBaseUrl: repoBaseUrl };\n var astWalker = buildBaseAstWalker();\n astWalker.setStartFunction(_astNodeType2.default.CONTRACT_DEFINITION, contractDefinitionStartFunction);\n for (var source in sources) {\n var ast = (0, _safeGet2.default)(sources[source], 'source', 'AST');\n state = astWalker.walk(ast, state);\n }\n return state.docs;\n\n function contractDefinitionStartFunction(node, state) {\n var nodeName = (0, _safeGet2.default)(node, 'AST node', 'name');\n var docs = state.docs,\n contractsPath = state.contractsPath,\n absolutePath = state.absolutePath,\n idToHyperlink = state.idToHyperlink,\n version = state.version,\n repoBaseUrl = state.repoBaseUrl;\n\n var docId = (0, _util.buildDocId)(absolutePath, nodeName, contractsPath);\n var content = _server2.default.renderToStaticMarkup(_react2.default.createElement(_document2.default, {\n contractDefinition: node,\n contractsPath: contractsPath,\n absolutePath: absolutePath,\n idToHyperlink: idToHyperlink,\n version: version,\n repoBaseUrl: repoBaseUrl\n }));\n return _extends({}, state, {\n docs: docs.concat([{\n docId: docId,\n docTitle: nodeName,\n content: content\n }])\n });\n }\n}", "addDefaultDeclarations() {\n sources_1.addTypeDocOptions(this);\n }", "function i18nMetaToDocStmt(meta){var tags=[];if(meta.description){tags.push({tagName:\"desc\"/* Desc */,text:meta.description});}if(meta.meaning){tags.push({tagName:\"meaning\"/* Meaning */,text:meta.meaning});}return tags.length==0?null:new JSDocCommentStmt(tags);}", "async getDocumentationAccess() {\n const { restrictedAccess } = await strapi\n .store({\n environment: '',\n type: 'plugin',\n name: 'documentation',\n key: 'config',\n })\n .get();\n\n return { restrictedAccess };\n }", "function define_parser_APIs_1() {\n return {\n TERROR: 2,\n EOF: 1,\n\n // internals: defined here so the object *structure* doesn't get modified by parse() et al,\n // thus helping JIT compilers like Chrome V8.\n originalQuoteName: null,\n originalParseError: null,\n cleanupAfterParse: null,\n constructParseErrorInfo: null,\n yyMergeLocationInfo: null,\n\n __reentrant_call_depth: 0, // INTERNAL USE ONLY\n __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup\n __error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup\n\n // APIs which will be set up depending on user action code analysis:\n //yyRecovering: 0,\n //yyErrOk: 0,\n //yyClearIn: 0,\n\n // Helper APIs\n // -----------\n\n // Helper function which can be overridden by user code later on: put suitable quotes around\n // literal IDs in a description string.\n quoteName: function parser_quoteName(id_str) {\n return '\"' + id_str + '\"';\n },\n\n // Return the name of the given symbol (terminal or non-terminal) as a string, when available.\n //\n // Return NULL when the symbol is unknown to the parser.\n getSymbolName: function parser_getSymbolName(symbol) {\n if (this.terminals_[symbol]) {\n return this.terminals_[symbol];\n }\n\n // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up.\n //\n // An example of this may be where a rule's action code contains a call like this:\n //\n // parser.getSymbolName(#$)\n //\n // to obtain a human-readable name of the current grammar rule.\n var s = this.symbols_;\n for (var key in s) {\n if (s[key] === symbol) {\n return key;\n }\n }\n return null;\n },\n\n // Return a more-or-less human-readable description of the given symbol, when available,\n // or the symbol itself, serving as its own 'description' for lack of something better to serve up.\n //\n // Return NULL when the symbol is unknown to the parser.\n describeSymbol: function parser_describeSymbol(symbol) {\n if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) {\n return this.terminal_descriptions_[symbol];\n } else if (symbol === this.EOF) {\n return 'end of input';\n }\n var id = this.getSymbolName(symbol);\n if (id) {\n return this.quoteName(id);\n }\n return null;\n },\n\n // Produce a (more or less) human-readable list of expected tokens at the point of failure.\n //\n // The produced list may contain token or token set descriptions instead of the tokens\n // themselves to help turning this output into something that easier to read by humans\n // unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*,\n // expected terminals and nonterminals is produced.\n //\n // The returned list (array) will not contain any duplicate entries.\n collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) {\n var TERROR = this.TERROR;\n var tokenset = [];\n var check = {};\n // Has this (error?) state been outfitted with a custom expectations description text for human consumption?\n // If so, use that one instead of the less palatable token set.\n if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) {\n return [this.state_descriptions_[state]];\n }\n for (var p in this.table[state]) {\n p = +p;\n if (p !== TERROR) {\n var d = do_not_describe ? p : this.describeSymbol(p);\n if (d && !check[d]) {\n tokenset.push(d);\n check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries.\n }\n }\n }\n return tokenset;\n }\n };\n}", "function docInterface(doc, path, request) {\n\treturn {\n\t\tdesc: doc,\n\t\tpath: path,\n\t\trenderDoc: function() {\n\t\t\tvar templateName = doc._template || request.path.slice(1).replace(/\\//g, '_');\n\t\t\tvar template = require('templates/' + templateName + '.html') || '<h2>Error</h2><p>Template not found at <code>templates/'+templateName+'.html</code></p>';\n\t\t\ttemplate = template.replace(/\\{\\{domain\\}\\}/g, config.domain);\n\t\t\ttemplate = template.replace(/\\{\\{sidenav\\}\\}/g, renderSidenav());\n\t\t\tif (doc._template_vars) {\n\t\t\t\tfor (var k in doc._template_vars) {\n\t\t\t\t\tvar v = doc._template_vars[k];\n\t\t\t\t\ttemplate = template.replace(RegExp('{{'+k+'}}', 'g'), v);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn template;\n\t\t}\n\t};\n}", "function printAstToDoc(ast, options, alignmentSize = 0) {\n const {\n printer\n } = options;\n\n if (printer.preprocess) {\n ast = printer.preprocess(ast, options);\n }\n\n const cache = new Map();\n\n function printGenerically(path, args) {\n const node = path.getValue();\n const shouldCache = node && typeof node === \"object\" && args === undefined;\n\n if (shouldCache && cache.has(node)) {\n return cache.get(node);\n } // We let JSXElement print its comments itself because it adds () around\n // UnionTypeAnnotation has to align the child without the comments\n\n\n let res;\n\n if (printer.willPrintOwnComments && printer.willPrintOwnComments(path, options)) {\n res = callPluginPrintFunction(path, options, printGenerically, args);\n } else {\n // printComments will call the plugin print function and check for\n // comments to print\n res = comments.printComments(path, p => callPluginPrintFunction(p, options, printGenerically, args), options, args && args.needsSemi);\n }\n\n if (shouldCache) {\n cache.set(node, res);\n }\n\n return res;\n }\n\n let doc = printGenerically(new fastPath(ast));\n\n if (alignmentSize > 0) {\n // Add a hardline to make the indents take effect\n // It should be removed in index.js format()\n doc = addAlignmentToDoc$1(concat$4([hardline$2, doc]), alignmentSize, options.tabWidth);\n }\n\n docUtils$1.propagateBreaks(doc);\n return doc;\n}", "function pre(payload) {\n\n let title = null;\n\n // banner is first image and banner text is image alt\n payload.resource.banner = {\n img: '',\n text: ''\n };\n const firstImg = select(payload.resource.mdast, 'image');\n if (firstImg.length > 0) {\n payload.resource.banner = {\n img: firstImg[0].url,\n text: firstImg[0].alt\n }\n }\n\n const content = [];\n let currentSection = {children: [], type: 'standard'};\n\n visit(payload.resource.mdast, [\"paragraph\",\"heading\",\"thematicBreak\"], function (node) {\n\n if (node.type == \"heading\" && node.depth == 1 && !title){\n title = node.children[0].value;\n return;\n }\n if (node.type == \"thematicBreak\") {\n content.push(LayoutMachine.layout(currentSection));\n currentSection = {children: [], type: 'standard'};\n }\n else {\n currentSection.children.push(node);\n }\n });\n\n // content.push(LayoutMachine.layout(currentSection));\n content.push(currentSection);\n\n debugger;\n payload.resource.content = content;\n\n // avoid htl execution error if missing\n payload.resource.meta = payload.resource.meta || {};\n payload.resource.meta.references = payload.resource.meta.references || [];\n payload.resource.meta.icon = payload.resource.meta.icon || '';\n}", "function parseDoc(doc, newEdits) {\n\t\n\t var nRevNum;\n\t var newRevId;\n\t var revInfo;\n\t var opts = {status: 'available'};\n\t if (doc._deleted) {\n\t opts.deleted = true;\n\t }\n\t\n\t if (newEdits) {\n\t if (!doc._id) {\n\t doc._id = uuid();\n\t }\n\t newRevId = uuid(32, 16).toLowerCase();\n\t if (doc._rev) {\n\t revInfo = parseRevisionInfo(doc._rev);\n\t if (revInfo.error) {\n\t return revInfo;\n\t }\n\t doc._rev_tree = [{\n\t pos: revInfo.prefix,\n\t ids: [revInfo.id, {status: 'missing'}, [[newRevId, opts, []]]]\n\t }];\n\t nRevNum = revInfo.prefix + 1;\n\t } else {\n\t doc._rev_tree = [{\n\t pos: 1,\n\t ids : [newRevId, opts, []]\n\t }];\n\t nRevNum = 1;\n\t }\n\t } else {\n\t if (doc._revisions) {\n\t doc._rev_tree = makeRevTreeFromRevisions(doc._revisions, opts);\n\t nRevNum = doc._revisions.start;\n\t newRevId = doc._revisions.ids[0];\n\t }\n\t if (!doc._rev_tree) {\n\t revInfo = parseRevisionInfo(doc._rev);\n\t if (revInfo.error) {\n\t return revInfo;\n\t }\n\t nRevNum = revInfo.prefix;\n\t newRevId = revInfo.id;\n\t doc._rev_tree = [{\n\t pos: nRevNum,\n\t ids: [newRevId, opts, []]\n\t }];\n\t }\n\t }\n\t\n\t invalidIdError(doc._id);\n\t\n\t doc._rev = nRevNum + '-' + newRevId;\n\t\n\t var result = {metadata : {}, data : {}};\n\t for (var key in doc) {\n\t /* istanbul ignore else */\n\t if (Object.prototype.hasOwnProperty.call(doc, key)) {\n\t var specialKey = key[0] === '_';\n\t if (specialKey && !reservedWords[key]) {\n\t var error = createError(DOC_VALIDATION, key);\n\t error.message = DOC_VALIDATION.message + ': ' + key;\n\t throw error;\n\t } else if (specialKey && !dataWords[key]) {\n\t result.metadata[key.slice(1)] = doc[key];\n\t } else {\n\t result.data[key] = doc[key];\n\t }\n\t }\n\t }\n\t return result;\n\t}", "function makeDoclet(tagStrings) {\n var comment = '/**\\n' + tagStrings.join('\\n') + '\\n*/';\n return new jsdoc.doclet.Doclet(comment, {});\n }" ]
[ "0.6819972", "0.6600354", "0.6525554", "0.64226204", "0.62938106", "0.61691725", "0.61278695", "0.59683883", "0.58856326", "0.587375", "0.5792791", "0.5733502", "0.5733502", "0.572565", "0.572565", "0.569983", "0.5597127", "0.5591373", "0.55203974", "0.5476188", "0.5469906", "0.5447306", "0.5433247", "0.54119337", "0.5387167", "0.530564", "0.5203994", "0.5203096", "0.5195624", "0.51758546", "0.51666003", "0.51572114", "0.51470554", "0.51450187", "0.51346385", "0.5130351", "0.512798", "0.51217276", "0.51164305", "0.51038086", "0.5097474", "0.50921446", "0.5091394", "0.50512874", "0.5018983", "0.50145465", "0.50145465", "0.49975577", "0.49944052", "0.4984263", "0.4976053", "0.4976053", "0.49733055", "0.49670073", "0.49515438", "0.4946856", "0.49281225", "0.49200377", "0.491872", "0.49138108", "0.49095702", "0.49093726", "0.49065828", "0.49023017", "0.4890726", "0.48899534", "0.48897028", "0.4882659", "0.4881593", "0.4881593", "0.4881593", "0.4881593", "0.4881593", "0.487732", "0.4875781", "0.48646766", "0.48646766", "0.4864459", "0.4862591", "0.4862591", "0.4862591", "0.4860803", "0.48598546", "0.48547134", "0.4847377", "0.48354518", "0.48318124", "0.481558", "0.481558", "0.481558", "0.48077914", "0.48047024", "0.47985184", "0.47970182", "0.47728318", "0.47723547", "0.4770708", "0.47665733", "0.47474545", "0.47434404", "0.4732001" ]
0.0
-1
Two numbers are relatively prime if their greatest common factor is 1. In other worst if they cannot be divided by any common numbers other than 1, they are relatively prime. 13, 16, 9, 5, an 119 are all relatively prime because there share no common factors except for 1, to easily see this I will show their factorizations, 13, 2 x 2 x 2 x 2, 3 x 3, 5, 17 x 7 Create a function that takes 2 inputs, an number, n and a list, l. The function should return a list of all the numbers in l that are relatively prime to n. n and all numbers in l will be positive integers greater than or equal to 0. Some examples: relatively_prime(8, [1,2,3,4,5,6,7]) >>> [1,3,5,7] relatively_prime(15, [72,27,32,61,77,11,40]) >>> [32, 61, 77, 11, 40] relatively_prime(210, [15,100,2222222,6,4,12369,99]) >>> []
function gcd(a,b) { return (b===0) ? a : gcd( b, a%b); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function smallestPrimeOf(n) {\n for(let i=2; i<Math.ceil(Math.sqrt(n)); i++) {\n if(n % i == 0) {\n return i;\n }\n }\n return n;\n}", "function nextPrime(n){\n if(n === 0){return 2;}\n var answer = 0;\n function isPrime(num, start) {\n for ( var i = 2; i < num; i++ ) {\n if ( num % i === 0 ) {\n return false;\n }\n }\n return true;\n }\n for(var i = n + 1; i < n + 100; i++){\n if(isPrime(i , n)){\n answer = i;\n break;\n }\n }\n return answer;\n}", "function findSmallerPrimes() {\n for (let i = 0; i < 1000; i++) {\n isPrime(i);\n }\n}", "function findLargestPrimeFactor(number){\n\n//find all the primes between 0 and sqrt(number) (600851475143 by default)\n// we can use sqrt(number) since we don't care about the highest prime\n// we just care about the highest factor\n//starting at the end of the list (aka, starting with large primes) see if any of them divide the number inputed evenly.\n//if so, bob's your uncle.\n number = (number == undefined ? 600851475143 : number);\n // sieve of Eratosthenes\n var sievedPrimes = [];\n var largestPrimeFactor = i;\n for(var i = 2; i < Math.sqrt(number); i++){\n if(sievedPrimes[i] == undefined ){\n for(var degree=1, j = i << 1; j < Math.sqrt(number); j = (i << 1)+(++degree*i)){//we only care about primes < sqrt which greatly limits the search\n sievedPrimes[j] = false;\n }\n if(number%i == 0){\n largestPrimeFactor = i;\n }\n }\n }\n return largestPrimeFactor;\n}", "function findPrimeFactors(n) {\n\tif (n < 1)\n\t\tthrow \"Argument error\";\n\tvar small = [];\n\tvar large = [];\n\tvar end = Math.floor(Math.sqrt(n));\n\tfor (var i = 1; i <= end; i++) {\n\t\tif (n % i == 0) {\n\t\t\tsmall.push(i);\n\t\t\tif (i * i != n) // Don't include a square root twice\n\t\t\t\tlarge.push(n / i);\n\t\t}\n\t}\n\tlarge.reverse();\n\treturn small.concat(large);\n}", "function largestPrime(n){\n // initiate at 2 because 2 is the lowest prime\n var i = 2;\n // keep checking up to the number passed in\n while(i < n){\n // while the number is divisible by a number between 2 and n, keep dividing\n while(n % i === 0){\n n = parseInt(n/i);\n }\n // increment\n i++;\n }\n // when number is not divisible by any number between 2 and the number, return the number\n return n;\n}", "function Prime(bits, provable) {\r\n if (provable === undefined) {\r\n provable = true;\r\n }\r\n \r\n return new Promise((resolve, reject) => {\r\n try {\r\n if (provable) {\r\n resolve(ProvablePrime(bits));\r\n } else {\r\n resolve(ProbablePrime(bits));\r\n }\r\n } catch (e) {\r\n reject(e);\r\n }\r\n });\r\n}", "function largetPrimeFactor(n) {\n var i;\n var factors = findFactors(n);\n var len = factors.length;\n //default JS sort is Alphabetical Asending!\n //Numeric Descending Sort\n factors.sort(function (n1, n2) {\n return n1 < n2;\n });\n return _.find(factors, function (num) {\n return isPrime(num);\n });\n}", "function nthPrime(n) {\n let arr = [2];\n let nextElement = 3;\n while (arr.length < n) {\n for (let elem of arr) {\n if (elem > Math.sqrt(nextElement)) {\n arr.push(nextElement);\n break;\n } else {\n if (nextElement % elem === 0) {\n break;\n }\n }\n }\n nextElement += 2;\n }\n\n return arr[arr.length - 1];\n}", "function checkPrime(x) {\n for (let i = 2; i <= x/2; i++) {\n if (x%i === 0) {\n return null;\n }\n }\n return x;\n}", "function getRemAndPrime(num) {\n if (num !== 1) { /*If Number Is One Thats A End Point Of Recursive*/\n let i = 1;\n while (++i) {\n if (isPrime(i)) {/*Check Prime*/\n let res = num / i;\n if (!isFloat(res)) {/*Result Should Be Whole number*/\n primeList.push(i);\n getRemAndPrime(res);\n break;\n }\n }\n }\n } else {\n console.log(JSON.stringify(primeList) + \"===\" + primeList.reduce((a, b) => { return a * b }, 1));\n }\n}", "function nPrimeList(n) {\n var primelist = []\n for (let i = 2; primelist.length < n; i++) {\n if (isPrime(i)) {\n primelist.push(i);\n }\n }\n return primelist;\n}", "function sumOfDivided(lst) {\n var max = Math.max.apply(null, lst.map(Math.abs)), //max abs value in lst\n primes = [],\n composites = [max+1]; //non prime numbers\n\n if(lst.length > 0){\n for(var i = 2; i <= max; i++) {\n if( !composites[i] ){\n var sum = 0, isFactor = false;\n\n lst.forEach(function(n) {\n if(n % i == 0) {\n sum += n;\n isFactor = true;\n }\n });\n if(isFactor){ primes.push([i, sum]); } //its prime and its a factor\n for(var j = 2*i; j <= max; j += i) { composites[j] = true; } //multiples of the prime\n }\n }\n }\n return primes;\n}", "function leastFactor(composite) {\n\n // if (isNaN(n) || !isFinite(n)) return NaN;\n\n if (composite === 0n) return 0n;\n if (composite % 1n || composite*composite < 2n) return 1n;\n if (composite % 2n === 0n) return 2n;\n if (composite % 3n === 0n) return 3n;\n if (composite % 5n === 0n) return 5n;\n\n for (let i = 7n; (i * i) < composite; i += 30n) {\n if (composite % i === 0n) return i;\n if (composite % (i + 4n) === 0n) return i + 4n;\n if (composite % (i + 6n) === 0n) return i + 6n;\n if (composite % (i + 10n) === 0n) return i + 10n;\n if (composite % (i + 12n) === 0n) return i + 12n;\n if (composite % (i + 16n) === 0n) return i + 16n;\n if (composite % (i + 22n) === 0n) return i + 22n;\n if (composite % (i + 24n) === 0n) return i + 24n;\n }\n\n // it is prime\n return composite;\n}", "function isPrime(n){\n console.log(\"Các số nguyên tố trong khoảng từ 1 đến \"+n)\n if(n <2){\n console.log(\"không có số nguyên tố nào cả\")\n \n }else{\n console.log(2)\n for(var i = 3; i <= n; i++ ){\n \n for(var j=2; j < Math.sqrt(i); j++){\n if(i % j === 0){\n return 0;\n \n }\n console.log(i) \n }\n \n }\n \n }\n \n \n}", "function findNextPrime(val) {\r\n for (var n = val + 1; n < (Math.pow(n, 2) + 2); n++) {\r\n if (checkIfPrime(n)) {\r\n return n;\r\n break; //break on the first possible find\r\n }\r\n }\r\n}", "function printAllPrimesUpTo(max){\n for (let i = 2; i <= max; i++) {\n let possiblePrime = checkPrime(i);\n if (possiblePrime) {\n console.log(possiblePrime);\n }\n }\n}", "function solution(N) {\n function primeFactors(n) {\n const factors = [];\n let divisor = 2;\n\n while (n >= 2) {\n if (n % divisor == 0) {\n factors.push(divisor);\n n = n / divisor;\n } else {\n divisor++;\n }\n }\n return factors;\n }\n\n const primesFound = primeFactors(N);\n\n // for (let i = 0; i <= N; i++) {\n // if (primeFactors(i + 1)) {\n // console.log('prime', i + 1, primeFactors(i + 1));\n // largestFound = i + 1;\n // } /* else {\n // console.log('not');\n // } */\n // }\n return primesFound[primesFound.length - 1];\n}", "function primeList() {\n // For max=60M, computes 3.5 million primes in 15 seconds\n // For max=10M, computes 67k primes in 2 seconds.\n\n // Initialize variables\n let max = 10000000; // Maximum number to check if prime.\n let a = new Array(max);\n let out = []\n\n // Initialize sieve array\n for (var i=0; i<=max; i++) {\n a[i]=1;\n }\n\n // Mark all composite numbers\n for (var i=2; i<=max; i++) {\n for (var j=2; i*j<=max; j++) {\n a[i*j]=0;\n }\n }\n\n // Generate output list of prime numbers\n for (var i=2; i<=max; i++) {\n if (a[i]==1) {\n out.push(i)\n }\n }\n\n return out;\n}", "function findLargestPrime(integer){\n var factorArray = [];\n for(var i = 2; i < integer; i++){\n if(integer % i === 0){\n factorArray.push(i);\n }\n }\n largestFactor = factorArray[factorArray.length - 1];\n for(var x = 0; x < factorArray.length; x++){\n for(var i = 2; i < largestFactor + 1; i++){\n if(i != factorArray[x] && factorArray[x] % i === 0){\n factorArray.splice(x, 1)[0];\n x -= 1;\n i = largestFactor;\n }\n }\n }\n return factorArray[factorArray.length - 1]\n}", "function findPrimes(n) {\n var i,s,p,ans;\n s=new Array(n);\n for (i=0;i<n;i++)\n s[i]=0;\n s[0]=2;\n p=0; //first p elements of s are primes, the rest are a sieve\n for(;s[p]<n;) { //s[p] is the pth prime\n for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]\n s[i]=1;\n p++;\n s[p]=s[p-1]+1;\n for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)\n }\n ans=new Array(p);\n for(i=0;i<p;i++)\n ans[i]=s[i];\n return ans;\n }", "function isPrime(n) {\n var sum = 0\n if (n <= 1) {\n return false\n } else {\n for (var i = 2; i < n+1; i++) {\n if (n % i === 0) {\n sum++\n if (n === 2) {\n return true\n }\n }\n if (sum > 1){\n return false\n }\n }\n if (sum === 1) {\n return true\n }\n }\n}", "function numPrimorial(n) {\r\n let j;\r\n let arr = new Set;\r\n\r\n function createPrimeArr(length) {\r\n if (arr.size == n) return;\r\n for (let i = 1; i <= length; i++) {\r\n let tempArr = [];\r\n for (j = 0; j <= i; j++) {\r\n if (i % j == 0) tempArr.push(i);\r\n }\r\n\r\n if (tempArr.length == 2) {\r\n\r\n arr.add(tempArr[0])\r\n };\r\n };\r\n createPrimeArr(length + 1)\r\n };\r\n createPrimeArr(n)\r\n return arr\r\n}", "function primeFactorList(n) {\n\tif (n < 1) throw \"Argument error\";\n\tlet result = [];\n\twhile (n != 1) {\n\t\tlet factor = smallestFactor(n);\n\t\tresult.push(factor);\n\t\tn /= factor;\n\t}\n\treturn result;\n}", "function problem7(){\n c=1;\n x=3;\n while( c < 10001 ){\n if(fasterPrime(x)){\n c++;\n }\n x+=2;\n }\n return x-2;\n}", "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function test_prime(n) {\n console.log(\"prime clicked\");\n console.log(n);\n\n if (n <= 1) {\n return false;\n } else if (n === 2 || n == 3) {\n return true;\n } else {\n for (var x = 2; x <= Math.floor(Math.sqrt(n)); x++) {\n if (n % x === 0) {\n console.log(x);\n return false;\n }\n }\n return true;\n }\n}", "function isPrime(n) {\n if (isNaN(n) || !isFinite(n) || n%1 || n<2) return false; \n if (n==leastFactor(n)) return true;\n return false;\n}", "function isPrime(n) {\n\n if (n === 1) {\n return false;\n }\n else if (n === 2) {\n return true;\n } else {\n for (var i = 2; i < n; i++) {\n if (n % i === 0) {\n return false;\n }\n }\n return true\n }\n}", "function isPrime(n)\r\n{\r\n var flag=0;\r\n for(let i=2 ; i < n/2 ; i++) {\r\n if(n%i === 0) {\r\n flag = 1;\r\n break;\r\n }\r\n }\r\n if(flag == 0) {\r\n return true;\r\n }\r\n}", "function firstPrimeAbove(n){\n var i = somePrimes.length;\n while(somePrimes[--i] > n);\n return somePrimes[++i];\n }", "function allPrimesLessThanN(n) {\n for (let i = 0; i < n; i++) {\n if (isPrime2(i)) {\n \n }\n }\n}", "function problem3(num){\n for(var x = 2; x<=num; x++){\n if(isPrime(x) !== true){\n }\n else if (num%x===0){\n num = num/x;\n }\n else if (isPrime(num) == true)\n return num;\n }\n}", "function primeFactorList(n) {\n if (n < 1) throw new RangeError(\"Argument error\");\n var result = [];\n\n while (n !== 1) {\n var factor = smallestFactor(n);\n result.push(factor);\n n /= factor;\n }\n\n return result;\n}", "function isPrime(n) {\n n = Math.abs(n);\n if (n === 2) { return true };\n if (n === 0 || n === 1) { return false };\n let arr = Array.from(Array(n).keys()).filter(item => item > 1);\n return arr.every(item => n % item !== 0);\n}", "function primeFactorList(n) {\n\t\tif (n < 1)\n\t\t\tthrow new RangeError(\"Argument error\");\n\t\tlet result = [];\n\t\twhile (n != 1) {\n\t\t\tconst factor = smallestFactor(n);\n\t\t\tresult.push(factor);\n\t\t\tn /= factor;\n\t\t}\n\t\treturn result;\n\t}", "function solve(n, p){\n // Complete this function\n var front = (Math.floor(p / 2));\n var back = (Math.floor(n / 2) - front);\n if (front > back){\n return back\n } else {\n return front\n }\n}", "function listPrimes(n) {\n const list = [];\n const output = [];\n // Make an array from 2 to (n-1)\n for (let i = 0; i < n; i += 1) {\n list.push(true);\n }\n // remove multiples of primes starting from 2,3,5...\n for (let i = 2; i <= Math.sqrt(n); i += 1) {\n if (list[i]) {\n for (let j = i * i; j < n; j += i) {\n list[j] = false;\n }\n }\n }\n\n // All array[i] set to ture are primes\n for (let i = 2; i < n; i += 1) {\n if (list[i]) {\n output.push(i);\n }\n }\n return output;\n}", "function primeFactorization(n) {\n var ret = [];\n var divider = 2;\n while(n > 1) {\n if(n%divider === 0) {\n ret.push(divider);\n n = n/divider;\n }\n else {\n divider++;\n }\n }\n return ret;\n}", "function isPrime(n) {\n if (n === 1) {\n return false;\n } else if (n === 2) {\n return true;\n } else {\n for (var x = 2; x < n; x++) {\n if (n % x === 0) {\n return false;\n }\n }\n return true;\n }\n}", "function findPrimes(n) {\n var i, s, p, ans;\n s = new Array(n);\n for (i = 0; i < n; i++)\n s[i] = 0;\n s[0] = 2;\n p = 0; //first p elements of s are primes, the rest are a sieve\n for (; s[p] < n; ) { //s[p] is the pth prime\n for (i = s[p] * s[p]; i < n; i += s[p]) //mark multiples of s[p]\n s[i] = 1;\n p++;\n s[p] = s[p - 1] + 1;\n for (; s[p] < n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)\n }\n ans = new Array(p);\n for (i = 0; i < p; i++)\n ans[i] = s[i];\n return ans;\n }", "function solve(n, p){\n\n var output = Math.min(p/2,(n-p)/2)\n\n if((n == p)||(p == 1)) {\n return 0\n } else if(output < 1){\n return Math.round(output)\n }\n else {\n return Math.floor(output)\n }\n }", "function isPrime(number) {\n if (!Number.isInteger(number)) {\n return false;\n }\n\n if (number <= 1) {\n return false;\n }\n\n let largestPrime = 2;\n let indexOfLargestPrime = 0;\n let half = Math.round(Math.sqrt(number));\n\n for(let i = 0; i < knownPrimes.length; i++) {\n let prime = knownPrimes[i];\n if(prime <= half) {\n largestPrime = prime;\n indexOfLargestPrime = i;\n if(number % prime === 0){\n return false;\n }\n }\n };\n\n if (indexOfLargestPrime !== knownPrimes.length - 1) {\n largestPrime = knownPrimes[indexOfLargestPrime + 1];\n } else {\n largestPrime++;\n }\n\n for(let i = largestPrime; i <= half; i++) {\n if(number % i === 0) {\n return false;\n }\n }\n\n return true;\n}", "function checkPrime(number){\n var pom = true\n for (var i = 2; i <= number; i++){\n if ((number %i ) === 0 && number !== i){\n pom = false;\n }\n }\n return pom;\n}", "function test_prime(n)\n{ \n if (n===1) {return false; }\n else if(n === 2)\n{ return true; }\nelse {\nfor(var x = 2; x < n; x++) {\n if(n % x === 0) \n{ return false; } \n}\n return true; \n }\n}", "function get_prime_factors(number) {\n number = Math.floor(number);\n if (number == 1) {\n //alert(\"Warning: 1 has no prime factorization.\");\n return 1;\n }\n var factorsout = [];\n var n = number;\n var q = number;\n var loop;\n\n for (var i = 0; i < PRIMES.length; i++) {\n if (PRIMES[i] > n) break;\n\n factorsout.push(0);\n\n if (PRIMES[i] == n) {\n factorsout[i]++;\n break;\n }\n\n loop = true;\n\n while (loop) {\n q = n / PRIMES[i];\n\n if (q == Math.floor(q)) {\n n = q;\n factorsout[i]++;\n continue;\n }\n loop = false;\n }\n }\n\n return factorsout;\n}", "function PrimeTest(a){\n if (isNaN(a) || !isFinite(a) || a % 1 || a < 2) return false; \n var m = Math.sqrt(a);\n for (var i = 2; i <= m; i++) if (a % i==0) return false;\n return true;\n}", "function isPrime(n) {\n if (n === 1 || n === 0 || (n % 2 === 0 && Math.abs(n) > 2)) return false;\n const lim = Math.floor(Math.sqrt(n));\n for (let i = 3; i < lim; i += 2) {\n if (n % i === 0) return false;\n }\n return true;\n}", "function largestPrimeFactor(number) {\n if(isPrime(number)) return number\n \n let sqrt = Math.floor(Math.sqrt(number))\n \n sqrt = sqrt % 2 === 0 ? sqrt + 1 : sqrt\n \n for( let i = sqrt; i >= 1; i-= 2){\n if(((number % i) === 0) && isPrime(i)){\n return i\n }\n }\n }", "function isPrimeV2(n) {\n if (n <= 1 || n >= 1000) return false;\n\n for (let i = 2; i <= Math.sqrt(n); i++) {\n if (n % i === 0) return false;\n }\n\n return true;\n}", "function isPrime(n) {\n if (n <= 1) {\n return false;\n }\n if(n === 2) {\n return true;\n }\n if(n%2 === 0) {\n return false;\n }\n \n var sq = Math.sqrt(n);\n var i;\n for (i = 3; i <= sq; i = i + 2) {\n if (n % i === 0) {\n return false;\n }\n }\n return true;\n}", "function isPrime(n) {\n for (var i = 2;i < n; i++) {\n if(n % i === 0){\n return false;\n }\n }\n return n > 1;\n}", "function isPrime(n){\n for (let a = 2; a < n; a++){\n if (n%a === 0){\n return false;\n }\n }\n return true;\n }", "function getPrimes(int) {\r\n var primes = [];\r\n var curr = 2n;\r\n \r\n while (curr < int) {\r\n if ((int / curr) * curr === int) {\r\n int /= curr;\r\n primes.push(curr);\r\n console.log(curr);\r\n } else {\r\n curr += 1n;\r\n }\r\n }\r\n primes.push(int);\r\n \r\n return primes;\r\n}", "function uniquePrimeFactors(n) {\n if (n < 1n)\n throw new RangeError();\n let result = [];\n for (let i = 2n, end = sqrt(n); i <= end; i++) {\n if (n % i == 0n) {\n result.push(i);\n do\n n = n / i;\n while (n % i == 0n);\n end = sqrt(n);\n }\n }\n if (n > 1n)\n result.push(n);\n return result;\n }", "function test_prime(n)\n{\n\n if (n===1)\n {\n return false;\n }\n else if(n === 2)\n {\n return true;\n }else\n {\n for(var x = 2; x < n; x++)\n {\n if(n % x === 0)\n {\n return false;\n }\n }\n return true; \n }\n}", "function isPrime(n) {\n let max = Math.sqrt(n);\n for (let i = 2; i <= max; i++) {\n if (n % i === 0) return false;\n }\n return true;\n}", "function prime2(n) {\n const data = [];\n for (let i = 1; i < n; i += 2) {\n data.push(i);\n }\n data[0] = 0;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] > 0) {\n let k = data[i];\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 0;\n }\n }\n }\n const result = [2];\n for (let i of data) {\n if (i > 0) {\n result.push(i);\n }\n }\n return result;\n }", "function isPrime(x) {\n var i;\n \n console.log('Checking base');\n if (isNaN(x) || !isFinite(x) || x < 2) {\n return false;\n }\n\n console.log('Checking x % 2 ');\n if (x % 2 === 0) {\n return x === 2;\n }\n\n console.log('Checking x % 3');\n if (x % 3 === 0) {\n return x === 3;\n }\n\n console.log('Checking x % 5');\n if (x % 5 === 0) {\n return x === 5;\n\n }\n\n for (i = 7; i <= Math.sqrt(x); i += 30) {\n console.log('Checking x % ' + i);\n if (x % i === 0) {\n return false;\n }\n\n console.log('Checking x % ' + (i + 4));\n if (x % (i + 4) === 0) {\n return false;\n }\n\n console.log('Checking x % ' + (i + 6));\n if (x % (i + 6) === 0) {\n return false;\n }\n\n console.log('Checking x % ' + (i + 10));\n if (x % (i + 10) === 0) {\n return i + 10;\n }\n\n console.log('Checking x % ' + (i + 12));\n if (x % (i + 12) === 0) {\n return i + 12;\n }\n\n console.log('Checking x % ' + (i + 16));\n if (x % (i + 16) === 0) {\n return i + 16;\n }\n\n console.log('Checking x % ' + (i + 22));\n if (x % (i + 22) === 0) {\n return i + 22;\n }\n\n console.log('Checking x % ' + (i + 24));\n if (x % (i + 24) === 0) {\n return i + 24;\n }\n }\n\n return true;\n }", "function isPrime(number) { \n if (number === 1) return false\n else if (number === 2) return true\n else if (number % 2 === 0) return false\n for (let j = 3; j <= Math.floor(Math.sqrt(number)); j+=2) {\n if (!(number % j)) return false\n }\n return true\n}", "function test_prime(n)\r\n{\r\n\r\n if (n===1)\r\n {\r\n return false;\r\n }\r\n else if(n === 2)\r\n {\r\n return true;\r\n }else\r\n {\r\n for(var x = 2; x < n; x++)\r\n {\r\n if(n % x === 0)\r\n {\r\n return false;\r\n }\r\n }\r\n return true; \r\n }\r\n}", "function test_prime(n)\n{\n if (n===1)\n {\n return false;\n }\n else if(n === 2)\n {\n return true;\n }else\n {\n for(var x = 2; x < n; x++)\n {\n if(n % x === 0)\n {\n return false;\n }\n }\n return true; \n }\n}", "function nextPrime(input){\n let counter\n input++; \n while(true){\n counter = 0;\n for (let i = 2; i <= Math.sqrt(input); i++) {\n if(input % i == 0) counter++\n }\n if(counter == 0 && input > 1) {\n return input \n } else {\n input++\n continue\n }\n }\n}", "function isPrime(n) {\n if (n <= 1) return false;\n var upper = Math.sqrt(n);\n for (var i = 2; i <= upper; i++) {\n if (n % i === 0) return false;\n }\n \n return true;\n}", "function isPrime(n){\n var divisor = 2;\n \n while (n > divisor){\n if(n % divisor == 0){\n return false; \n }\n else\n divisor++;\n }\n return true;\n }", "function smallestFactor(n) {\n\tif (n < 2)\n\t\tthrow \"Argument error\";\n\tif (n % 2 == 0)\n\t\treturn 2;\n\tlet end = Math.floor(Math.sqrt(n));\n\tfor (let i = 3; i <= end; i += 2) {\n\t\tif (n % i == 0)\n return i;\n\t}\n\treturn n;\n}", "function IsPrime(n){\n var divisor = 2;\n\n while(n > divisor){\n if (n % divisor == 0){\n return false;\n }\n else divisor++;\n }\n return true;\n}", "function nth_prime(n) {\n\n}", "function testPrimeNum(n){\n if(n===1){\n return false;\n }else if(n===2){\n return true;\n }else{\n for(var i=2; i<n;i++){\n if(n%i===0){\n return false;\n }\n }\n return true;\n }\n}", "function isPrime(n)\r\n{\r\n\tfor(let k=2;k<n;k++){\r\n\t\tif(!(n%k))\r\n\t\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "function isPrime(n)\r\n{\r\n\tfor(let k=2;k<n;k++){\r\n\t\tif(!(n%k))\r\n\t\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "function cekPrime (param1){\n for(var i=2;i< param1; i++){\n if(param1 % i==0){\n return false;\n }\n }\n return true;\n}", "function primeFactorize(v)\n{let factors=[];\n for(k=1;k<v;k++)\n {\n if(v%k===0&&isPrime(k))\n {\n if(!factors.includes(k))\n factors.push(k);\n }\n }\n for(j=0;j<factors.length;j++)\n {\n console.log(factors[j]+\" \");\n }\n}", "function PrimeFactors(n){\n var factors = [],\n divisor = 2;\n\n while(n>2){\n if (n % divisor == 0){\n factors.push(divisor);\n n= n/ divisor;\n }\n else{\n divisor ++;\n } \n }\n return factors;\n}", "function isPrime(num) {\n\t// convert given number to an absolute number\n\tvar newNum = Math.abs(num);\n\tif (newNum === 1 || 0) {\n\t\t// special numbers that are not prime.\n\t\tconsole.log(num, ' is not a prime number.');\n\t\treturn false;\n\t} else if (newNum === 2) {\n\t\t// 2 is the only even number that is prime.\n\t\tconsole.log(num, ' is a prime number.');\n\t\treturn true;\n\t} else if (newNum % 2 === 0) {\n\t\t// even numbers (except 2) are not prime numbers\n\t\tconsole.log(num, ' is not a prime number.')\n\t\treturn false;\n\t} else {\n\t\t// 1. get square root of number and round to whole number\n\t\tvar sqNewNum = Math.round(Math.sqrt(newNum));\n\t\t// 2. trial division every number, starting with 2, until the square root of num (the function's parameter)\n\t\tfor (var i=2; i<=sqNewNum; i++) {\n\t\t\t// 3. if a number from sq root has remainder 0 after dividing, it's not prime.\n\t\t\tif (newNum % i === 0) {\n\t\t\t\tconsole.log(num, ' is a not a prime number.');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tconsole.log(num, ' is a prime number.');\n\t\treturn true;\n\t}\n}", "function primeFactorization(n) {\n var factors = [],\n divisor = 2;\n\n while (n >= 2) {\n if (n % divisor == 0 ) {\n factors.push(divisor);\n n = n / divisor;\n }\n else {\n divisor++;\n }\n }\n return factors;\n}", "function findPrime(nPrimes,startAt){\n var n = 100\n k=startAt+nPrimes\n \n while (startAt<=k){\n i=2\n flag = false\n while(i<startAt){\n if(startAt%i===0){\n flag = true\n }\n \n i++\n }\n \n console.log(flag? startAt+' is not a prime':startAt+' is prime')\n startAt++\n }\n}", "function smallestFactor(n) {\n if (n < 2) throw new RangeError(\"Argument error\");\n if (n % 2 === 0) return 2;\n var end = Math.floor(Math.sqrt(n));\n\n for (var i = 3; i <= end; i += 2) {\n if (n % i === 0) return i;\n }\n\n return n;\n}", "function largestPrimeFactor(num) {\n var i = 2,\n primes = [];\n\n //if num is prime, return num\n if (isPrime(num)) {\n return num;\n }\n\n //recursivly return next prime until at lowest point.\n while (i < num) {\n if (num % i === 0) {\n return largestPrimeFactor(num / i);\n }\n i += 1;\n }\n}", "function randomPrime(limit) {\n var primeList = [];\n for (var i=3; i < limit; i++) {\n if (i == leastFactor(i)) {\n primeList.push(i);\n }\n }\n return primeList[Math.floor(Math.random() * primeList.length)];\n}", "function findLargestPrime(number) {\n var factor;\n var prime;\n var largestPrime\n\n for (i = 2; i < number / 2; i++) {\n if (number % i === 0) { // then i is a factor\n var k = 2;\n for (k = 2; k < i; k++) {\n if (i % k !== 0 || i === 2) { // if i is only divisible by itself and 1\n prime = i\n }\n else { // i is not a prime number\n console.log(largestPrime);\n return largestPrime;\n }\n }\n console.log(prime + \" is a prime factor\");\n largestPrime = prime\n }\n }\n return largestPrime;\n} //end function", "function isPrime(n) {\n var divisor = 2;\n while (n > divisor){\n if(n % divisor == 0) {\n return false;\n } else {\n divisor++;\n }\n }\n return true;\n}", "function isPrime(n) {\n let prime = false;\n let factors = 0;\n\n for (let i = 1; i <= n; i++) {\n if (n % i === 0) {\n factors++;\n }\n }\n\n if (factors === 2) prime = true;\n\n return prime;\n}", "function primes(n) {\n var realNumbers = [];\n for(i=0; i<=n; i++) {\n realNumbers.push(true);\n }\n var primeNumbers = [];\n for (i=0; i<=n; i++) {\n if (i == 0 || i == 1 || realNumbers[i] === false) {\n continue;\n }\n primeNumbers.push(i);\n for (j=i; true; j++) {\n if (i*j < realNumbers.length) {\n realNumbers[i*j] = false;\n } else {\n break;\n }\n }\n }\n return primeNumbers;\n}", "function largePrime(val) {\n var count = 0;\n var primenum = 1\n while (count < val) {\n primenum ++;\n if (isPrime(primenum)) {\n count ++;\n }\n \n \n }\n return primenum;\n}", "function isPrime(n) {\n\t// TODO:\n}", "function isPrime(n) {\n if (n <= 1n)\n throw new RangeError();\n if ((n & 1n) == 0n)\n return n == 2n;\n for (let i = 3n, end = sqrt(n); i <= end; i += 2n) {\n if (n % i == 0n)\n return false;\n }\n return true;\n }", "function smallestFactor(n) {\n\t\tif (n < 2)\n\t\t\tthrow new RangeError(\"Argument error\");\n\t\tif (n % 2 == 0)\n\t\t\treturn 2;\n\t\tconst end = Math.floor(Math.sqrt(n));\n\t\tfor (let i = 3; i <= end; i += 2) {\n\t\t\tif (n % i == 0)\n\t\t\t\treturn i;\n\t\t}\n\t\treturn n;\n\t}", "function isPrime(n) {\n if (n < 2) return false;\n var q = Math.floor(Math.sqrt(n));\n for (var i = 2; i <= q; i++) {\n if (n % i == 0) {\n return false;\n }\n }\n return true;\n}", "function isPrime(number){\n\tif(number <= 1){return false;}\n\tif(number == 2){return true;}\n\tif(!(number%2)){return false;}\n\tvar maxCheck = Math.floor(Math.sqrt(number));\n\tfor(var i = 3; i <= maxCheck; i+=2){\n\t\tif(!(number%i)){return false;}\n\t}\n\treturn true;\n}", "function primes(limit) {\n let list = [];\n let nonPrimes = [];\n\n //build range\n for (let idx = 2; idx <= limit; idx++) list.push(idx);\n\n // mark nonPrimes\n list.forEach(number => {\n if (!nonPrimes.includes(number)) {\n for (let testNum = number * 2; testNum <= limit; testNum += number) {\n nonPrimes.push(testNum);\n }\n }\n });\n \n // filter out nonPrimes\n return list.filter(number => !nonPrimes.includes(number));\n}", "isPrime(index) {\n var n = 2;\n while (n <= index / 2) {\n if (index % n == 0) {\n return 0;\n }\n n++;\n }\n return index;\n}", "function isPrime(n) {\n for(let i = 2; i <= n / 2; i++) {\n if(n % i === 0) return false;\n }\n return true;\n}", "function amicablePairsUpTo(maxNum) {\n function sumProperDivisors(n){\n let sum = 0\n const arr = [], max = Math.floor(Math.sqrt(n));\n for(let i = 1; i <= max; i++){\n if(n % i === 0){\n const j = n / i;\n sum += i\n if( i !== j && j !== n){\n sum += j\n }\n \n }\n }\n return sum;\n }\n const pairs = [];\n for(let i = 1; i < maxNum; i++){\n \n const a = sumProperDivisors(i);\n const b = sumProperDivisors(a);\n if(i === b && a !== b && a < b){\n pairs.push([a, b]);\n }\n }\n \n return [...pairs];\n }", "function largestPrimeFactor(number) {\n let primeFactors = [];\n let primeCandidate = 2; // Start with smallest prime number (2)\n\n // algorithm works for positive numbers\n while (number > 1) {\n // If number divisible with candidate; append to list\n while (number % primeCandidate === 0) {\n primeFactors.push(primeCandidate);\n number /= primeCandidate;\n }\n primeCandidate += 1; // Just increase by 1; all multiple of primeCandidate will not evaluate anyway\n // -> e.g. if number is divided by 2, multiples like 4/6/8/... are not possible anymore\n }\n return primeFactors[primeFactors.length - 1];\n}", "function generateSafePrime(\r\n\t\tx,\t\t\t\t//string or BigInteger - safe-prime, or start-number from which need to generate a safe-prime,\r\n\t\t\t\t\t\t//or number - bitlength to generate random safePrime with specified bitlength, if \"x\" not a string or BigInteger\r\n\t\tmode\t\t\t//'previous', or 'next', or 'doubled-previous', or 'doubled_next';\r\n\t,\tMRrounds\r\n\t){\t\t\r\n\t\t/*\r\n\t\t\tProof of the validity of the representation a Safe-Prime number, in form: p = 12*k - 1:\r\n\r\n\t\t\tLet q = 12*x+r; where x - natural number, r = q%12 - remainder by modulo x, and number with value from 0 up to (x-1) (0,1,2,3,4,5,6,7,8,9,10,11).\r\n\t\t\tIn this form can be represented each natural number.\r\n\r\n\t\t\tNow, let us prove that the representation of any Safe-Prime (which are not excepted), in form q = 12*x+11 is valid:\r\n\t\t\t\r\n\t\t\t1.\tWhen r is even, y - natural number, r = 2*y; q = 12*x + r = 12*x + 2y; q = 2*(6x+y) - so q have divisor 2, and this is even number, not an odd prime number.\r\n\t\t\t\tSo, y = 0,1,2,3,4,5, and even values of r = 0,2,4,6,8,10 - are excluded.\r\n\t\t\t\r\n\t\t\t2. Now, exclude an odd values of r:\r\n\t\t\t\tWhen r = 1; q = 12*x + 1; (q-1)/2 = 12*x/2 = 6*x = 2*3x - have divisor 2, and this is even number, not an odd Sophie-Germen prime number.\r\n\t\t\t\tWhen r = 3; q = 12*x + 3; q = 3*(4x+1) - have divisor 3, and this is not a prime, because this have no divisors besides 1 and itself.\r\n\t\t\t\tWhen r = 5; q = 12*x + 5; (q-1)/2 = (12*x+4)/2 = 2*(6x+2)/2 = (6x+2) = 2*(3x+1) - have divisor 2, and this is even number, not an odd Sophie-Germen prime number.\r\n\t\t\t\t\tException: x = 0; q = 12*0 + 5 = 5; (q-1)/2 = (5-1)/2 = 4/2 = 2, is even, but this is a Sophie-Germen prime-number, and this have divisor 1 and itself.\r\n\t\t\t\tWhen r = 7; q = 12*x + 7; (q-1)/2 = (12*x+6)/2 = 2*(6x+3)/2 = (6x+3) = 3*(2x+1) - have divisor 3, and this is not a prime, because this have no divisors besides 1 and itself.\r\n\t\t\t\t\tException: x = 0; q = 12*0 + 7 = 7; (q-1)/2 = (7-1)/2 = 6/2 = 3, have divisor 3, but this is a Sophie-Germen prime-number, and this have divisor 1 and itself.\r\n\t\t\t\tWhen r = 9; q = 12*x + 9; (q-1)/2 = (12*x+8)/2 = 2*(6*x+4)/2 = (6x+4) = 2*(3x+2) - have divisor 2, and this is even number, not an odd Sophie-Germen prime number.\r\n\r\n\t\t\tAfter this all, from all possible values of r = q%12, from the numbers 0,1,2,3,4,5,6,7,8,9,10,11,\r\n\t\t\twas been excluded (two exceptions) the values r = 0,2,4,6,8,10,1,3,5,7,9 (sorted: 0,1,2,3,4,5,6,7,8,9,10), and only one option remains - value 11.\r\n\t\t\tConsequently, r = 11, and any Safe-Prime nubmer (except for 5, 7), can be represented in form q = 12*x + 11;\r\n\t\t\tNow, let, k = (x+1); q = 12*(x+1) - 1 = 12k - 1; Consequently, q = 12k - 1.\r\n\t\t\t\r\n\t\t\tOriginal statement is proven.\r\n\t\t*/\r\n\t\t\r\n\t\tMRrounds = MRrounds || getSetMRrounds();\t//default MillerRabin rounds\r\n\t\t\r\n\t\tif((typeof x !== 'number') && bigInt().from(x).isSafePrime()){return bigInt().from(x);} //if x not number but string or bigint, and if this already safe prime - return it\r\n\t\t\r\n\t\t//\tOr start generate the Safe-Prime:\r\n\t\t//by \"bitlength\" - prime with specified bitlength in number \"x\", or by specified BigInteger \"x\" - the start number, with \"mode\" - 'previos'(default), 'next',\r\n\t\t//(also, 'doubled[_- +.]previous', 'doubled[_- +.]next' - means generate previous or next Sofi-Germen prime, and return doubled safePrime 2p+1).\r\n\t\t\r\n\t\t//\tsp - Safe Prime, sgp - Sofi-Germen's prime, corresponding for sp.\r\n\t\t//sgp = (sp-1)/2 - must be a prime, when sp is Safe Prime. \t\t\t| * 2\r\n\t\t//2*sgp = sp-1\t\t\t\t\t\t\t\t\t\t\t\t\t\t| + 1\r\n\t\t//2*sgp + 1 = sp\t\t\t\t\t\t\t\t\t\t\t\t\t|revert this\r\n\t\t//sp = 2sgp + 1; \t\t\t\t\t\t\t\t\t\t\t\t\t|if sgp, is a prime -> return sp.\r\n\t\t\r\n\t\tmode = mode || 'previous';\r\n\r\n\t//\tconsole.log(\r\n\t//\t\t'Generating \"safe prime\" number, as '\t\t\t\t\t\t\t\t\t\t\t\t+\r\n\t//\t\tmode\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+\r\n\t//\t\t' prime from x '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+\r\n\t//\t\t( ( mode.indexOf('doubled') !== -1 ) ? ', means as next 2x' : '' )\t\t\t\t\t+\r\n\t//\t\t((typeof x === 'number')?'from random '+x+' bits BigInteger': x.toString())\t\t\t+\r\n\t//\t\t', for which (p-1)/2 is prime number too... '\r\n\t//\t);\r\n\t\t\t\t\r\n\t\tvar p, prime = (typeof x === 'number') ? bigInt.randbits(x) : bigInt().from(x);\t//just got rand bits or nubmer.\r\n\t\tprime = (\r\n\t\t\t\t\t(prime.MillerRabin(MRrounds))\t\t\t\t\t\t\t\t\t\t\t\t//if already prime\r\n\t\t\t\t\t\t? prime\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//use it\r\n\t\t\t\t\t\t: prime.prevprime()\r\n\t\t\t\t)\r\n\t\t;\r\n\t\tif(prime.isSafePrime()){return prime;}\r\n\t\tprime = (\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//find next or previous prime, (12k - 1)\r\n\t\t\t\t\t\t\t(mode.indexOf('previous')!==-1)\r\n\t\t\t\t\t\t\t\t? (prime.subtract(prime.mod(bigInt('12'))).add(bigInt('12')).prev())\t//\t((p - (p%12) + 12) - 1) \t->\tnext number (12k - 1)\r\n\t\t\t\t\t\t\t\t: (prime.subtract(prime.mod(bigInt('12'))).prev())\t\t\t\t\t\t//\t(p - (p%12) - 1) \t\t-> \tprevious number (12k - 1)\r\n\t\t\t\t)\r\n\t\t;\r\n\t\tif(prime.isSafePrime()){return prime;}\r\n\t\tdo{\r\n\t\t//\tconsole.log('p', p, 'prime', prime.toString());\r\n\t\t\tprime = ( (mode.indexOf('previous')!==-1) ? prime.subtract(bigInt('12')) : prime.add(bigInt('12')) );\t//next or previous nubmer (12k-1)\r\n\t\t\t//find next prime p, by rolling, using MillerRabin() primality check\r\n\t\t\tp = (\r\n\t\t\t\t\t( mode.indexOf('doubled') !== -1 )\r\n\t\t\t\t\t\t? (prime.multiply(bigInt('2'))).next()\t\t\t\t\t//make p*2+1\r\n\t\t\t\t\t\t: (prime.prev()).divide(bigInt('2'))\t\t\t\t\t//or (p-1)/2\r\n\t\t\t\t)\r\n\t\t\t;\r\n\t\t//\tconsole.log('p.toString()', p.toString());\r\n\t\t}while(\r\n\t\t\t\t!prime.isNegative()\r\n\t\t\t&&\t(\r\n\t\t\t\t\t!prime.MillerRabin(MRrounds)\r\n\t\t\t\t||\t!p.MillerRabin(MRrounds)\t\t\t\t\t\t\t\t\t\t//check (p*2)+1 primality of\r\n\t\t\t)\r\n\t\t)\r\n\t\tp = ( ( mode.indexOf( 'doubled' ) !== -1 ) ? p : prime );\t//return safe prime, if next or previous was been Sofi-Germen prime, and need to return doubled Safe-prime.\r\n\r\n\t//\tconsole.log('Done! p = ', p.toString());\r\n\t\treturn p;\t\t\t\t\t\t\t\t\t\t\t\t\t//maybe this fuction return a safe prime\r\n\t}", "function primeOf(phii,min=0) {\n\tmin=Math.abs(min); min+=2;min+=2;\n\tif (min>=phii) error(\"Minimum for e : \"+min+\" is greater than phi : \"+phii+\" !\");\n\t// TODO\n\tfor (var ee=min;ee<phii;ee++) {\n\t\tif (GCD(phii,ee)==1) break;\n\t}\n\treturn ee;\n}", "function nthPrime(n) {\n let number = 2;\n let primeCount = 0;\n let biggestPrime;\n function isPrime(num) {\n for(var i = 2; i < num; i++)\n if(num % i === 0) return false;\n return true;\n }\n while(primeCount !== n) {\n if(isPrime(number)) {\n biggestPrime = number;\n primeCount++;\n number++;\n } else {\n number++\n }\n }\n return biggestPrime;\n}", "function isPrime(n){\n if(n < 2) return false;\n if(n == 2) return true;\n if(n % 2 == 0) return false;\n for(var i=3; (i*i) <= n; i+=2) {\n \tif(n % i == 0) return false;\n }\n return true;\n}", "function ml_z_nextprime(z1) {\n // Interestingly, the zarith next_prime only returns \n // probabalistic primes. We do the same, with the \n // same probablistic parameter of 25.\n // https://fossies.org/dox/gmp-6.1.2/mpz_2nextprime_8c_source.html\n \n z1 = bigInt(z1)\n var one = bigInt(1);\n var two = bigInt(2);\n\n if (z1.lt(one) || z1.equals(one)) {\n return 2;\n }\n\n if (z1.and(one).equals(one)) {\n z1 = z1.add(two);\n } else {\n z1 = z1.add(one);\n }\n\n while (true) {\n if (z1.isProbablePrime(25)) {\n return ml_z_normalize(z1);\n } else {\n z1 = z1.add(two)\n }\n }\n}", "function isPrime(num) {\n num = Math.abs (num);\nif (num < 2) {return false;}\nfor (let i=2;i<num;i++) { \n if (num%i === 0){ \n return false;}\n}\nreturn true;\n}" ]
[ "0.6503214", "0.6483699", "0.6259035", "0.6149936", "0.6098556", "0.6085731", "0.6061442", "0.6059811", "0.60493255", "0.60318154", "0.59825945", "0.5920506", "0.589946", "0.5890826", "0.5889013", "0.5868843", "0.5868289", "0.5864898", "0.5863611", "0.58463246", "0.58426946", "0.5833711", "0.58309954", "0.5823226", "0.5822478", "0.5811508", "0.5799593", "0.5798015", "0.57948214", "0.5793168", "0.57917756", "0.5783262", "0.5781222", "0.5778298", "0.57781476", "0.5770719", "0.5769822", "0.5768784", "0.5754833", "0.5748044", "0.5745211", "0.57435143", "0.57424664", "0.5735191", "0.5727053", "0.5725982", "0.57222724", "0.57219934", "0.57176495", "0.5706485", "0.5701763", "0.5701272", "0.5698133", "0.5697072", "0.5693054", "0.5686266", "0.56812924", "0.567799", "0.5677951", "0.5676559", "0.5673116", "0.5666858", "0.56654215", "0.5655963", "0.5650564", "0.5645292", "0.5640732", "0.56333625", "0.563292", "0.5630583", "0.5630583", "0.56287867", "0.56276226", "0.5627544", "0.5627081", "0.56183785", "0.56179243", "0.5615872", "0.561536", "0.5612616", "0.56080747", "0.5606773", "0.560565", "0.5595425", "0.55953455", "0.5594573", "0.5589024", "0.558078", "0.5577674", "0.5577528", "0.557545", "0.55748296", "0.5573696", "0.5571868", "0.5571039", "0.5568619", "0.55566436", "0.5552087", "0.5551868", "0.55401963", "0.55305237" ]
0.0
-1
No sockets in minscripten
function adjtimex(tx) { const [mode, result] = readUint(tx); if (!result) return -EFAULT; if (mode !== 0 && mode !== ADJ_OFFSET_SS_READ) return -EPERM; if (!writeFill(tx, 0, sizeofTimex)) return -EFAULT; return TIME_OK; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Socket() {}", "initSockets() {\n ;\n }", "function settaSocket(s){\r\n\t\"use strict\";\r\n\tsocket=s;\r\n}", "function on_socket_get(message) {\"use strict\"; }", "function Server() {}", "__ssl() {\n /// TODO: nothing, I guess?\n }", "function wst_client() {\n this.tcpServer = net.createServer();\n }", "init() {\n this.socket.emit('init', 'ooga');\n }", "function getNullSocket () {\n return new Writable({\n write (chunk, encoding, callback) {\n setImmediate(callback)\n }\n })\n}", "function SandboxSocketOpen()\n{\n ws.onmessage = SandboxSocketMessageHandler;\n}", "function doesSupportWebsockets() {\n return !((bowser.msie && bowser.version < 10) ||\n (bowser.firefox && bowser.version < 11) ||\n (bowser.chrome && bowser.version < 16) ||\n (bowser.safari && bowser.version < 7) ||\n (bowser.opera && bowser.version < 12.1));\n}", "function init(){\n wss.on('connection', onConnection);\n}", "function configureMaxSockets(http){\n http.globalAgent.maxSockets = pound.userOptions.globalAgentMaxSockets;//Infinity;\n }", "connect() {\n throw new Error(\n 'The Message Bus is not currently supported in browser environments'\n );\n }", "setUpSocketEventListeners() {}", "constructor() {\n // Allow only ws protocol\n this.socket = io('http://localhost:4001', {transports: ['websocket']});\n }", "function java_socket_bridge_ready() {\n\t\"use strict\";\n\tjava_socket_bridge_ready_flag = true;\n}", "initSockets() {\n this.relay.on('requests satisfied', (data) => {\n const sockets = this.channel('relay');\n\n if (!sockets)\n return;\n\n this.to('relay', 'relay requests satisfied', data);\n });\n }", "function onListening() {\n <%- varconst %> addr = server.address();\n<% if (es6) { -%>\n <%- varconst %> bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;\n<% } else { -%>\n <%- varconst %> bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n<% } -%>\n\n // www.comfort\n<% comfort.sort().forEach(function (use) { -%>\n<% if (es6) { -%>\n console.log(`\\x1b[37m\\x1b[0m`, `process.env.<%- use %>:`, `\\x1b[32m\\x1b[1m`, process.env.<%- use %>, `\\x1b[37m\\x1b[0m`);\n<% } else { -%>\n console.log('\\x1b[37m\\x1b[0m', 'process.env.<%- use %>:', '\\x1b[32m\\x1b[1m', process.env.<%- use %>, '\\x1b[37m\\x1b[0m');\n<% } -%>\n<% }); -%>\n<% if (es6) { -%>\n console.log(`frameguard:`, `\\x1b[35m\\x1b\\[1m`, xframeorigin, `\\x1b[37m\\x1b[0m`);\n console.log(`\\x1b[37m\\x1b[0m`, `===`, `\\x1b[32m\\x1b[1m`, __dirname, `\\x1b[37m\\x1b[0m`, `===============`);\n debug(`Debugging on:`, `\\x1b[33m\\x1b[1m`, bind);\n<% }", "function r(e,t){if(e&&t)return\"sendrecv\";if(e&&!t)return\"sendonly\";if(!e&&t)return\"recvonly\";if(!e&&!t)return\"inactive\";throw new Error(\"If you see this error, your JavaScript engine has a major flaw\")}", "function booDJ(e) {\n\tsocket.emit('boo', {\n\t});\n}", "_runSocketServer() {\n const socketServer = new ws.Server({ port: SOCKET_SERVER_PORT });\n\n socketServer.on('connection', socket => {\n this._connectedSockets = [...this._connectedSockets, socket];\n\n socket.send(JSON.stringify(this._getProjectContent()));\n\n socket.on('close', () => {\n this._connectedSockets = this._connectedSockets.filter(\n _socket => _socket !== socket\n );\n });\n });\n }", "connect() {\n let socket = new sockjs_client__WEBPACK_IMPORTED_MODULE_3__(`http://192.168.1.17:8080/socket`);\n let stompClient = stompjs__WEBPACK_IMPORTED_MODULE_2__[\"over\"](socket);\n stompClient.debug = null;\n return stompClient;\n }", "isSocket() {\n return (this.#type & IFMT) === IFSOCK;\n }", "function test(o0)\n{\n try {\no4.o11 = \"Socket already connected\";\n}catch(e){}\n}", "setupSocket() {\n this.socket = io('/gameroom');\n this.socket.on('connect', () => {\n this.socket.emit('setup_client')\n });\n this.socket.on('packet', this.handleSocketMessages)\n }", "listen() {\n }", "connect() {}", "function srv() {\n return src('./dist')\n .pipe(server({\n livereload: true,\n open: true\n }));\n}", "get io() {\n return {\n engine: {\n transport: {\n polling: false\n }\n }\n };\n }", "constructor() {\n super();\n this.openworld = function(name){\n if ( name === ''){\n var sock = new ws('ws://www.yourworldoftext.com/ws/');\n }\n else {\n var sock = new ws(`ws://www.yourworldoftext.com/${name}/ws/`);\n }\n //var sock = new ws(`ws://www.yourworldoftext.com/ws/`);\n var world = new World(name, this);\n sock.on('open', () => {\n world.setsock(sock)\n })\n return world;\n }\n var pushqueue = [];\n this.newpush = function(world){\n pushqueue.push(world);\n }\n this.emptyqueue = function(world){\n pushqueue = pushqueue.filter(item => {return item == world;});\n console.log('queue emptied');\n }\n setInterval(()=>{\n if (pushqueue.length > 0){\n pushqueue.shift().servpush();\n console.log('server communications remaining:', pushqueue.length, '; time:', +new Date());\n }\n else{\n this.emit('free');\n }\n }, 800)\n }", "function onListening(){cov_12fvjqzcov().f[2]++;const addr=(cov_12fvjqzcov().s[26]++,server.address());const bind=(cov_12fvjqzcov().s[27]++,typeof addr==='string'?(cov_12fvjqzcov().b[6][0]++,'pipe '+addr):(cov_12fvjqzcov().b[6][1]++,'port '+addr.port));cov_12fvjqzcov().s[28]++;console.log('Listening on: ',bind);}", "function onListening() {\n var addr = wss.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "constructor() {\n this.socketEventList = [];\n this.asyncExtensionList = [];\n this.extensions = {};\n this.setupSocket();\n }", "function Network() {}", "function Network() {}", "function Network() {}", "function Network() {}", "function Network() {}", "socketMiddleware(server) {\n this.plugins.filter((plugin) => {\n return \"function\" === typeof plugin.socketMiddleware;\n }).forEach((plugin) => {\n plugin.socketMiddleware(server);\n });\n }", "function callInicioSocket() {\r\n\tconsole.log(\"Peticion Inicio # \" + MAIN_SERVER_UDP_PORT + \" # \" + APP_ID);\r\n\t\r\n\tvar ab = str2ab(INICIO + \";\" + APP_ID);\r\n\tsocketUdp.write(socks.socketId, ab, writeComplete);\r\n}", "function proxySocket() {\n\t\tproxyEvents.forEach(function(event){\n\t\t\tsocket.on(event, function(data) {\n\t\t\t\tamplify.publish('socket:'+event, data || null);\n\t\t\t});\n\t\t});\n\t\tsocket.on('connect', function() {\n\t\t\tsocket.emit('subscribe', user.token);\n\t\t\tamplify.publish('socket:connect');\n\t\t});\n\t\n\t}", "constructor(server_address, server_port, use_ssl) {\n this.addr = \"ws://\" + server_address + \":\" + server_port;\n if(use_ssl)\n this.addr = \"wss://\" + server_address + \":\" + server_port;\n this.plugins = [];\n }", "constructor() {\n this.io = require('socket.io')();\n }", "function initSocket() {\n\tg_socket = io.connect(g_server_address, {secure: true});\n}", "Sockets() {\n this.io = socketIo(this.server);\n let sockets = new Socket_1.Socket(this.io);\n }", "function createServer(opts) {\n opts = defaults(opts, {\n url: '/skates',\n middleware: connect.createServer(),\n entry: './client.js',\n cache: true\n })\n var sox = sockjs.createServer()\n var app = opts.middleware\n var _listen = app.listen\n //TODO... automatically insert browserify and sock.\n app.listen = function () {\n var args = [].slice.call(arguments)\n sox.installHandlers(_listen.apply(app, args), {\n prefix: opts.prefix || opts.url\n })\n return app\n }\n var browser = browserify(opts)\n browser.addEntry(opts.entry)\n\n //this adds some global information from the server. \n //it will be the same for all clients that have loaded data \n //from this server\n var clientSettings = defaults(opts.client, {\n url: opts.url,\n timestamp: app.timestamp = Date.now(), //this is the version of the code you are on\n })\n\n browser.prepend([\n 'window.SKATES = ' + JSON.stringify(clientSettings), \n 'window.SKATES.create = ' + function () {\n return new SockJS(SKATES.prefix || SKATES.url)\n }.toString() + ';'\n ].join('\\n'))\n browser.prepend(fs.readFileSync(__dirname + '/src/sockjs-0.3.min.js'))\n/*\n REMEMBER to make sure that the javascript gets served.\n maybe inject it into the page?\n or is that too overbearing?\n*/\n app.use(browser)\n sox.on('connection', function () {\n var args = [].slice.call(arguments)\n args[0] = toEmitter(args[0])\n args.unshift('connection')\n app.emit.apply(app, args)\n })\n return app\n}", "customSocketRender(socket){\n return null;\n }", "start() {\n\n /**\n * Initialize the websocket server object\n * @type {TemplatedApp}\n */\n const app = uWS.App().ws('/*', {\n\n // Websocket server options\n compression: uWS.SHARED_COMPRESSOR,\n maxPayloadLength: 16 * 1024 * 1024,\n idleTimeout: 10,\n maxBackpressure: 1024,\n\n /**\n * Event triggered whenever a client connects to the websocket\n * @param ws {WebSocket} The newly connected client\n */\n open: (ws) => {\n\n // send newly connected client initial timestamp\n this.notify(ws, 0)\n },\n\n /**\n * Event triggered whenever the server receives an incoming message from a client\n * @param ws {WebSocket} The client the incoming message is from\n * @param message The incoming message\n * @param isBinary {boolean} Whether the message was sent in binary mode\n */\n message: (ws, message, isBinary) => {\n\n // decode incoming message into an object\n let data = JSON.parse(new Buffer.from(message).toString());\n\n // notify client with event for message with count \"c\"\n this.notify(ws, data.c);\n }\n\n /**\n * Tells the websocket server to start listening for incoming connections\n * on the given port\n */\n }).listen(port, (token) => {\n if (token) {\n console.log('Listening to port ' + port);\n } else {\n console.log('Failed to listen to port ' + port);\n }\n });\n }", "function WebSocketConnection()\n{\nvar self = this;\n\nvar isNodeJs = (typeof window === \"undefined\" ? true : false);\n\nvar lib = null;\nvar SpaceifyError = null;\nvar SpaceifyLogger = null;\n\nif(isNodeJs)\n\t{\n\tlib = \"/var/lib/spaceify/code/\";\n\n\tSpaceifyLogger = require(lib + \"spaceifylogger\");\n\tSpaceifyError = require(lib + \"spaceifyerror\");\n\n\tglobal.fs = require(\"fs\");\n\tglobal.WebSocket = require(\"websocket\").w3cwebsocket;\n\t}\nelse\n\t{\n\tlib = (window.WEBPACK_MAIN_LIBRARY ? window.WEBPACK_MAIN_LIBRARY : window);\n\n\tSpaceifyLogger = lib.SpaceifyLogger;\n\tSpaceifyError = lib.SpaceifyError;\n\t}\n\nvar errorc = new SpaceifyError();\nvar logger = new SpaceifyLogger(\"WebSocketConnection\");\n\nvar url = \"\";\nvar id = null;\nvar port = null;\nvar socket = null;\nvar origin = null;\nvar pipedTo = null;\nvar isOpen = false;\nvar isSecure = false;\nvar remotePort = null;\nvar remoteAddress = null;\nvar eventListener = null;\n\n// For client-side use, in both Node.js and the browser\n\nself.connect = function(opts, callback)\n\t{\n\tid = opts.id || null;\n\tport = opts.port || \"\";\n\tisSecure = opts.isSecure || false;\n\n\tvar caCrt = opts.caCrt || \"\";\n\tvar hostname = opts.hostname || null;\n\tvar protocol = (!isSecure ? \"ws\" : \"wss\");\n\tvar subprotocol = opts.subprotocol || \"json-rpc\";\n\n\ttry\t{\n\t\turl = protocol + \"://\" + hostname + (port ? \":\" + port : \"\") + (id ? \"?id=\" + id : \"\");\n\n\t\tvar cco = (isNodeJs && isSecure ? { tlsOptions: { ca: [fs.readFileSync(caCrt, \"utf8\")] } } : null);\n\n\t\tsocket = new WebSocket(url, \"json-rpc\", null, null, null, cco);\n\n\t\tsocket.binaryType = \"arraybuffer\";\n\n\t\tsocket.onopen = function()\n\t\t\t{\n\t\t\tlogger.log(\"WebSocketConnection::onOpen() \" + url);\n\n\t\t\tisOpen = true;\n\n\t\t\tcallback(null, true);\n\t\t\t};\n\n\t\tsocket.onerror = function(err)\n\t\t\t{\n\t\t\tlogger.error(\"WebSocketConnection::onError() \" + url, true, true, logger.ERROR);\n\n\t\t\tisOpen = false;\n\n\t\t\tcallback(errorc.makeErrorObject(\"wsc\", \"Failed to open WebsocketConnection.\", \"WebSocketConnection::connect\"), null);\n\t\t\t}\n\n\t\tsocket.onclose = function(reasonCode, description)\n\t\t\t{\n\t\t\tonSocketClosed(reasonCode, description, self);\n\t\t\t};\n\n\t\tsocket.onmessage = onMessageEvent;\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tcallback(err, null);\n\t\t}\n\t};\n\n// For server-side Node.js use only\n\nself.setSocket = function(val)\n\t{\n\ttry\t{\n\t\tsocket = val;\n\n\t\tsocket.on(\"message\", onMessage);\n\n\t\tsocket.on(\"close\", function(reasonCode, description)\n\t\t\t{\n\t\t\tonSocketClosed(reasonCode, description, self);\n\t\t\t});\n\n\t\tisOpen = true;\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.setId = function(val)\n\t{\n\tid = val;\n\t};\n\nself.setPipedTo = function(targetId)\n\t{\n\tpipedTo = targetId;\n\t};\n\nself.setRemoteAddress = function(val)\n\t{\n\tremoteAddress = val;\n\t};\n\nself.setRemotePort = function(val)\n\t{\n\tremotePort = val;\n\t};\n\nself.setOrigin = function(val)\n\t{\n\torigin = val;\n\t};\n\nself.setIsSecure = function(val)\n\t{\n\tisSecure = val;\n\t}\n\nself.setEventListener = function(listener)\n\t{\n\teventListener = listener;\n\t};\n\nself.getId = function()\n\t{\n\treturn id;\n\t};\n\nself.getRemoteAddress = function()\n\t{\n\treturn remoteAddress;\n\t};\n\nself.getRemotePort = function()\n\t{\n\treturn remotePort;\n\t};\n\nself.getOrigin = function()\n\t{\n\treturn origin;\n\t};\n\nself.getIsSecure = function()\n\t{\n\treturn isSecure;\n\t}\n\nself.getPipedTo = function()\n\t{\n\treturn pipedTo;\n\t}\n\nself.getIsOpen = function()\n\t{\n\treturn isOpen;\n\t}\n\nself.getPort = function()\n\t{\n\treturn port;\n\t}\n\nvar onMessage = function(message)\n\t{\n\ttry\t{\n\t\tif (eventListener)\n\t\t\t{\n\t\t\tif (message.type == \"utf8\")\n\t\t\t\t{\n\t\t\t\t//logger.log(\"WebSocketConnection::onMessage(string): \" + JSON.stringify(message.utf8Data));\n\n\t\t\t\teventListener.onMessage(message.utf8Data, self);\n\t\t\t\t}\n\t\t\tif (message.type == \"binary\")\n\t\t\t\t{\n\t\t\t\t//logger.log(\"WebSocketConnection::onMessage(binary): \" + binaryData.length);\n\n\t\t\t\teventListener.onMessage(message.binaryData, self);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nvar onMessageEvent = function(event)\n\t{\n\t//logger.log(\"WebSocketConnection::onMessageEvent() \" + JSON.stringify(event.data));\n\n\ttry\t{\n\t\tif (eventListener)\n\t\t\teventListener.onMessage(event.data, self);\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nvar onSocketClosed = function(reasonCode, description, obj)\n\t{\n\tlogger.log(\"WebSocketConnection::onSocketClosed() \" + url);\n\n\ttry\t{\n\t\tisOpen = false;\n\n\t\tif (eventListener)\n\t\t\teventListener.onDisconnected(obj.getId());\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.send = function(message)\n\t{\n\ttry\t{\n\t\tsocket.send(message);\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.sendBinary = self.send;\n\nself.close = function()\n\t{\n\ttry\t{\n\t\tsocket.close();\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\n}", "function socketSupport() {\n window.WebSocket = window.WebSocket || window.MozWebSocket;\n if (window.WebSocket) {\n return \"webSocket\";\n } else if (swfobject.hasFlashPlayerVersion(\"10.0.0\")) {\n return \"flashSocket\";\n } else {\n return \"xhrPolling\";\n }\n }", "function java_socket_bridge_ready(){\n\tjava_socket_bridge_ready_flag = true;\n}", "[net.onConnect](evt) {\n console.log('SC:connected', evt);\n }", "static get is() { return 'lingo-live-write-message'; }", "function start () {\n listen()\n}", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "serveVendorSocketIo() {\n if ( this.#isConfigured !== true ) {\n this.log.warn('[uibuilder:web.js:serveVendorSocketIo] Cannot run. Setup has not been called.')\n return\n }\n\n // Add socket.io client - look both in uibuilder master folder, then uibRoot, then userDir\n let sioPath = packageMgt.getPackagePath2( 'socket.io-client', [path.join(__dirname, '..', '..'), this.uib.rootFolder, this.RED.settings.userDir] )\n\n // If it can't be found the usual way - probably because Docker being used & socket.io not in usual place\n if ( sioPath === null ) {\n try {\n sioPath = path.join(path.dirname(require.resolve('socket.io-client')), '..')\n } catch (e) {\n this.log.error(`[uibuilder:web:serveVendorSocketIo] Cannot find socket.io-client. ${e.message}`)\n }\n }\n\n if (this.vendorRouter === undefined) throw new Error('this.vendorRouter is undefined')\n\n if ( sioPath !== null ) {\n // console.log('>> this.uib.staticOpts >>', this.uib.staticOpts)\n sioPath += '/dist'\n this.vendorRouter.use( '/socket.io-client', express.static( sioPath, this.uib.staticOpts ) )\n this.routers.user.push( { name: 'Socket.IO Client', path: `${this.uib.httpRoot}/uibuilder/vendor/socket.io-client/*`, desc: 'Socket.IO Clients', type: 'Static', folder: sioPath } )\n // ! No! This never actually worked! :} - The socket.io SERVER actually creates the path for the client used in script tag but that doesn't work with import/build\n // this.vendorRouter.use( '/socket.io', express.static( sioPath, opts ) )\n } else {\n // Error: Can't find Socket.IO\n this.log.error(`[uibuilder:web.js:serveVendorSocketIo] Cannot find installation of Socket.IO Client. It should be in userDir (${this.RED.settings.userDir}) but is not. Check that uibuilder is installed correctly. Run 'npm ls socket.io-client'.`)\n }\n }", "function SockJS(url,protocols,options){if(!(this instanceof SockJS)){return new SockJS(url,protocols,options)}if(arguments.length<1){throw new TypeError(\"Failed to construct 'SockJS: 1 argument required, but only 0 present\")}EventTarget.call(this);this.readyState=SockJS.CONNECTING;this.extensions=\"\";this.protocol=\"\";// non-standard extension\noptions=options||{};if(options.protocols_whitelist){log.warn(\"'protocols_whitelist' is DEPRECATED. Use 'transports' instead.\")}this._transportsWhitelist=options.transports;var sessionId=options.sessionId||8;if(typeof sessionId===\"function\"){this._generateSessionId=sessionId}else if(typeof sessionId===\"number\"){this._generateSessionId=function(){return random.string(sessionId)}}else{throw new TypeError(\"If sessionId is used in the options, it needs to be a number or a function.\")}this._server=options.server||random.numberString(1000);// Step 1 of WS spec - parse and validate the url. Issue #8\nvar parsedUrl=new URL(url);if(!parsedUrl.host||!parsedUrl.protocol){throw new SyntaxError(\"The URL '\"+url+\"' is invalid\")}else if(parsedUrl.hash){throw new SyntaxError(\"The URL must not contain a fragment\")}else if(parsedUrl.protocol!==\"http:\"&&parsedUrl.protocol!==\"https:\"){throw new SyntaxError(\"The URL's scheme must be either 'http:' or 'https:'. '\"+parsedUrl.protocol+\"' is not allowed.\")}var secure=parsedUrl.protocol===\"https:\";// Step 2 - don't allow secure origin with an insecure protocol\nif(loc.protocol===\"https\"&&!secure){throw new Error(\"SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS\")}// Step 3 - check port access - no need here\n// Step 4 - parse protocols argument\nif(!protocols){protocols=[]}else if(!Array.isArray(protocols)){protocols=[protocols]}// Step 5 - check protocols argument\nvar sortedProtocols=protocols.sort();sortedProtocols.forEach(function(proto,i){if(!proto){throw new SyntaxError(\"The protocols entry '\"+proto+\"' is invalid.\")}if(i<sortedProtocols.length-1&&proto===sortedProtocols[i+1]){throw new SyntaxError(\"The protocols entry '\"+proto+\"' is duplicated.\")}});// Step 6 - convert origin\nvar o=urlUtils.getOrigin(loc.href);this._origin=o?o.toLowerCase():null;// remove the trailing slash\nparsedUrl.set(\"pathname\",parsedUrl.pathname.replace(/\\/+$/,\"\"));// store the sanitized url\nthis.url=parsedUrl.href;// Step 7 - start connection in background\n// obtain server info\n// http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26\nthis._urlInfo={nullOrigin:!browser.hasDomain(),sameOrigin:urlUtils.isOriginEqual(this.url,loc.href),sameScheme:urlUtils.isSchemeEqual(this.url,loc.href)};this._ir=new InfoReceiver(this.url,this._urlInfo);this._ir.once(\"finish\",this._receiveInfo.bind(this))}", "publishMasterHost() {\n this.log.info('Bonjour: Casting Master mode server on port: '+this.settings.WEBSERVER_PORT+' name: '+this.masterServiceName);\n this.mastetService = this.bonjour.publish({ name: this.masterServiceName, type: 'piLaz0rTag', port: this.settings.WEBSERVER_PORT })\n }", "function socketclient(res) {\n global.clog(\"[ss_reqHan][socketclient][SENT]\");\n res.writeHead(200, {\n \"Content-Type\": \"application/javascript\"\n }); //?\n var sendingfile = fs.readFileSync('./server_core/socket.io.dev.js');\n res.write(sendingfile);\n res.end();\n}", "function startSSHy() {\n // Initialise the window title\n //document.title = \"SSHy Client\";\n\n // Opens the websocket!\n ws = new WebSocket(wsproxyURL, 'base64');\n\n // Sets up websocket listeners\n ws.onopen = function(e) {\n transport = new SSHyClient.Transport(ws);\n\n\t\t/*\n\t\t!! Enables or disables RSA Host checking !!\n\t\tSince Linuxzoo changes host every time there is no reason to use it\n\t\t*/\n\n\t\ttransport.settings.rsaCheckEnabled = false;\n };\n\t// Send all recieved messages to SSHyClient.Transport.handle()\n ws.onmessage = function(e) {\n\t\t// Convert the recieved data from base64 to a string\n transport.parceler.handle(atob(e.data));\n };\n\t// Whenever the websocket is closed make sure to display an error if appropriate\n ws.onclose = function(e) {\n\t\tif(term){\n\t\t\t// Don't display an error if SSH transport has already detected a graceful exit\n\t\t\tif(transport.closing){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tterm.write('\\n\\n\\rWebsocket connection to ' + transport.auth.hostname + ' was unexpectedly closed.');\n\t\t\t// If there is no keepAliveInterval then inform users they can use it\n\t\t\tif(!transport.settings.keepAliveInterval){\n\t\t\t\tterm.write('\\n\\n\\rThis was likely caused by he remote SSH server timing out the session due to inactivity.\\r\\n- Session Keep Alive interval can be set in the settings to prevent this behaviour.');\n\t\t\t}\n\t\t} else {\n\t\t\t// Since no terminal exists we need to initialse one before being able to write the error\n termInit();\n term.write('WebSocket connection failed: Error in connection establishment: code ' + e.code);\n\t\t}\n };\n\t// Just a little abstraction from ws.send\n\tws.sendB64 = function(e){\n\t\tthis.send(btoa(e));\n\n\t\ttransport.parceler.transmitData += e.length;\n\t\ttransport.settings.setNetTraffic(transport.parceler.transmitData, false);\n\t};\n}", "static set dedicatedServer(value) {}", "setupWebSocket() {\n\n let self = this;\n let filterImsi = self._nconf.get(\"udpRelayService:filterImsi\");\n self.socket.on('connect', function () {\n console.log(\"Connected to NB-IoT relay service\");\n });\n self.socket.on('message', function (data) {\n data.msgStr = new Buffer(data.data, 'base64').toString(\"ascii\");\n data.msgJSON = safelyParseJSON(data.msgStr) || {};\n\n // if set in the config.jsom the messages are filtered bei an imsi\n if (filterImsi === '' || filterImsi === data.imsi) {\n log.L2(dl, '########################');\n log.L2(dl, 'Received from: ' + data.imsi);\n log.L2(dl, \"Reveiced at: \" + data.timestamp);\n log.L2(dl, \"Direction: \" + data.direction);\n log.L2(dl, \"Message_raw: \" + data.msgStr);\n log.L2(dl, \"Message_json: \" + JSON.stringify(data.msgJSON, null, 4));\n log.L2(dl, '########################\\n\\n\\n');\n\n self.emit('jsonData', data);\n }\n });\n\n self.socket.on('disconnect', function () {\n log.L1(dl,\"Disconnected from NB-IoT relay service\");\n });\n\n self.socket.on('error', (error) => {\n log.Err(dl, error);\n });\n\n }", "constructor() {\n // call the socket init with the url of my test environment aka local host (WS server)\n socket.init('ws://localhost:3001'); \n //sending and echoing a message\n socket.registerOpenHandler(() => {\n let message = new ChatMessage({ message: 'pow!' });\n socket.sendMessage(message.serialize());\n });\n socket.registerMessageHandler((data) => {\n console.log(data);\n });\n }", "_propagateServerEvents () {\n function socketProperties (socket) {\n const byteSize = require('byte-size')\n const output = {\n bytesRead: byteSize(socket.bytesRead).toString(),\n bytesWritten: byteSize(socket.bytesWritten).toString(),\n remoteAddress: socket.remoteAddress\n }\n if (socket.bufferSize) {\n output.bufferSize = byteSize(socket.bufferSize).toString()\n }\n return output\n }\n\n /* stream connection events */\n const server = this.server\n server.on('connection', socket => {\n this.emit('verbose', 'server.socket.new', socketProperties(socket))\n socket.on('connect', () => {\n this.emit('verbose', 'server.socket.connect', socketProperties(socket))\n })\n socket.on('data', () => {\n this.emit('verbose', 'server.socket.data', socketProperties(socket))\n })\n socket.on('drain', () => {\n this.emit('verbose', 'server.socket.drain', socketProperties(socket))\n })\n socket.on('timeout', () => {\n this.emit('verbose', 'server.socket.timeout', socketProperties(socket))\n })\n socket.on('close', () => {\n this.emit('verbose', 'server.socket.close', socketProperties(socket))\n })\n socket.on('end', () => {\n this.emit('verbose', 'server.socket.end', socketProperties(socket))\n })\n socket.on('error', function (err) {\n this.emit('verbose', 'server.socket.error', err)\n })\n })\n\n server.on('close', () => {\n this.emit('verbose', 'server.close')\n })\n\n /* on server-up message */\n server.on('listening', () => {\n const isSecure = t.isDefined(server.addContext)\n let ipList\n if (this.config.hostname) {\n ipList = [ `${isSecure ? 'https' : 'http'}://${this.config.hostname}:${this.config.port}` ]\n } else {\n ipList = util.getIPList()\n .map(iface => `${isSecure ? 'https' : 'http'}://${iface.address}:${this.config.port}`)\n }\n this.emit('verbose', 'server.listening', ipList)\n })\n\n server.on('error', err => {\n this.emit('verbose', 'server.error', err)\n })\n\n /* emit memory usage stats every 30s */\n const interval = setInterval(() => {\n const byteSize = require('byte-size')\n const memUsage = process.memoryUsage()\n memUsage.rss = byteSize(memUsage.rss).toString()\n memUsage.heapTotal = byteSize(memUsage.heapTotal).toString()\n memUsage.heapUsed = byteSize(memUsage.heapUsed).toString()\n memUsage.external = byteSize(memUsage.external).toString()\n this.emit('verbose', 'process.memoryUsage', memUsage)\n }, 60000)\n interval.unref()\n }", "function start_server () {\n var server = new msp.Proxy();\n server.listen(8050);\n log('Proxying from http://:8050');\n}", "_onListening() {\n /* Called after socket.bind */\n let address = this.socket.address()\n log.info(`server listening ${address.address}:${address.port}`)\n }", "function myServer() {\n\tthis.server = server;\n}", "constructor() {\n this.#listen();\n }", "constructor() {\n this.#listen();\n }", "function start() {\n\tsocket.connect(port, host);\n}", "static get dedicatedServer() {}", "function defaultOnListen() {\n console.log(\"Socket is listening on port: \" + port);\n\n if (onListen)\n onListen();\n }", "function openServer() {\n connect.server({\n host: cfg.server.host,\n root: cfg.server.root,\n port: cfg.server.port,\n livereload: true\n });\n }", "function getSocketFromApp(){\n return io;\n}", "function serverConnected() {\n println(\"Connected to Server\");\n}", "function NetworkUtil(){}", "function configurar() {\n if (socket) {\n socket.close()\n }\n let host = document.getElementById(\"hostip\").value\n socket = new WebSocket(host)\n setupSocket(socket)\n\n}", "function $socketlistener(port)\n{\n\tvar thisPtr=this;\t\n\tvar listener_port=parseInt(port)||9001;\n\n\tvar outstream = null;\n\tvar instream = null;\t\n\tvar serverSocket = null;\n\tvar busy = false;\n\tvar running = false;\n\t\n\tthis.outlet1 = new this.outletClass(\"outlet1\",this,\"message to write to socket\");\n\tthis.outlet2 = new this.outletClass(\"outlet2\",this,\"bang on connect\");\t\n\tthis.inlet1=new this.inletClass(\"inlet1\",this,\"message to read from socket\");\n\t\n\tfunction server_start() {\n\t\t\n\t\tif(running) {\n\t\t\tLilyDebugWindow.error(\"socketlistener on port \" + listener_port + \" is already started.\");\n\t\t\treturn;\n\t\t} else {\n\t\t\trunning=true;\n\t\t}\n\t\t\n\t\tvar listener = {\n\t\t\tonSocketAccepted : function(socket, transport) {\n\t\t\t\t\n\t\t\t\t//this doesn't work...\n\t\t\t\tif(busy) {\n\t\t\t\t\tLilyDebugWindow.error(\"socketlistener on port \" + listener_port + \" busy\");\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tbusy=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ttry {\n\t\t\t\t\toutstream = transport.openOutputStream(0,0,0);\n\t\t\t\t\tvar stream = transport.openInputStream(0,0,0);\n\t\t\t\t\tinstream = Components.classes[\"@mozilla.org/scriptableinputstream;1\"].createInstance(Components.interfaces.nsIScriptableInputStream);\n\t\t\t\t\tinstream.init(stream);\n\t\t\t\t\tthisPtr.outlet2.doOutlet(\"bang\");\t\t\t\t\n\t\t\t\t} catch(ex2) { \n\t\t\t\t\tLilyDebugWindow.error(\"::\"+ex2); \n\t\t\t\t}\n\n\t\t\t\tvar dataListener = {\n\t\t\t\t\tdata : \"\",\n\t\t\t\t\tonStartRequest: function(request, context){},\n\t\t\t\t\tonStopRequest: function(request, context, status) {},\n\t\t\t\t\tonDataAvailable: function(request, context, inputStream, offset, count) {\n\t\t\t\t\t\tthis.data = instream.read(count);\n\t\t\t\t\t\t//LilyDebugWindow.print(\"data received is \\\"\"+this.data+\"\\\"\");\n\t\t\t\t\t\tthisPtr.outlet1.doOutlet(this.data); //\n\t\t\t\t\t}\n\t\t\t\t}; //close dataListener\n\n\t\t\t\tvar pump = Components.classes[\"@mozilla.org/network/input-stream-pump;1\"].createInstance(Components.interfaces.nsIInputStreamPump);\n\t\t\t\tpump.init(stream, -1, -1, 0, 0, false);\n\t\t\t\tpump.asyncRead(dataListener,null);\n\n\t\t\t},\n\t\t\tonStopListening : function(socket, status){\n\t\t\t\tbusy=false;\n\t\t\t}\n\t\t}; //close listener \n\n\t\ttry {\n\t\t\tserverSocket = Components.classes[\"@mozilla.org/network/server-socket;1\"].createInstance(Components.interfaces.nsIServerSocket);\n\t\t\tserverSocket.init(listener_port,false,-1);\n\t\t\tserverSocket.asyncListen(listener);\n\t\t} catch(ex) { \n\t\t\tLilyDebugWindow.error(ex); \n\t\t}\n\t}\n\n\tfunction server_stop() {\n\t\tif(serverSocket) {\n\t\t\tserverSocket.close();\n\t\t\tserverSocket=null;\n\t\t\trunning=false;\n\t\t}\n\t\t\n\t\tif(instream) {\n\t\t\tinstream.close();\n\t\t\tinstream=null;\t\n\t\t}\n\t\t\n\t\tif(outstream) {\n\t\t\toutstream.close();\n\t\t\toutstream=null;\n\t\t}\t\t\n\t\t\t\n\t}\n\n\t//clean up\n\tthis.destructor=function() {\n\t\tserver_stop();\t\t\n\t}\t\t\t\n\t\n\t//write to socket\n\tthis.inlet1[\"anything\"]=function(msg) {\n\t\tif(running&&outstream) \n\t\t\toutstream.write(msg,msg.length);\n\t\telse\n\t\t\tLilyDebugWindow.error(\"socketlistener: no sockets connected.\")\n\t}\t\n\t\n\tserver_start(); //start on it.\n\t\n\treturn this;\n}", "function WSServerMaster() {\n\tthis.masterProcess = null;\n\tthis.ip = '127.0.0.1';\n\n\tthis.headers = WSServerMaster.generatePeerHeaders({\n\t\tip: this.ip,\n\t\tversion: '9.8.7',\n\t});\n\n\tthis.wsPort = this.headers.wsPort;\n\tthis.httpPort = this.headers.httpPort;\n}", "function setup() {\n var IPTiddler = $tw.wiki.getTiddler(\"$:/ServerIP\");\n var IPAddress = IPTiddler.fields.text;\n $tw.socket = new WebSocket(`ws://${IPAddress}:8000`);\n $tw.socket.onopen = openSocket;\n $tw.socket.onmessage = parseMessage;\n $tw.socket.binaryType = \"arraybuffer\";\n\n addHooks();\n }", "function initConn(){\nnode.warn(\"LINE 15: node.path= \" + node.path);\n var socket = require('socket.io-client')(node.host, { path: node.path, multiplex:false });\n node.server = socket; // keep for closing\n handleConnection(socket);\n }", "function jouer() {\r\n var btn = document.getElementById('jouer');\r\n sock.emit('jouer');\r\n btn.innerHTML = \"Changer d'affaire\";\r\n}", "constructor(wss) {\n this.websocketServer = wss;\n }", "function serve() {\n browsersync.init({\n server: 'src',\n notify: false,\n open: true,\n cors: true,\n online: true\n })\n}", "function serve() {\n connect.server(serverConfig);\n}", "function proxyHttps() {\n httpServer.on('connect', function (req, socket, upgradeHead) {\n var netClient = net.createConnection(INTERNAL_HTTPS_PORT);\n\n netClient.on('connect', function () {\n\n socket.write(\"HTTP/1.1 200 Connection established\\r\\nProxy-agent: Netscape-Proxy/1.1\\r\\n\\r\\n\");\n });\n\n socket.on('data', function (chunk) {\n netClient.write(chunk);\n });\n socket.on('end', function () {\n netClient.end();\n });\n socket.on('close', function () {\n netClient.end();\n });\n socket.on('error', function (err) {\n log.error('socket error ' + err.message);\n netClient.end();\n });\n\n netClient.on('data', function (chunk) {\n socket.write(chunk);\n });\n netClient.on('end', function () {\n socket.end();\n });\n netClient.on('close', function () {\n socket.end();\n });\n netClient.on('error', function (err) {\n\n socket.end();\n });\n\n });\n}", "function emitGreet(socket) {\n if (socket)\n socket.emit(\"greet\", {\n \"queue\": queue.queue,\n \"delta\": queue.getDeltaNumber()\n });\n else\n debug(\"attempted to emit with null socket\");\n}", "function __FIXME_SBean_server_echo() {\n\tthis._pname_ = \"server_echo\";\n\t//this.stamp:\t\tint32\t\n}", "function setupSocket(socket) {\n\n socket.onopen = function () {\n connectedToWS = true\n }\n\n socket.onmessage = function (msg) {\n connectionSketch.showServerResponse(msg.data)\n }\n\n socket.onclose = function () {\n connectedToWS = false\n }\n}", "function test0()\n{\n\t(server = HTTPmodule.createServer(app)).listen(PORT);\n\tconsole.log('0.start test_no_use');\n\tvar socket0 = NETmodule.connect(options,function() {\n\t\t\t socket0.write('GET /Hello_world.txt HTTP/1.1\\r\\n' +\n\t\t\t 'Host: 127.0.0.1\\r\\n' +\n\t\t\t 'Connection: keep-alive\\r\\n' + \n\t\t\t '\\r\\n');\n\t\t\t});\n\tvar i0 = 0;\n\tsocket0.on('data', function(chunk) {\n\t\tif (i0 === 0) //if it is the header.\n\t\t{\n\t\t\tvar d = chunk.toString();\n\t\t\tif (d.indexOf('HTTP/1.1 404 Not Found') !== -1)\n\t\t\t{\n\t\t\t\tconsole.log('0.test_no_use SUCCEEDED');\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tconsole.log('0.test_no_use failed');\n\t\t\t}\n\t\t\ti0++;\n\t\t}\n\t});\n\trunTests();\n\tsocket0.on('error', function(e) {\n\t\tconsole.log('problem with request 0: ' + e.message);\n\t\trunTests();\n\t});\n}", "generateRecvonlySsrc() {\n if (this.peerconnection) {\n this.peerconnection.generateRecvonlySsrc();\n } else {\n logger.error('Unable to generate recvonly SSRC - no peerconnection');\n }\n }", "constructor() {\n /* server code from https://cs.nyu.edu/courses/fall18/CSCI-UA.0480-003/_site/homework/03.html */\n this.server = net.createServer(sock => this.handleConnection(sock));\n this.routes = {};\n this.middleware = null;\n }", "start(cb) {\n let app = require('../pomelo').app;\n let self = this;\n\n let gensocket = function(socket) {\n let hybridsocket = new HybridSocket(curId++, socket);\n hybridsocket.on('handshake', self.handshake.handle.bind(self.handshake, hybridsocket));\n hybridsocket.on('heartbeat', self.heartbeat.handle.bind(self.heartbeat, hybridsocket));\n hybridsocket.on('disconnect', self.heartbeat.clear.bind(self.heartbeat, hybridsocket.id));\n hybridsocket.on('closing', Kick.handle.bind(null, hybridsocket));\n self.emit('connection', hybridsocket);\n };\n\n this.connector = app.components.__connector__.connector;\n this.dictionary = app.components.__dictionary__;\n this.protobuf = app.components.__protobuf__;\n this.decodeIO_protobuf = app.components.__decodeIO__protobuf__;\n\n if(!this.ssl) {\n this.listeningServer = net.createServer();\n } else {\n this.listeningServer = tls.createServer(this.ssl);\n }\n this.switcher = new Switcher(this.listeningServer, self.opts);\n\n this.switcher.on('connection', function(socket) {\n gensocket(socket);\n });\n\n if(!!this.distinctHost) {\n this.listeningServer.listen(this.port, this.host);\n } else {\n this.listeningServer.listen(this.port);\n }\n\n process.nextTick(cb);\n }", "onWsRequest(req, socket, head) {\n const parsedUrl = url.parse(req.url, true);\n // Find the rending location. Default to csr if not specified\n const urlRenderLoc = parsedUrl.query[\"renderingLocation\"];\n const renderingLocation = urlRenderLoc === \"ssr\" ? SpawnerTypes_1.RenderingLocation.Server : SpawnerTypes_1.RenderingLocation.Client;\n // For now, we don't support the session token, model search dirs, or model file for the proxy mode.\n // The only way to get the token is via URL params, and that may negate the whole point since it's visible in\n // the URL? HTTP headers are out as we can't set them via the JS Websocket APIs:\n // https://stackoverflow.com/questions/4361173/http-headers-in-websockets-client-api\n const spawnConfig = SpawnerTypes_1.SpawnConfig.createWsProxyConfig(req, socket, head, renderingLocation);\n this._spawnScServer(spawnConfig);\n }", "init() {\n module_utils.patchModule(\n 'nats',\n 'connect',\n wrapNatsConnectFunction\n );\n }" ]
[ "0.6149176", "0.61252487", "0.59384966", "0.56086254", "0.559202", "0.5523177", "0.55183905", "0.54619616", "0.5425321", "0.5383393", "0.53784853", "0.53077674", "0.5256524", "0.52435595", "0.5237733", "0.5230596", "0.5208514", "0.5205358", "0.518955", "0.51776093", "0.51354986", "0.51330745", "0.513218", "0.5131996", "0.51240504", "0.51239926", "0.5122746", "0.51199704", "0.51068366", "0.5105895", "0.51044536", "0.5102505", "0.50954926", "0.5082888", "0.5074701", "0.5074701", "0.5074701", "0.5074701", "0.5074701", "0.507447", "0.5067205", "0.506472", "0.50632524", "0.50476384", "0.50407755", "0.5034103", "0.50255376", "0.50243783", "0.50039166", "0.4997479", "0.4963367", "0.49625912", "0.49601567", "0.49441275", "0.49218628", "0.4914255", "0.4914255", "0.4914255", "0.4914255", "0.4914255", "0.4914255", "0.4908993", "0.49017102", "0.49016216", "0.4899371", "0.4897345", "0.48879555", "0.4879843", "0.48694408", "0.4846907", "0.4845922", "0.4845537", "0.4844125", "0.4841276", "0.4841276", "0.48365837", "0.48362646", "0.48340613", "0.48327813", "0.48327193", "0.48258975", "0.48173273", "0.48151457", "0.48146635", "0.4808148", "0.48033538", "0.48029009", "0.4798124", "0.47887084", "0.47879204", "0.47854093", "0.4784371", "0.4779181", "0.47726253", "0.476739", "0.47657058", "0.4765414", "0.47640926", "0.47625378", "0.47530374", "0.4752695" ]
0.0
-1
No multiprocess in minscripten
function exit(status) { throw new ExitException(status); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isProcessableParallel() {\n return false;\n }", "process() {}", "process() {}", "function singleThread() {\n\n process.argv[2] = 'estoy programando en node.js';\n process.argv[3] = 2+5;\n \n\n console.log('-------------------------------------------');\n console.log('EL PROCESO DE NODE.JS');\n console.log('Id del proceso.......... ' + process.pid);\n console.log('Titulo.................. ' + process.title);\n console.log('Directorio de Node...... ' + process.execPath);\n console.log('Directorio actual....... ' + process.cwd());\n console.log('Version de Node......... ' + process.version);\n console.log('Versiones Dependencias.. ' + process.versions);\n console.log('Plataforma (S.O.)....... ' + process.platform);\n console.log('Arquitectura (S.0.)..... ' + process.arch);\n console.log('Tiempo activo de Node... ' + process.uptime());\n console.log('Argumentos del proceso.. ' + process.argv); // Arreglo con cada uno de los procesos realizados por el programa\n console.log('-------------------------------------------');\n\n for (let key in process.argv) {\n console.log(process.argv[key]);\n }\n\n}", "function main() {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n if (process.send === undefined) {\n throw Error('This script needs to be invoked as a NodeJS worker.');\n }\n const config = getReleaseConfig();\n const builtPackages = yield config.buildPackages();\n // Transfer the built packages back to the parent process.\n process.send(builtPackages);\n });\n}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "limitConcurrency() {\n return true;\n }", "start () {}", "runWorkers () {\n }", "function minorScripts() {\n return src([config.srcFolder + '/js/**/*.js', '!'+ config.srcFolder + '/js/vendor/**/*.js', '!' + config.srcFolder + '/js/**/*.min.js'].concat(negatedAllScripts))\n .pipe(sourcemaps.init())\n .pipe(babel())\n .pipe(minify({\n ext: {\n min: '.min.js'\n }\n }))\n .pipe(sourcemaps.write('./maps'))\n .pipe( dest( config.destFolder + '/js'))\n}", "minify() {\n\n }", "function node_enable() {\n if(typeof process === 'object' && process + '' === '[object process]'){\n return true;\n }\n else{\n return false;\n }\n}", "async function optimizeScripts() {\n await gulp\n .src(configProd.optimize.scripts.src)\n .pipe(plumber())\n .pipe(uglify(configProd.optimize.scripts.options))\n .pipe(gulp.dest(configProd.optimize.scripts.dest))\n .pipe(size(configProd.size));\n}", "function InlineWorkerFactory(){\n\t}", "run () {\n }", "function Process(){}", "get threads() { return check(threadsWasm); }", "function isDedicatedOrSharedWorker()\n{\n return false;\n}", "function mini() {\n return gulp.src('project/*.html')\n .pipe(useref())\n .pipe(gulpIf('*.js', terse()))\n .pipe(gulpIf('*.css', cssnano()))\n .pipe(gulp.dest('dist'))\n}", "static get concurrency() {\n return 1\n }", "static get concurrency() {\n return 1\n }", "static get concurrency () {\r\n return 1\r\n }", "function jsTask() {\n return src(files.jsPath)\n .pipe(babel())\n .pipe(conCat('main.js'))\n //terser minifies the files after concat put them togheter\n .pipe(terser())\n .pipe(dest('pub/js'));\n}", "async function startUnstable(){\n\n}", "runAllCodeChunks() {\n if (!this.config.enableScriptExecution) {\n return;\n }\n const codeChunks = this.previewElement.getElementsByClassName(\"code-chunk\");\n for (let i = 0; i < codeChunks.length; i++) {\n codeChunks[i].classList.add(\"running\");\n }\n this.postMessage(\"runAllCodeChunks\", [this.sourceUri]);\n }", "function warmupWasmEngine() {\n\t if (warmWorker !== null) {\n\t throw new Error('warmupWasmEngine() already called');\n\t }\n\t warmWorker = createWorker();\n\t}", "function multitask() {\n\n // Merge task-specific and/or target-specific options with these defaults.\n var options = this.options({});\n\n // Iterate over all specified file groups.\n this.files.forEach(function(f) {\n // Concat specified files.\n var src = f.src.filter(function(filepath) {\n // Warn on and remove invalid source files (if nonull was set).\n if (!grunt.file.exists(filepath)) {\n grunt.log.warn('Source file \"' + filepath + '\" not found.');\n return false;\n } else {\n return true;\n }\n }).map(function(filepath) {\n // Read file source.\n return grunt.file.read(filepath);\n }).join('\\n');\n\n // Crushing, cleaning and minifying\n src = minify(clean(crush(src)));\n\n // Write the destination file.\n grunt.file.write(f.dest, src);\n\n // Print a success message.\n grunt.log.writeln('File \"' + f.dest + '\" created.');\n });\n }", "static get concurrency () {\n return 1\n }", "static get concurrency () {\n return 1\n }", "static getDefaultConcurrency() {\n return 2;\n }", "static run( jsenCode ) {\n const threadContext = {\n code: jsenCode,\n pc: 0,\n labelList: {\n blockBegin: 0,\n blockEnd: jsenCode.length,\n },\n };\n JZENVM._runContext( threadContext );\n }", "createWorkerTsne () {\n return new Promise((resolve, reject) => {\n const hash = window.hipilerConfig.workerTsneHash.length ?\n `-${window.hipilerConfig.workerTsneHash}` : '';\n\n const loc = window.hipilerConfig.workerLoc || 'dist';\n\n queue()\n .defer(text, `${loc}/tsne-worker${hash}.js`)\n .await((error, tSneWorker) => {\n if (error) { logger.error(error); reject(Error(error)); }\n\n const worker = new Worker(\n window.URL.createObjectURL(\n new Blob([tSneWorker], { type: 'text/javascript' })\n )\n );\n\n resolve(worker);\n });\n });\n }", "function main() {\n init();\n worker();\n}", "function jsProd() {\n\tvar scripts = JSON.parse(fs.readFileSync(paths.js + '/_compile.json', { encoding: 'utf8' }));\n\n\tscripts.forEach(function(obj){\n\t\tsrc(obj.src)\n\t\t\t.pipe(concat(obj.name))\n\t\t\t.pipe(uglify())\n\t\t\t.pipe(dest(paths.js));\n\t});\n\n\treturn Promise.resolve('the value is ignored');\n}", "startOptimization() {\n this.worker.postMessage({'cmd': 'start', 'courses': this.courses, 'maxHours': this.maxHours});\n }", "function run() {}", "function h$run(a) {\n ;\n var t = h$fork(a, false);\n h$startMainLoop();\n return t;\n}", "start() {\n }", "function createJStart(hasj) {\n var mout;\n\n if (hasj)\n mout = \"var jserver = require('jamserver')(true);\\n\";\n else\n mout = \"var jserver = require('jamserver')(false);\\n\";\n\n mout += \"const {Flow, ParallelFlow, PFlow} = require('flows.js')();\\n\";\n mout += \"var jamlib = jserver.jamlib;\\n\";\n mout += \"jamlib.run(function() {});\\n\";\n mout += \"\\n\\n\";\n\n return mout;\n\n}", "isMultiCompiler() {\n return this.projectConfig.files.length > 1;\n }", "function startMaster() {\n console.log('Started master');\n}", "function h$run(a) {\n ;\n var t = h$fork(a, false);\n h$startMainLoop();\n return t;\n}", "function minJs() {\n return gulp\n .src(paths.dev.js)\n .pipe(babel({\n presets: ['@babel/env']\n }))\n .pipe(concat('main.js'))\n .pipe(minify({\n ext: {\n min: '.min.js'\n },\n }))\n .pipe(gulp.dest(paths.dist.js))\n}", "function TaskLoop() {\n\t\n}", "function main(){\n return false;\n}", "function run() {\n\n}", "function main() {\n init();\n enable();\n}", "function fallbackToNodeJSCheck(){const cores=_os.default.cpus().filter(function(cpu,index){const hasHyperthreading=cpu.model.includes(`Intel`);const isOdd=index%2===1;return!hasHyperthreading||isOdd;});return cores.length;}", "function jsTask() {\n return src(files.jsPath)\n .pipe(browserSync.stream())\n // .pipe(uglify())\n .pipe(sourcemapsB.init())\n .pipe(babel())\n .pipe(concatB(\"main.js\"))\n .pipe(sourcemapsB.write(\".\"))\n .pipe(dest('pub/js')\n\n );\n}", "function compress() {\n return src(['dist/math.js'])\n .pipe(minify({\n ext:{\n min:'.min.js'\n }\n }))\n .pipe(dest('./dist'));\n}", "function minJs() {\n return gulp\n .src(paths.dev.js)\n .pipe(concat('main.js'))\n .pipe(minify({\n ext: {\n min: '.min.js'\n },\n }))\n .pipe(gulp.dest(paths.dist.js));\n}", "function prod(cb) {\n if (util.isProd()) {\n startProd(cb());\n }\n}", "work() {}", "async transform() {\n if (this.options.minify) {\n await uglify(this);\n }\n }", "function compressJS(callB) {\n pump([\n gulp.src(\"./js/*.js\", {\n sourcemaps: true\n }),\n uglify(),\n concat('main.min.js'),\n gulp.dest(\"./bundle\")\n ],\n callB\n );\n}", "function mainScript( cb ) {\n // A filter to only use scripts in projectScripts - take out vendor scripts\n if ( allScripts.length === 0 ) {\n cb();\n return; \n }\n const noVendorFilter = filter( negatedProjectVendorScripts.concat( config.projectScripts ), {restore: true});\n return checkSrc( allScripts )\n .pipe(sourcemaps.init())\n .pipe( noVendorFilter ) //no babel-ing of vendor files\n .pipe(babel())\n .pipe( noVendorFilter.restore ) //put the vendor files back\n .pipe( concat( config.projectScriptName )) //put all files into single file with projectScriptName\n // .pipe( dest( config.destFolder + '/js')) // copy unminized js to destination - gulp minify appears to keep unminified file in stream\n .pipe( minify({\n ext: {\n min: '.min.js'\n }\n }))\n .pipe(sourcemaps.write('./maps'))\n .pipe( dest( config.destFolder + '/js'));\n}", "function min() {\n return src(['src/js/*.js', '!src/js/*.min.js', '!src/js/livereload.js'])\n .pipe(minify({\n ext:{\n src:'.js',\n min:'.min.js'\n },\n ignoreFiles: ['.min.js']\n }))\n .pipe(dest('src/js'))\n}", "function jsComp(cb){\n return src(\"./src/js/**/*.js\")\n .pipe(gulpIf(buildEnv === 'prod', uglify()))\n .pipe(conCat('main.min.js'))\n .pipe(dest(buildDir+\"js/\"))\n cb();\n}", "function kia_promo_scripts_promo() {\n\treturn src(projects.kia_promo.scripts_promo.src)\n\t.pipe(concat(projects.kia_promo.scripts_promo.output))\n\t// .pipe(uglify()) // Minify js (opt.)\n\t.pipe(header(projects.kia_promo.forProd))\n\t.pipe(dest(projects.kia_promo.scripts_promo.dest))\n\t.pipe(browserSync.stream())\n}", "function jsTask() {\n\n return src(files.jsPath)\n\n .pipe(concat('script.js'))\n\n .pipe(minify())\n\n .pipe(dest('src/js'));\n\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n if (typeof window !== 'undefined') {\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n }\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n if (typeof window !== 'undefined') {\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n }\n}\n}", "function run() {\n\n }", "function main(argv)\n{\n\tif(argv.h)\n\t{\n\t\tdisplayUsage();\n\t\tprocess.exit(0);\n\t}\n\n\tif(argv.l)\n\t{\n\t\tdisplayTasks();\n\t\tprocess.exit(0);\n\t}\n\n\t//default doesn't seem to be working for OPTIMIST right now\n\t//if task is not specified, we default to ALL\n\tvar task = (!argv.tasks)?\"ALL\":argv.tasks.toUpperCase();\n\n\tif(!taskIsRecognized(task))\n\t{\n\t\tprint(\"Unrecognized task : \" + task);\n\t\tdisplayUsage();\n\t\tprocess.exit(1);\n\t}\n\n\tverbose = argv.v != undefined;\n\tversion = argv.version;\n\n\textraSourceFiles = argv.s;\n\t\n\tif(argv.o)\n\t{\n\t\tjs_file_name = argv.o;\n\t}\n\n\tvar shouldBuildSource = (task == TASK.BUILDSOURCE);\n\tvar shouldBuildDocs = (task == TASK.BUILDDOCS);\n\n\tif(task==TASK.CLEAN)\n\t{\n\t\tcleanTask(\n\t\t\tfunction(success)\n\t\t\t{\n\t\t\t\tprint(\"Clean Task Completed\");\n\t\t\t}\n\t\t);\n\t}\n\n\tif(task == TASK.ALL)\n\t{\t\n\t\tshouldBuildSource = true;\n\t\tshouldBuildDocs = true;\n\t}\n\n\tif(shouldBuildDocs && (version == undefined))\n\t{\n\t\tdisplayUsage();\n\t\tprocess.exit(0);\n\t}\n\n\tif(shouldBuildSource)\n\t{\n\t\tbuildSourceTask(function(success)\n\t\t{\t\t\n\t\t\tprint(\"Build Source Task Complete\");\n\t\t\tif(shouldBuildDocs)\n\t\t\t{\n\t\t\t\tbuildDocsTask(version,\n\t\t\t\t\tfunction(success)\n\t\t\t\t\t{\n\t\t\t\t\t\tprint(\"Build Docs Task Complete\");\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t});\n\t}\n\n\tif(shouldBuildDocs && task != \"ALL\")\n\t{\n\t\tbuildDocsTask(version,\n\t\t\tfunction(success)\n\t\t\t{\n\t\t\t\tprint(\"Build Docs Task Complete\");\n\t\t\t}\n\t\t);\n\t}\t\n}", "function prodScripts(){\n return gulp\n .src(config.scripts.src)\n .pipe($.babel())\n .pipe($.concat(config.scripts.bundle))//after babel transpiling\n .pipe($.uglify())//now minify app.js\n .pipe(gulp.dest(config.scripts.dest)); \n}", "function main(){\n\t\n}", "function jekyllProd() {\n return gulp.src('.').pipe(run('bundle exec jekyll build'));\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function define(_, chunk) {\nif (!shared) {\n shared = chunk;\n} else if (!worker) {\n worker = chunk;\n} else {\n var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n var sharedChunk = {};\n shared(sharedChunk);\n mapboxgl = chunk(sharedChunk);\n mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n}\n}", "function main() {\n\n}", "function run() {\n 'use strict';\n}", "function masterProcess() {\n console.log('Master %s is running', process.pid);\n\n /**\n * Creating workers in same number as number of cores the running machine is.\n */\n for (let i = 0; i < numCPUs; i++) {\n console.log('Forking process number ... %s.....%s', i, process.pid);\n /**\n * cluster.fork() to create worker, which is a based on child process fork() functionality \n */\n cluster.fork();\n }\n\n /**\n * Event Handler which fires everytime a new worker created. \n */\n cluster.on('online', (worker) => {\n console.log('Worker ' + worker.process.pid + ' is online');\n });\n\n /**\n * Event Handler which fires everytime a worker/process is exit or disconnected.\n */\n cluster.on('exit', (worker) => {\n console.log('The worker has exit..%s', worker.id);\n /**\n * Creating a new worker \n */\n cluster.fork();\n });\n}", "canParallelize(pluginWrappers) {\n return pluginWrappers.every((wrapper) => wrapper.parallelBabel !== undefined);\n }", "start() {\n const me = this;\n const scriptFileName = this.pathToBitJS_ + this.getScriptFileName();\n if (scriptFileName) {\n this.worker_ = this.createWorkerFn_(scriptFileName);\n\n this.worker_.onerror = function (e) {\n console.log('Worker error: message = ' + e.message);\n throw e;\n };\n\n this.worker_.onmessage = function (e) {\n if (typeof e.data == 'string') {\n // Just log any strings the workers pump our way.\n console.log(e.data);\n } else {\n me.handleWorkerEvent_(e.data);\n }\n };\n\n const ab = this.ab;\n this.worker_.postMessage({\n file: ab,\n logToConsole: this.debugMode_,\n }, [ab]);\n this.ab = null;\n }\n }", "function startMaster() {\n console.log(`Started master`);\n}", "function ProcessController() {}", "run() {\n this.forkWorkers()\n }", "function js() {\n return src(source + 'js/*.js')\n .pipe(concat('main.js'))\n .pipe(rename({ suffix: '.min' }))\n .pipe(dest(destination + 'js'));\n}", "started () {}", "async function performPreBuildSteps() {\n if (!argv._.includes('serve')) {\n await preBuildRuntimeFiles();\n await preBuildExtensions();\n }\n}", "function Main()\n {\n \n }", "function main() {\n}", "function ejecutar(){\n Concurrent.Thread.create(caballo,\"inputCaballo1\",\"metrosRecorridos1\",100000);\n Concurrent.Thread.create(caballo,\"inputCaballo2\",\"metrosRecorridos2\",100000);\n Concurrent.Thread.create(caballo,\"inputCaballo3\",\"metrosRecorridos3\",100000);\n }", "createProcesses() {\n Object.keys(this.workers).forEach(type => {\n const env = {\n 'type': type,\n 'verbose': config.verbose,\n };\n this.workers[type] = this.fork(type, env);\n });\n }", "async function start() {\n await build();\n await server(port);\n opn(`http://localhost:${port}`);\n\n watch(\"src\", {recursive: true}, async (evt, name) => {\n console.log(`${name} changed : re-buliding`);\n await build();\n wss.broadcast(\"reload\");\n });\n}", "function njTask () {\n return src('src/**/!(_)*.njk')\n .pipe(nunjucks.compile())\n .pipe(rename(function (path) {\n path.extname = '.html'\n }))\n .pipe(dest('output'))\n}" ]
[ "0.584577", "0.5704992", "0.5704992", "0.5629925", "0.54633343", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.5406037", "0.5295608", "0.5294036", "0.5263957", "0.51970196", "0.51805997", "0.5130743", "0.5126131", "0.5124282", "0.5114839", "0.5096955", "0.50911295", "0.508701", "0.5073807", "0.5073807", "0.5059559", "0.5055514", "0.5050356", "0.5049626", "0.5044972", "0.5031508", "0.5030014", "0.5030014", "0.5019815", "0.5012986", "0.5008746", "0.50066996", "0.5003955", "0.50035137", "0.4997063", "0.49887577", "0.4988483", "0.4966544", "0.49488947", "0.4943396", "0.49392876", "0.4933708", "0.4928117", "0.49273953", "0.49203992", "0.49141634", "0.48953536", "0.48816875", "0.4880637", "0.48788494", "0.48697552", "0.48632485", "0.48601675", "0.4856855", "0.4853225", "0.48481828", "0.48419583", "0.48239827", "0.48227027", "0.48224613", "0.48224613", "0.48198092", "0.48113137", "0.48081687", "0.47965476", "0.47951734", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47931054", "0.47930712", "0.47929552", "0.47854275", "0.47817653", "0.47810614", "0.4778255", "0.4775791", "0.4770059", "0.47573608", "0.47552434", "0.47547948", "0.4748118", "0.47472414", "0.47467163", "0.47467157", "0.47458634", "0.47424647" ]
0.0
-1
another method for opposite function
function opposite(d1, d2){ let dic={'NORTH':'SOUTH', 'WEST':'EAST', 'SOUTH':'NORTH', 'EAST':'WEST'} //if (dic[d1]===d2) return true return dic[d1]===d2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function opposite(t, a, b) {\n\t\t\treturn t[0] != a && t[0] != b ? t[0] : t[1] != a && t[1] != b ? t[1] : t[2];\n\t\t}", "function opposite(number) {\n //your code here\n return -number;\n}", "function opposite(number) {\n return -number;\n}", "function opposite(number) {\n return(-number);\n}", "function opposite(number) {\n return number * -1;\n}", "function opposite(number) {\n return number * -1\n}", "function opposite(number) { //No native methods \"challenge\"\n return -number;\n}", "function opposite(number) {\n //your code here\n if(number > 0) {return -number}\n return Math.abs(number);\n}", "function invertValue(value){ \r\n\treturn !value;\r\n}", "function not(b){ return !b; }", "invert() {\n this.reverse = !this.reverse;\n this._applySpeed();\n }", "function negate(f) {\n return function(...args){ \n return !f(...args)\n }\n }", "static negateQV(q) {\nvar qv;\nqv = this.copyOfQV(q);\nreturn this.setNegateQV(qv);\n}", "function getOpposite() {\n if (this.key === \"left\") {\n return this.getSibling(\"right\");\n } else if (this.key === \"right\") {\n return this.getSibling(\"left\");\n }\n}", "negate() {\n this._truth = !this._truth;\n }", "negate() {\n this._truth = !this._truth;\n }", "function negate(fn){\n return function not(...args){\n return !fn(...args)\n }\n}", "function getOpposite() {\n\t if (this.key === \"left\") {\n\t return this.getSibling(\"right\");\n\t } else if (this.key === \"right\") {\n\t return this.getSibling(\"left\");\n\t }\n\t}", "function getOpposite() {\n\t if (this.key === \"left\") {\n\t return this.getSibling(\"right\");\n\t } else if (this.key === \"right\") {\n\t return this.getSibling(\"left\");\n\t }\n\t}", "function not(x) { return !x; }", "function NameprepInversion_makeOpposite () {\n var result = new NameprepInversion(this.rangeArray);\n result.opposite = 1 ^ this.opposite;\n return result;\n}", "function invert_negatives(num){\n if(num > 0){\n return num*-1;\n }\n else if(num < 0){\n return num;\n }\n else{\n return false;\n }\n}", "function inverse(){\n\t\n\tlet inverted =\tcalculation['operand'] = -(calculation['operand']);\n\tdisplay.textContent = inverted;\n\t\n}", "inverse() {\nreturn (TRX.fromTRX(this)).setInvert();\n}", "function getOppositeNumber(number){\n return(-number);\n }", "function not(x) {\n return !x;\n }", "function isDifferentFromOpposite(name, value) {\n\tvar oppositeParamName = name === 'origin' ? 'destination' : 'origin';\n\treturn _parameters.params[oppositeParamName].code !== value;\n}", "function getOpposite() {\n\n return (BUY == orderType) ? SELL: BUY;\n\n }", "function complementOfConverse(r) {\n\treturn complement(converse(r));\n }", "function not(p) {\n return (x) => !p(x);\n }", "get not() {\n this.negate = !this.negate;\n return this;\n }", "function oppositeSides(start, end, startBox, endBox, startSide, endSide) {\n const deltaFromStart = delta(\n start,\n end,\n isHorizontal(startSide),\n isOuter(startSide)\n );\n if (deltaFromStart > buffer) {\n return direct(start, end, startSide, endSide);\n } else if (\n oppositeSidesTransverseGapLargeEnough(startBox, endBox, startSide, endSide)\n ) {\n return oppositeSidesDoublingBack(\n start,\n end,\n startBox,\n endBox,\n startSide,\n endSide\n );\n } else if (deltaFromStart > 0) {\n return direct(start, end, startSide, endSide);\n } else if (\n oppositeSidesShortPathIsOuter(\n start,\n end,\n startBox,\n endBox,\n startSide,\n endSide\n )\n ) {\n return oppositeSidesLoopOuter(\n start,\n end,\n startBox,\n endBox,\n startSide,\n endSide\n );\n } else {\n return oppositeSidesLoopInner(\n start,\n end,\n startBox,\n endBox,\n startSide,\n endSide\n );\n }\n}", "function inverse(flag){\n\tif (flag==0)\n\t\treturn \"b\";\n\tif (flag==1)\n\t\treturn \"w\";\n}", "inverse() {\n this.xyz = this.xyz.negate();\n return this;\n }", "function negate(n) {\n return -n;\n }", "function complement(pred) { return function(x) { return !(pred (x)); }; }", "function isnt(x, y){\n\t return !is(x, y);\n\t }", "function op_andnot(x, y)\n{\n return x & ~y;\n}", "function getOppositeEdge(edge) {\r\n return edge * -1;\r\n}", "function op_andnot(x, y) {\r\n\t return x & ~y;\r\n\t}", "function op_andnot(x, y) {\r\n\t return x & ~y;\r\n\t}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function negate() {\n if (is_operator(equation_array[0])) {\n return;\n }\n var negated_element = parseFloat(equation_array[0]) * (-1);\n equation_array[0] = negated_element.toString();\n update_display();\n}", "get invert() {\n return (\"invert\" in this.raw) ? this.raw.invert : false;\n }", "revert() { }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x,y) { return x&~y; }", "function op_andnot(x, y) { return x & ~y; }", "static setNegateQV(qv) {\n//-----------\nqv[0] = -qv[0];\nqv[1] = -qv[1];\nqv[2] = -qv[2];\nqv[3] = -qv[3];\nreturn qv;\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}", "function op_andnot(x, y) {\n return x & ~y\n}" ]
[ "0.7713208", "0.74177945", "0.7300315", "0.72357374", "0.7231619", "0.7230499", "0.7105349", "0.7087361", "0.66610557", "0.663712", "0.6598386", "0.65563947", "0.6515124", "0.648685", "0.64836067", "0.64836067", "0.6464711", "0.6440583", "0.6440583", "0.6418673", "0.6336347", "0.6335692", "0.6287789", "0.6272514", "0.62648183", "0.6263079", "0.6249781", "0.6238879", "0.6226237", "0.6224904", "0.6179236", "0.61631244", "0.6152964", "0.61492157", "0.61459893", "0.6136191", "0.6118408", "0.6109021", "0.60943115", "0.60874", "0.60874", "0.6069781", "0.6069781", "0.6069781", "0.6069781", "0.6069781", "0.6068485", "0.6066241", "0.6038155", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.6022779", "0.5991573", "0.59894335", "0.59670806", "0.59670806", "0.59670806", "0.59670806", "0.59670806", "0.59670806", "0.59670806" ]
0.0
-1
Some things to restore the previous session's selection
function scriptPath() { try { return app.activeScript; } catch (e) { return File(e.fileName); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectionRestore() {\n if (savedSelection) {\n rangy.restoreSelection(savedSelection);\n savedSelection = false;\n }\n}", "function restoreOptions() {\n var i, len, elements, elem, setting, set;\n\n elements = mainview.querySelectorAll('#skinSection input');\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n if (elem.value === localStorage[elem.name]) {\n elem.checked = true;\n }\n else {\n elem.checked = false;\n }\n }\n\n elements = mainview.querySelectorAll('#dictSection select');\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n elem.querySelector('option[value=' + localStorage[elem.name] + ']').selected = true;\n }\n\n\n elements = mainview.querySelectorAll('#captureSection tbody tr');\n setting = JSON.parse(localStorage.capture);\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n set = setting[i];\n elem.querySelector('input').checked = set.status;\n elem.querySelector('select').value = set.assistKey;\n }\n }", "function restoreSelection(range) {\n if (range) {\n if (window.getSelection) {\n sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && range.select) {\n range.select();\n }\n }\n }", "resetDeviceSelection() {\n\t\tif ( this.deviceSelection && this.deviceSelection.defaultSelected ) {\n\t\t\tthis.deviceSelection.activate( this.deviceSelection.defaultSelected );\n\t\t} else if ( this.deviceSelection ) {\n\t\t\tthis.deviceSelection.activate( 'base' );\n\t\t}\n\t}", "reset() {\n this._selection = -1;\n }", "resetSelection () {\n this.currentSelection = null\n }", "function restoreSavedSelection(start, end, color, noteId) {\n var savedSel = new Object();\n savedSel.start = start;\n savedSel.end = end;\n savedSel.color = color;\n restoreSelection(savedSel, noteId);\n android.selection.clearSelection();\n}", "function restoreState() {\n\t\t if (storageAvailable('sessionStorage')) {\n\t\t\t // Great! We can use sessionStorage awesomeness\n\t\t\t console.log('Restoring user selection from session storage.');\n\t\t\t window.init.theme = sessionStorage.getItem('currentTheme');\n\n\t\t\t // toggle theme buttons\n\t\t\t // switchButtons();\n\t\t }\n\t\t else {\n\t\t\t // Too bad, no sessionStorage for us\n\t\t\t console.warn('Storage [sessionStorage] no available. Can\\'t restore user selected theme.');\n\t\t }\n\t }", "function restoreSelection(savedSel, noteId) {\n// Create range selection and add note icon\n var range = createSelectionRange(savedSel);\n\n if (noteId != 0) {\n// Remove note icon if pass initial color\n if (!savedSel.color || savedSel.color === \"initial\") {\n removeNoteElement(noteId)\n } else {\n insertNoteIcon(noteId);\n }\n } else {\n window.TextSelection.jsLog(\"No note in selection\");\n }\n\n// Create range selection and remove underline first\n// android.selection.clearSelection();\n// range = createSelectionRange(savedSel);\n// removeUnderlineSelection();\n// highlight(\"initial\");\n\n// Create range selection and highlight or underline\n// android.selection.clearSelection();\n range = createSelectionRange(savedSel);\n if (savedSel.color == \"underline\") {\n underlineSelection();\n } else {\n\n highlight(savedSel.color);\n }\n\n// } catch (e) {\n// window.TextSelection.jsError(\"restoreSelection\\n\" + e);\n// }\n}", "_resetSelection() {\n this.__selectedRangeArr = [];\n this.__anchorSelectionIndex = -1;\n this.__leadSelectionIndex = -1;\n }", "function restoreState() {\n\t\tvar cookieData;\n\t\tif (!elToPaste) {\n\t\t\tcookieData = getCookie(save_file_cookie);\n\t\t\tif (cookieData != null) {\n\t\t\t\tcookieData = cookieData.split(',');\n\t\t\t\telToPaste = {type: unescape(unescape(cookieData[0])), name: unescape(unescape(cookieData[1])), cmd: unescape(unescape(cookieData[2]))};\n\t\t\t}\n\t\t}\n\t\tcookieData = getCookie(save_inf_cookie);\n\t\tif (cookieData != null) {\n\t\t\tcookieData = cookieData.split(',');\n\t\t\tif ((cookieData[0] != '') || (cookieData[0] != '/')) {\n\t\t\t\tcur_path = unescape(cookieData[0]);\n\t\t\t}\n\t\t\tview_type = cookieData[1];\n\t\t}\n\t}", "function resetSelection() {\n selectedHref = '#';\n selectedLi = -1;\n // remove all selected on reset\n $suggestionBox.find('li').removeClass('selected');\n }", "function restore_options() {\n chrome.storage.sync.get(tcDefaults, function(storage) {\n updateShortcutInputText('popKeyInput', storage.popKeyCode);\n });\n}", "restoreSelections() {\n if (!this.trackedSelections) {\n return;\n }\n const value = AppContext.getInstance().hash.getProp(AppConstants.HASH_PROPS.SELECTION, '');\n if (value === '') {\n return;\n }\n const ranges = value.split(';').map((s) => ParseRangeUtils.parseRangeLike(s));\n this.trackedSelections.select(ranges);\n }", "function restoreSession(){\n /* restore objects Timers, default settings */\n Timers = JSON.parse(sessionStorage.getItem('timers'));\n settingsDefaults = JSON.parse(sessionStorage.getItem('settings'));\n /* Stat and Loop Resetup */\n loadStats();\n initQueue();\n /* fill default form */\n fillDefault();\n // switch button labels\n for(i = 0; i < 3; i++){\n updateBtnDisplay(i);\n updateDefaultLoop(i);\n }\n if(Timers[3].on){\n customSelected = 3;\n updateBtnDisplay(3);\n updateDefaultLoop(3);\n }\n if(Timers[4].on){\n updateBtnDisplay(4);\n updateDefaultLoop(4);\n }\n \n}", "function switchSettings2Back() {\n /* Reset Focus */\n Draw.resetFocus();\n }", "function rescanSelection() {\n _rescanSelectionNext(Object.keys(selection), function(err) {\n if (err) flashError(\"Failed to rescan selection\");\n else flash(\"Selection scanned again\");\n });\n}", "function restore_options() {\n var storageArea = chrome.storage.local;\n storageArea.get(\"keybindings\", function(data) {\n if (!data.keybindings) {\n return;\n }\n choice = data.keybindings;\n var select = document.getElementById(\"keybindings\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == choice) {\n child.selected = \"true\";\n break;\n }\n }\n });\n}", "restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }", "function qRestore(q, sel, del, sotext, motexts) { // other texts only specified if selected\n if (q.mix != null) {\n qSetMulti(q, sel, del);\n } else {\n qSet(q, sel[0]);\n }\n var lsix = sel.length - 1;\n qAppendOtherOpts(q, sel[lsix]);\n if (sotext) {\n qChangeOptText(q, qSingleOtherIx(q), sotext);\n }\n if (motexts) {\n for (var i = lsix; motexts.length > 0; i--) {\n qChangeOptText(q, sel[i], motexts.pop());\n }\n }\n}", "function clearLS(){\n window.localStorage.removeItem(\"selection\");\n}", "function restoreOptions() {\n chrome.storage.sync.get(['master', 'slave'], function(items) {\n document.getElementById('master').value = items.master || '';\n document.getElementById('slave').value = items.slave || '';\n });\n }", "resetSelection() {\n if (!this.isSelectionEmpty()) {\n this._resetSelection();\n this._fireChangeSelection();\n }\n }", "function restore_options() {\n if (typeof save === \"undefined\") {\n save = true;\n }\n\n if (typeof warn === \"undefined\") {\n warn = true;\n }\n\n if (typeof modify === \"undefined\") {\n modify = true;\n }\n\n if (typeof keyCommand === \"undefined\") {\n keyCommand = 69;\n }\n\n keyString.value = stringFromCharCode(keyCommand);\n keyValue.value = keyCommand;\n\n if (warn === \"true\") {\n warnYes.checked = true;\n } else {\n warnNo.checked = true;\n }\n\n if (save === \"true\") {\n saveYes.checked = true;\n } else {\n saveNo.checked = true;\n }\n\n if (modify === \"true\") {\n modifyYes.checked = true;\n } else {\n modifyNo.checked = true;\n }\n}", "function restore_options() {\n chrome.storage.local.get('default_mode',function(items){\n var mode_ = items['default_mode'];\n if (!mode_) {\n return;\n }\n var select = document.getElementById(\"mode\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == mode_) {\n child.selected = \"true\";\n break;\n }\n }\n });\n }", "function restore_options(){\n\trestore_sync_options();\n\trestore_local_options();\n}", "function restore_options() {\n chrome.storage.local.get(['ProgramDate','TicketNumber','ProgramSit'], items => {\n if (items) {\n document.getElementById('ProgramDate').value = items.ProgramDate;\n document.getElementById('ProgramSit').value = items.ProgramSit;\n document.getElementById('TicketNumber').selectedIndex = items.TicketNumber;\n }\n });\n}", "function restoreView(viewToRestore){contextLView=viewToRestore;}", "function resetToNoneState() {\n // clear text editing mode\n if (state == STATE_TEXT_EDITING) {\n currentTextEditor.destroy();\n currentTextEditor = null;\n }\n\n // deselect everything\n selectedFigureId = -1;\n selectedConnectionPointId = -1;\n selectedConnectorId = -1;\n selectedContainerId = -1;\n\n // if group selected\n if (state == STATE_GROUP_SELECTED) {\n var selectedGroup = STACK.groupGetById(selectedGroupId);\n\n // if group is temporary then destroy it\n if (!selectedGroup.permanent) {\n STACK.groupDestroy(selectedGroupId);\n }\n\n //deselect current group\n selectedGroupId = -1;\n }\n\n state = STATE_NONE;\n}", "function restoreOptions()\n{\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get(\n {\n 'favoriteColor': 'red',\n 'likesColor': true\n },\n function(items)\n {\n color_select.value = items.favoriteColor;\n color_selected.textContent = items.favoriteColor;\n color_selected.style.color = items.favoriteColor;\n like_checkbox.checked = items.likesColor;\n }\n );\n}", "function reset() {\r\n restore_options();\r\n update_status(\"已还原\");\r\n}", "restore() {\n if(this.saved.caret)\n this.set(this.saved.startNodeIndex, this.saved.startOffset);\n else\n this.set(this.saved.startNodeIndex, this.saved.startOffset,\n this.saved.endNodeIndex, this.saved.endOffset);\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n panel: true,\n remove: true,\n notify: true,\n restyle: true,\n console: false,\n console_deep: false,\n }, (items) => {\n for (let item in items) {\n document.getElementById(item).checked = items[item];\n }\n });\n}", "function resetSelectedTextElement() \n {\n element = this;\n clearPreviousSelection();\n }", "function resetSelectMode( paramDocument ) {\r\n\tisSelectMode = false;\r\n}", "function clearPreviousSelection()\n {\n if ($.browser.msie) \n {\n document.selection.empty();\n }\n else\n {\n window.getSelection().removeAllRanges();\n }\n }", "function restoreStudy(){\n $('[data-save]').each(function(){\n $(this).val(localStorage.getItem(prefix+'/'+currentTopic+'-'+$(this).attr('data-save')));\n });\n }", "function restore_options() {\n chrome.storage.local.get(null, function (result) {\n document.getElementById(\"newProductSelection\").selectedIndex = result.newProductCellColorUser;\n if (result.jiraPreviewLiveChecked) {\n document.getElementById('jiraPreviewLiveChecked').checked = true;\n }\n });\n}", "function restore_options() {\n var fontSize=localStorage[\"readerFontSize\"];\n if(fontSize){\n \t$(\"#fontsize\").val(fontSize);\n }\n\n var font = localStorage[\"readerFont\"];\n if (!font) {\n return;\n }\n var select = $(\"#fonts\");\n for (var i = 0; i < select.children().length; i++) {\n var child = select.children()[i];\n if ($(child).val() == font) {\n $(child).attr('selected', \"true\");\n break;\n }\n }\n\n}", "function resetDataDeselect() {\n\t\t\tconsole.log(\"resetDataDeselect()\");\n\n\t\t\tvm.apiDomain.logicalDBKey = \"\";\t\n\t\t\taddAdbRow();\n\t\t}", "function restoreOptions() {\n // retrieves data saved, if not found then set these to default parameters\n chrome.storage.sync.get({\n color: \"FFEB3B\",\n opac: .5,\n rad: 50,\n trigger: \"F2\",\n\t\ttoggle: true,\n activePage: false\n }, function(items) {\n \t// sets value of the sliders and settings to saved settings\n document.getElementById('trigger').value = items.trigger;\n\n // draws the circle and text preview to loaded preferences\n\t\topacity = items.opac;\n\t\tradius = items.rad;\n\t\thighlight = items.color;\n\t\tcheck = items.toggle;\n\t\t$('#toggle').prop('checked', check);\n\t\tdrawCircle(opacity, radius, highlight);\n });\n}", "function resetApplicationState() {\r\n Canvas.clearCanvas();\r\n Animation.reset();\r\n animating = false;\r\n\r\n AlgoSelect.deselectAlgButtons();\r\n AlgoSelect.loadAlgoInfo('default');\r\n\r\n // save to undo history\r\n saveCurrentState()\r\n}", "function restoreSettings() {\n function setCurrentChoice(result) {\n if(result !== undefined && result.insert !== undefined && result.insert !== \"\"){\n document.getElementById('cmn-toggle-1').checked = result.insert;\n }\n else{\n console.log(\"No Settings Found\");\n return null;\n }\n }\n\n chrome.storage.local.get(\"insert\", setCurrentChoice);\n chrome.storage.local.get(\"lang\", function(result) {\n if(result !== undefined && result.lang !== undefined && result.lang !== \"\") {\n lang = result.lang;\n updateStrings();\n var select = document.getElementById('lang-sel').value = result.lang;\n }\n });\n}", "function withRestoredSelections(f) {\n const oldSelections = getSelectedTaskKeys();\n try {\n f();\n } finally {\n setSelections(oldSelections);\n }\n }", "function restore_options() {\n chrome.storage.sync.get({\n pages: DEFAULT_PAGES,\n random: DEFAULT_RANDOM\n }, function(items) {\n clean_pages();\n set_pages(items.pages);\n document.getElementById('random').checked = items.random;\n });\n}", "function restore_options() {\n\tfor( i in pOptions){\n\t\tif(typeof(pOptions[i].def)=='boolean')\n\t\t\tdocument.getElementById(i).checked = ((localStorage[i]=='true')?true:pOptions[i].def);\n\t\telse\n\t\t\tdocument.getElementById(i).value = ((localStorage[i])?localStorage[i]:pOptions[i].def);\n\t}\n\n\n// var favorite = localStorage[\"favorite_color\"];\n// if (!favorite) {\n// return;\n// }\n// var select = document.getElementById(\"color\");\n// for (var i = 0; i < select.children.length; i++) {\n// var child = select.children[i];\n// if (child.value == favorite) {\n// child.selected = \"true\";\n// break;\n// }\n// }\n}", "function reload() {\r\n this.selection.setBookmark();\r\n this.save();\r\n this.load();\r\n this.selection.moveToBookmark();\r\n }", "function _restorePreviousFocus() {\n _Overlay._Overlay._trySetActive(_Overlay._Overlay._ElementWithFocusPreviousToAppBar);\n }", "function restore_options() {\n var curr_url = localStorage.getItem(\"sheet_url\");\n var curr_appname = localStorage.getItem(\"app_name\");\n $appName.value = curr_appname;\n\n if (curr_url === null || curr_url === \"\") {\n return false;\n } else {\n $sheet_url.value = curr_url;\n $save.textContent = \"update\";\n $sheetJump.href = curr_url;\n $sheetJump.style.display = \"block\";\n }\n }", "load(session) {\n var state = session.state;\n this.selectedNumbers = state.selectedNumbers; \n this.updateUI();\n }", "function resetPosition(){\n\t\tdocument.getElementById('position').options[0].selected = 'selected';\n\t}", "clearSelection() {\n if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) {\n this.state.setSelectedKeys(new $cc81f14158b02e1e259a5a46d24f0c$export$Selection());\n }\n }", "saveSelection(){\n this.selected = this.model.document.selection.getSelectedElement()\n }", "function restoreOptions() {\n\n var getting = browser.storage.local.get(\"currency\");\n getting.then(setCurrentChoice, onError);\n\n function setCurrentChoice(result) {\n document.querySelector(\"#currency\").value = result.currency || \"USD\";\n }\n\n function onError(error) {\n console.log(`Error: ${error}`);\n }\n}", "function restoreView(viewToRestore) {\n contextLView = viewToRestore;\n}", "function restoreView(viewToRestore) {\n contextLView = viewToRestore;\n}", "function restore_options() {\n $(\"#theme\").val(\"blue\");\n $(\"#font_size\").val(\"0.9em\");\n $(\"#popup_width\").val(\"610\");\n $(\"#popup_height\").val(\"620\");\n $(\"#bookmark_url\").val(\"http://www.google.com/bookmarks/\");\n $(\"#sig_url\").val(\"http://www.google.com/bookmarks/find\");\n}", "function reload() {\n this.selection.setBookmark();\n this.save();\n this.load();\n this.selection.moveToBookmark();\n }", "function restore_options() {\n assignNodeReferences();\n chrome.storage.sync.get({\n payWallOption: true,\n adRemovalOption: true,\n trumpOption: true,\n trumpNameOption: 'florida man',\n yoHeaderOption: true,\n yoSuffixOption: 'yo'\n }, function(items) {\n payWallOption.checked = items.payWallOption;\n adRemovalOption.checked = items.adRemovalOption;\n trumpOption.checked = items.trumpOption;\n trumpNameOption.value = items.trumpNameOption.slice(0,30).toLowerCase();\n yoSuffixOption.value = items.yoSuffixOption.slice(0,30).toLowerCase();\n yoHeaderOption.checked = items.yoHeaderOption;\n closeButton.addEventListener(\"click\", function() {save_options()});\n closeButton.removeAttribute('disabled');\n });\n}", "function restore_options() {\n\trestore_local(\"sense_facebook\");\n\trestore_local(\"sense_google\");\n\trestore_local(\"sense_twitter\");\n\trestore_local(\"sense_youtube\");\n\trestore_local(\"sense_4Chan\");\n\trestore_local(\"sense_selector\");\n\trestore_local(\"sense_color\");\n\trestore_local(\"api_key\");\n\tsave_options();\n}", "function restoreOptions() {\r\n var result = localStorage[\"default_account\"];\r\n if (!result) {\r\n return;\r\n }\r\n}", "function restorePrevious() {\n\t\t\tif (hasSnapshot()) {\n\t\t\t\tsnap.history.pop();\n\t\t\t\tdoRollback();\n\t\t\t}\n\t\t}", "function restore_options() {\n var opt = this\n chrome.storage.sync.get({\n syncVolume: true,\n saveVolume: true\n }, function(items) {\n document.getElementById('saveVol').checked = items.saveVolume; \n document.getElementById('syncVol').checked = items.syncVolume;\n if(items.saveVolume == false) {\n document.getElementById('syncVol').checked = false;\n document.getElementById('syncVol').disabled = true;\n document.getElementById('syncVolSpan').style.opacity = 0.6;\n } else {\n document.getElementById('syncVol').disabled = false;\n document.getElementById('syncVolSpan').style.opacity = 1;\n }\n\n // If it's a first time visit, then these values will not already be set. So, set them.\n opt.save_options();\n\n });\n}", "resetSelectedRow() {\n\n this.selectedRowCoords.r = null\n this.selectedRowCoords.c = null\n this.editedRowCoords.r = null\n this.editedRowCoords.c = null\n this.validatedCell.r = null\n this.validatedCell.c = null\n\n this.hot.deselectCell();\n }", "goBackToCurrentView(){\n\t\tlet e = document.getElementById('x3d_context');\n\t\te.runtime.resetView();\n\t}", "function restoreOptions() {\r\n try {\r\n var api = chrome || browser;\r\n api.storage.sync.get(null, (res) => {\r\n document.querySelector(\"#voice\").value = res.voice || getFirstVoice();\r\n document.querySelector(\"#speed\").value = res.speed || 1;\r\n document.querySelector(\"#pitch\").value = res.pitch || 1;\r\n document.querySelector(\"#colorBackground\").value =\r\n res.colorBackground || \"light\";\r\n restoreColor();\r\n document.querySelector(\"#fontSize\").value = res.fontSize || \"medium\";\r\n\t restoreFontSize();\r\n if (\r\n res.experimentalMode &&\r\n res.definiteArticleCheck &&\r\n res.definiteArticleColor\r\n ) {\r\n colorDefiniteArticles(res.definiteArticleColor);\r\n }\r\n if (\r\n res.experimentalMode &&\r\n res.indefiniteArticleCheck &&\r\n res.indefiniteArticleColor\r\n ) {\r\n colorIndefiniteArticles(res.indefiniteArticleColor);\r\n }\r\n if (res.experimentalMode && res.eclipseMode) {\r\n eclipseMode();\r\n }\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n}", "function restoreOriginalConfig() {\n\n\t\tvar bbox = new OpenLayers.Bounds(-4500000, 3050000, 7500000, 9800000);\n\n\t\t\n\t\t\n\t\ttry {\n\t\t\tmap.zoomToExtent(bbox);\n\t\t\tdocument.getElementById('searchText1').value = \"\";\n\t\t\tdocument.getElementById(\"searchingResult\").style.display = 'none';\n\t\t\tsearchString = \"\";\n\n\t\t\t\n\t\t\tselectedLayer().visibility = true;\n\t\t\tselectedLayer().redraw();\n\t\t\tclearSearchResults();\n\t\t\tsingleSelect.activate();\n\t\t\tuserAreaSelect.deactivate();\n\n\t\t} catch(err) {}\n\t\tmap.events.triggerEvent(\"moveend\");\t\n\t}", "function reset(){\n\t/* MAKE URL */\n\tselected.clear();\n\twindow.location.href = makeQueryString();\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n add_rmp_links: true,\n highlight_easy_classes: true,\n hide_full_classes: false\n }, function(items) {\n document.getElementById('add_rmp_links').checked = items.add_rmp_links;\n document.getElementById('highlight_easy_classes').checked = items.highlight_easy_classes;\n document.getElementById('hide_full_classes').checked = items.hide_full_classes;\n });\n }", "function clearSelection() {\r\n map.deselectCountry();\r\n pc1.deselectLine();\r\n donut.deselectPie();\r\n sp1.deselectDot();\r\n }", "function resetSelection(){\n\t$(\".document-list, #scrapPaperDiv, .scrap-keyword\").find(\"span\").each(function( index ){\n\t\tif($(this).hasClass('ent_highlighted')){\n\t\t\t$(this).removeClass('ent_highlighted');\n\t\t}\n\t\t\n\t\tif($(this).hasClass('highlighted')){\n\t\t\t$(this).parent().unhighlight({className:$(this).text().split(\" \")[0]});\t\t\n\t\t}\n\t});\n\tqueue = [];\n}", "function restore_options() {\n var settings = getFromLocalStorage(\"settings\");\n document.getElementById('apply').checked = settings.apply;\n document.getElementById('show').checked = settings.show;\n}", "function reset_selected_options() {\n\t// clear input fields\n\t$('input[name=sliding_door_scheme_id]').val('');\n\n\t// clear dom triggers\n\t$('div.handle-picker-container a').removeClass('selected');\n\n\t// hide the next step button - user should select required config after scheme change\n\t$('div#submit').addClass('hidden');\n\n\t// switch back to main configuration step\n\tswitch_back_to_configuration_picker();\n}", "function restoreOptionSelection(optionName) {\n\tvar optionValue = $('#'+optionName+'Val').val()\n\tif(optionValue != '') {\n\t\toptionClick(optionName, optionValue)\n\t}\n}", "function restoreOptions() {\r\n var user = localStorage[\"user\"];\r\n if(!user) {\r\n return;\r\n }\r\n document.getElementById(\"user\").value = user;\r\n}", "loadSelection() {\n let selection = this.state.selection;\n this.clearSelection();\n return selection;\n }", "function resetToOptions(){\n\tconsole.log(\"Resetting to initial\", viewerParams.parts.options_initial);\n\tviewerParams.parts.options = JSON.parse(JSON.stringify(viewerParams.parts.options_initial));\n\tresetViewer();\n}", "function updateSelection(){\n\t\t\tif(lastMousePos.pageX == null) return;\n\t\t\t\n\t\t\tsetSelectionPos(selection.second, lastMousePos);\n\t\t\tclearSelection();\n\t\t\t\n\t\t\tif(selectionIsSane()) drawSelection();\n\t\t}", "function RestoreSelectionWithoutContentLoad(tree) {\n if (gRightMouseButtonSavedSelection) {\n let view = gRightMouseButtonSavedSelection.view;\n // restore the selection\n let transientSelection = gRightMouseButtonSavedSelection.transientSelection;\n let realSelection = gRightMouseButtonSavedSelection.realSelection;\n view.selection = realSelection;\n // replay any calls to adjustSelection, this handles suppression.\n transientSelection.replayAdjustSelectionLog(realSelection);\n // Avoid possible cycle leaks.\n gRightMouseButtonSavedSelection.view = null;\n gRightMouseButtonSavedSelection = null;\n\n if (tree) {\n tree.invalidate();\n }\n\n UpdateMailToolbar(\"RestoreSelectionWithoutContentLoad\");\n }\n}", "function resetSelection(time=0) {\n d3.selectAll('.elm').transition().duration(time).style('opacity', 1)\n .style('stroke-width', 1);\n d3.selectAll('.navAlt').transition().duration(time).style('opacity', 1);\n d3.selectAll('.labels').transition().duration(time).style('font-size', \"9.5px\")\n .style(\"fill\", \"#B8CBED\").style(\"opacity\", 0.5);\n }", "function restoreOptions() {\n var ip = localStorage[\"ip\"];\n var port = localStorage[\"port\"];\n if (!ip && !port) {\n return;\n }\n document.getElementById(\"ip\").value = ip;\n document.getElementById(\"port\").value = port;\n}", "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function setSelection(doc, sel, options) {\n\t\t setSelectionNoUndo(doc, sel, options);\n\t\t addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n\t\t }", "function restore_options() {\n var options = loadLoginOption();\n if (!options) {\n return;\n }\n\n $(\"#username\").val(options[\"username\"]);\n $(\"#pwd\").val(options[\"pwd\"]);\n $(\"#trdpwd\").val(options[\"trdpwd\"]);\n $(\"#hdd\").val(options[\"hdd\"]);\n $(\"#ip\").val(options[\"ip\"]);\n $(\"#mac\").val(options[\"mac\"]);\n}", "restoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}", "revertSelected() {\n this.getSelectedIds().forEach(id => {\n this.get(id).revert();\n this.get(id).deselect();\n });\n this.render();\n }", "function reset() {\n result = (\"\");\n choices = [];\n}", "function resetFocus()\n\t{\n\t\t// zoom out to default zoom level, center to default position,\n\t\t// and remove all selection highlights\n\t\tvar script = [];\n\t\tscript.push(_scriptGen.zoom(_options.defaultZoom)); // zoom to default zoom level\n\t\tscript.push(_scriptGen.defaultCenter()); // center to default position\n\n\t\t// convert array to a single string\n\t\tscript = script.join(\" \");\n\n\t\t// send script string to the app\n\t\t_3dApp.script(script);\n\t}", "function resetOptions(){\n\t \t \n\t\t g_options = jQuery.extend({}, g_temp.originalOptions);\n\t\t \n\t\t g_selectedItemIndex = -1;\n\t\t g_selectedItem = null;\n\t\t g_objSlider = undefined;\n\t\t g_objThumbs = undefined;\n\t\t g_objSlider = undefined; \n\t}", "restoreDefault() {\n this.resetCCSetting();\n }", "clearSelection() {\n this._clearSelection();\n }", "function normalSail()\n{\t\n\tUnselectSails();\n\tnormalSailSelected = true;\n}", "function restore_options() {\n if (common.options.getRSSChannels()) {\n var rss_channels_config = JSON.parse(common.options.getRSSChannels());\n Object.keys(rss_channels_config).forEach(function (key) {\n document.getElementById(key).checked = (rss_channels_config[key] === \"true\");\n });\n }\n document.getElementById(common.storageKey.showLastItems).value = common.options.getShowLastItems();\n document.getElementById(common.storageKey.updatePeriod).value = common.options.getUpdatePeriod();\n document.getElementById(common.storageKey.windowWidth).value = common.options.getWindowWith();\n}", "clearSelection() {\n this.currentlySelected = '';\n }", "function restore_options() { \r\n document.getElementById('pkey').value = window.localStorage.getItem('pkey', key);\r\n}", "function restore_options() {\n\n left.value \t= localStorage[\"left\"];\n right.value \t= localStorage[\"right\"];\n tops.value \t= localStorage[\"tops\"];\n bottom.value \t= localStorage[\"bottom\"];\n\n //alert(\"Test\");\n /* var select = document.getElementById(\"color\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == favorite) {\n child.selected = \"true\";\n break;\n }\n }*/\n}", "function restore_options() {\n\t// get options, or return default values if not set\n\tchrome.storage.sync.get(bb_values.default_options, function (items) {\n\t\tdocument.getElementById(\"forum_view\").value = items.forum_view;\n\t\tdocument.getElementById(\"blackboard_domains\").value = items.blackboard_domains.join(\"\\n\");\n\t});\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n favoriteColor: 'red',\n likesColor: true,\n\tinstancia: ''\n }, function(items) {\n document.getElementById('color').value = items.favoriteColor;\n document.getElementById('like').checked = items.likesColor;\n\tdocument.getElementById('instancia').value = items.instancia;\n });\n}", "function xRestoreState()\n{\n\t//restore list state\n\tvar name = \"xMenuState\";\n\tvar start = document.cookie.indexOf(name+\"=\");\n\tif(start != -1)\n\t{\n\t\tvar len = start+name.length+1;\n\t\tif ((!start) && (name != document.cookie.substring(0,name.length))) return null;\n\t\tif (start == -1) return null;\n\t\tvar end = document.cookie.indexOf(\";\",len);\n\t\tif (end == -1) end = document.cookie.length;\n\t\tvar value = unescape(document.cookie.substring(len,end));\n\t\tvar values = value.split(\"|\");\n\t\tfor(i=0;i<values.length-1;i++)\n\t\t{\n\t\t\tvar couple = values[i].split(\":\");\n\t\t\tdocument.getElementById(couple[0]).style.display = couple[1];\n\t\t}\n\t}\n\t//restore img state\n\tname = \"xMenuStateImg\";\n\tstart = document.cookie.indexOf(name+\"=\");\n\tif(start != -1)\n\t{\n\t\tvar len = start+name.length+1;\n\t\tif ((!start) && (name != document.cookie.substring(0,name.length))) return null;\n\t\tif (start == -1) return null;\n\t\tvar end = document.cookie.indexOf(\";\",len);\n\t\tif (end == -1) end = document.cookie.length;\n\t\tvar value = unescape(document.cookie.substring(len,end));\n\t\tvar values = value.split(\"[]\");\n\t\tfor(i=0;i<values.length-1;i++)\n\t\t{\n\t\t\tvar couple = values[i].split(\">>\");\n\t\t\tvar imgs = couple[1].split(\",\");\n\t\t\tfor(var il in imgs)\n\t\t\t{\n\t\t\t\tdocument.getElementById(imgs[il]).src = couple[0];\n\t\t\t}\n\t\t}\n\t}\n}", "function restoreOptions() {\n // defaults set to true\n chrome.storage.sync.get({\n translateHeadings: true,\n translateParagraphs: true,\n translateOthers: true,\n azurekey: ''\n }, function (items) {\n document.getElementById('selectorH').checked = items.translateHeadings\n document.getElementById('selectorP').checked = items.translateParagraphs\n document.getElementById('selectorOthers').checked = items.translateOthers\n if (items.azurekey != '') {\n document.getElementById('key').value = '***'\n }\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n darkGithub: false,\n darkSemaphore: false,\n darkLogentries: false,\n darkThundertix: false,\n darkThunderstage: false,\n darkThunderlocal: false\n }, function(items) {\n document.getElementById('dark_github').checked = items.darkGithub;\n document.getElementById('dark_semaphore').checked = items.darkSemaphore;\n document.getElementById('dark_logentries').checked = items.darkLogentries;\n document.getElementById('dark_thundertix').checked = items.darkThundertix;\n document.getElementById('dark_thunderstage').checked = items.darkThunderstage;\n document.getElementById('dark_localthundertix').checked = items.darkThunderlocal;\n });\n}" ]
[ "0.8070127", "0.69869334", "0.6934845", "0.69180346", "0.6888552", "0.68706656", "0.6828675", "0.6809891", "0.6706013", "0.6687331", "0.6664929", "0.6613561", "0.66055036", "0.6592532", "0.65911496", "0.6523383", "0.6508823", "0.64703935", "0.64642227", "0.6448113", "0.63902247", "0.6389057", "0.6384239", "0.63380605", "0.62925595", "0.62890625", "0.62662476", "0.6237944", "0.62197065", "0.62196827", "0.6214962", "0.61957467", "0.61764836", "0.617633", "0.61635673", "0.6156289", "0.61545944", "0.6153467", "0.6151729", "0.6138073", "0.61343724", "0.61307263", "0.61283684", "0.61211133", "0.6116651", "0.61134344", "0.6091148", "0.6087494", "0.6078257", "0.60733074", "0.60632145", "0.60627955", "0.6059291", "0.605757", "0.6053578", "0.6053578", "0.6051212", "0.60466033", "0.60456544", "0.6042183", "0.6037764", "0.6035128", "0.60313934", "0.6030729", "0.60249645", "0.6024313", "0.6023172", "0.6006966", "0.6005549", "0.59947425", "0.59916675", "0.59852284", "0.59847134", "0.5978536", "0.597838", "0.59721583", "0.5970694", "0.59679174", "0.5965953", "0.5964033", "0.59566784", "0.5955303", "0.5955303", "0.595485", "0.5954441", "0.59510946", "0.5941729", "0.5935965", "0.5933341", "0.5932645", "0.5931715", "0.59301627", "0.592508", "0.591765", "0.59109753", "0.5906828", "0.5902082", "0.58970165", "0.5894844", "0.58912945", "0.5885279" ]
0.0
-1
Convert an array of ListItems to an array of strings
function getQueryNames(sel) { var arr = []; for (var i = 0; i < sel.length; i++) { arr.push(sel[i].text); } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStringArray(items) {\n // Return empty array if undefined or null\n if (!items) return [];\n // If string, split by commas\n if (typeof items === \"string\") items = items.split(\",\");\n // Trim and convert all to lowercase\n var length = items.length;\n for (var i = 0; i < length; i++) items[i] = $.trim(items[i].toString());\n return items;\n }", "function arrToList(array) {\n var listStr = ''\n array.forEach(item => listStr += `${item}\\n`)\n return listStr;\n}", "function convertToString(itemList){\n itemList = $.perc_utils.convertCXFArray(itemList);\n $.each(itemList, function(k,v){\n itemList[k] = v.toString();\n });\n return itemList;\n }", "function elementsAsStrings(arrayOfArrays) {\n assert(_.isArray(arrayOfArrays));\n return arrayOfArrays.map(function (array) {\n assert(_.isArray(array));\n return array.map(function (elem) {\n if (elem instanceof ElementWrapper) {\n return elem.toStringSync();\n } else {\n assert(_.isString(elem));\n return elem;\n }\n });\n });\n }", "function setOutString(itemList) {\r\n return setArray2Str(itemList)\r\n}", "function stringItUp(arr){\n var newArr = arr.map(function(item){\n return item.toString()\n })\n console.log(newArr)\n}", "function arrayify(item) {\n return [].concat(item);\n}", "function getStringLists(arr) {\n const stringArray = arr.filter(str =>typeof str === 'string');\n return stringArray;\n }", "function getStringLists(array){\n return [array].push(array)\n}", "function quotedOrList(items) {\n return Object(_orList__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(items.map(function (item) {\n return \"\\\"\".concat(item, \"\\\"\");\n }));\n}", "function copyListRawString(list) {\n\t\tvar result = [],\n\t\t\ti;\n\t\t\n\t\tif (!Array.isArray(list)) {\n\t\t\tif (isLispString(list)) {\n\t\t\t\treturn toRawString(list);\n\t\t\t}\n\t\t\treturn list;\n\t\t}\n\t\t\n\t\tfor (i = 0; i < list.length; i++) {\n\t\t\tresult.push(copyListRawString(list[i]));\n\t\t}\n\t\t\n\t\treturn result;\n\t}", "function createListItems(arr){\n let items = '';\n\nfor(let i =0; i<arr.length; i++){\n items += `<li>${arr[i]}</li>`;\n}\nreturn items;\n}", "function ArrayToString(oList, sName, sIndent, bNumberItems ) {\n\tif( sName == undefined || oList == undefined ) {\n\t\tHandleWarning(\"ArrayToString() needs a list and a name\");\n\t\treturn \"\";\n\t}\n\n\tsIndent = sIndent == undefined ? \"\" : sIndent;\n\tvar tRet = \"\";\n\n\tvar i = 0 ;\n\tfor( var tItem in oList ) {\n\t\tvar sNumber =bNumberItems == true ? \" [\" + tItem + \"]\" : \" \";\n\t\ttRet += sIndent + sNumber + oList[tItem].toString() + \"\\n\";\n\t\ti++;\n\t}\n\tif( i == 0) {\n\t\treturn sIndent + \"Object has no \" + sName +\"\\n\";\n\t}\n\n\treturn sIndent + sName + \":\\n\" + tRet;\n}", "toListString(arr) {\n\t\tif (!arr.length) return '';\n\t\tif (arr.length === 1) return arr[0];\n\t\tif (arr.length === 2) return `${arr[0]} and ${arr[1]}`;\n\t\treturn `${arr.slice(0, -1).join(\", \")}, and ${arr.slice(-1)[0]}`;\n\t}", "static listArrayAsString(stringArray) {\n // Check if argument is an array\n if (Array.isArray(stringArray)) {\n let arrayItemText = '';\n // Loop through each value of array\n for (let index = 0, arrLength = stringArray.length; index < arrLength; index++) {\n arrayItemText += stringArray[index];\n // If array length is more than 1 and index is NOT the last element\n // If array length is 2, only add ' and '\n // Else: If index is second to last element, add ', and ' Else add ', '\n if (arrLength > 1 && index != arrLength - 1) {\n arrayItemText += (arrLength == 2) ? ' and '\n : (index == arrLength - 2) ? ', and ' : ', ';\n }\n }\n // Return created string\n return arrayItemText;\n } else if (typeof stringArray == 'string') // Else if argument is string, return the same string\n return stringArray;\n }", "static getUIStringVector(arr){\n\t\tif (arr == null){\n\t\t\treturn \"\";\n\t\t}\n\t\tvar content = \"\";\n\t\tfor (var i = 0; i < arr.count(); i++){\n\t\t\tcontent += this.getUIString(arr.item(i));\n\t\t}\n\t\treturn content;\n\t}", "function readableList(array) {\n var list = '',\n lastItem;\n switch (array.length) {\n case 0:\n return '';\n\n case 1:\n return array[0];\n case 2:\n return array[0] + ' and ' + array[1];\n\n default:\n lastItem = array.pop();\n array.each(function (item) {\n list += item + ', ';\n });\n list += 'and ' + lastItem;\n array.push(lastItem);\n return list;\n }\n }", "function listToArray() {\n\n}", "function array2string($arr) {\n\tvar str = \"\";\n\t$arr.forEach(item => {\n\t\tstr += item + '\\n';\n\t});\n\treturn str;\n}", "function arrayToString(a) {\n return \"[\" + a.join(\", \") + \"]\";\n}", "function arrayToString(array) {\n return array.join('')\n }", "function arrayToList() {\n\n}", "function getItemNames(){\n let namesArr = [];\n for (let i = 0; i < allItems.length; i++){\n namesArr.push(allItems[i].name);\n }\n return namesArr;\n}", "function stringifyArray(input){\n return input.join(',');\n}", "function stringify(array){\n\tvar arrayB=[]\n\tfor(i in array)\n\t\tarrayB[i]=\"\"+array[i];\n\treturn arrayB;\n}", "listToList(arr) {\n var items = [];\n arr.forEach(i => {\n items.push(i);\n });\n return items;\n }", "vlist2string(vlist, label) {\n\t\tlet s = '';\n\t\tfor (let u of vlist) {\n\t\t\tif (s.length > 0) s += ' ';\n\t\t\ts += this.x2s(e, label);\n\t\t}\n\t\treturn '[' + s + ']';\n\t}", "function list_to_string(l) {\n if (array_test(l) && l.length === 0) {\n return \"[]\";\n } else {\n if (!is_pair(l)){\n return l.toString();\n }else{\n return \"[\"+list_to_string(head(l))+\",\"+list_to_string(tail(l))+\"]\";\n }\n }\n}", "function getTasksAsArray() {\n let liArray = document.querySelectorAll(\"li\");\n let newArray = [];\n\n for (let i = 0; i < liArray.length; i++) {\n newArray.push(liArray[i].innerText);\n }\n newArray = newArray.join(\" \");\n console.log(newArray);\n}", "stringThisArray(array){\n return array.join(\"\");\n }", "function stringifyList(value) {\n\tif(Array.isArray(value)) {\n\t\tvar result = new Array(value.length);\n\t\tfor(var t=0, l=value.length; t<l; t++) {\n\t\t\tvar entry = value[t] || \"\";\n\t\t\tif(entry.indexOf(\" \") !== -1) {\n\t\t\t\tresult[t] = \"[[\" + entry + \"]]\";\n\t\t\t} else {\n\t\t\t\tresult[t] = entry;\n\t\t\t}\n\t\t}\n\t\treturn result.join(\" \");\n\t} else {\n\t\treturn value || \"\";\n\t}\n}", "function getStringArray(integerList) {\r\n stringArray=\"\";\r\n for (i=0;i<integerList.length;i++) {\r\n str=stringifyNumber(integerList[i]);\r\n stringArray+=prefix+str;\r\n prefix=\", \";\r\n\r\n }\r\n return stringArray;\r\n}", "function getArray(items) {\n return new Array().concat(items);\n}", "function getArray(items) {\n return new Array().concat(items);\n}", "function getArray(items) {\n return new Array().concat(items);\n}", "function arrayToStringV2(arr) {\n let result = '';\n arr.forEach((elem) => {\n result += elem;\n });\n return result;\n}", "function caml_string_of_array (a) { return new MlString(4,a,a.length); }", "itemsListToString(){\n for (var i = 0; i < this.state.items.length; i++){\n var currItem = this.state.items[i]\n }\n }", "function arrayToString(arr) {\n return arr.join(\"\")\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }", "function listOffArrayElements(toBeListed) { \n\n\n\tvar outputText = ''; \n\n\tfor (var i = 0; i < toBeListed.length; i++) {\n\n\t\toutputText += toBeListed[i]; \n\n\t\tif (i < toBeListed.length - 1) {\n\n\t\t\toutputText += ', ';\n\n\t\t}\n\n\n\t}\n\n\toutputText += '.'; \n\n\treturn outputText; \n\n\n}", "function turnNodeArrayIntoStringArray(arrayNodes){\n var stringArray=[];\n arrayNodes.forEach(function(element){\n var elementArray = [];\n element.each(function(index, title){\n elementArray.push(title.innerHTML);\n });\n stringArray.push(elementArray);\n });\n return stringArray;\n}", "function transformerList(val) {\n\t return util.arrayify(val);\n\t}", "function transformerList(val) {\n\t return util.arrayify(val);\n\t}", "function flattenToString(arr) {\n var i,\n iz,\n elem,\n result = '';\n\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += isArray(elem) ? flattenToString(elem) : elem;\n }\n\n return result;\n }", "toString() {\n const names = [];\n this.elements.forEach((element) => {\n names.push(element.toString());\n });\n return \"[\" + names.join(\", \") + \"]\";\n }", "function arrayToList(arr) {\n let ul = document.createElement('ul'),\n li;\n for (let i = 0; i < arr.length; i++) {\n if (Array.isArray(arr[i])) {\n li.appendChild(arrayToList(arr[i]));\n } else {\n li = document.createElement('li');\n li.appendChild(document.createTextNode(arr[i]));\n ul.appendChild(li);\n }\n }\n return ul;\n}", "function transformerList(val) {\n return util.arrayify(val);\n}", "function quotedArray(arr) {\n return '[' +\n lib.map(arr, function(x) { return '\"' + x + '\"'; }) +\n ']';\n}", "function arrayToString(arr) {\n var arrString = arr.join(\", \");\n return arrString;\n}", "function generateShoppingItemsString(shoppingList) {\n const items = shoppingList.map((item, index) => generateItemElement(item, index));\n return items.join(\"\");\n}", "function getList(item){\r\n return !isArrayOrList(item) ? [item] : item;\r\n }", "function getList(item){\r\n return !isArrayOrList(item) ? [item] : item;\r\n }", "getCustomListString() {\n this.generatePackingList();\n return this.arrayToBulletList(this.packingList);\n }", "function arrayOutput(ar){\n\tvar s = \"\";\n\tar.map((el)=>{\n\t\ts += JSON.stringify(el) + \"\\n\";\n\t});\n\treturn s;\n}", "function handleArray(item) {\n if (item === undefined) return [null];\n if (Array.isArray(item)) return item;\n if (typeof item === \"string\") return [item];\n}", "function arrToStr(arr) {\n var str = '';\n\n for (var i = 0; i < arr.length; i++) {\n str += arr[i].toString();\n }\n\n return str;\n}", "function getList(item){\n return !isArrayOrList(item) ? [item] : item;\n }", "function getList(item){\n return !isArrayOrList(item) ? [item] : item;\n }", "function getList(item){\n return !isArrayOrList(item) ? [item] : item;\n }", "function encodeArray(arrayValue) {\n return arrayValue.map(encodeURIComponent).join(',');\n}", "function encodeArray(arrayValue) {\n return arrayValue.map(encodeURIComponent).join(',');\n}", "function stringItUp(arr) {\n const result = arr.map(function(num){\n return num.toString();\n });\n return result;\n}", "function getItems (array) {\n let data = [];\n console.log(\"=======================\")\n for(i=0; i < array.length; i++){\n data.push(array[i].item_name)\n console.log(i + \" - \" + array[i].item_name);\n };\n // console.log(data);\n return data;\n}", "handAsStrings() {\n const result = new Array();\n for (const i of this.hand) {\n result.push(i.toString());\n }\n return result;\n }", "function getList(item) {\n return !isArrayOrList(item) ? [item] : item;\n }", "function arrayToString(array) {\n var string = \"\";\n for (let j = 0; j < array.length; j++){\n var string = string + array[j] + '\\n';\n };\n return string = string.slice(0, -1);\n }", "function makeListItem(array){\n return \" <li> <span> <p id='name'> To do: \"+array[0]+\" </p> <p id='loc'> Location: \" + array[4] + \"</p> <p id='loc'> Time: \" + array[5] + \"</p> </span> </li> \";\n}", "function encodeArray(arrayValue) {\n\t return arrayValue.map(encodeURIComponent).join(',');\n\t}", "function array(it){\r\n return String(it).split(',');\r\n}", "function listString (list) {\n\tresult = \"Number items: \" + list.length + \", type \" + typeof(list) + \" \" ;\n\tfor ( i = 0 ; i < list.length ; i++ ){\n\t\tresult += list[i].getAttribute(\"name\") + \"\\n\" ;\n\t}\n\treturn result ;\n}", "function filter_list(l) {\n result = [];\n for (let i = 0; i < l.length; i++){\n if (typeof l[i] !== 'string'){\n result.push(l[i])\n }\n }\n return result;\n}", "function toArray(names) {\n return names.split(\",\");\n }", "function convertListToArray(eventData) {\r\n for (k = 0; k < eventData.length; k++) {\r\n eventData[k].positionArray = eventData[k].positions.split(\" \");\r\n }\r\n}", "function joinElement(arr) {\n return arr.toString();\n}", "toString() {\n return arrayToString(this);\n }", "function convertToString()\t{\r\n\tarrayString = prefer.toString();\r\n\t\r\n}", "arrayToBulletList(arr) {\n var str = \"• \"+arr[0]+\" •\\n\";\n for(var i = 1; i < arr.length; i++) {\n str += arr[i]+\" •\\n\";\n }\n return str;\n }", "function stringItUp(arr){\r\n return arr.map(num => num.toString())\r\n }", "function populatelist(listItems = [], itemsList) {\n itemsList.innerHTML = listItems.map((item, i) => {\n return `<li class=\"list-group-item\">\n <input type=\"checkbox\" data-index=${i} id=\"item${i}\" ${item.done ? 'checked' : ''} />\n <label for=\"item${i}\" class=\"strikey\">${item.text}</label>`;\n }).join('');\n\n }", "function toArray(list){\n var array = Array(list.length);\n for(let i=0; i < list.length; i++){\n array[i] = list[i];\n }\n return array;\n}", "_toStringArray(t) {\n if (!Array.isArray(t))\n throw TypeError();\n if (t.some(function(t) {\n return \"string\" != typeof t;\n }))\n throw TypeError();\n return t;\n }", "function makeListItems() {\n const jokes = jokeFacade.getJokes();\n let jokeList = jokes.map(joke => `<li> ${joke} </li>`);\n const listItemsAsStr = jokeList.join(\"\");\n document.getElementById(\"jokes\").innerHTML = listItemsAsStr;\n}", "function numToStrings(array) {\n return array.map(el => el + '')\n }", "function quotedOrList(items) {\n var selected = items.slice(0, MAX_LENGTH);\n return selected.map(function (item) {\n return '\"' + item + '\"';\n }).reduce(function (list, quoted, index) {\n return list + (selected.length > 2 ? ', ' : ' ') + (index === selected.length - 1 ? 'or ' : '') + quoted;\n });\n}", "function getArray1(items) {\n return new Array().concat(items);\n}", "function deepFlatten(strList, array) {\n for (const item of array) {\n if (Array.isArray(item)) {\n deepFlatten(strList, item);\n } // else if (item instanceof Declaration) {\n // strList.push(item.toString());\n // }\n else {\n strList.push(item);\n }\n }\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += Array.isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }", "function renderItemString(_ref) {\n\t var data = _ref.data;\n\t var getItemString = _ref.getItemString;\n\t var itemString = _ref.itemString;\n\t var itemType = _ref.itemType;\n\t\n\t if (!itemString) {\n\t itemString = data.length + ' item' + (data.length !== 1 ? 's' : '');\n\t }\n\t return getItemString('Array', data, itemType, itemString);\n\t}", "function renderItemString(_ref) {\n\t var data = _ref.data;\n\t var getItemString = _ref.getItemString;\n\t var itemString = _ref.itemString;\n\t var itemType = _ref.itemType;\n\n\t if (!itemString) {\n\t itemString = data.length + ' item' + (data.length !== 1 ? 's' : '');\n\t }\n\t return getItemString('Array', data, itemType, itemString);\n\t}", "function toArray(list) {\r\n\t return Array.prototype.slice.call(list || [], 0);\r\n\t}", "function listToArray(list){\n var array = [];\n var loop = list;\n while (loop != null){\n array.push(loop.value);\n loop = loop.rest;\n }\n return array;\n}", "function stringifyArr(arr){\n\tvar str = \"[\";\n\tarr.forEach(function(e){\n\t\tstr += \"'\"+e+\"', \";\n\t});\n\tstr += \"]\";\n\treturn str.replace(\"', ]\", \"']\");\t\n}", "function stringItUp(arr){\n stringArr = arr.map(function(num){\n return num.toString()\n })\n console.log(stringArr)\n}", "function makeArray(input_data) {\n var data_array = [];\n var data_string = input_data.asText(); //converts CSnap list object to a text string\n for (var i = 0; i < data_string.length; i++) {\n var val = \"\";\n while(data_string[i] !== \",\" && i < data_string.length) { //read through variable-length values until I hit a comma\n val += data_string[i];\n i++;\n }\n\n if(val !== \"\") {\n data_array.push(val);\n }\n }\n return data_array;\n }", "function SpecialArray() {\n var values = new Array();\n\n values.push.apply(values, arguments);\n \n values.toPipedString = function() {\n return this.join(\"|\");\n };\n \n return values;\n}", "static arrayToText(array, fn) {\n if (fn) {\n array = array.map(fn);\n }\n\n return array.join(', ').replace(/,(?=[^,]*$)/, this.L('L{ and }'));\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += Array.isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }", "function flattenToString(arr) {\n var i, iz, elem, result = '';\n for (i = 0, iz = arr.length; i < iz; ++i) {\n elem = arr[i];\n result += Array.isArray(elem) ? flattenToString(elem) : elem;\n }\n return result;\n }" ]
[ "0.68316925", "0.67684793", "0.6746222", "0.67011017", "0.6582725", "0.65249354", "0.64473766", "0.64360195", "0.6361075", "0.62616557", "0.6246455", "0.6209374", "0.604988", "0.6044432", "0.59681624", "0.58981097", "0.58836764", "0.58815295", "0.58758014", "0.5857577", "0.58357775", "0.58315676", "0.58025366", "0.579582", "0.5780514", "0.57514596", "0.5747078", "0.5744635", "0.56993335", "0.5693031", "0.5678251", "0.5670334", "0.5645112", "0.5645112", "0.5645112", "0.564056", "0.56360894", "0.56323975", "0.5631592", "0.56311804", "0.56311804", "0.56311804", "0.5610113", "0.5608769", "0.5605871", "0.5605871", "0.5600328", "0.5579083", "0.5562364", "0.55518556", "0.5551019", "0.55478334", "0.55181575", "0.55167955", "0.55167955", "0.55160713", "0.55148715", "0.5510381", "0.5507353", "0.5497051", "0.5497051", "0.5497051", "0.5496422", "0.5496422", "0.54915243", "0.54914755", "0.5488425", "0.5488271", "0.5481032", "0.5479687", "0.5478163", "0.54582316", "0.5448145", "0.54476213", "0.54474217", "0.5447146", "0.54311603", "0.54297805", "0.54281884", "0.5427918", "0.54266006", "0.5421754", "0.5417943", "0.54134995", "0.5405486", "0.5403965", "0.54024804", "0.5393668", "0.53912896", "0.53907174", "0.5379041", "0.53781474", "0.53612536", "0.5351915", "0.53456056", "0.53359777", "0.53356355", "0.5332956", "0.5332931", "0.5319525", "0.5319525" ]
0.0
-1
Create an array of GREP queries from the app and the user folder
function findQueries(queryType) { function findQueriesSub(dir) { var f = Folder(dir).getFiles('*.xml'); return f; } var indesignFolder = function() { if ($.os.indexOf ('Mac') > -1) { return Folder.appPackage.parent; } else { return Folder.appPackage; } } var queryFolder = app.scriptPreferences.scriptsFolder.parent.parent + "/Find-Change Queries/" + searchTypeResults[queryType].folder + "/"; var appFolder = indesignFolder() + '/Presets/Find-Change Queries/' + searchTypeResults[queryType].folder + '/' + $.locale; // Create dummy separator file var dummy = File(queryFolder + "----------.xml"); dummy.open('w'); dummy.write(''); dummy.close(); var list = findQueriesSub(appFolder); list = list.concat(findQueriesSub(queryFolder)); for (var i = list.length - 1; i >= 0; i--) { list[i] = decodeURI(list[i].name.replace('.xml', '')); } searchTypeResults[queryType].results = list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUsers() {\n const users = [];\n return new Promise((resolve, reject) => {\n // Scan for keys starting with user:\n this.rdsCli.scan(0, 'MATCH', 'user:*', 'COUNT', 100, (err, reply) => {\n if (err) {\n reject();\n }\n\n const totalUsers = reply[1].length;\n let i = 0; // Counter\n\n // Loop through and get data for each user\n _.forEach(reply[1], (user) => {\n this.rdsCli.hgetall(user, (err, reply) => {\n i++;\n users.push(reply); // Add to array\n\n // Resolve promise when finished\n if (i === totalUsers) {\n resolve(users);\n }\n });\n });\n });\n });\n }", "users(parent, args, { db }, info) {\n\n // no query: return all users\n if (!args.query) {\n return db.users;\n }\n\n // query: search for matches of query string with the user name and return filtered array\n return db.users.filter(user => user.name.toLowerCase().includes(args.query.toLowerCase()));\n\n }", "function config_gmail_search_array_() {\n\n // array of arrays, title of search, and then query to perform \n var five_mins_ago_timestamp = get_unix_timestamp_last_x_mins_(5);\n \n return [\n ['New email from bob in last 5 mins', 'from:[email protected] after:' + five_mins_ago_timestamp],\n //['Newer than 1 hour', 'newer_than:1h']\n ];\n\n}", "function getUserTestGlobs() {\n let userGlobs = process.argv.find(s => s.startsWith(\"watch-only\"));\n return userGlobs ? processUserGlobs(userGlobs) : [];\n}", "async BuildMatchlist() {\n\t\t\tlet _glob = async(pattern, filters) => {\n\t\t\t\tlet globBasepath = this.FindBasepath(pattern);\n\n\t\t\t\treturn await\n\t\t\t\t\tglobSync(pattern)\n\t\t\t\t\t\t.filter((filepath) =>\n\t\t\t\t\t\t\tfilters.find((filter) =>\n\t\t\t\t\t\t\t\t!filepath.match(new RegExp(filter))\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t.map((filepath) => {\n\t\t\t\t\t\t\tlet shortPath = filepath.replace(globBasepath, ''),\n\t\t\t\t\t\t\t\tparsedPath = path.parse(shortPath),\n\t\t\t\t\t\t\t\ttitle = `${shortPath.replace(parsedPath.ext, '')}`;\n\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tpath : filepath,\n\t\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\t\tdir : parsedPath.dir,\n\t\t\t\t\t\t\t\tbase : parsedPath.base,\n\t\t\t\t\t\t\t\text : parsedPath.ext,\n\t\t\t\t\t\t\t\tname : parsedPath.name,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t});\n\t\t\t};\n\n\t\t\treturn [].concat(...await Promise.all(\n\t\t\t\tthis.def.glob\n\t\t\t\t\t.map((pattern) => _glob(pattern, this.def.filters))\n\t\t\t));\n\t\t}", "function processUserGlobs(val) {\n let result = [];\n let fileListString = val.split(\"=\")[1];\n if (fileListString) {\n result = fileListString.split(\",\")\n .map(s => s.trim())\n .map(checkGlobPrefix);\n }\n return result;\n}", "function getallusers() {\n\n\t}", "function getQuery(req, res) {\n\n\tdb.child(queries).once('value')\n\t.then(function (snapshot) {\n\n\t\tlet userQueries = snapshot.val();\n\n\t\tlet data = {};\n\t\tdata[queries] = new Array();\n\n\t\tfor(user in userQueries) {\n\n\t\t\tlet obj = {};\n\n\t\t\temail = user.replace(/,/g, '.');\n\n\t\t\tobj[\"email\"] = email;\n\t\t\tobj[\"query\"] = new Array();\n\n\t\t\tfor(query in userQueries[user]) {\n\n\t\t\t\tobj[\"query\"].push(userQueries[user][query]);\n\t\t\t}\n\t\t\tdata[queries].push(obj);\n\t\t}\n\n\t\treturn res.status(200).json({\n\t\t\tsuccess: true,\n\t\t\tdata: data\n\t\t});\n\t})\n\t.catch(() => {\n\n\t\treturn res.status(500).json({\n\t\t\terror: \"error getting queries\",\n\t\t\tsuccess: false\n\t\t})\n\t})\n\n}", "async gatherDataFromServer(client) {\n const userPhids = [];\n const userPhidMap = new Map();\n\n const projPhids = [];\n const projPhidMap = new Map();\n\n // There is no specific \"apps.search\" call that can be made so we fall back\n // to using \"phid.query\" for PHID-APPS. This actually works across all\n // types, but the lookup results are less useful in addition to being less\n // detailed. Ex, \"fullName\" for a USER is `${username} (${realName})`.\n const genericPhids = [];\n const genericPhidMap = new Map();\n\n for (const [phid, info] of this._phidToInfo.entries()) {\n if (phid.startsWith('PHID-USER')) {\n userPhids.push(phid);\n userPhidMap.set(phid, info);\n } else if (phid.startsWith('PHID-PROJ')) {\n projPhids.push(phid);\n projPhidMap.set(phid, info);\n } else {\n genericPhids.push(phid);\n genericPhidMap.set(phid, info);\n }\n }\n\n let userSearchPromise;\n let projSearchPromise;\n let genericSearchPromise;\n\n if (userPhids.length > 0) {\n userSearchPromise = client.apiCall(\n 'user.search',\n {\n constraints: {\n phids: userPhids,\n }\n }\n );\n } else {\n userSearchPromise = Promise.resolve({ data: [] });\n }\n\n if (projPhids.length > 0) {\n projSearchPromise = client.apiCall(\n 'project.search',\n {\n constraints: {\n phids: projPhids,\n },\n }\n );\n } else {\n projSearchPromise = Promise.resolve({ data: [] });\n }\n\n if (genericPhids.length > 0) {\n genericSearchPromise = client.apiCall(\n 'phid.query',\n {\n phids: genericPhids,\n }\n );\n } else {\n genericSearchPromise = Promise.resolve({});\n }\n\n const userResults = await userSearchPromise;\n for (const userInfo of userResults.data) {\n const info = userPhidMap.get(userInfo.phid);\n // Remove the users as we match them up for invariant checking.\n userPhidMap.delete(userInfo.phid);\n\n info.name = userInfo.fields.realName;\n info.nick = `@${userInfo.fields.username}`;\n }\n\n const projResults = await projSearchPromise;\n for (const projInfo of projResults.data) {\n const info = projPhidMap.get(projInfo.phid);\n projPhidMap.delete(projInfo.phid);\n\n info.name = projInfo.description;\n info.nick = `#${projInfo.name}`;\n }\n\n const genericResults = await genericSearchPromise;\n // The results are an object dictionary where the `phid` of each value is\n // its key in the dictionary, so we don't need the key.\n for (const phidInfo of Object.values(genericResults)) {\n const info = genericPhidMap.get(phidInfo.phid);\n genericPhidMap.delete(phidInfo.phid);\n\n info.name = phidInfo.fullName;\n info.nick = `!${phidInfo.name}`;\n }\n\n if (userPhidMap.size !== 0) {\n console.warn('Some user lookups did not resolve:', userPhidMap);\n }\n if (projPhidMap.size !== 0) {\n console.warn('Some project lookups did not resolve:', projPhidMap);\n }\n if (genericPhidMap.size !== 0) {\n console.warn('Some generic/app lookups did not resolve:', genericPhidMap);\n }\n }", "function findAllUsers(){//https://developers.google.com/web/ilt/pwa/working-with-the-fetch-api\n return fetch(this.url).then(function(res){\n if( !(res.ok) ){\n throw Error(res.statusText)\n }\n return res\n }).then(function(response){\n return response.json()\n }).catch(function(error){alert(\"error try refresh\")})\n }", "function getUsers(query) {\n if ($scope.data.ACL.users.length) {\n var args = {\n options: {\n classUid: 'built_io_application_user',\n query: query\n }\n }\n return builtDataService.Objects.getAll(args)\n } else\n return $q.reject({});\n }", "getSongsByUser(userAuthAddress) {\n\t\tvar query = `\n\t\tSELECT * FROM songs\n\t\t\tLEFT JOIN json USING (json_id)\n\t\t\tWHERE directory=\"data/users/${userAuthAddress}\"\n\t\t\tORDER BY date_added ASC\n\t\t`;\n\t\tconsole.log(query)\n\t\n\t\treturn this.cmdp(\"dbQuery\", [query]);\n\t}", "function queriesFromGlobalMetadata(queries,outputCtx){return queries.map(function(query){var read=null;if(query.read&&query.read.identifier){read=outputCtx.importExpr(query.read.identifier.reference);}return{propertyName:query.propertyName,first:query.first,predicate:selectorsFromGlobalMetadata(query.selectors,outputCtx),descendants:query.descendants,read:read};});}", "async loadSuggestions (command, domain) {\r\n try {\r\n console.log('loadSuggestions')\r\n const process = new ProcessSpawner(command, ['list', 'items', '--session=' + this.sessionKey])\r\n const data = await process.executeSyncInAsyncContext()\r\n console.log('got data of length ', data.length)\r\n\r\n const matches = JSON.parse(data)\r\n console.log('got matches of length', matches.length)\r\n\r\n const credentials = matches.map(match => match).filter((match) => {\r\n try {\r\n var matchHost = new URL(match.overview.url).hostname\r\n if (matchHost.startsWith('www.')) {\r\n matchHost = matchHost.slice(4)\r\n }\r\n return matchHost === domain\r\n } catch (e) {\r\n return false\r\n }\r\n })\r\n\r\n var expandedCredentials = []\r\n\r\n for (var i = 0; i < credentials.length; i++) {\r\n const item = credentials[i]\r\n const process = new ProcessSpawner(command, ['get', 'item', item.uuid, '--session=' + this.sessionKey])\r\n const output = await process.executeSyncInAsyncContext()\r\n const credential = JSON.parse(output)\r\n\r\n var usernameFields = credential.details.fields.filter(f => f.designation === 'username')\r\n var passwordFields = credential.details.fields.filter(f => f.designation === 'password')\r\n\r\n if (usernameFields.length > 0 && passwordFields.length > 0) {\r\n expandedCredentials.push({\r\n username: usernameFields[0].value,\r\n password: passwordFields[0].value,\r\n manager: '1Password'\r\n })\r\n }\r\n }\r\n\r\n return expandedCredentials\r\n } catch (ex) {\r\n const { error, data } = ex\r\n console.error('Error accessing 1Password CLI. STDOUT: ' + data + '. STDERR: ' + error, ex)\r\n return []\r\n }\r\n }", "prepareGlobs(globs, projectRootPath) {\n const output = [];\n\n for (let pattern of globs) {\n // we need to replace path separators by slashes since globs should\n // always use always slashes as path separators.\n pattern = pattern.replace(new RegExp(`\\\\${path.sep}`, 'g'), '/');\n\n if (pattern.length === 0) {\n continue;\n }\n\n const projectName = path.basename(projectRootPath);\n\n // The user can just search inside one of the opened projects. When we detect\n // this scenario we just consider the glob to include every file.\n if (pattern === projectName) {\n output.push('**/*');\n continue;\n }\n\n if (pattern.startsWith(projectName + '/')) {\n pattern = pattern.slice(projectName.length + 1);\n }\n\n if (pattern.endsWith('/')) {\n pattern = pattern.slice(0, -1);\n }\n\n output.push(pattern);\n output.push(pattern.endsWith('/**') ? pattern : `${pattern}/**`);\n }\n\n return output;\n }", "getMyGenresFromIndex() {\n\t\tvar query = `\n\t\tSELECT * FROM genres\n\t\t\tLEFT JOIN json USING (json_id)\n\t\t\tWHERE directory=\"data/users/${userAuthAddress}\"\n\t\t\tORDER BY date_added ASC\n\t\t`;\n\t\n\t\treturn this.cmdp(\"dbQuery\", [query]);\n\t}", "getAll(query) {\n\t\treturn this.command(query, \"all\");\n\t}", "function getReposList() {\n fs.readFile(dir+filteredResults, function(err,data) {\n if (err) {\n return console.log(err);\n }\n var repos = JSON.parse(data);\n console.log(\"File \"+(dir+filteredResults)+\" has \"+repos.length+\" elements\");\n var index = 0;\n while (index < repos.length) {\n getDirectoryForRepo(repos[index]);\n index++;\n }\n });\n}", "function request_all_logins(){\n\tvar cmd_data = { \"cmd\":\"get_logins\"};\n\tcon.send(JSON.stringify(cmd_data));\n\tg_logins=[];\n}", "function getAllData(msgs,temp) {\n var sync = true;\n var arr = [];\n var temppulldata;\n var xx;\n for (var i = 0; i<msgs.length; i++) {\n console.log(JSON.stringify(msgs[i]));\n temppulldata = JSON.parse(fs.readFileSync('./mock/'+msgs[i].id+'.json'));\n var service = nock(\"https://www.googleapis.com/gmail/v1/users\")\n .get('/' + temp.gmailid + '/messages/' + msgs[i].id)\n .reply(200, temppulldata);\n xx = getData(temp.user, temp.gmailid, temp.gmailtoken, msgs[i].id);\n arr.push(xx);\n if(i==msgs.length -1)\n sync = false;\n }\n while(sync) {require('deasync').sleep(100);}\n nock.cleanAll()\n return arr;\n}", "function getDBList(callback) {\r\n module.nano.db.list(function(err, body) {\r\n var userDB = [];\r\n\tfor (var i = 0, len = body.length ; i < len ; i++ ){\r\n\t if (body[i] == '_replicator')\r\n\t \t continue;\r\n\t if (body[i] == '_users')\r\n\t\t continue;\r\n\t if (body[i] == 'history')\r\n\t\t continue;\r\n\t userDB.push(body[i]);\r\n\t }\r\n callback(userDB);\r\n });\r\n}", "async loadSuggestions (command, domain) {\r\n try {\r\n const process = new ProcessSpawner(command, ['list', 'items', '--url', this.sanitize(domain), '--session', this.sessionKey])\r\n const data = await process.execute()\r\n\r\n const matches = JSON.parse(data)\r\n const credentials = matches.map(match => {\r\n const { login: { username, password } } = match\r\n return { username, password, manager: 'Bitwarden' }\r\n })\r\n\r\n return credentials\r\n } catch (ex) {\r\n const { error, data } = ex\r\n console.error('Error accessing Bitwarden CLI. STDOUT: ' + data + '. STDERR: ' + error)\r\n return []\r\n }\r\n }", "users() {\r\n\t\treturn API.get(\"pm\", \"/list-users\");\r\n\t}", "function querySearch (query) {\n\t \t$scope.getPrincipals(query);\n\n\t var results = query ? $scope.emailsList.filter( createFilterFor(query) ) : $scope.emailsList,\n\t deferred;\n\t if ($scope.simulateQuery) {\n\t deferred = $q.defer();\n\t $timeout(function () { deferred.resolve( results ); }, Math.random() * 1000, false);\n\t return deferred.promise;\n\t } else {\n\t \tvar emailListVar = [];\n\n\t \tangular.forEach(results, function(email) {\n\t \t \temailListVar.push({\"email\" : email})\n\t \t});\n\t \tconsole.log('emailListVar',emailListVar);\n\t return emailListVar;\n\t }\n\t }", "static async getAllUsers() {\n try {\n //establish connection with db server\n const [ db, client ] = await getConnection();\n\n //retrieve CURSOR OBJECT containing pointers to all users from database\n const result = await db.collection('users').find({});\n\n //get object array from cursor\n const resultArray = await result.toArray();\n\n //if no users, throw 404\n if (!resultArray.length) throw new ExpressError('There are no users in the database', 404);\n\n //close database connection\n client.close();\n\n //return array\n return resultArray;\n } catch(err) {\n //throw express error\n if (client) client.close();\n throw new ExpressError(err.message, err.status || 500);\n }\n }", "function getPullList(userId, gmailId, gmailToken)\n{\n var sync = true;\n var data = null;\n var options = {\n url: 'https://www.googleapis.com/gmail/v1/users/' + gmailId + \"/messages?maxResults=20\", // Add search string in the end as '&q=\"You can view, comment on, or merge this pull request online at\"'\n method: 'GET',\n headers: {\n \"content-type\": \"application/json\",\n \"Authorization\": \"Bearer \"+ gmailToken\n }\n };\n request(options, function (error, response, body)\n {\n console.log(\"HTTP response headers are the following:\\n\" + \"Response: \" + JSON.stringify(response) + \"\\nError:\" + error + \"\\nBody\" + JSON.stringify(body) + \"\\n\");\n if (error)\n\t\t\tdata = error;\n else\n \tdata = JSON.parse(body);\n sync = false;\n });\n while(sync) {require('deasync').sleep(100);}\n return data;\n\n}", "async queryAllUsers(stub, args) {\n let usersArray = [];\n\n for (let i = 0; i < args.length; i++) {\n let userAsBytes = await stub.getState(args[i]);\n if (userAsBytes != null && userAsBytes.length != 0) {\n usersArray.push(JSON.parse(userAsBytes.toString('utf8')));\n }\n }\n\n // let users = {};\n // users.users = usersArray;\n return usersArray;\n }", "async _whereIsQueries(ip) {\n return await Promise.all([\n server.database.query(WHEREIS_PROXY_QUERY, ip, ip),\n server.database.query(WHEREIS_LOCATION_QUERY, ip, ip),\n ]);\n }", "static getUsers() {\n return API.fetcher(\"/user\");\n }", "getIrcUsers(verbose) {\r\n\t\treturn new Promise(topres => {\r\n\t\t\tthis.irc.send(\"names\", this.channel);\r\n\t\t\tthis.irc.once(`names${this.channel}`, nicks => {\r\n\t\t\t\tif(verbose){\r\n\t\t\t\t\tPromise.all(\r\n\t\t\t\t\t\tObject.keys(nicks).map(nick => new Promise(res => {\r\n\t\t\t\t\t\t\tthis.irc[this.irc.expanded ? \"wii\" : \"whois\"](nick, res);\r\n\t\t\t\t\t\t}))\r\n\t\t\t\t\t).then(topres);\r\n\t\t\t\t}else{\r\n\t\t\t\t\ttopres(Object.keys(nicks));\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t})\r\n\t}", "function get_users(){\n\tconst q = datastore.createQuery(USER);\n\treturn datastore.runQuery(q).then( (entities) => {\n\t\t\treturn entities[0].map(ds.fromDatastore);\n\t\t});\n}", "function grepMain() {\r\n\r\n\tlet argLen = process.argv.length;\r\n\r\n\t// The first element will be process.execPath\r\n\t// The second element will be the path to the JavaScript file being executed\r\n\t// The remaining elements will be any additional command line arguments\r\n\tif(argLen <= 2) {\r\n\t\tconsole.log(\"Usage: grep [-icR] [pattern] [file]\");\r\n\t\treturn;\r\n\t} else if (argLen > 5) {\r\n\t\tconsole.log(\"Wrong number of arguments, Usage: grep [-icR] [pattern] [file]\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tvar argPromise = new Promise(function(resolve, reject) {\r\n\t\t\r\n\t\tlet options = '';\r\n\r\n\t\tprocess.argv.forEach((val, index) => {\r\n\r\n\t\t //console.log(`${index}: ${val}`);\r\n\r\n\t\t if(argLen === 4) {\r\n\r\n\t\t \tif(index === 2)\r\n\t\t \t\tpattern = val;\r\n\t\t \telse\r\n\t\t \t\tfileLoc = val;\r\n\r\n\t\t } else if (argLen === 5) {\r\n\r\n\t\t \tif(index === 2)\r\n\t\t \t\toptions = val;\r\n\t\t \telse if(index === 3)\r\n\t\t \t\tpattern = val;\r\n\t\t \telse\r\n\t\t \t\tfileLoc = val;\r\n\r\n\t\t }\r\n\r\n\t\t if (index === argLen-1) {\r\n\t\t \targObj = {\r\n\t\t\t\t'options': options,\r\n\t\t\t\t'pattern': pattern,\r\n\t\t\t\t'fileLoc': fileLoc\r\n\t\t \t}\r\n\r\n\t\t \tresolve(argObj);\r\n\t\t }\r\n\r\n\t\t});\r\n\r\n\t});\r\n\r\n\targPromise.then(function(argObj) {\r\n\r\n\t\t// Print promise object\r\n\t\t//console.log(argObj);\r\n\r\n\t\tlet options = argObj.options;\r\n\t\tlet pattern = argObj.pattern;\r\n\t\tlet fileLoc = argObj.fileLoc;\r\n\r\n\t\tif (options.indexOf('r') > 0) {\r\n\r\n\t\t\trecursive(fileLoc, function (err, files) {\r\n\r\n\t\t\t\tif(err){\r\n\t\t\t\t\tconsole.log('Error: not able to find directory');\r\n\t\t\t\t\tprocess.exit(1);\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// `files` is an array of file paths\r\n\t\t\t\t//console.log(files);\r\n\r\n\t\t\t\t(async function loop() {\r\n\t\t\t\t\tfor (let i = 0; i < files.length; i++) {\r\n\t\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve, Math.random() * 1000));\r\n\t\t\t\t\t\tprint(files[i]);\r\n\t\t\t\t\t}\r\n\t\t\t\t})();\r\n\r\n\t\t\t});\r\n\r\n\t\t} else {\r\n\t\t\tprint(fileLoc);\r\n\t\t}\r\n\r\n\t\tfunction print(fileLoc) {\r\n\r\n\t\t\tconst fileStream = fs.createReadStream(fileLoc);\r\n\r\n\t\t\tfileStream.on('error', function(err) {\r\n\t\t\t\tif(err) {\r\n\t\t\t\t\tconsole.log('Invalid argument: ' + err);\r\n\t\t\t\t\tprocess.exit(1);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tconst rd = readline.createInterface({\r\n\t\t\t input: fileStream,\r\n\t\t\t output: process.stdout,\r\n\t\t\t terminal: false\r\n\t\t\t});\r\n\r\n\t\t\tlet countOfMatchedLines = 0;\r\n\r\n\t\t\trd.on('line', function(line) {\r\n\r\n\t\t\t\tif(options != '') {\r\n\r\n\t\t\t\t\tlet flgOpt = '';\r\n\r\n\t\t\t\t\tif (options[0] != \"-\") {\r\n\t\t\t\t\t\tconsole.log('Invalid options!');\r\n\t\t\t\t\t\tprocess.exit(1);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(options.indexOf('i') > 0) {\r\n\r\n\t\t\t\t\t\tflgOpt = 'i';\r\n\r\n\t\t\t\t\t\tlet lowerLine = line.toLowerCase();\r\n\t\t\t\t\t\tlet lowerPattern = pattern.toLowerCase();\r\n\r\n\t\t\t\t\t\tif(lowerLine.includes(lowerPattern)){\r\n\r\n\t\t\t\t\t\t\tif(options.indexOf('r') > 0) {\r\n\r\n\t\t\t\t\t\t\t\tif(options.indexOf('c') <= 0) {\r\n\t\t\t\t\t\t\t\t\tconsole.log(fileLoc + ': ' + line + '\\n');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t} else if(options.indexOf('c') <= 0) {\r\n\r\n\t\t\t\t\t\t\t\tconsole.log(line);\r\n\r\n\t\t\t\t\t\t\t} \r\n\r\n\t\t\t\t\t\t}\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(options.indexOf('c') > 0) {\r\n\r\n\t\t\t\t\t\tif(flgOpt=='i') {\r\n\t\t\t\t\t\t\tline = line.toLowerCase();\r\n\t\t\t\t\t\t\tpattern = pattern.toLowerCase();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif(line.includes(pattern)){\r\n\t\t\t\t\t\t\tcountOfMatchedLines++;\r\n\t\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(options.indexOf('r') > 0 && flgOpt != 'i' && options.indexOf('c') <= 0) {\r\n\r\n\t\t\t\t\t\tif(line.includes(pattern)){\r\n\t\t\t\t\t\t\tconsole.log(fileLoc + ': ' + line + '\\n');\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif(line.includes(pattern)){\r\n\t\t\t\t\t\tconsole.log(line);\r\n\t\t\t\t\t}\t\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\t\t\trd.on('close', function(line) {\r\n\r\n\t\t\t\tif(countOfMatchedLines>0) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(options.indexOf('r') > 0) {\r\n\t\t\t\t\t\tconsole.log(fileLoc +': ' + countOfMatchedLines);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tconsole.log(countOfMatchedLines);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\t\t}\r\n\t\t\r\n\t});\r\n\r\n}", "function allAccessSearch() {\n var deferred = Q.defer();\n\n that.pm.search(query, 25, function(err, data) {\n if (err) { deferred.reject(err); return; }\n\n var songs = (data.entries || []).map(function(res) {\n var ret = {};\n\n ret.score = res.score;\n\n if (res.type == \"1\") {\n ret.type = \"track\";\n ret.track = that._parseTrackObject(res.track);\n }\n else if (res.type == \"2\") {\n ret.type = \"artist\";\n ret.artist = res.artist;\n }\n else if (res.type == \"3\") {\n ret.type = \"album\";\n ret.album = res.album;\n }\n\n return ret;\n });\n\n deferred.resolve(songs);\n });\n\n return deferred.promise;\n }", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(function (query) {\n var read = null;\n\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants,\n read: read,\n static: !!query.static\n };\n });\n }", "function getAll (query) {\n return service.get('/user/all', {\n params: query\n })\n}", "allUsers() { return queryAllUsers() }", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(function (query) {\n var read = null;\n\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants,\n read: read,\n static: !!query.static\n };\n });\n}", "function getSearchResults() {\n return browser.loadOptions().then(function(options) {\n return gerrit.fetchAllowedInstances(options).then(function(instances) {\n var hosts = instances.map(function(instance) { return instance.host; });\n return comm.sendMessage('getSearchResults', hosts).then(\n function(wrapper) {\n var results = undefined;\n if (wrapper.results.length !== 0) {\n results = new gerrit.SearchResults(wrapper.results.map(\n function(result) {\n return gerrit.SearchResult.wrap(\n result.host, result.user, result.data, options);\n }));\n }\n\n var errors = undefined;\n if (wrapper.errors.length !== 0) {\n errors = wrapper.errors.map(function(element) {\n return {\n host: element.host,\n error: browser.FetchError.wrap(element.error),\n };\n });\n }\n\n return Promise.resolve({\n results: results,\n errors: errors,\n });\n });\n });\n });\n}", "function getAllItems() {\n // load query details to json object\n var oWebsite = context.get_web();\n context.load(oWebsite);\n var tasksEntries = [];\n\n context.executeQueryAsync(function () {\n\n var itemsCount = collListItem.get_count();\n for (var i = 0; i < itemsCount; i++) {\n var item = collListItem.itemAt(i);\n var taskEntry = item.get_fieldValues();\n\n taskEntry.SourceURL = context.get_web().get_serverRelativeUrl() + \"/Lists/\" + options.listName + \"/\" + taskEntry.DocumentName;\n tasksEntries.push(helperService.parse(taskEntry, options.fields.mappingFromSP));\n\n }\n\n deferred.resolve(tasksEntries);\n\n\n });\n\n\n\n }", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(function (query) {\n var read = null;\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants, read: read,\n };\n });\n}", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(function (query) {\n var read = null;\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants, read: read,\n };\n });\n}", "function getUserPictures() {\n let query = \"command=loadPictureList\";\n query += \"&username=\" + endabgabe2.globalUser;\n console.log(query);\n sendRequest(query, handlePictureListeResponse);\n }", "function getUsers(query) {\n return new Promise(function (resolve, reject) {\n\n if (!query || query.length < MIN_CHARS_TO_SEARCH) {\n // No query - no server results.\n return resolve([]);\n }\n\n AJS.debug('server-users-supplier: Looking in cache for ' + query);\n var cacheEntry = cache.getClosest(query);\n if (cacheEntry) {\n AJS.debug('server-users-supplier: Found cache entry with query ' + cacheEntry.query);\n if (cacheEntry.query === query) {\n // Exact match - just serve these results.\n return resolve(cacheEntry.users);\n }\n\n // Not an exact match. Might need a REST call, but we can show results based on what we have cached.\n var rankedUsers = UserRanker(cacheEntry.users, query);\n cache.add(query, rankedUsers);\n\n // TODO Always resolve with what we have from the cache - this is information that can be put in front of\n // the user immediately. We then decide whether to follow up the local results with remote ones.\n // However, we need the ability to 'resolve' multiple times - to call the render once with the cached\n // results and again (if not debounced, stale, etc, etc) with the server results.\n if (cacheEntry.isExhausted) {\n return resolve(rankedUsers);\n }\n\n // Else we might be searching for \"John\" but \"Joh\" already has >={limit} users.\n // We need to hit the server!\n // TODO - can we resolve multiple times?\n }\n\n var contextPath = Meta.get('context-path');\n var escapedQuery = LuceneQuery.escape(query);\n var queryParameters = {\n cql: 'user ~ \"' + Confluence.unescapeEntities(escapedQuery) + '\"',\n start: 0,\n limit: limit\n };\n var url = contextPath + '/rest/api/search';\n var success = function success(response) {\n var results = response.results;\n var users = results.map(function (result) {\n var user = result.user;\n user.supplier = UserSupplier.SERVER;\n user.timestamp = result.timestamp;\n AJS.debug('server-users-supplier: Adding user to cache: ' + user.username);\n return user;\n });\n cache.add(query, users);\n resolve(users);\n };\n\n // Debounce\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(function () {\n $.getJSON(url, queryParameters, success).fail(reject);\n }, DEBOUNCE_WAIT_MS);\n });\n }", "function getUsers(query) {\n return new Promise(function (resolve, reject) {\n\n if (!query || query.length < MIN_CHARS_TO_SEARCH) {\n // No query - no server results.\n return resolve([]);\n }\n\n AJS.debug('server-users-supplier: Looking in cache for ' + query);\n var cacheEntry = cache.getClosest(query);\n if (cacheEntry) {\n AJS.debug('server-users-supplier: Found cache entry with query ' + cacheEntry.query);\n if (cacheEntry.query === query) {\n // Exact match - just serve these results.\n return resolve(cacheEntry.users);\n }\n\n // Not an exact match. Might need a REST call, but we can show results based on what we have cached.\n var rankedUsers = UserRanker(cacheEntry.users, query);\n cache.add(query, rankedUsers);\n\n // TODO Always resolve with what we have from the cache - this is information that can be put in front of\n // the user immediately. We then decide whether to follow up the local results with remote ones.\n // However, we need the ability to 'resolve' multiple times - to call the render once with the cached\n // results and again (if not debounced, stale, etc, etc) with the server results.\n if (cacheEntry.isExhausted) {\n return resolve(rankedUsers);\n }\n\n // Else we might be searching for \"John\" but \"Joh\" already has >={limit} users.\n // We need to hit the server!\n // TODO - can we resolve multiple times?\n }\n\n var contextPath = Meta.get('context-path');\n var escapedQuery = LuceneQuery.escape(query);\n var queryParameters = {\n cql: 'user ~ \"' + Confluence.unescapeEntities(escapedQuery) + '\"',\n start: 0,\n limit: limit\n };\n var url = contextPath + '/rest/api/search';\n var success = function success(response) {\n var results = response.results;\n var users = results.map(function (result) {\n var user = result.user;\n user.supplier = UserSupplier.SERVER;\n user.timestamp = result.timestamp;\n AJS.debug('server-users-supplier: Adding user to cache: ' + user.username);\n return user;\n });\n cache.add(query, users);\n resolve(users);\n };\n\n // Debounce\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(function () {\n $.getJSON(url, queryParameters, success).fail(reject);\n }, DEBOUNCE_WAIT_MS);\n });\n }", "function getAllData() {\n return Promise.all(gitHubUsers.map( item => getUserData(item)))\n }", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(query => {\n let read = null;\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants, read,\n static: !!query.static\n };\n });\n}", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(query => {\n let read = null;\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants, read,\n static: !!query.static\n };\n });\n}", "function contacts(queries) {\n const names = [],\n result = [];\n // * Loop through queries\n for (const [operation, name] of queries) {\n switch (operation) {\n case \"add\":\n names.push(name);\n break;\n case \"find\":\n result.push(\n names.map((n) => n.startsWith(name)).reduce((a, b) => a + b)\n );\n break;\n }\n }\n return result;\n}", "getRepoList(opts) {\n\t\tconst query = encodeQueryString(opts);\n\t\treturn this._get(`/api/user/repos?${query}`);\n\t}", "function PathSearchResultCollector() {\n\n}", "function getAllUsers() {\n let todoUsersDB = storage.getItem('P1_todoUsersDB');\n\n if (todoUsersDB) { return JSON.parse(todoUsersDB); }\n else { return []; }\n }", "async AllUsers(p, a, { app: { secret, cookieName }, req, postgres, authUtil }, i) {\n const getUsersQ = {\n text: 'SELECT * FROM schemaName.users'\n }\n\n const getUsersR = await postgres.query(getUsers)\n\n return getUsersR.rows\n }", "listAuthUserRepos(params) {\n\t\t\treturn minRequest.get('/user/repos', params)\n\t\t}", "function queriesFromGlobalMetadata(queries, outputCtx) {\n return queries.map(function (query) {\n var read = null;\n if (query.read && query.read.identifier) {\n read = outputCtx.importExpr(query.read.identifier.reference);\n }\n return {\n propertyName: query.propertyName,\n first: query.first,\n predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),\n descendants: query.descendants, read: read,\n static: !!query.static\n };\n });\n}", "function doGetAllRootApp() {\n\treturn new Promise(function(resolve, reject) {\n\t\tconst pool = require('../app/db/dbpool.js').getPool();\n\t\t//let hoses = await tempDB.hospitals.findAll({ attributes: ['id', 'Hos_RootPathUri'], raw: true });\n\t\tpool.connect().then(client => {\n\t\t\tclient.query('BEGIN');\n\t\t\tvar sqlCmd = 'select \"id\", \"Hos_Name\", \"Hos_RootPathUri\" from \"hospitals\"';\n\t\t\tclient.query(sqlCmd, []).then(res => {\n\t\t\t\tif (res.rowCount > 0){\n\t\t\t\t\tclient.query('COMMIT');\n\t\t\t\t\tresolve(res.rows);\n\t\t\t\t} else {\n\t\t\t\t\tresolve({});\n\t\t\t\t}\n\t\t\t}).catch(err => {\n\t\t\t\tclient.query('ROLLBACK');\n\t\t\t\treject(err.stack)\n\t\t\t});\n\t\t\tclient.release();\n\t\t});\n\t});\n}", "function getAllChallenges(path) {\n var appIndex = getIndexFromAttr([], \"appName\", path.app);\n var grps = getData([appIndex]).groups;\n return function(data) {\n console.log(grps);\n return grps.reduce(function(accu, group) {\n return accu.concat(group.challenges.map(function(ch) {ch.group = group.groupID; return ch;}));\n }, []).map(function(chal) {\n return {params: {app: path.app, group: chal.group, challenge: chal.challengeID, UID: data.UID}, textDesc: chal.textDesc};\n });\n }\n}", "function users(callback) {\n\tif (_windows) {\n\t\tcallback(NOT_SUPPORTED);\n\t}\n\n\tvar result = [];\n\texec(\"users\", function(error, stdout) {\n\t\tif (!error) {\n\t\t\tresult = stdout.toString().replace(/ +/g, \" \").replace(/\\n+/g, \" \").trim().split(' ').filter(function(e) {return e.trim() !== ''});\n\t\t}\n\t\tcallback(result);\n\t});\n}", "async getSuggestions (domain) {\r\n if (this.lastCallList[domain] != null) {\r\n return this.lastCallList[domain]\r\n }\r\n\r\n const command = this.path\r\n if (!command) {\r\n return Promise.resolve([])\r\n }\r\n\r\n if (this.sessionKey == null) {\r\n throw new Error()\r\n }\r\n\r\n this.lastCallList[domain] = this.loadSuggestions(command, domain).then(suggestions => {\r\n this.lastCallList[domain] = null\r\n return suggestions\r\n }).catch(ex => {\r\n this.lastCallList[domain] = null\r\n })\r\n\r\n return this.lastCallList[domain]\r\n }", "async getSuggestions (domain) {\r\n if (this.lastCallList[domain] != null) {\r\n return this.lastCallList[domain]\r\n }\r\n\r\n const command = this.path\r\n if (!command) {\r\n return Promise.resolve([])\r\n }\r\n\r\n if (this.sessionKey == null) {\r\n throw new Error()\r\n }\r\n\r\n this.lastCallList[domain] = this.loadSuggestions(command, domain).then(suggestions => {\r\n this.lastCallList[domain] = null\r\n return suggestions\r\n }).catch(ex => {\r\n this.lastCallList[domain] = null\r\n })\r\n\r\n return this.lastCallList[domain]\r\n }", "static async getUsers (token) {\n const query = `*[_type == 'user'] {\n name,\n _id\n }\n `\n client.config({ token })\n return client.fetch(query)\n }", "function querySearch (query) {\n\t\t\t\t\t\t \t//var results = $rootScope.clients;\n\t\t\t\t\t\t\t var results = query ? $rootScope.clients.filter(createFilterFor(query)) : $rootScope.clients,\n\t\t\t\t\t\t deferred;\n\t\t\t\t \t\t\treturn results;\n\t\t\t\t\t\t\t \n//\t\t\t\t\t\t \tvar urlClients = protocol_url + appHost + \"/client/operator/list\"\n//\t\t\t\t\t\t\t var data = {domain:appFirmDomain}\n//\t\t\t\t\t\t return httpService.GET(urlClients,data).then(\n//\t\t\t\t\t\t \t\tfunction(response) {\n//\t\t\t\t\t\t \t\t\tvar results = response.data;\n//\t\t\t\t\t\t \t\t\treturn results;\n//\t\t\t\t\t\t\t\t\t}\n//\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t }", "function getSearches(req, res) {\n\tif (!req.session.user) {\n\t\tres.end();\n\t\treturn;\n\t}\n\tvar result;\n\tvar username = req.session.user;\n\tmongo.connect(\"mongodb://localhost:27017/\", function(err, db) {\n\t\tif(err) {\n\t\t\tconsole.log(\"Database error\");\n\t\t\treturn;\n\t\t}\n\t\tvar collection = db.collection('users');\n\t\tcollection.find({username : username}).toArray(function(err,items) {\n\t\t\t// Setting up user Session (=email)\n\t\t\tif (!err) {\n\t\t\t\tresult = items[0].searches;\n\t\t\t\tres.json(result);\n\t\t\t}\n\t\t});\n\t});\n}", "expandGlobPatterns(context, argv) {\n const nextArgv = [];\n this.debug('Expanding glob patterns');\n argv.forEach((arg) => {\n if (arg.charAt(0) !== '-' && is_glob_1.default(arg)) {\n const paths = fast_glob_1.default\n .sync(arg, {\n cwd: String(context.cwd),\n onlyDirectories: false,\n onlyFiles: false,\n })\n .map((path) => new common_1.Path(path).path());\n this.debug(' %s %s %s', arg, chalk_1.default.gray('->'), paths.length > 0 ? paths.join(', ') : chalk_1.default.gray(this.tool.msg('app:noMatch')));\n nextArgv.push(...paths);\n }\n else {\n nextArgv.push(arg);\n }\n });\n return nextArgv;\n }", "async getResults(query, data) { // * Updated this function to run asynchronously\n if (!query) return [];\n if(this.options.endpoint !== undefined) { // ! Added this conditional to run the logic supplied on component construction\n data = await this.options.getUserData(query, this.options.endpoint, this.options.numOfResults);\n }\n // Filter for matching strings\n return data.filter((item) => {\n return item.text.toLowerCase().includes(query.toLowerCase());\n });\n }", "async function getUserList() {\n\n // Connection properties\n var options = {\n method: 'GET',\n uri: conf.API_PATH + `5808862710000087232b75ac`,\n json: true\n };\n\n return (await request(options)).clients;\n}", "function user_extra_params(query, params, rtc) {\n var queries = params || [];\n\n for (var key in query.user_query) {\n if (key === 'app' || key === 'autostart' || key === 'dir'\n || key === 'filename' || key === 'host' || key === 'hostname'\n || key === 'http_port' || key === 'pathname' || key === 'port'\n || key === 'server' || key === 'stream' || key === 'buffer'\n || key === 'schema' || key === 'vhost' || key === 'api'\n || key === 'path'\n ) {\n continue;\n }\n\n if (query[key]) {\n queries.push(key + '=' + query[key]);\n }\n }\n\n return queries;\n}", "getMatches(loggedInUserId, gender, religion, minAge, maxAge) {\n\n\n return new Promise( function (resolve,reject) {\n let db = new sqlite3.Database(file);\n\n let sql = \n `SELECT * FROM user \n WHERE gender=\"${gender}\"\n AND religion=\"${religion}\"\n AND age >= ${minAge}\n AND age <= ${maxAge}\n AND id != ${loggedInUserId}\n LIMIT 10`;\n\n db.all(sql,function(err,rows) {\n if (err) {\n reject(err);\n } else {\n resolve(rows);\n }\n });\n\n db.close();\n });\n }", "function makeQueryToGetAppData() {\n if (os_system === 'win32') {\n return '\"order by $id asc\"';\n }\n return '\"order by \\\\$id asc\"';\n}", "function populateSystemUsers() {\n\tvar searchSystemUser = $(\"#id_input_search_system_user\").val();\n\trequest_url = SYSTEM_USERS_URL;\n\trequest_params = ACTION_TYPE + \"=\" + ACTION_QUERY + \"&\" + SEARCH_KEY + \"=\"\n\t\t\t+ searchSystemUser + \"&\" + RESULT_FORMAT + \"=\"\n\t\t\t+ RESULT_FORMAT_TABLE_ROWS;\n\trequest_intent = INTENT_QUERY_SYSTEM_USERS;\n\tsendPOSTHttpRequest(request_url, request_params, request_intent);\n}", "function getQueries(req, res, next) {\n var query = req.query;\n req.clientQueries = {\n sort: parseSort(query[queries.sort]),\n page: parsePaginate(query[queries.page]),\n search: query[queries.search],\n filters: parseFilters(query)\n };\n next();\n}", "function makePromisesArray(preferences) {\n const { cuisine, radius, currLocation, diningExp, open } = preferences;\n // If the user specified delivery the default to 15 mile radius.\n // Else default to max radius allowed by the API.\n const defaultRadiusMeters =\n diningExp === 'meal_delivery' ? milesToMeters(15) : 50000;\n const proxyUrl = 'https://cors-anywhere.herokuapp.com/';\n const nearbySearchBaseUrl =\n 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?';\n const promises = [];\n const cuisineTypes = cuisine;\n // Make sure we still create a promise even if no cuisine type is specified.\n // This will make the text search query just \"restaurant\" without specifying a cuisine.\n if (!cuisineTypes.length) {\n cuisineTypes.push('');\n }\n for (const cuisineType of cuisineTypes) {\n const searchParams = new URLSearchParams();\n searchParams.append('type', 'restaurant');\n searchParams.append('location', currLocation.lat + ',' + currLocation.lng);\n if (cuisineType) {\n searchParams.append('keyword', cuisineType);\n }\n if (radius.pref) {\n searchParams.append('radius', milesToMeters(radius.pref));\n } else {\n searchParams.append('radius', defaultRadiusMeters);\n }\n if (open) {\n searchParams.append('opennow', open);\n }\n searchParams.append('key', process.env.REACT_APP_GOOGLE_API_KEY);\n promises.push(\n fetch(proxyUrl + nearbySearchBaseUrl + searchParams, {\n headers: {\n 'Access-Control-Allow-Origin': '*',\n 'Content-Type': 'application/json',\n },\n })\n );\n }\n return promises;\n}", "static async getAll(userName) {\n let projection = {\n aliases: 1, contactPersons: 1, name: 1, \"clientAddress.state.name\": 1,\n \"clientAddress.country.name\": 1\n }\n try {\n const db = mongodb.getDB();\n let aggregate = await db.db().collection(Collection.CLIENT_PROJECT_PERMISSION).aggregate(\n [\n { \"$match\": { \"userName\": userName } },\n { \"$unwind\": \"$clients\" },\n { \"$lookup\": { \"from\": \"client\", \"localField\": \"clients\", \"foreignField\": \"_id\", \"as\": \"data\" } }]\n ).toArray();\n //let result = await DatabaseService.getAll(collectionName, projection);\n if (aggregate.length > 0) {\n\n return aggregate[0].data;\n } else {\n return [];\n }\n\n } catch (err) {\n throw err;\n }\n\n }", "getCmds() {\n return new Promise((resolve, reject) => {\n this.collection.find({}).toArray((err, cmds) => {\n if (err) {\n logger.error(err);\n return reject(err);\n } else {\n return resolve(cmds);\n }\n });\n });\n }", "function get_users(){\n var q = datastore.createQuery(USERS);\n\n return datastore.runQuery(q).then( (entities) => {\n return entities;\n });\n}", "function showdbs(){\n\n\tif(!loggedIn){//log in and try again\n\t\treturn login(function(){\n\t\t\tshowdbs();\n\t\t});\n\t}\n\tvar options = {\n\t\turl\t: \"https://en.reddit.com/subreddits/mine/moderator.json\",\n\t\theaders\t: {\n\t\t\t'User-Agent' : 'Mongit/1.0.0 by mjkaufer',\n\t\t\t'X-Modhash'\t: modhash,\n\t\t\t'Cookie' : 'reddit_session=' + encodeURIComponent(cookie)\n\t\t},\n\t\tmethod : 'GET'\n\t};\n\trequest(options, function(err, res, body){\n\t\tif(err){\n\t\t\tconsole.log(err.stack);\n\t\t\tconsole.log(\"Couldn't find dbs you are a contributor to\");\n\t\t\treturn;\n }\n\n\t\tbody = JSON.parse(body); // the json isn't manuverable without this :(\n\t\tdbs=[]; // sets to empty string\n\t\tfor(var i=0; i<body.data.children.length;i++){\n\t\t\tdbs.push(body.data.children[i].data.display_name) // recreates array\n\t\t}\n\t\tconsole.log(\"Databases:\",dbs);\n\t\treturn;\n\t})\n\n}", "function getAllPolls()\n{\n return new Promise(\n function(resolve, reject)\n {\n MongoClient.connect(process.env.MONGODB_URL,function(error, database)\n {\n if(error) throw error;\n else\n {\n var databaseObject = database.db(\"fcc_node_challenge_one\");\n databaseObject.collection(\"VotingApplication\").find({}).toArray(function(err, result) {\n if(err) reject(err);\n else\n {\n database.close();\n resolve(result);\n }\n });\n }\n });\n }\n );\n}", "async function getMatches(query) {\n const queryParts = query.toLowerCase().split(' ');\n const [\n tabs,\n tabGroups,\n ] = await Promise.all([\n chrome.tabs.query({}),\n chrome.tabGroups.query({}),\n ]);\n const tabGroupsById = tabGroups.reduce((acc, tabGroup) => {\n acc[tabGroup.id] = tabGroup;\n return acc;\n }, {});\n\n return tabs\n .filter(tab => tab.url !== location.href)\n .map(tab => Object.assign({}, tab, {\n matchesTitle: matchesQuery(queryParts, tab.title),\n matchesUrl: matchesQuery(queryParts, tab.url),\n group: tabGroupsById[tab.groupId],\n }))\n .filter(tab => tab.matchesTitle || tab.matchesUrl);\n}", "function getUsers() {\n let ourQuery = 'SELECT employeeID, name FROM QAA.user_TB';\n return makeConnection.mysqlQueryExecution(ourQuery, mySqlConfig);\n}", "function QueryGeo()\n{\n\tconsole.log(\"QueryGeo length: \" + geoquery.length);\n\tvar data = {queries: geoquery};\n\tqueueMsg('QueryGeo', data);\n\tgeoquery=[]; //empty the geoquery array\n}", "function getProgramInfo (urlList) {\n var deferred = $q.defer();\n\n // Fire all http calls\n $q.all(urlList.map(function (_url) {\n return $http({method: 'GET', url: _url});\n })).then(function (results) { \n deferred.resolve(results);\n });\n\n return deferred.promise;\n }", "async populate (req, res) {\n const users = await User.find({}).populate('queries').populate('location')\n\n users.forEach(user => {\n const { location, queries } = user\n\n queries.forEach(query => {\n const prefs = {\n categoryId: AdsHelper.CAR_CATEGORY,\n locationId: location.publicId\n }\n const searchCriteria = {\n keywords: AdsHelper.formatQueryToKeywords(query),\n minPrice: query.minPrice,\n maxPrice: query.maxPrice\n }\n\n kijiji.query(prefs, searchCriteria, async (err, ads) => {\n if (err) {\n return res.status(400).send(err)\n }\n await ads.forEach(ad => saveNewAd(query, ad))\n res.send('Done populating!')\n })\n })\n })\n }", "function watched_domains(user_id) {\n // query to get domains which the\n // user is only watching\n var q = [{\n \"id\": null,\n \"name\": i18n.mql.query.name(),\n \"type\": \"/type/domain\",\n \"!/freebase/user_profile/favorite_domains\": {\n \"id\": user_id,\n \"link\": {\n \"timestamp\": null\n },\n \"limit\": 1\n },\n \"limit\": 1000\n }];\n\n return freebase.mqlread(q)\n .then(function(env) {\n return env.result.sort(sort_by_name);\n });\n}", "function cypressGrep () {\n /** @type {string} Part of the test title go grep */\n let grep = Cypress.env('grep')\n\n if (grep) {\n grep = String(grep).trim()\n }\n\n /** @type {string} Raw tags to grep string */\n const grepTags = Cypress.env('grepTags') || Cypress.env('grep-tags')\n\n const burnSpecified =\n Cypress.env('grepBurn') || Cypress.env('grep-burn') || Cypress.env('burn')\n\n const grepUntagged =\n Cypress.env('grepUntagged') || Cypress.env('grep-untagged')\n\n if (!grep && !grepTags && !burnSpecified && !grepUntagged) {\n // nothing to do, the user has no specified the \"grep\" string\n debug('Nothing to grep, version %s', version)\n\n return\n }\n\n /** @type {number} Number of times to repeat each running test */\n const grepBurn =\n Cypress.env('grepBurn') ||\n Cypress.env('grep-burn') ||\n Cypress.env('burn') ||\n 1\n\n /** @type {boolean} Omit filtered tests completely */\n const omitFiltered =\n Cypress.env('grepOmitFiltered') || Cypress.env('grep-omit-filtered')\n\n debug('grep %o', { grep, grepTags, grepBurn, omitFiltered, version })\n if (!Cypress._.isInteger(grepBurn) || grepBurn < 1) {\n throw new Error(`Invalid grep burn value: ${grepBurn}`)\n }\n\n const parsedGrep = parseGrep(grep, grepTags)\n\n debug('parsed grep %o', parsedGrep)\n\n // prevent multiple registrations\n // https://github.com/cypress-io/cypress-grep/issues/59\n if (it.name === 'itGrep') {\n debug('already registered @cypress/grep')\n\n return\n }\n\n it = function itGrep (name, options, callback) {\n if (typeof options === 'function') {\n // the test has format it('...', cb)\n callback = options\n options = {}\n }\n\n if (!callback) {\n // the pending test by itself\n return _it(name, options)\n }\n\n let configTags = options && options.tags\n\n if (typeof configTags === 'string') {\n configTags = [configTags]\n }\n\n const nameToGrep = suiteStack\n .map((item) => item.name)\n .concat(name)\n .join(' ')\n const tagsToGrep = suiteStack\n .flatMap((item) => item.tags)\n .concat(configTags)\n .filter(Boolean)\n\n const shouldRun = shouldTestRun(\n parsedGrep,\n nameToGrep,\n tagsToGrep,\n grepUntagged,\n )\n\n if (tagsToGrep && tagsToGrep.length) {\n debug(\n 'should test \"%s\" with tags %s run? %s',\n name,\n tagsToGrep.join(','),\n shouldRun,\n )\n } else {\n debug('should test \"%s\" run? %s', nameToGrep, shouldRun)\n }\n\n if (shouldRun) {\n if (grepBurn > 1) {\n // repeat the same test to make sure it is solid\n return Cypress._.times(grepBurn, (k) => {\n const fullName = `${name}: burning ${k + 1} of ${grepBurn}`\n\n _it(fullName, options, callback)\n })\n }\n\n return _it(name, options, callback)\n }\n\n if (omitFiltered) {\n // omit the filtered tests completely\n return\n }\n\n // skip tests without grep string in their names\n return _it.skip(name, options, callback)\n }\n\n // list of \"describe\" suites for the current test\n // when we encounter a new suite, we push it to the stack\n // when the \"describe\" function exits, we pop it\n // Thus a test can look up the tags from its parent suites\n const suiteStack = []\n\n describe = function describeGrep (name, options, callback) {\n if (typeof options === 'function') {\n // the block has format describe('...', cb)\n callback = options\n options = {}\n }\n\n const stackItem = { name }\n\n suiteStack.push(stackItem)\n\n if (!callback) {\n // the pending suite by itself\n const result = _describe(name, options)\n\n suiteStack.pop()\n\n return result\n }\n\n let configTags = options && options.tags\n\n if (typeof configTags === 'string') {\n configTags = [configTags]\n }\n\n if (!configTags || !configTags.length) {\n // if the describe suite does not have explicit tags\n // move on, since the tests inside can have their own tags\n _describe(name, options, callback)\n suiteStack.pop()\n\n return\n }\n\n // when looking at the suite of the tests, I found\n // that using the name is quickly becoming very confusing\n // and thus we need to use the explicit tags\n stackItem.tags = configTags\n _describe(name, options, callback)\n suiteStack.pop()\n\n return\n }\n\n // overwrite \"context\" which is an alias to \"describe\"\n context = describe\n\n // overwrite \"specify\" which is an alias to \"it\"\n specify = it\n\n // keep the \".skip\", \".only\" methods the same as before\n it.skip = _it.skip\n it.only = _it.only\n // preserve \"it.each\" method if found\n // https://github.com/cypress-io/cypress-grep/issues/72\n if (typeof _it.each === 'function') {\n it.each = _it.each\n }\n\n describe.skip = _describe.skip\n describe.only = _describe.only\n if (typeof _describe.each === 'function') {\n describe.each = _describe.each\n }\n}", "function getDirectory(sheetName) {\n let dirBackend = SpreadsheetApp.openById(permDirID)\n // get users\n let userSheet = dirBackend.getSheetByName('Users')\n let userTable = userSheet.getRange(2, 1, userSheet.getLastRow() - 1, 6).getValues()\n let users = {}\n for (let i = 0; i < userTable.length; i++) {\n for (let j = 1; j <= 5; j++) {\n let name = userTable[i][j].trim()\n if (name) {\n if (!users[name]) {\n users[name] = userTable[i][0].trim()\n } else {\n console.log('error: multiple definitions of user', name)\n return\n }\n }\n }\n }\n // get mods\n let modSheet = dirBackend.getSheetByName('Mods')\n let modTable = modSheet.getRange(1, 1, modSheet.getLastRow(), modSheet.getLastColumn()).getValues()\n let mods = []\n for (let j=0; j<modTable[0].length; j++) {\n if (['global', sheetName].includes(modTable[0][j])) {\n for (let i=1; i<modTable.length; i++) {\n let email = modTable[i][j].trim()\n if (email) {mods.push(email)}\n }\n }\n }\n console.log(\"imported directory; mods:\\n\", mods)\n return [users, mods]\n}", "function constructArrUsers(array, occurences, friends) {\n fetch(\"https://rpsexam-61a3.restdb.io/rest/registeredusers\", {\n method: \"get\",\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"x-apikey\": \"5ddfb3cc4658275ac9dc201e\",\n \"cache-control\": \"no-cache\"\n }\n })\n .then(e => e.json())\n .then(data => {\n let i = 0;\n // j is used to parse through the data backwards\n let j = data.length - 1;\n while (i < occurences && j != 0) {\n // Check for name overlappings\n // If there are, the suggestion is already a friend\n let k = 0;\n\n // Check each friend with the selected user from the db\n friends.forEach(friend => {\n if (data[j].username == friend) {\n k++;\n }\n });\n\n if (k == 0) {\n array.push(data[j]);\n // Value decreases to check the next user\n j--;\n // Value increases as one suggestion is found\n i++;\n } else {\n j--;\n }\n }\n\n addFriendSuggestions(array, occurences, friends);\n });\n}", "function allusers(db) {\n\t//define and set a standard set of default responses as the returned object\n\tlet response = _sqlresponse(`all users`);\n\t\n\ttry { //wrap the instruction in a try/catch to protect the process\n\t\t//this set of instructions runs a single instruction multiple times, each time using the next 'bound' dataset \n\t\tconst statement = db.prepare(\n\t\t\t`SELECT \n\t\t\t\tuserid, \n\t\t\t\tfriendlyname, \n\t\t\t\temailaddress, \n\t\t\t\tpassword, \n\t\t\t\tadmin, \n\t\t\t\tdatetime(lastlogin,'unixepoch') as lastlogin\n\t\t\tFROM\n\t\t\t\tUsers\n\t\t\tORDER BY \n\t\t\t\tuserid\n\t\t\t;`\n\t\t);\n\n\t\t// const statement = db.prepare(\n\t\t// \t`SELECT userid, friendlyname, emailaddress, password, admin, \n\t\t// \t\tdatetime(lastlogin,'unixepoch') as lastlogin\n\t\t// \tFROM Users\n\t\t// \tWHERE userid > @userid\n\t\t// \tORDER BY userid\n\t\t// \t;`\n\t\t// );\n\n\t\tconst results = statement.all(); //execute the statement\n\t\t//const results = statement.all({userid: 2000}); //execute the statement\n\t\tresponse.results = results; //add any results to the response\n\n\t\tconsole.log(\"Records found: \" + results.length);\n\t\tconsole.log(results);\n\n\t} catch (error) {\n\t\t//error detected while attempting to process the request - update the initialised sql return response\n\t\tresponse.success = false;\n\t\tresponse.code = httpcode.CONFLICT;\n\t\tresponse.message = error.code + \":\" + error.message;\n\t}\n\n\t_showsqlresponse(response); //check out the current response before returning to the calling instruction\n\treturn response;\n}", "function listUsers(api, query) {\n return api_1.GET(api, '/users', { query })\n}", "async function fetchAllPulls(owner, repo) {\n const queryString = `\n query p1 ($owner:String!, $repo:String!, $after:String) {\n repository(owner:$owner, name:$repo) {\n pullRequests (first:100, after:$after) {\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n edges {\n node {\n number\n title\n url\n author {\n login\n }\n createdAt\n updatedAt\n closed\n mergedAt\n timeline(last: 1) {\n totalCount\n }\n }\n }\n }\n }\n }`;\n\n let numPages = 0;\n let allPulls = [];\n\n let hasNextPage = null;\n let endCursor = null;\n do {\n let variablesObject = { owner: owner, repo: repo, after: endCursor };\n let variablesString = JSON.stringify(variablesObject);\n\n let pulls = await fetchOnePage(queryString, variablesString);\n console.log(++numPages);\n console.log(pulls);\n allPulls.push(...pulls.data.repository.pullRequests.edges);\n\n let pageInfo = pulls.data.repository.pullRequests.pageInfo;\n hasNextPage = pageInfo.hasNextPage;\n endCursor = pageInfo.endCursor;\n } while (hasNextPage);\n\n return allPulls;\n}", "allUsers() {\r\n this.log(`Getting list of users...`);\r\n return this.context\r\n .retrieve(`\r\n SELECT emailAddress, password\r\n FROM Users\r\n `\r\n )\r\n }", "makeURLList(){\r\n \r\n this.urls.length = 0;\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://sandipbgt.com/theastrologer/api/horoscope/' + this.sign.toLowerCase()+'/today/');\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://horoscope-api.herokuapp.com/horoscope/today/' + this.sign);\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://widgets.fabulously40.com/horoscope.json?sign=' + this.sign.toLowerCase());\r\n this.urls.push('https://cors-anywhere.herokuapp.com/http://ohmanda.com/api/horoscope/' + this.sign.toLowerCase());\r\n \r\n //calling the search function\r\n this.search();\r\n }", "getPingsForNow(bot) {\n\t\tvar dt = dateTime.create();\n\t\tvar today = new Date(dt.now());\n\t\tvar today_datestring = ''+(today.getUTCMonth()+1)+'/'+today.getUTCDate()+'/'+today.getUTCFullYear();\n\t\t//var query = \"select * from users where ping_time = '\"+new Date(dt.now()).getHours()+\":00:00' and ( ping_day = 'EVERYDAY' or ping_day = '\"+today_datestring+\"')\";\n\t\tvar query = \"select u.username from team t inner join users u on (t.t_id = u.t_id) where ((u.ping_day = '\"+today_datestring+\"' or u.ping_day = 'EVERYDAY') and u.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00')\"\n\t\t\t+ \" OR u.ping_day != '\"+today_datestring+\"' and u.ping_day != 'EVERYDAY' and t.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00'\";\n\t\tvar users = [];\n\t\tvar getUsers = function (err, data) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (var i in data.rows) {\n\t\t\t\tbot.bot.startPrivateConversation({ user: data.rows[i]['username'] }, function (err, convo) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconvo.say(\"Hello there! <@\" + data.rows[i]['username'] + \">\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//users.addRow(data[i]);\n\t\t\t}\n\t\t}\n\t\tDataAccess.select(query, getUsers);\n\t\treturn users;\n\t}", "function getGistUsers() {\n ListService\n .getListData()\n .then(function(response) {\n console.log('response: ', response);\n $scope.gists = response.data;\n $scope.totalItems = $scope.gists.length;\n }, function(error) {\n console.log(error);\n });\n }", "function urlsForUser(id) {\n return databases.urlDatabase[id];\n}", "async getTweetQueries() {\n const list = await this.config.find({}).lean();\n list.forEach(async item => {\n await this.getTweets(this._formatQuery(item));\n });\n }", "findAllHost() {\n const hosts = new Set();\n this.apps.forEach(app => {\n app.host.map(host => {\n hosts.add(host);\n })\n });\n this.allHosts = Array.from(hosts);\n return this.allHosts;\n }", "function getStrippedUsers(){\r\n\t// SECURITY: strip users of passwords before sending to client\r\n\tvar clientList = [];\r\n\tusers.forEach(function(user) {\r\n\t\tclientList.push({nick: user.nick, status: user.status});\r\n\t});\r\n\treturn clientList;\r\n}", "#getShortUrlsArray() {\n let shortUrlsArray = fs.readdirSync(\n path.resolve(__dirname, \"./DB\"),\n \"utf-8\"\n );\n return shortUrlsArray.map((url_id) => {\n return url_id.split(\".\")[0];\n });\n }", "function queryGists() {\n // Clear any old results that may exist in the \"results\" div\n document.getElementById(\"results\").innerHTML = \"\";\n\n var requests = [];\n for (var i = 0; i < getNumRequests(); i++) {\n requests[i] = new XMLHttpRequest();\n // Page numbers in the Github API are indexed from 1, not 0.\n requests[i].open(\"GET\", \"https://api.github.com/gists/public?page=\"+(i+1), true);\n // Call a function that returns another function, which gets assigned to this property\n requests[i].onreadystatechange = getHttpRequestCallback(requests[i]);\n requests[i].send();\n }\n}", "function getPgPromises(pg,groupsize){\n\tvar todownload = [];\n\n\tvar maxitems = (pg * groupsize);\n\tvar firstitem = maxitems - (groupsize - 1);\n\tconsole.log(\"woking on: \",firstitem, maxitems);\n\n\tfor(var i = firstitem; i <= maxitems; i++){\n\t\tvar downloadedPage = loadPage(i);\n\t\ttodownload.push(downloadedPage);\n\t}\n\t\n\treturn todownload;\n}", "function getAirwatchUsers(groupId, search) {\n var tenant = scriptProps.getProperty(\"airWatchTenant\");\n var airwatchParams = getAirwatchParams();\n var response = UrlFetchApp.fetch(\"https://\" + tenant + \"/api/system/users/search?locationgroupId=\" + groupId + search, airwatchParams); \n var text = response.getContentText();\n var json = JSON.parse(text);\n var data = json.Users;\n\n var airwatchUsers = {\n \"options\": []\n };\n\n for (var i = 0; i < data.length; i++) {\n var value = data[i].Id.Value\n airwatchUsers.options[i] = {\n \"text\": {\n \"emoji\": true,\n \"type\": \"plain_text\",\n \"text\": data[i].FirstName + \" \" + data[i].LastName\n },\n \"value\": value.toString()\n }\n };\n\n return airwatchUsers;\n}" ]
[ "0.55193484", "0.5497706", "0.5363746", "0.53192085", "0.52674216", "0.5230066", "0.51623124", "0.50635934", "0.5048695", "0.5041904", "0.4993227", "0.4981733", "0.49244386", "0.4919895", "0.49186534", "0.49010453", "0.489128", "0.48582524", "0.48229757", "0.4820361", "0.4813044", "0.47945908", "0.47818756", "0.47648647", "0.47574142", "0.47505608", "0.4743455", "0.47324517", "0.47180742", "0.47006762", "0.46946228", "0.46870965", "0.46856728", "0.46715233", "0.46705505", "0.46605676", "0.46457088", "0.46443987", "0.46408537", "0.4637947", "0.4637947", "0.46311978", "0.46301365", "0.46301365", "0.46271458", "0.46271163", "0.46271163", "0.46262607", "0.46199623", "0.4619858", "0.46165618", "0.46098697", "0.46058893", "0.46034387", "0.45953658", "0.4593751", "0.45922205", "0.45843944", "0.45843944", "0.45816198", "0.45740905", "0.4570632", "0.45689622", "0.45418715", "0.45403293", "0.45288444", "0.45286632", "0.45184553", "0.45179835", "0.45141003", "0.44965833", "0.4489317", "0.44721773", "0.44705787", "0.4462975", "0.44611585", "0.44579664", "0.44548267", "0.44535443", "0.44513503", "0.44487572", "0.44424275", "0.44404683", "0.4434371", "0.44330087", "0.44240382", "0.44237813", "0.44192603", "0.4418548", "0.4416877", "0.4415371", "0.4415273", "0.4412587", "0.44125402", "0.44114482", "0.44093135", "0.44074562", "0.44016746", "0.4400315", "0.43976185" ]
0.48040754
21
Local task progress bar
function createLocalProgressBar(message, total) { localProgressBar = new Window('palette', message, undefined, {closeButton:false}); localProgressBar.progressbar = localProgressBar.add('progressbar', undefined, 0, total); localProgressBar.progressbar.preferredSize.width = 300; localProgressBar.show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function ProgressBar(timer) {\r\n var div = 100 / timer;\r\n percent = 0;\r\n\r\n var counterBack = setInterval(function () {\r\n percent += div;\r\n if (percent <= 100) {\r\n document.getElementById(\"PBar\").style.width = 0 + percent + \"%\";\r\n document.getElementById(\"PBar\").innerHTML = \"Scansione in corso\";\r\n } else {\r\n clearTimeout(counterBack);\r\n document.getElementById(\"PBar\").style.width = 0;\r\n }\r\n\r\n }, 1000);\r\n}", "showProgressBar() {\n // Get the progress bar filler texture dimensions.\n const {\n width: w,\n height: h\n } = this.textures.get('progress-bar').get();\n\n // Place the filler over the progress bar of the splash screen.\n const img = this.add.sprite(100, 350, 'progress-bar').setOrigin(0).setScale(0.9);\n\n // Crop the filler along its width, proportional to the amount of files\n // loaded.\n this.load.on('progress', v => img.setCrop(0, 0, Math.ceil(v * w), h));\n }", "function progressBar(elem) {\n $elem = elem;\n // build progress bar elements\n buildProgressBar();\n // start counting\n start();\n }", "function progressBar(elem){\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "function progressBar(elem){\r\n $elem = elem;\r\n //build progress bar elements\r\n buildProgressBar();\r\n //start counting\r\n start();\r\n }", "function moveProgressBar() {\n\n\tvar status = document.querySelector('#status');\n\ttime = 0;\n\n\tprogress = setInterval(green, 20);\n\n\tfunction green() {\n\t\tif (time >= 100) {\n\t\t\tclearInterval(progress);\n\t\t\texitGame();\n\t\t} else if (score >= 10) {\n\t\t\ttime +=1;\n\t\t} else {\n\t\t\ttime +=0.5;\n\t\t} status.style.width = time + \"%\";\n\t}\n}", "function progressBar(elem) {\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "function progressBar(elem){\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "function progressBar(elem){\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "function progressBar(elem){\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "function progressBar(elem){\n $elem = elem;\n //build progress bar elements\n buildProgressBar();\n //start counting\n start();\n }", "static finish() {\n this.progress = 100;\n setTimeout(() => {\n this.bar.style.width = `${this.progress}%`;\n }, 100);\n setTimeout(() => {\n this.parent.style.height = '0px';\n }, 1000);\n }", "function progressBar( elem ) {\n jQueryelem = elem;\n // build progress bar elements\n buildProgressBar();\n // start counting\n start();\n }", "onprogress() {}", "function updateProgress() {\n $(\"#progressBar\").css(\"width\", _progress + \"%\");\n }", "_progress() {\n\tconst currentProgress = this.state.current * ( 100 / this.state.questionsCount );\n this.progress.style.width = currentProgress + '%';\n\n\t// update the progressbar's aria-valuenow attribute\n this.progress.setAttribute('aria-valuenow', currentProgress);\n }", "function tick() {\n if((timer <= 0)) clearInterval(tick_ref);\n\n displayTimer();\n\n let style = \"\";\n\n timer--;\n\n progressbarPosition = map(timer, 0, total_time, 0, 100);\n\n style += \"--progress-position: \" + (-progressbarPosition) + \"%;\";\n\n if(timer <= 0) {\n style = \"--progress-position: 0%;\"\n }\n\n // Change color\n if(timer < 30 && timer >= 10) {\n style += \"--progress-color: var(--progress-warn);\";\n }\n if(timer < 10) {\n style += \"--progress-color: var(--progress-stop);\";\n }\n // apply css changes to DOM\n let html = document.getElementsByTagName('html')[0];\n html.style.cssText = style;\n}", "function updateProgressBar() {\n pbValue+=10;\n $('.progress-bar').css('width', pbValue+'%').attr('aria-valuenow', pbValue);\n $('.progress-bar').text(pbValue + \"%\");\n }", "function startBar() {\n\t\tconst barSeconds = localStorage.getItem('Timer') * 60000;\n\t\t// eslint-disable-next-line global-require\n\t\tconst ProgressBar = require('progressbar.js');\n\n\t\t// implement progressbar in the div \"progressbar\"\n\t\tconst bar = new ProgressBar.Line(progressbar, {\n\t\t\teasing: 'linear',\n\t\t\tduration: barSeconds,\n\t\t\tcolor: '#6441aa',\n\t\t\tsvgStyle: { width: '100%', height: '100%', margin: '0 0 100px 0' },\n\t\t});\n\t\tbar.animate(1.0);\n\t}", "function progressBarFull() {\n\t$(\"#progress-bar-yellow\").css(\"width\",\"100%\");\n\tprogressBarPoint = 100;\n}", "function updateProgressBar(){\n // Update the value of our progress bar accordingly.\n $('#progress-bar').val((r.getCurrentTime() / r.getDuration()) * 100);\n}", "launchprogressbar() {\n\t\tlet percent = this.progressbar.attr(\"data-percent\"); // récupère le data 100% de l\"élément\n this.progressbar.animate( {\n \twidth: percent // on passe de 0% à 100%\n },this.timeout, \"linear\", () => {\n \tthis.progressbar.css(\"width\", 0); // une fois l'animation complète, on revient à 0\n });\n }", "function set_progress(percent)\n{\n\tconsole.log(\"XDDD\");\n\tdocument.getElementById(\"bar\").style.width=percent+\"%\";\n}", "function updateProgress() {\n try {\n var gauge = getDailyTaskGauge();\n var progress = getProgress(gauge);\n if (progress === null) {\n return; // Progress is not there yet\n }\n if (!progress.done || progress.done === progress.total) {\n return;\n }\n var pb = getOrCreateProgressBar(gauge);\n pb.style.width = (100 * progress.done / progress.total) + '%';\n } catch (e) {\n console.log('DailyProgress: Ошибка при обновлении. ' + e);\n }\n}", "_setProgress(v) {\n\t\tconst w = PROGRESSBAR_WIDTH * v;\n\t\tthis._fg.tilePositionX = w;\n\t\tthis._fg.width = PROGRESSBAR_WIDTH- w;\n\t}", "function updateProgressBar(){\n progressBarTimer += 5; // percentage\n \n var progressString = String(progressBarTimer) + \"%\";\n $(\"#progressBar\").css( \"width\", progressString);\n if (progressBarTimer === 100) {\n //stop timer\n clearInterval( localInterval);\n $(\"#progressBar\").css( \"width\", \"0%\");\n }\n}", "increaseProgressBar() {\n this.width += 100 / this.nbSecond * this.intervalTime / 1000; // calcul de la vitesse d'incrémentation en fonction du nombre de secondes total attendu\n $('#progress-bar').width(`${this.width}%`); // définition de la width\n if (this.width >= 100) {\n this.stopTimer(false);\n }\n this.timeSpent += this.intervalTime;\n }", "function updateProgress (event) {\r\n var elem = document.getElementById(\"bar\"); \r\n var width = 0;\r\n if (event.lengthComputable) {\r\n var percentComplete = event.loaded / event.total;\r\n width = parseInt(100 * percentComplete);\r\n elem.style.width = Math.max(4, width) + '%'; \r\n elem.innerHTML = '&nbsp;' + Math.max(1, width) + '%';\r\n } else {\r\n\t\t\t// Unable to compute progress information since the total size is unknown\r\n console.log(\"no progress indication available\");\r\n } // end if else length\r\n } // end function updateProgress (event) ", "function updateBar(){\n var bar = $('#progress');\n\tif (variables.progress < 100){\n\t\tvariables.progress += 5;\n\t\tbar.width(variables.progress + '%');\n\t} else {\n\t\tvariables.progress = 0;\n\t\tvariables.videos += 1;\n\t\tbar.width(\"0%\");\n\t\tclearKeys();\n\t\tloadRound();\n\t}\n}", "function bar (prog) {\n var r = prog.progress/prog.total\n var s = '\\r', M = 50\n for(var i = 0; i < M; i++)\n s += i < M*r ? '*' : '.'\n\n return s + ' '+prog.progress+'/'+prog.total+' '//+':'+prog.feeds\n}", "function startBar() {\n if (i == 0) {\n i = 1;\n width = 0;\n var id = setInterval(tick, 10);\n\n // 1 tick function of progress bar 1 tick = 100ms and\n function tick() {\n if (width >= 100 ) {\n clearInterval(id);\n i = 0;\n checkEndGame();\n } else {\n adjustWidth();\n }\n\n // adjust width of progress bar and % displayed each tick\n function adjustWidth() {\n width += 0.0166666666666667;\n bar.style.width = width + \"%\";\n bar.innerHTML = width.toFixed(1) + \"%\";\n\n // set width value to a var\n barWidth = width;\n }\n\n }\n }\n }", "function callbackProgress( progress, result ) {\n\treturn;\n\tvar bar = 250;\n\tif ( progress.total ){\n\t\tbar = Math.floor( bar * progress.loaded / progress.total );\n\t}\n\tvar curBarWidth = document.getElementById( \"bar\" ).style.width;\n\tdocument.getElementById( \"bar\" ).style.width = bar + \"px\";\n}", "function updateProgressBar(){\n // Update the value of our progress bar accordingly.\n $('#progress-bar').val((player.getCurrentTime() / player.getDuration()) * 100);\n }", "function updateProgressbarDisplay() {\n if (progressBarProgressionElement) {\n updateStep(progressBarProgressionElement)\n updateCounter()\n }\n }", "function progress() {\n progress_hd =\t \t\twindow.open('','progress', 'width=260,height=100,status=0,resizable=1,menubar=0,location=0,toolbar=0,scrollbars=0');\n progress_hd.focus();\n progress_hd.document.write(\"<html><head><title>NDB WebLog \"+version+\"</title><style type='text/css'>h2 { font-family: Arial, sans-serif; }</style></head><body bgcolor='#ffffd8'><h2>Working...<br><small>Please wait</small></h2></body></html>\");\n progress_hd.document.close();\n}", "function progressUpdate() {\r\n loadingProgress = Math.round(progressTl.progress() * 100);\r\n $(\".txt-perc\").text(loadingProgress + '%');\r\n}", "function setProgressBar() {\n monthlyProgress = daysMetGoal/daysInMonth;\n monthlyProgress = Math.round(monthlyProgress * 100, 0);\n var barLength = 1;\n if(statIndex == 1){\n if(monthlyProgress > 0){\n\t\tbarLength = monthlyProgress * .9; //divide by 9/10 since the progress bar is only 90 pixels wide\n\t}\n \tstatDisplay.setCursor(90, 55);\n\tstatDisplay.writeString(font, 1, '| ' + monthlyProgress + '%', 1, true);\n }\n else if (statIndex == 0){\n\tif(progress > 0) {\n\t\tbarLength = progress * .9;\n\t}\n\tstatDisplay.setCursor(90, 55);\n \tstatDisplay.writeString(font, 1, '| ' + progress + '%', 1, true);\n }\n barLength = Math.round(barLength);\n if(barLength > 90){ //if over 90 pixels, max out at 90 to prevent overwriting pixels\n barLength = 90;\n }\n statDisplay.setCursor(1,1);\n statDisplay.drawLine(1, 55, barLength, 55, 1);\n statDisplay.drawLine(1, 56, barLength, 56, 1);\n statDisplay.drawLine(1, 57, barLength, 57, 1);\n statDisplay.drawLine(1, 58, barLength, 58, 1);\n statDisplay.drawLine(1, 59, barLength, 59, 1);\n statDisplay.drawLine(1, 60, barLength, 60, 1);\n statDisplay.drawLine(1, 61, barLength, 61, 1);\n}", "updateProgressBar(percentage) {\n let $progressBar = document.getElementById(\"progress-bar\");\n this.progressBarObj.value = Math.min(\n 100,\n this.progressBarObj.value + percentage\n );\n $progressBar.style.width = this.progressBarObj.value + \"%\";\n $progressBar.valuenow = this.progressBarObj.value;\n $progressBar.innerText = this.progressBarObj.value + \"%\";\n }", "showProgressBar() {\n\n document.getElementById('loading-progress-container').style.display = 'block';\n document.getElementById('loading-progress').style.width = \"0%\";\n\n }", "static start() {\n this.parent = document.querySelector('.progress');\n this.parent.innerHTML = '';\n this.bar = document.createElement('div');\n this.bar.classList.add('progress__bar');\n this.parent.appendChild(this.bar);\n this.parent.style.height = '5px';\n this.progress = 10;\n this.bar.style.width = `${this.progress}%`;\n\n const animate = setInterval(() => {\n if (this.progress < 75) {\n this.step();\n } else {\n clearInterval(animate);\n }\n }, 400);\n }", "function setProgress(percent) {\n $('#progressBar .progress-bar').css({width: percent + '%'});\n $('#percent').text(percent + '%');\n}", "progressHandler(file, progress) {\n const filename = file.name\n const percentage = parseFloat(progress.bytesUploaded / progress.bytesTotal * 100).toFixed(2)\n const sizeUploaded = (progress.bytesUploaded / 1024 / 1024).toFixed(3)\n const sizeTotal = (progress.bytesUploaded / 1024 / 1024).toFixed(3)\n\n const bar = document.createElement('div')\n bar.innerHTML = \"~=\".repeat(200)\n bar.style.cssText = `position: absolute; left: 0; bottom: 0; width: ${percentage}%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`\n\n if (parseInt(percentage) == 100) {\n this.infoTarget.innerHTML = `Upload finished<br>${file.id}`\n } else {\n this.infoTarget.innerHTML = `${sizeUploaded}&thinsp;/&thinsp;${sizeTotal} MB, ${percentage}%<br>uploading ${file.id}`\n this.infoTarget.appendChild(bar)\n }\n }", "function updateProgressBar(progress) {\n\n if (!progress) {\n progress = 0;\n }\n\n // get progress bar\n var progress_div = document.getElementById(\"training-progress\");\n\n if (!progress_div) {\n console.warn(\"Missing progress-bar element!\");\n return;\n }\n\n // update progress bar status\n var progress_str = String(progress) + \"%\";\n progress_div.style.width = progress_str;\n //progress_div.setAttribute(\"aria-valuenow\", String(progress));\n progress_div.innerHTML = progress_str;\n\n if (progress >= 100) {\n progress_div.classList.add(\"progress-bar-success\");\n progress_div.classList.add(\"progress-bar-striped\");\n }\n else {\n progress_div.setAttribute(\"class\", \"progress-bar\");\n }\n}", "function progressBar(current, max, legend, title) {\n var bar, barLegend, body, step;\n if (current == 0) {\n $('.user-interface').show();\n // Add the progress bar\n bar = $('<div class=\"progress-bar\"></div>');\n barLegend = $('<div class=\"bar-legend\">' + legend + '</div>');\n body = $('.interface-body');\n body.empty();\n if (title == undefined) {\n body.append('<div class=\"bar-title\">Executing...</div>').append(bar).append(barLegend);\n } else {\n body.append('<div class=\"bar-title\">' + title + '</div>').append(bar).append(barLegend);\n }\n } else {\n bar = $('.progress-bar');\n barLegend = $('.bar-legend');\n }\n while (current >= bar.children().length) {\n step = $('<div class=\"progress-step\"></div>').width(bar.width() / max);\n bar.append(step);\n barLegend.html(legend);\n }\n}", "function updateProgress (){\n\tprogress.value += 30;\n}", "function updateProgress(){\n const computedPercentage = Math.round(attendanceRecords.length / traineeIds.length * 100);\n $(\"#progressbar\").children().attr(\"aria-valuenow\", computedPercentage).css(\"width\", computedPercentage + \"%\").text(computedPercentage + \"% Complete\");\n}", "function onUploadProgress(e) {\r\n\tif (e.lengthComputable) {\r\n\t\tvar percentComplete = parseInt((e.loaded + totalUploaded) * 100 / totalFileLength);\r\n\t\tvar bar = document.getElementById('bar');\r\n\t\tbar.style.width = percentComplete + '%';\r\n\t\tbar.innerHTML = percentComplete + ' % complete';\r\n\t\tconsole.log(\" bar prog \" + percentComplete)\r\n\r\n\t\tpercentage = percentComplete;\r\n\r\n\t\tconsole.log(\" percentage prog \" + percentage)\r\n\t} else {\r\n\t\tdebug('unable to compute');\r\n\t}\r\n}", "function updateProgressInfo() {\n\tif (!div_progress_info) {\n\t\tdiv_progress_info = document.getElementById('progress_info');\n\t}\n\tif (!div_progress_bar) {\n\t\tdiv_progress_bar = document.getElementById('progress_bar');\n\t}\n\tif (!div_progress_info && !div_progress_bar) {\n\t\treturn;\n\t}\n\n\tvar percentage = Math.floor(100.0*blamedLines/totalLines);\n\n\tif (div_progress_info) {\n\t\tdiv_progress_info.firstChild.data = blamedLines + ' / ' + totalLines +\n\t\t\t' (' + padLeftStr(percentage, 3, '\\u00A0') + '%)';\n\t}\n\n\tif (div_progress_bar) {\n\t\t//div_progress_bar.setAttribute('style', 'width: '+percentage+'%;');\n\t\tdiv_progress_bar.style.width = percentage + '%';\n\t}\n}", "function updateProgressBar(width) {\n document.documentElement.style.setProperty('--progressbar-width', `${width}%`);\n}", "function updateProgress() {\n let progressLabel = ui.Label({\n value: 'Scanning image collections ' + processedCount + ' of ' + collectionCount,\n style: {fontWeight: 'bold', fontSize: '12px', margin: '10px 5px'}\n });\n\n progressPanel.clear();\n progressPanel.add(progressLabel)\n }", "function updateProgress() {\n var progress = 0,\n currentValue = $scope.curVal,\n maxValue = $scope.maxVal,\n // recompute overall progress bar width inside the handler to adapt to viewport changes\n progressBarWidth = progressBarBkgdElement.prop('clientWidth');\n\n if ($scope.maxVal) {\n // determine the current progress marker's width in pixels\n progress = Math.min(currentValue, maxValue) / maxValue * progressBarWidth;\n }\n\n // set the marker's width\n progressBarMarkerElement.css('width', progress + 'px');\n }", "function showProgressInfo(){\n if (currReq === 0) {\n progressInfo.show();\n }\n currReq++;\n if (currReq === numReq) {\n progressInfo.hide();\n }\n progressInfo.html('Downloading ' + currReq + ' of ' + numReq );\n }", "function autoProgress() {\n\tvar elem = document.getElementById(\"progressbar\");\n\tvar width = 0;\n\tvar id = setInterval(frame, 100);\n\tfunction frame(){\n\t\tif(width == 100){\n\t\t\tclearInterval(id);\n\t\t}else{\n\t\t\twidth++;\n\t\t\telem.style.width = width + '%';\n\t\t\telem.innerHTML = width * 1 + '%';\n\t\t}\n\t}\n}", "function updateProgress() {\n\t var percentage = (progressBar.hideEta - new Date().getTime()) / progressBar.maxHideTime * 100;\n\t progressElement.style.width = percentage + '%';\n\t }", "function handleProgress() {\n const percent =\n (selectors.video.currentTime / selectors.video.duration) * 100;\n selectors.progressBar.style.flexBasis = `${percent}%`;\n}", "function updateProgress() {\n elements.progressBar.style.width = `${\n (elements.video.currentTime / elements.video.duration) * 100\n }%`;\n elements.currentTime.textContent = `${displayTime(\n elements.video.currentTime\n )} / `;\n elements.durationTime.textContent = `${displayTime(elements.video.duration)}`;\n}", "function updateProgress ( current, total ){\n $(\".progress .currentProgress\").css('width', ((current - 1) / total) * 100 +'%');\n $(\".progress .progresstext\").html('Frage '+ current + ' von ' + (total))\n }", "function slideProgress() {\n let perc = (video.currentTime/video.duration)*100;\n progressbar.style.width = perc.toString()+'%';\n }", "function setProgressBar(curStep){\n var percent = parseFloat(50 / steps) * curStep;\n percent = percent.toFixed();\n $(\".barrapedido1\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "function updateProgressBarLoadingCore() {\n var loading = 0, loaded = 0;\n loading += view.getModel().getResourceManager().getLoadingCount();\n loaded += view.getModel().getResourceManager().getLoadedCount();\n // Progress %\n status.setProgress(Math.floor(100 * (loaded || 0) / ((loading || 0) + (loaded || 1))) / 100);\n }", "function updateProgress(showUI){\n var countsLeft = 0;\n for (var i=0; i < TagTracker.progressTracking.length; i++){\n countsLeft += TagTracker.progressTracking[i];\n }\n if (countsLeft > 0){\n if (debug > 1){\n console.log(\"not finished, continuing\");\n }\n\n console.log(document.getElementById(\"theProgressBar\"));\n\n var percent = 100 - Math.floor((countsLeft /\n (TagTracker.maxQueryCount * TagTracker.hashTags.length)) * 100);\n var progressBar = document.getElementById(\"theProgressBar\");\n\n if (TagTracker.strategy == \"sample\"){\n // TODO: if this makes sense, should just count # samples/sampleLimit\n //percent =\n }\n\n if (showUI){\n document.getElementById(\"theProgressBar\").style.width = percent + \"%\";\n }\n\n }else{\n renderContent();\n }\n }", "function progressBar(){\n //window.pageYOffset -> amount scrolled\n //document.body.scrollHeight -> total page height\n //window.innerHeigh -> window height\n document.getElementById('progress-bar').style.width = Math.min((101 * window.pageYOffset / (document.body.scrollHeight - window.innerHeight)), 100) + '%';\n}", "function updateProgress (evt) {\n\n if (evt.lengthComputable) {\n var percentComplete = Math.floor((evt.loaded / evt.total) * 100),\n percentIntegrated = (percentComplete / 100) * options.width;\n\n // Display progress status\n if(options.progress != false) {\n $(options.progress).text(percentComplete); \n }\n\n // Convert 'percentComplete' to preloader element's width\n $(options.gazer).stop(true).animate({\n width: percentIntegrated\n }, function() {\n options.done.call();\n });\n\n } else {\n // when good men do nothing \n }\n }", "function setProgressBar(curStep){\n var percent = parseFloat(100 / steps) * curStep;\n percent = percent.toFixed();\n $(\".progress-bar\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\");\n }", "updateLoadingBar() {\n if (this.loadingRemains !== G.resource.remains) {\n this.loadingBar.text = `${G.resource.remains} resource(s) to load...\\nReceived file '${G.resource.currentLoad}'.`;\n }\n }", "function updateProgressBar(){ \r\n\tdocument.getElementById('progress').style.width = [count+1]/30*100+'%'; \r\n}", "function progress(step, nbSteps, stepLabel) {\n var percent = (step/(nbSteps+1))*100;\n $(\"#progress .progress-bar\").attr('aria-valuenow', step).attr('aria-valuemax', nbSteps+1).attr('style','width:'+percent.toFixed(2)+'%').find(\"span\").html(step + \"/\" + nbSteps);\n $(\"#progressStep\").html(stepLabel);\n}", "function setProgressBar(curStep){\n var percent = parseFloat(50 / steps) * curStep;\n percent = percent.toFixed();\n $(\".barrafinal\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "function progress() {\n $(\"#progressbar\").slider('value', Math.floor((100 / audio.duration) * audio.currentTime));\n $(\"#duration\").text(getTime(audio.currentTime) + \" / \" + getTime(audio.duration));\n }", "function updateProgressBar() {\n const percent = (video.currentTime / video.duration) * 100\n progressBar.style.flexBasis =`${percent}%`\n}", "updateProgressBar() {\n let revealRange = 103 - 24; //See css comment (progressBox). \n let revealPercent = this.points / this.pointsNeeded; //Current percent of points needed.\n this.baseProgressMargin = -24; //Margin value: Progress box hides bar.\n this.progressMargin = this.baseProgressMargin - revealPercent * revealRange; //New margin value\n document.getElementById(\"progress\").style.marginTop = this.progressMargin + \"vh\"; //Reveal percent of glowing border as level progress indicator.\n }", "function updateLoading(progress, message) { \n \n console.log(progress, message);\n\n const loaded = document.getElementById(\"loadedBox\");\n const loadingMessage = document.getElementById(\"loadingMessage\");\n\n if (progress >= 100) {\n const loading = document.getElementById(\"loading\");\n loading.classList.add(\"hidden\");\n loaded.style.width = 0;\n loadingMessage.innerText = \"\";\n }\n\n loaded.style.width = progress + \"%\";\n loadingMessage.innerText = message;\n}", "function onProgress( xhr ) {\n if ( xhr.lengthComputable ) {\n const percentComplete = xhr.loaded / xhr.total * 100;\n if (percentComplete > 99) {\n $('#placeholder')[0].innerText = 'Finishing up...'\n } else if (percentComplete > 50) {\n $('#placeholder')[0].innerText = 'Almost there...'\n }\n }\n\n }", "function updateProgress(percentage) {\n document.getElementById(\"pbar_innerdiv\").style.width = percentage + \"%\";\n}", "function updateEditProgress (progress) {\n var total = progress.total\n var quorum = 0\n var missing = 0\n document.getElementById('prog').title = progress.collected +\n ' updated out of ' + total + ' members.'\n document.getElementById('prog-collected').style.width = quorum + '%'\n // document.getElementById('prog-collected').class = \"progress-bar-success\"\n document.getElementById('prog-collected').classList.remove('progress-bar-warning')\n document.getElementById('prog-collected').classList.add('progress-bar-success')\n // prog-missing now means \"extra votes after quorum has been reached.\"\n document.getElementById('prog-missing').style.width = -missing + '%'\n document.getElementById('prog-missing').class = 'progress-bar'\n document.getElementById('prog-missing').classList.add('progress-bar')\n document.getElementById('prog-missing').classList.remove('progress-bar-warning')\n // document.getElementById('prog-missing').classList.add('progress-bar-success')\n document.getElementById('prog-missing').classList.remove('progress-bar-striped')\n}", "function renderProgress(val, perc, message) {\n\t\tbar.style.width = perc + \"%\";\n\n renderMessage(message);\n\t}", "moveLoading() {\n if (this.progressBar) {\n let actVal = this.progressBar.getProgress();\n actVal = ((actVal + 1 >= 100) ? 0 : actVal + 1);\n this.progressBar.setProgress(actVal);\n }\n }", "function runProgressBar(time) {\t\n\t\n\t/*Make the progress div visible*/\n\td3.selectAll(\"#progress\")\n\t\t.style(\"visibility\", \"visible\");\n\t\n\t/*Linearly increase the width of the bar\n\t//After it is done, hide div again*/\n\td3.selectAll(\".prgsFront\")\n\t\t.transition().duration(time).ease(\"linear\")\n\t\t.attr(\"width\", prgsWidth)\n\t\t.call(endall, function() {\n\t\t\td3.selectAll(\"#progress\")\n\t\t\t\t.style(\"visibility\", \"hidden\");\n\t\t});\n\t\n\t/*Reset to zero width*/\n\td3.selectAll(\".prgsFront\")\n\t\t.attr(\"width\", 0);\n\t\t\n}", "function runProgressBar(time) {\t\n\t\n\t/*Make the progress div visible*/\n\td3.selectAll(\"#progress\")\n\t\t.style(\"visibility\", \"visible\");\n\t\n\t/*Linearly increase the width of the bar\n\t//After it is done, hide div again*/\n\td3.selectAll(\".prgsFront\")\n\t\t.transition().duration(time).ease(\"linear\")\n\t\t.attr(\"width\", prgsWidth)\n\t\t.call(endall, function() {\n\t\t\td3.selectAll(\"#progress\")\n\t\t\t\t.style(\"visibility\", \"hidden\");\n\t\t});\n\t\n\t/*Reset to zero width*/\n\td3.selectAll(\".prgsFront\")\n\t\t.attr(\"width\", 0);\n\t\t\n}", "function showProgress() {\n var bar = document.getElementById(\"bar\");\n var width = parseInt(bar.style.width = (6 + (totalClicks / 15 * 100)) + '%');\n bar.innerText = '';\n var percent = document.createElement('p');\n if (totalClicks == 15) {\n bar.style.width = '0%';\n var progress = document.getElementById(\"progress\");\n progress.style.width = '0%';\n } else {\n percent.innerText = width + '%';\n bar.appendChild(percent);\n }\n}", "function progressBarScroll() {\n\t\tlet winScroll = document.body.scrollTop || document.documentElement.scrollTop,\n\t\t\t\theight = document.documentElement.scrollHeight - document.documentElement.clientHeight,\n\t\t\t\tscrolled = (winScroll / height) * 100;\n\t\tdocument.getElementById(\"progressBar\").style.width = scrolled + \"%\";\n\t}", "function setProgress(value) {\n\tdocument.getElementById(\"progressbar\").setAttribute(\"aria-valuenow\",value);\n\tdocument.getElementById(\"progressbar\").setAttribute(\"style\",\"width: \" +value+ \"%\");\t\n\tdocument.getElementById(\"progressbar\").innerHTML = (value+ \"%\"); \n}", "function buildProgressBar(){\r\n $progressBar = $(\"<div>\",{\r\n id:\"progressBar\"\r\n });\r\n $bar = $(\"<div>\",{\r\n id:\"bar\"\r\n });\r\n $progressBar.append($bar).prependTo($elem);\r\n }", "function handleProgress() {\n const percent = (video.currentTime / video.duration) * 100;\n progressBar.style.flexBasis = `${percent}%`;\n}", "function handleProgress() {\n const percent = (video.currentTime / video.duration) * 100;\n progressBar.style.flexBasis = `${percent}%`;\n}", "function handleProgress() {\n const percent = (video.currentTime / video.duration) * 100;\n progressBar.style.flexBasis = `${percent}%`;\n}", "function create_prog(){\n\t\tvar myProgBar = new progressBar(\n\t\t\t1, //border thickness\n\t\t\t'#000000', //border colour\n\t\t\t'#a5f3b1', //background colour\n\t\t\t'#043db2', //bar colour\n\t\t\t400, //width of bar (excluding border)\n\t\t\t20, //height of bar (excluding border)\n\t\t\t1 //direction of progress: 1 = right, 2 = down, 3 = left, 4 = up\n\t\t);\n\t\t\n }", "function fillProgressBar(bar, barPercent) {\n const progressBarInterval = setInterval(() => {\n barPercent = barPercent + 1;\n bar.style.width = `${barPercent}%`;\n if (barPercent >= 100) {\n clearInterval(progressBarInterval);\n }\n }, 30);\n}", "function addProgress() {\n var progressValue = (100 * parseFloat($('#progressBarOne').css('width')) / parseFloat($('#progressBarOne').parent().css('width'))) + '%';\n var progressValueNum = parseFloat(progressValue);\n if (progressValueNum < 99) {\n var finalValue = (progressValueNum + 16.6);\n $('#progressBarOne').css('width', finalValue + \"%\");\n $(\"#progressBarOne\").text(finalValue.toFixed(0) + \"%\");\n\n }\n else {\n $('#progressBarOne').css('width', \"100%\");\n $(\"#progressBarOne\").text(\"100%\");\n\n }\n\n if (finalValue >= 95) {\n $('#progressBarOne').css('background-color', '#56a773')\n }\n}", "function setProgressBar(curStep){\n var percent = parseFloat(100 / steps) * curStep;\n percent = percent.toFixed();\n $(\".progress-bar-1\")\n .css(\"width\",percent+\"%\")\n .html(percent+\"%\"); \n }", "function handleProgress(){\n const percent = (video.currentTime / video.duration) * 100;\n progressBar.style.flexBasis = `${percent}%`;\n}", "function update_progress() {\n let tot = open + closed;\n\n $(\"#progress_open\").css(\"width\", (open * 100 / tot) + \"%\");\n $(\"#progress_close\").css(\"width\", (closed * 100 / tot) + \"%\");\n}", "function createProgressBar() {\n\tprogressBarContainer.innerHTML = \"\";\n\tconst progressDivSize = ((progressBarContainerSize/toDoList.all.length)/progressBarContainerSize)*100;\n\tfor (let i = 0; i < toDoList.all.length; i++){\n\t\tconst newDiv = document.createElement(\"div\")\n\t\tnewDiv.className = \"barUndone\"\n\t\tnewDiv.style.width = progressDivSize + \"%\";\n\t\tprogressBarContainer.appendChild(newDiv)\n\t}\n\tprogressUpdate()\n}", "function progressHandler(loader, resource) {\n //TODO - implement loading bar\n}", "function _updateProgressBar(oldReferenceLayer){oldReferenceLayer.querySelector(\".introjs-progress .introjs-progressbar\").style.cssText=\"width:\".concat(_getProgress.call(this),\"%;\");oldReferenceLayer.querySelector(\".introjs-progress .introjs-progressbar\").setAttribute(\"aria-valuenow\",_getProgress.call(this));}", "function buildProgressBar(){\n $progressBar = $(\"<div>\",{\n id:\"progressBar\"\n });\n $bar = $(\"<div>\",{\n id:\"bar\"\n });\n $progressBar.append($bar).prependTo($elem);\n }", "function buildProgressBar(){\n $progressBar = $(\"<div>\",{\n id:\"progressBar\"\n });\n $bar = $(\"<div>\",{\n id:\"bar\"\n });\n $progressBar.append($bar).prependTo($elem);\n }", "function buildProgressBar(){\n $progressBar = $(\"<div>\",{\n id:\"progressBar\"\n });\n $bar = $(\"<div>\",{\n id:\"bar\"\n });\n $progressBar.append($bar).prependTo($elem);\n }", "function buildProgressBar(){\n $progressBar = $(\"<div>\",{\n id:\"progressBar\"\n });\n $bar = $(\"<div>\",{\n id:\"bar\"\n });\n $progressBar.append($bar).prependTo($elem);\n }", "function progress(percent, element) { // load progress-bar\n var progressBarWidth = percent * element.width() / 100;\n\n element.find('.loading').animate({ width: progressBarWidth }, 500);\n element.find('.interest').html(percent + \"%\");\n\n}" ]
[ "0.74066514", "0.7207696", "0.71808034", "0.7170998", "0.7129276", "0.712523", "0.7119566", "0.71169984", "0.71169984", "0.71169984", "0.71169984", "0.7077858", "0.7073955", "0.70446193", "0.70411485", "0.69790316", "0.69390196", "0.693149", "0.69177324", "0.6910491", "0.69072497", "0.68879014", "0.68860155", "0.68823063", "0.6882306", "0.6878855", "0.6856644", "0.68559515", "0.6838286", "0.6818394", "0.6810973", "0.6796829", "0.67967653", "0.6766542", "0.6760299", "0.6745845", "0.67404187", "0.6730253", "0.672533", "0.67243016", "0.67088103", "0.6705574", "0.66918397", "0.66903895", "0.66867775", "0.66835743", "0.667932", "0.6676627", "0.66751623", "0.66721153", "0.667008", "0.6644671", "0.66443866", "0.66176057", "0.6613039", "0.66051656", "0.66021025", "0.65968347", "0.659641", "0.65948844", "0.6579945", "0.65759546", "0.65660435", "0.65607846", "0.65498525", "0.6546948", "0.65420955", "0.65351737", "0.6531124", "0.6530493", "0.6526411", "0.6524218", "0.6519968", "0.65170765", "0.6514637", "0.6499217", "0.649699", "0.649641", "0.649641", "0.64958584", "0.649462", "0.64937514", "0.64917916", "0.6490517", "0.6490517", "0.6490517", "0.6486641", "0.64865863", "0.64856493", "0.6482975", "0.6480873", "0.64728624", "0.6472651", "0.6461209", "0.6456662", "0.6455324", "0.6455324", "0.6455324", "0.6455324", "0.64527845" ]
0.6632001
53
this one returns an array of all prime factors of a given number
function getAllFactorsFor(remainder) { var factors = [], i; for (i = 2; i <= remainder; i++) { while ((remainder % i) === 0) { factors.push(i); remainder /= i; } } return factors; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPrimeFactors(num) {\n const solution = [];\n let divisor = 2;\n while (num > 2) {\n if (num % divisor === 0) {\n solution.push(divisor);\n num = num / divisor;\n } else divisor++;\n }\n return solution;\n}", "function get_prime_factors(number) {\n number = Math.floor(number);\n if (number == 1) {\n //alert(\"Warning: 1 has no prime factorization.\");\n return 1;\n }\n var factorsout = [];\n var n = number;\n var q = number;\n var loop;\n\n for (var i = 0; i < PRIMES.length; i++) {\n if (PRIMES[i] > n) break;\n\n factorsout.push(0);\n\n if (PRIMES[i] == n) {\n factorsout[i]++;\n break;\n }\n\n loop = true;\n\n while (loop) {\n q = n / PRIMES[i];\n\n if (q == Math.floor(q)) {\n n = q;\n factorsout[i]++;\n continue;\n }\n loop = false;\n }\n }\n\n return factorsout;\n}", "function factors(num) {\n var factArr = [];\n for (var i = 0; i <= num; i++) {\n if (num % i === 0) {\n factArr.push(i);\n } \n }\n return factArr;\n}", "function PrimeFactors(n){\n var factors = [],\n divisor = 2;\n\n while(n>2){\n if (n % divisor == 0){\n factors.push(divisor);\n n= n/ divisor;\n }\n else{\n divisor ++;\n } \n }\n return factors;\n}", "function primeFactors (n) {\n const factors = []\n let divisor = 2\n\n while (n > 2) {\n if (n % divisor === 0) {\n factors.push(divisor)\n n = n / divisor\n }\n else {\n divisor++\n }\n }\n return factors\n}", "function primeFactors(n) {\n\tvar result = [],\n\t\tdivisor = 2;\n\n\twhile (n > 2) {\n\t\tif (n % divisor == 0) {\n\t\t\tresult.push(divisor);\n\t\t\tn = n / divisor;\n\t\t}\n\t\telse {\n\t\t\tdivisor++;\n\t\t}\n\t}\n\n\treturn result;\n}", "function findPrimeFactors(num = 0) {\n if (num === 0) return [];\n\n const primeFactors = [];\n let divisor = 2;\n\n while (num >= Math.pow(divisor, 2)) {\n if (num % divisor === 0) {\n primeFactors.push(divisor);\n num /= divisor;\n } else {\n divisor++;\n }\n }\n\n primeFactors.push(num);\n\n return primeFactors;\n}", "function factors(number) {\n //let divisor = number;\n let factors = [];\n for (let ix = 1; ix < number; ix++) {\n if (number % ix === 0) {\n factors.push(number / ix);\n }\n }\n /*\n do {\n if (number % divisor === 0) {\n factors.push(number / divisor);\n }\n divisor -= 1;\n } while (divisor !== 0);\n */\n return factors;\n}", "function primeFactors(n) {\n let i = 2, factors = [];\n while (i * i <= n) {\n if (n % i) {\n i++;\n } else {\n n = Math.floor(n / i);\n factors.push(i);\n }\n }\n if (n > 1) factors.push(n);\n return factors;\n}", "function getPrimeFactorArray(number) {\n let arr = [], primeFactor = 1\n while (number > 1)\n {\n primeFactor++\n while(number % primeFactor == 0)\n {\n arr.push(primeFactor)\n number = number / primeFactor\n }\n }\n return arr\n }", "function factors(n) {\n const result = []\n for (let i = 0; i <= n; i++) {\n n % i === 0 ? result.push(i) : arr\n }\n\n return result\n}", "function primeFactors(n) {\n let factors = [];\n while (n >= 2 && n % 2 === 0) {\n factors.push(2);\n n /= 2;\n }\n\n for (let i = 3; i <= Math.sqrt(n); i += 2) {\n while (n % i === 0) {\n factors.push(i);\n n /= i;\n }\n }\n\n if (n > 2) factors.push(n);\n\n return factors;\n}", "function primeFactors(n) {\n var factors = [];\n if (n < 2 || !Number.isInteger(n)) return factors;\n\n // function to help find next prime to divide by...\n function isPrime(n) {\n if (n < 2 || !Number.isInteger(n)) return false;\n for (var i = 2; i <= n / 2; i++) {\n if (Number.isInteger(n / i)) return false;\n }\n return true;\n }\n\n var prime = 2; // start with smallest prime\n while (!isPrime(n)) {\n if (Number.isInteger(n / prime)) {\n factors.push(prime);\n n = n / prime;\n } else {\n // find next prime\n prime++;\n while (!isPrime(prime)) prime++;\n }\n }\n factors.push(n);\n return factors;\n}", "function primeFactorization(n) {\n var ret = [];\n var divider = 2;\n while(n > 1) {\n if(n%divider === 0) {\n ret.push(divider);\n n = n/divider;\n }\n else {\n divider++;\n }\n }\n return ret;\n}", "function primeFactors(number) {\n var out = [1];\n \n for (var i = 2; i <= number; i++){\n if (number % i == 0){\n\n // 34 % 17 === 0\n // isPrime(17)\n \n // every number that is divisible will make it here\n // number = 34\n // factors = [1, 2, 17, 34]\n if(isPrime(i)){\n out.push(i); \n }\n }\n }\n \n \n // given an array of numbers, return only the prime numbers\n \n // start at 2 and check each factors[j] from 2 on\n // if factors[j]%j === 0 && fact\n \n // number = 24\n // 1,2,3,4,6,8,12,24\n \n return out;\n}", "function find_factors(num){\n var results = [];\n for(var i=1 ; i<=num ; i++){\n if(num % i === 0){\n results.push(i);\n }\n }\n\n return results;\n}", "function primeFactorization(n) {\n var factors = [],\n divisor = 2;\n\n while (n >= 2) {\n if (n % divisor == 0 ) {\n factors.push(divisor);\n n = n / divisor;\n }\n else {\n divisor++;\n }\n }\n return factors;\n}", "function factors(num) {\n let factors = [];\n for(let i = 1; i <= num; i ++){\n if (num % i === 0){\n factors.push(i);\n }\n }\n return factors;\n}", "function getPrimeFactors(num) {\n num = Math.floor(num);\n var root, factors = [], x, sqrt = Math.sqrt, doLoop = 1 < num;\n while( doLoop ){\n root = sqrt(num);\n x = 2;\n if (num % x) {\n x = 3;\n while ((num % x) && ((x += 2) < root));\n }\n x = (x > root) ? num : x;\n factors.push(x);\n doLoop = ( x != num );\n num /= x;\n }\n return factors;\n}", "function factors(num){\n let numArray = [];\n for (let i = 1; i <= Math.floor(num); i++) {\n if (num % i === 0) {\n numArray.push(i);\n } \n }\n return numArray;\n}", "function getFactors(number) {\n var factors, sqrt, possibleFactor, otherPossibleFactor;\n factors = [];\n possibleFactor = 1;\n sqrt = Math.sqrt(number);\n while (possibleFactor <= sqrt) {\n if (number % possibleFactor === 0) {\n factors[factors.length] = possibleFactor;\n\n otherPossibleFactor = number / possibleFactor;\n if (otherPossibleFactor !== possibleFactor) {\n factors[factors.length] = otherPossibleFactor;\n }\n }\n possibleFactor += 1;\n }\n\n return factors;\n }", "function factors(num) {\n let fact = []\n for(let i=1; i <= num; i++){\n if(num %i === 0){\n fact.push(i)\n }\n }\n return fact\n}", "function factors(num) {\n let arr = [];\n if (num === 1) {\n return [1];\n }\n for (let i = 0; i <= Math.round(num / 2); i++) {\n if (num % i === 0) {\n arr.push(i);\n }\n }\n arr.push(num);\n return arr;\n}", "function primeFactors(n){\n const originalInput = n;\n var factors = [];\n var divisor = 2;\n while (n >= 2) {\n if (n % divisor === 0) {\n factors.push(divisor); // store a found factor\n allPrimes.push(divisor); // store for the next stage\n n = n / divisor;\n } else {\n divisor++;\n }\n }\n primeOccurrences.push(factors);\n // factorsMap.set(`${originalInput}`, factors)\n return factors;\n}", "function factoriiPrimi(n) {\n var factors = [];\n \n for (var i = 2; i <= n; i++) {\n while ((n % i) === 0) {\n factors.push(i);\n n /= i;\n }\n }\n \n return factors;\n}", "function numFactors(num) {\n let factors = [];\n for (let i = 0; i <= num; i++) {\n if (num % i === 0) {\n factors.push(i);\n }\n }\n console.log(factors);\n}", "function factorize(num){\n const factors = [];\n for(let i = 0; i <= num; i++){\n if(num % i === 0){\n factors.push(i);\n } \n }\n return factors;\n}", "function factorOfNum(number) {\n var factors = []\n for (var i = 1; i < number; i++) {\n if (number % i == 0)\n factors.push(i)\n }\n return factors\n}", "function getFactors(n) {\n let factors = [];\n\n for (let i = 1; i < n; i++) {\n if (n % i === 0) {\n factors.push(i);\n }\n }\n\n return factors;\n}", "function getFactors(n) {\n // Returns all factors of n, given n>1.\n \n // Return empty list for invalid input.\n if (n <= 1) {\n console.log(\"Warning: Invalid input to getFactors().\");\n return [];\n }\n\n // Initialize variables\n var out = [1, n];\n\n for (var i=2; i <= Math.round(n/2); i++) {\n if (n%i == 0){\n out.push(i);\n }\n }\n\n return out.sort();\n}", "function primeFactorList(n) {\n if (n < 1) throw new RangeError(\"Argument error\");\n var result = [];\n\n while (n !== 1) {\n var factor = smallestFactor(n);\n result.push(factor);\n n /= factor;\n }\n\n return result;\n}", "function findFactors(n) {\n var factors = [];\n var sq = Math.sqrt(n);\n var i;\n for (i = 1; i <= sq; i++) {\n if (n % i === 0) {\n factors.push(i);\n if (i < sq) {\n factors.push(n / i);\n }\n }\n }\n return factors;\n}", "function primeFactorize(v)\n{let factors=[];\n for(k=1;k<v;k++)\n {\n if(v%k===0&&isPrime(k))\n {\n if(!factors.includes(k))\n factors.push(k);\n }\n }\n for(j=0;j<factors.length;j++)\n {\n console.log(factors[j]+\" \");\n }\n}", "function factors(number) {\n var list = [];\n for (var count = 1; count <= number; count++)\n if (number % count === 0) {\n list.push(count);\n }\n console.log(\"The factors of \" + number + \" are: \" + list);\n}", "function findFactors(num) {\n const list = [];\n for (let i = 0; i <= num; i++) {\n if (num % i === 0) {\n list.push(i);\n }\n }\n return list;\n}", "function getAllFactorsFor(remainder) {\n\t\t var factors = [], i;\n\t\t \n\t\t //run the loop using modulus operator to get factorization\n\t\t for (i = 2; i <= remainder; i++) {\n\t\t\t while ((remainder % i) === 0) {\n\t\t\t\t factors.push(i);\n\t\t\t\t remainder /= i;\n\t\t\t }\n\t\t }\n\t\t \n\t\t //return your stuff in the array\n\t\t return factors;\n\t }", "function primeFactorList(n) {\n\t\tif (n < 1)\n\t\t\tthrow new RangeError(\"Argument error\");\n\t\tlet result = [];\n\t\twhile (n != 1) {\n\t\t\tconst factor = smallestFactor(n);\n\t\t\tresult.push(factor);\n\t\t\tn /= factor;\n\t\t}\n\t\treturn result;\n\t}", "function primeFactorList(n) {\n\tif (n < 1) throw \"Argument error\";\n\tlet result = [];\n\twhile (n != 1) {\n\t\tlet factor = smallestFactor(n);\n\t\tresult.push(factor);\n\t\tn /= factor;\n\t}\n\treturn result;\n}", "function findPrimeFactors(n) {\n\tif (n < 1)\n\t\tthrow \"Argument error\";\n\tvar small = [];\n\tvar large = [];\n\tvar end = Math.floor(Math.sqrt(n));\n\tfor (var i = 1; i <= end; i++) {\n\t\tif (n % i == 0) {\n\t\t\tsmall.push(i);\n\t\t\tif (i * i != n) // Don't include a square root twice\n\t\t\t\tlarge.push(n / i);\n\t\t}\n\t}\n\tlarge.reverse();\n\treturn small.concat(large);\n}", "function uniquePrimeFactors(n) {\n if (n < 1n)\n throw new RangeError();\n let result = [];\n for (let i = 2n, end = sqrt(n); i <= end; i++) {\n if (n % i == 0n) {\n result.push(i);\n do\n n = n / i;\n while (n % i == 0n);\n end = sqrt(n);\n }\n }\n if (n > 1n)\n result.push(n);\n return result;\n }", "function asalFactors (number){ \n var factors= [],\n bölen= 2 \n \n while (number>2){\n\n if (number % bölen == 0){\n factors.push(bölen);\n number = number/bölen; \n }\n else {\n bölen++\n }\n }\n \n\n return factors\n}", "function factorize(){\n var factors = [];\n for (i=1; i<=targetNum;i++){\n if (targetNum%i==0){\n factors.push(i);\n }\n }\n console.log(\"factors = \" + factors)\n return factors;\n }", "function funcIsPrimeOrFactors(numNumber) {\n // body... \n var numHalf = Math.floor(numNumber / 2);\n var arrFactors = [];\n\n for (var i = 2; i <= numHalf; i++) {\n var numQuotient = Math.floor(numNumber / i);\n var numRemainder = numNumber % i;\n if (numRemainder === 0) {\n arrFactors.push([i, numQuotient]);\n }\n }\n console.log(arrFactors);\n return [arrFactors.length === 0, arrFactors];\n}", "function findFactors(num) {\n let factorArray = [];\n\n // increment from one to the number itself\n for(let i = 1; i <= num; i += 1) {\n if (Number.isInteger(num / i)) {\n factorArray.push(i);\n };\n }\n return factorArray;\n }", "function factors(x){\n if(Number.isInteger(x) === false || x < 1){\n return -1;\n }\n var factorlist = [];\n for(var i = x; i > 0; i--){\n if( x% i === 0){\n factorlist.push(i);\n }\n }\n return factorlist;\n}", "function FindFactors(num) {\n\tarr = [];\n\tfor (var i = num - 1; i >= 0; i--) {\n\t\t// console.log(i);\n\t\t// console.log(n / i);\n\t\t// console.log(arr[i]);\n\t\tif (Number.isInteger(num / i)) {\n\t\t\t// console.log(i, ' is a factor');\n\t\t\tarr.push(i);\n\t\t}\n\t}\n\t// console.log('The factors of ', num, 'are', arr);\n\t// return num;\n\treturn arr;\n}", "function primeFactorial(num) {\n\tvar sqrt = Math.sqrt(num),\n\t\t\tarray = [];\n\n\t// Prime number checking function.\n\t// Only accounts for positive, whole numbers.\n\tfunction isPrime(n) {\n\t\tvar root = Math.sqrt(n);\n\n\t\tif(n === 2) { return true }; // 2 is always prime.\n\t\tif(n < 2) { return false }; // Anything below 2 is not prime.\n\t\tif(n % 2 === 0) { return false }; // Even numbers (besides 2 above) are never prime.\n\n\t\t// Iterate every other, skipping even #'s.\n\t\tfor(var i = 3; i <= root; i += 2) {\n\t\t\tif(n % i === 0) { return false }\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t// Create an array populated with prime #'s from 2 to sqrt.\n\tfor(var i = 2; i <= sqrt; i++) {\n\t\tif(isPrime(i)) {\n\t\t\tarray.push(i);\n\t\t}\n\t}\n\n\t// Create an array containing the prime factors.\n\tvar index \t\t\t = [num],\n\t\t\tprimeFactors = [],\n\t\t\tlength \t\t\t = array.length;\n\n\tfor(var l = 0; l < length; l++) {\n\t\tif(index[index.length -1] % array[l] === 0) {\n\t\t\tvar x = index[index.length -1] / array[l];\n\t\t\tprimeFactors.push(array[l]);\n\t\t\tindex.push(x);\n\t\t}\n\t}\n\n\tArray.prototype.last = function() {\n\t\treturn this[this.length -1];\n\t}\n\t\n\t// return index[index.length - 2];\n\t// return primeFactors[primeFactors.length - 1];\n\tconsole.log('Prime Factors:', primeFactors);\n\treturn primeFactors.last();\n}", "function get_factors(number) {\n let factors = [];\n var nsqrt = Math.floor(Math.sqrt(number));\n\n for (var n = 2; n <= nsqrt; n++) {\n var q = number / n;\n if (Math.floor(q) == q) {\n factors.push(n);\n if (n != q) factors.push(q);\n }\n }\n\n return factors.sort(function (a, b) {\n return a - b;\n });\n}", "function getAllPrimeFactors(n){\n\n var primesTilln = [], q, primeFactors = [], obj, str = \"\", add;\n //generate all prime numbers til 'n'\n //here we are checking till the given number including the given number, to display that, if it self is a prime\n for(var i = 0; i <= n; i++){\n if(isPrime(i)){\n primesTilln.push(i);\n }\n }\n console.log(primesTilln);\n //now decompose 'n' with prime factors available from 'primesTilln'\n for(var j = 0; j <= primesTilln.length; j++){\n //divide 'n' with the primes in 'primesTilln' continously unitll it is divisible by a single prime\n while(n % primesTilln[j] === 0){\n q = n / primesTilln[j];\n n = q;\n primeFactors.push(primesTilln[j]);\n }\n }\n obj = getPrimesAndPowersObj(primeFactors);\n for(var x in obj){\n if(obj[x] > 1){\n add = \"(\" + x + \"**\" + obj[x] + \")\";\n }else if(obj[x] === 1){\n add = \"(\" + x + \")\";\n }\n str = str + add;\n }\n return str;\n}", "function primeFactors(n) {\n while (n != 1) {\n for (let i = 2; i * i <= n; i++) {\n if (n % i == 0) {\n console.log(i + \" \");\n n = Math.floor(n / i);\n break;\n }\n if (i == Math.floor(Math.sqrt(n))) {\n // if we reach √n and still haven't found a factor then the number is prime\n console.log(n + \" \");\n n = Math.floor(n / n);\n }\n }\n }\n}", "function divisors(num){\n var divs = [];\n for(var i=num-1;i>1;i--){\n if(num%i === 0){\n divs.unshift(i);\n }\n }\n if(divs.length < 1){\n return `${num} is prime`\n } else {\n return divs;\n }\n}", "function generateFactorArray() {\n\tlet array = [[]];\n\tfor (let i = 1; i <= maxSize; i++) {\n\t\tarray.push(findFactors(i));\n\t}\n\treturn array;\n}", "function primeFactor(inputnumber) {\n //if i is a factor of inputnumber, check if it is prime\n var factors = [];\n for (var i = 10000; i>1; i--){\n if (inputnumber%i===0){\n factors.push(i);\n }\n }\n\n for (var f in factors) {\n if (isPrime(factors[f])===true){\n return factors[f];\n }\n }\n}", "function sieve(n) {\n let arr = [];\n for (let i = 2; i <= n; i++) arr[i - 2] = i;\n\n for (let i = 2; i * i <= n; i++) {\n // we stop if the square of i is greater than n\n if (arr[i - 2] != 0) {\n // if the number is marked then all it's factors are marked so we move to the next number\n for (let j = Math.pow(i, 2); j <= n; j++) {\n // we start checking from i^2 because all the previous factors of i would be already marked\n if (arr[j - 2] % i == 0) arr[j - 2] = 0;\n }\n }\n }\n return arr;\n}", "function primeFactors(integer) {\n\n\n let divisor = 2;\n let number = integer;\n\n\n while (number > 1) {\n if (number % divisor === 0) {\n number = number / divisor;\n } else {\n divisor++;\n }\n }\n \n return divisor;\n}", "function primeFactorsTo(max)\n{\n var store = [], i, j, primes = [];\n for (i = 2; i <= max; ++i)\n {\n if (!store [i])\n {\n primes.push(i);\n for (j = i << 1; j <= max; j += i)\n {\n store[j] = true;\n }\n }\n }\n return primes;\n}", "primefactor(n) {\n console.log('prime factors of ' + n + ' is :')\n while (n % 2 == 0) {\n console.log(\"2 \")\n n /= 2;\n }\n for (var i = 3; i * i <= n; i++) {\n while (n % i == 0) {\n console.log(i + \" \");\n n /= i;\n\n }\n }\n if (n > 2) {\n console.log(n);\n }\n }", "function primeFactorization() { \n\n\tnumber = document.getElementById(\"userNumber3\").value;\t\n\tconsole.log(number);\n\n\tdivider = [];\n\tfor (i = 2; i < 100000; i++) {\n\t\tdivider.push(i);\n\t} \n\n\tvar check = []\n\tvar factors = []\n\tvar count = 0; \n\n\tvar findFactors = function(number) { \n\t\tcheck = []\n\t\t\n\t\tfor (i = 0; i < divider[i]; i++) {\n\t\t\t\n\t\t\tif (number % divider[i] === 0 && divider[i] != number) {\n\t\t\t\tif (number !== \"\" && number !== \"0\") {\n\t\t\t\tcheck.push(divider[i]);\n\t\t\t\tfactors.push(divider[i]);\n\t\t\t\tcount ++; \n\t\t\t\treturn number / divider[i];\n\t\t\t\t}\t\n\t\t\t} \n\t\t}\n\n\t\tif (check.length === 0 && count > 0) {\n\t\t\tfactors.push(number);\n\t\t\tnumber = \"end\";\n\t\t\treturn number;\n\t\t} else {\n\t\t\tfactors.push(\"Your number already is a prime number. Try a different one!\");\n\t\t\tnumber = \"end\";\n\t\t\treturn number;\n\t\t}\n\n\t}\t\n\n\tvar loop = function(number) {\n\t\tvar i = 0;\n\t\twhile (number !== \"end\" && i < 10000) {\n\t\t\ti++;\n\t\t\tvar number = findFactors(number);\n\t\t}\n\t}\t\n\n\tloop(number);\n\tvar answer = Math.max.apply(Math, factors);\n\tif (isNaN(answer) === true) {\n\t\tanswer = \"Not available\"\n\t} \n\n\tdocument.getElementById(\"multiplesAnswer3\").innerHTML = \"<h4> Prime factors of your\tnumber are: \" + factors.toString() + \" </h4>\" + \"<h4> The largest prime factor of your number is: \" + answer + \" </h4>\";\n return false;\n}", "function findFactors(number) {\n for (var i=2; i<=number;) {\n if (number % i ==0) {\n number /= i;\n }\n else {\n i++;\n }\n }\n console.log(i);\n}", "function primefactor(max) {\n var pfactors = []\n var factor = 2\n var remain = max\n while (remain > 1) {\n while (remain % factor == 0) {\n pfactors.push(factor)\n remain = remain / factor\n }\n factor++\n console.log(\"factor is: \" + factor)\n console.log(\"remain is: \" + remain)\n if (factor * factor > remain) {\n if (remain > 1) {\n pfactors.push(remain)\n }\n break\n }\n }\n console.log(pfactors)\n return pfactors.pop()\n}", "function divisors (number) {\n let divarray = [];\n for (i = 1; i <= number; i++) {\n // console.log(i) will print 1 - 15 (use for number count!)\n // console.log(number) will print \"15\", 15 times\n let num = i;\n if (number % num === 0) {\n divarray.push(num);\n }\n }\n return divarray;\n}", "function getPrimes(int) {\r\n var primes = [];\r\n var curr = 2n;\r\n \r\n while (curr < int) {\r\n if ((int / curr) * curr === int) {\r\n int /= curr;\r\n primes.push(curr);\r\n console.log(curr);\r\n } else {\r\n curr += 1n;\r\n }\r\n }\r\n primes.push(int);\r\n \r\n return primes;\r\n}", "function PrimeValues(value) {\n let primes = [], tempArr=[];\n\n //fills an array with 'true' from 2 to the given value.\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n\n //work way thru array tagging primes & non-primes\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n primes[j] = false;\n }\n }\n }\n\n // remove nonprimes from array.\n for(let i = 2; i < value; i++) {\n if(primes[i] === true) {\n tempArr.push(i);\n }\n }\n return tempArr;\n }", "function maxPrimeFactors(num) {\r\n // First prime number\r\n var x = 2;\r\n var primes = [];\r\n\r\n while (num > 1) {\r\n if (num % x === 0) {\r\n primes.push(x);\r\n num = num / x;\r\n } else {\r\n x += 1;\r\n }\r\n }\r\n maxPrime = primes[0];\r\n for (var i = 1; i < primes.length; i += 1) {\r\n if (primes[i] > maxPrime) {\r\n maxPrime = primes[i];\r\n }\r\n }\r\n return maxPrime;\r\n}", "function commonFactors(num1, num2) {\n const factors = []\n let max\n max = num1 > num2 ? num1 : num2\n for (let i = max; i >= 1; i--) {\n if (num1 % i === num2 % i) {\n factors.push(i)\n }\n }\n return factors\n}", "function primeGen(num) {\n const array = [];\n for (let i = 2; i < num; i++) {\n if (isPrime(i)) array.push(i);\n }\n\n return array;\n}", "function primes(count) {\n const primeNums = [];\n let i = 2;\n \n while (primeNums.length < count) {\n if (isPrime(i)) primeNums.push(i);\n i += 1;\n }\n \n return primeNums;\n}", "function get_fac(n) {\n let res = [];\n res[0]=1;\n for (let i=1; i<=n; i++) {\n res[i] = res[i-1]*i;\n }\n return res;\n}", "function factors(p) {\n const result = [];\n if (defs_1.isadd(p)) {\n p.tail().forEach((el) => result.push(...term_factors(el)));\n }\n else {\n result.push(...term_factors(p));\n }\n return result;\n}", "function primes(n) {\n var realNumbers = [];\n for(i=0; i<=n; i++) {\n realNumbers.push(true);\n }\n var primeNumbers = [];\n for (i=0; i<=n; i++) {\n if (i == 0 || i == 1 || realNumbers[i] === false) {\n continue;\n }\n primeNumbers.push(i);\n for (j=i; true; j++) {\n if (i*j < realNumbers.length) {\n realNumbers[i*j] = false;\n } else {\n break;\n }\n }\n }\n return primeNumbers;\n}", "function myQ6(arry, num) {\r\n\tvar result = [];\r\n\tvar j = 0;\r\n\tfor (var i = 0; i < arry.length; i++) {\r\n\t\tif ((arry[i] != 0) && (arry[i] % num == 0)) {\r\n\t\t\tresult[j] = i;\r\n\t\t\tj++;\r\n\t\t}\r\n\t}\r\n\r\n\t//result = num;\r\n\treturn result;\r\n}", "function primesArray(input) {\n //initialising array\n let primes = [];\n //avoid returning 1 as a prime value\n let i = 2;\n\n //setting condition - total number of values returned should be equal to n\n while (primes.length < input) {\n //if i passes prime test add it to the array\n if (isPrime(i)) {\n primes.push(i);\n }\n //increment in and add 1 to i\n i += 1;\n }\n return primes;\n}", "function primeFactors(n){\n let result = \"\";\n let factors = {};\n let f = 2; // lowest possible factor\n while (n > 1) {\n if (n % f === 0) {\n if (!factors.hasOwnProperty(f)) {\n factors[f] = 1;\n } else {\n factors[f]++;\n }\n n /= f;\n } else {\n f++;\n }\n }\n for (let key of Object.keys(factors)) {\n if (factors[key] === 1) {\n result += `(${key})`;\n } else {\n result += `(${key}**${factors[key]})`;\n }\n }\n return result;\n}", "function prime3(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n const result = [2];\n for(let i = 0; i < data.length; i += 1) {\n if (data[i] == 0) {\n result.push(2 * i + 1);\n }\n }\n return result;\n }", "function findTheDivisors(num) {\n let arr = [];\n for (let i = 0; i < num; i++) {\n if (num % i == 0 && i != 1) {\n arr.push(i);\n }\n }\n return arr.length ? arr : \"is prime\";\n}", "function primeGenerator(n) {\n\tvar result = [];\n\tvar counter = 2;\n\t\n\twhile (result.length < n) {\n\t\tif (testPrime(counter)) {\n\t\t\tresult.push(counter);\n\t\t}\n\t\tcounter++;\n\t}\n\treturn result;\n}", "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function notPrimes(a,b){\n let arr = [];\n for (let i = a; i < b; i++){\n if (!/[014689]/.test(i)) {\n for (let j = 2; j <= Math.sqrt(i); j++){\n if (i % j === 0) { arr.push(i); break;}\n }\n }\n }\n return arr;\n}", "function getPrimeNumbers(num) {\n let primes = [];\n for (let i = num; i > 1; i--) {\n if (isPrime(i)) {\n primes.push(i);\n }\n }\n return primes;\n }", "function findDivisors(a) {\n var divisors = [];\n for (var n = 1; n < a / 2 + 1; n++) {\n if (a % n == 0) {\n divisors.push(n);\n console.log(n);\n }\n }\n return divisors;\n}", "function findPrime() {\n prime = [2];\n const value = document.getElementById(\"input\").value;\n\n for (let number = 3; number <= value; number++) {\n let numArr = [];\n for (let divider = 2; divider < number; divider++) {\n numArr.push(number % divider);\n }\n\n let isZero = numArr.includes(0);\n\n if (!isZero) {\n prime.push(number);\n }\n }\n console.log(prime);\n}", "function checkPrimes(size) {\n var primes = [];\n var isPrime = true;\n for (var i = 2; i < size; i++) {\n isPrime = true;\n for (var j = 2; j < i / 2; j++) {\n if (i % j == 0 ) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n return primes;\n}", "function largestPrimeFactor(number) {\n if (number % 2 === 0) {\n return 2;\n }\n let arrayOfPrimeFctors = [];\n let i = 3;\n while(number != 1) {\n if (number % i === 0) {\n number /= i;\n arrayOfPrimeFctors.push(i);\n } else {\n i += 2;\n }\n }\n return arrayOfPrimeFctors[arrayOfPrimeFctors.length - 1];\n }", "function prime(num) {\n // Generate an array containing every prime number between 0 and the num specified (inclusive)\n\tvar primeNum = [];\n for(var i = 2; i <= num; i++) {\n \tif( prime2(i) ) {\n \tprimeNum.push(i);\n }\n }\n return primeNum;\n}", "factors() {\n\tfunction isPrime(n) {\n\tfor (var i = 2; i <= n / 2; i++) {\n\t\tif (n % i == 0) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n\t}\n\n\tfunction primeFactors(n) {\n\tfor (var i = 2; i * i < n; i++) {\n\tvar t = n % i;\n\t\tif (t == 0) {\n\t\t\tif (isPrime(i))\n\t \t\tconsole.log(i + \" \");\n\t\t}\n\t}\n\t}\n\n\tvar num = readlinesync.question(\"enter no to find prime factors\");\n\tconsole.log(\"prime factors are \");\n\tprimeFactors(num);\n}", "function listPrimes(n) {\n const list = [];\n const output = [];\n // Make an array from 2 to (n-1)\n for (let i = 0; i < n; i += 1) {\n list.push(true);\n }\n // remove multiples of primes starting from 2,3,5...\n for (let i = 2; i <= Math.sqrt(n); i += 1) {\n if (list[i]) {\n for (let j = i * i; j < n; j += i) {\n list[j] = false;\n }\n }\n }\n\n // All array[i] set to ture are primes\n for (let i = 2; i < n; i += 1) {\n if (list[i]) {\n output.push(i);\n }\n }\n return output;\n}", "function arrayFactors(array){\n for (var i=0; i<array.length;i++){\n output[array[i]] = [];\n for (var j=0; j<array.length;j++){\n if (i==j){\n continue; \n } else if(array[i] % array[j] == 0){\n console.log(array[j] +' is a factor of '+ array[i]);\n output[array[i]].push(array[j]);\n }\n }\n console.log('for array element ', array[i] + ' the output is ', output[array[i]]);\n }\n\n var displayOutput = output.toString();\n console.log(output);\n return displayOutput;\n}", "function divisibleBy (arr, divisor) {\n let result = [];\n for(let num of arr){\n if(num % divisor === 0){\n result.push(num);\n }\n }\n return result;\n}", "function divisibleBy(numbers, divisor) {\n let arr = [];\n for (let index = 0; index < numbers.length; index++) {\n if (numbers[index] % divisor === 0) {\n arr.push(numbers[index]);\n }\n }\n return arr;\n}", "function divisibleBy(numbers, divisor) {\n const divisibles = []\n for (let i = 0; i < numbers.length; i++) {\n if (numbers[i] % divisor === 0) {\n divisibles.push(numbers[i])\n }\n }\n return divisibles\n}", "function primeSieve(num){\n var primes = [];\n for(var i = 0; i <= num; i++){\n primes.push(1);\n }\n for(var j = 2; j <= Math.floor(Math.sqrt(primes.length)); j++){\n console.log('j', j);\n if(primes[j] === 1){\n for(var k = j * j; k <= num; k += j){\n primes[k] = 0; \n }\n }\n }\n return primes; \n}", "function divisors(integer) {\n let x = [];\n for (let i = 2; i < integer; i++) {\n if (integer % i === 0) x.push(i);\n }\n\n if (!x.length) return `${integer} is prime`;\n else return x;\n}", "function getFactorsSum (n) {\n console.log('we are in getFactorsSum for ' + n);\n let factorsArray = [];\n for (let i = 1; i <= n; i++) {\n if((n % i == 0) && (n != i)) {\n console.log('we pushed to factorsArray and the factor of ' + n + ' is ' + i);\n factorsArray.push(i);\n }\n }\n if (n == 1) {\n return 1;\n }\n console.log('the sum of the factors for ' + n + ' is ' + factorsArray.reduce((a, b) => a + b));\n return factorsArray.reduce((a, b) => a + b);\n \n}", "function pthFactor(n, p) {\n let factors = [];\n let i = 1;\n\n // check for factors that are less than or equal to sqrt(n)\n // create first half of array up to middle point\n while (i * i <= n) {\n if (n % i == 0) {\n factors.push(i);\n }\n i++;\n }\n\n // check if k is in first half of factors\n // if true, we have solution\n let arrSize = factors.length;\n\n if (p <= arrSize) {\n return factors[p - 1];\n }\n\n // check if k is in the second half of all factors\n // total number of factors is twice in size\n let factorsCount = 2 * arrSize;\n \n\n // check if n is perfect square - reduce factor count by 1 to prevent repetition\n if (factors[arrSize - 1] * factors[arrSize - 1] == n) {\n factorsCount--;\n }\n\n // p is greater than amount of factors in array, then return 0\n if (p > factorsCount) {\n return 0;\n }\n // divide n by corresponding factor at index to give actual factor\n console.log(factorsCount);\n console.log(factors[factorsCount-p])\n return n / factors[factorsCount - p];\n}", "function largestPrimeFactor(number) {\n let primeFactors = [];\n let primeCandidate = 2; // Start with smallest prime number (2)\n\n // algorithm works for positive numbers\n while (number > 1) {\n // If number divisible with candidate; append to list\n while (number % primeCandidate === 0) {\n primeFactors.push(primeCandidate);\n number /= primeCandidate;\n }\n primeCandidate += 1; // Just increase by 1; all multiple of primeCandidate will not evaluate anyway\n // -> e.g. if number is divided by 2, multiples like 4/6/8/... are not possible anymore\n }\n return primeFactors[primeFactors.length - 1];\n}", "function prime(){\nalert(\"A factor is a number that can divide another without leaving a remainder eg 3 is a factor of 6.\");\nalert(\"A number can have more than one factor eg 2,3,4,6 are all factors of 12.\");\nalert(\"A multiple is a number that can be divided by another without leaving a remainder eg 6 is a multiple of 3 \");\nalert(\"A number can have more than one multiple eg 6,9,12,15,18,21 etc are all multiples of 3.\");\nalert(\"Two or more numbers can have common factors eg factors of 12 are 2,3,4,6 and factors of 18 are 2,3,6,9.It can be seen that 2,3 and 6 are common factors of 12 and 18.The most useful common factor is the Highest common factor(HCF) in this case 6.\");\nalert(\"Two or more numbers can have common multiples eg multiples of 2 are 4,6,8,10,12,14,16,18,20,22,24 etc and multiples of 3 are 6,9,12,15,18,21,24 etc.It can be seen that 6,12,18,24 are common multiples of 2 and 3.The most useful common multiple is the Lowest common multiple(LCM) in this case 6.\");\n}", "function divisibleBy(numbers, divisor) {\n let arr = numbers.filter(el => {\n return el % divisor === 0;\n });\n \n return arr;\n}", "function primesToN(n) {\n\tvar result = [];\n\tfor (var i = 2; i <= n; i++) {\n\t\tif (testPrime(i)) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\treturn result;\n}", "function findLargestPrimeFactor(number){\n\n//find all the primes between 0 and sqrt(number) (600851475143 by default)\n// we can use sqrt(number) since we don't care about the highest prime\n// we just care about the highest factor\n//starting at the end of the list (aka, starting with large primes) see if any of them divide the number inputed evenly.\n//if so, bob's your uncle.\n number = (number == undefined ? 600851475143 : number);\n // sieve of Eratosthenes\n var sievedPrimes = [];\n var largestPrimeFactor = i;\n for(var i = 2; i < Math.sqrt(number); i++){\n if(sievedPrimes[i] == undefined ){\n for(var degree=1, j = i << 1; j < Math.sqrt(number); j = (i << 1)+(++degree*i)){//we only care about primes < sqrt which greatly limits the search\n sievedPrimes[j] = false;\n }\n if(number%i == 0){\n largestPrimeFactor = i;\n }\n }\n }\n return largestPrimeFactor;\n}", "function multiples(num1, num2) {\n let new_array = [];\n for (let i = 1; i <= 100; i++) {\n if (i % num1 === 0 && i % num2 === 0) {\n new_array.push(i);\n }\n } //end of for\n return new_array;\n } //end of multiples" ]
[ "0.84773177", "0.841825", "0.8261534", "0.8256249", "0.8255569", "0.82413673", "0.8226271", "0.8195013", "0.81867373", "0.81858087", "0.81778604", "0.8174697", "0.8132914", "0.80744773", "0.80608726", "0.80603385", "0.80320275", "0.8021769", "0.79962844", "0.79853904", "0.79806066", "0.79740137", "0.797189", "0.78904873", "0.7881206", "0.7878683", "0.78511167", "0.78381383", "0.77948105", "0.7781598", "0.77477545", "0.7719431", "0.7681215", "0.76765376", "0.7668463", "0.76342225", "0.7611903", "0.7608586", "0.7558865", "0.7546291", "0.75168115", "0.75162005", "0.74973506", "0.74792564", "0.7478043", "0.7446226", "0.7408512", "0.7166436", "0.7000178", "0.68638784", "0.68551016", "0.685232", "0.68516964", "0.68440616", "0.68428236", "0.68420595", "0.6815633", "0.6779241", "0.6709803", "0.6688023", "0.66379136", "0.66253495", "0.6616445", "0.6596266", "0.6583563", "0.65580386", "0.653479", "0.6515469", "0.6509507", "0.64943314", "0.64706606", "0.64577615", "0.64559096", "0.641253", "0.6411778", "0.64107585", "0.639109", "0.6370539", "0.63696206", "0.63587576", "0.6337914", "0.6337124", "0.6331531", "0.631295", "0.62948954", "0.6281434", "0.6261616", "0.6260706", "0.62311137", "0.6223595", "0.6211822", "0.62106705", "0.6203862", "0.6190976", "0.61847025", "0.61817956", "0.61725384", "0.6167045", "0.61650383", "0.61427575" ]
0.74810165
43
solution 1 this solution is not as efficient when combined with sieveOfEratosthenes
function isPrime(num) { if(num < 2) return false; for(let i=2; i < num; i++){ if(num%i===0) return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function problem10() {\n \"use strict\";\n var i, j, k, l, m, s, a; // i, j, k are counters, others are defined as we go\n l = Math.floor((2000000 - 1) / 2); //not sure why we're going halfway\n a = [];\n for (i = 0; i < l; i += 1) {\n a[i] = true; // make a whole bunch of numbers true\n }\n m = Math.sqrt(2000000); // first part that makes sense\n for (i = 0; i <= m; i += 1) { \n if (a[i]) { // all a[i] are already true\n j = 2 * i + 3; // all primes can be represented as 2k+3, certainly not for all k in Z as k = 3 gives 9 which is not prime\n k = i + j; // initialize k as a multiple of 3; k = 2i + 3 + i = 3i+3 = 3(i+1);\n while (k < l) {\n a[k] = false; // makes sense \n k += j; // make k a multiple of j and set it to false\n }\n }\n } // this doesn't seem like the seive of eratosthenes\n s = 2;\n for (i = 0; i < l; i += 1) { // now I see why we halved limit\n if (a[i]) {\n s += 2 * i + 3; // because here we use the 2k + 3\n }\n }\n return s;\n\n}", "function sieveOfEratosthenes2(n){\n var primes = [];\n\n for(var i = 0; i <= n; i++) primes[i] = true;\n primes[0] = false;\n primes[1] = false;\n\n for(var i = 2; i <= Math.sqrt(n); i++){\n for(var j = 2; j*i <= n; j++){\n primes[i * j] = false;\n }\n }\n\n var result = [];\n for(var i = 0; i < primes.length; i++){\n if(primes[i]) result.push(i);\n }\n\n return result;\n}", "function primeListSoE(max) {\n console.time();\n var numList = [];\n for (let i = 0; i <= max; i++) {\n numList.push(true);\n }\n //turn all even index to false\n for (let i = 4; i < numList.length; i+=2) {\n numList[i] = false;\n }\n for (let i = 3; i < Math.sqrt(numList.length); i+=2) {\n if (numList[i] != false) {\n for (let j = i; i * j < numList.length; j+=2) {\n numList[i * j] = false;\n }\n }\n }\n // var primeList = [];\n // for (let i = 2; i < numList.length; i++) {\n // if (numList[i]) {\n // primeList.push(i);\n // }\n // }\n\n console.timeEnd();\n // return primeList;\n while (numList[numList.length - 1] === false) {\n numList.pop();\n }\n return numList.length - 1;\n}", "function sieve(max) {\n // Returns array a of length max where a[i]=1 if i is prime.\n // For max=60M, computes 3.5 million primes in 15 seconds\n // For max=10M, computes 67k primes in 2 seconds.\n\n // Initialize variables\n let a = new Array(max);\n\n // Initialize sieve array\n for (var i=0; i<=max; i++) {\n a[i]=1;\n }\n\n // Mark all composite numbers\n for (var i=2; i<=max; i++) {\n for (var j=2; i*j<=max; j++) {\n a[i*j]=0;\n }\n }\n\n return a;\n}", "function sieve(limit){\n\t// console.log(\"starting sieve\");\n\tvar arr = []; \n\t//initialize an array\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\tarr[1]=0;\n\t//check all 2*n, 3*n, 4*n,etc... and make their entries 0\n\t//whatever remains must be a prime\n\tfor (var j=2; j < limit; j++){\n\t\tif (arr[j]!=0){\n\t\t\tfor (var k=2; k < limit/j; k++){\n\t\t\tarr[k*j] = 0;\t\n\t\t\t}\t\n\t\t}\n\t}\n\treturn arr;\n}", "function ErastosthenesSieve(N1, N2)\n{\n N1=parseInt(N1);\n\tN2=parseInt(N2);\n\tvar m = 0;\n\tvar prime=new Array();\n if (N2<N1)\n\t{\n\t\t//swap\n\t\tvar temp=N1;\n\t\tN1=N2;\n\t\tN2=temp;\n\t}\n\t\n\tfor(var n = N1;n<=N2; n++)\n\t{\n\t\ti=IsPrime(n);\n if (i == 1)\n\t\t{\n prime[m] = n;\n m ++;\n\t\t}\n\t}\n\t\n\treturn prime;\n}", "function primeMover(num){\n\t\n\tfunction sOE(n){\n\t\tvar tempArray = [];\n\t\tvar outputArray = [];\n\t\tvar upperLimit = Math.sqrt(n);\n\t\t\n\t\tfor(var i = 0; i < n; i++){\n\t\t\ttempArray.push(true);\n\t\t}\n\t\t\n\t\tfor(var j = 2; j <= upperLimit; j++){\n\t\t\tif(tempArray[j]){\n\t\t\t\tfor(var k = j*j ; k < n; k += j){\n\t\t\t\t\ttempArray[k] = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(var l = 2; l < n; l++){\n\t\t\tif(tempArray[l]){\n\t\t\t\toutputArray.push(l);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn outputArray;\n\t}\n\t\n\n\tvar primes = sOE(10000);\n\t\tconsole.log(primes);\n\t\n\treturn primes[num - 1];\n}", "function sieveOfEratosthenes(n){\n var squareRoot = Math.sqrt(n);\n var primes = [];\n\n //Turn all elements to true by default\n for (var i = 0; i <= n; i++){\n primes[i] = true;\n }\n\n //These are never prime so mark those false\n primes[0] = false;\n primes[1] = false;\n\n //Nested loop. For each number, starting from index 2,\n for (var i = 2; i <= squareRoot; i++){\n // check and see if the multiples are found within the original array (make sure they don't exceed the max). If they are, mark them false;\n for (var j = 2; j * i <= n; j++){\n primes[i * j] = false;\n }\n }\n\n //Create new array\n var result = []\n //Check all values from original array. If they are true, push their index to the new array\n for (var i = 0; i < primes.length; i++){\n if (primes[i]){\n result.push(i)\n }\n }\n\n //Return new array\n return result;\n}", "function SeiveOfEratosthenes(n){\n prime = Array.from({length: n+1}, (_, i) => true);\n for(i=2; i<=n; i++){\n //if its true finally, its a prime.\n if(prime[i]== true){\n //to go through the multiples.\n for(p = i*i; p<=n; p+=i){\n prime[p] = false;\n };\n };\n };\n //loop to print out primes\n textarea = document.getElementById('textarea');\n textarea.textContent = 'Prime Numbers upto ' + `${n}` + ' : ';\n for(i=2; i<=n;i++){\n if(prime[i] == true){\n textarea.textContent += i + \", \";\n };\n };\n\n}", "function primeList() {\n // For max=60M, computes 3.5 million primes in 15 seconds\n // For max=10M, computes 67k primes in 2 seconds.\n\n // Initialize variables\n let max = 10000000; // Maximum number to check if prime.\n let a = new Array(max);\n let out = []\n\n // Initialize sieve array\n for (var i=0; i<=max; i++) {\n a[i]=1;\n }\n\n // Mark all composite numbers\n for (var i=2; i<=max; i++) {\n for (var j=2; i*j<=max; j++) {\n a[i*j]=0;\n }\n }\n\n // Generate output list of prime numbers\n for (var i=2; i<=max; i++) {\n if (a[i]==1) {\n out.push(i)\n }\n }\n\n return out;\n}", "function sieveOfEratosthenes(n) {\n let primes = [];\n\n for(let i=0; i <= n; i++) {\n if(isPrime(i)) primes.push(i);\n }\n return primes;\n}", "function primeSieve(n) {\n var array = [], upperLimit = Math.sqrt(n), output = [];\n\n //makes an array from 2 to (n-1)\n for (var i = 0; i < n; i++){\n array.push(true);\n }\n\n //removes multiples of primes starting from 2,3,5\n for (var i = 2; i <= upperLimit; i++){\n if (array[i]) {\n for (var j = i * i; j < n; j += i) {\n array[j] = false;\n }\n }\n }\n\n //all array[i]set to true are primes for(var i = 2; i < n; i++){\n for (var i = 2; i < n; i++){\n if (array[i]){\n output.push(i);\n }\n }\n return output;\n}", "function primeSieve(num){\n var primes = [];\n for(var i = 0; i <= num; i++){\n primes.push(1);\n }\n for(var j = 2; j <= Math.floor(Math.sqrt(primes.length)); j++){\n console.log('j', j);\n if(primes[j] === 1){\n for(var k = j * j; k <= num; k += j){\n primes[k] = 0; \n }\n }\n }\n return primes; \n}", "function prime2(n) {\n const data = [];\n for (let i = 1; i < n; i += 2) {\n data.push(i);\n }\n data[0] = 0;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] > 0) {\n let k = data[i];\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 0;\n }\n }\n }\n const result = [2];\n for (let i of data) {\n if (i > 0) {\n result.push(i);\n }\n }\n return result;\n }", "function primeSieve(max) {\n let output = sieveMultiplesOf(2, max)\n let counter = 3;\n let baseMultipes = [2,3]\n\n while (counter*2 < max) {\n output = reSieve(counter, output);\n counter = findNextNumberInArray(counter, output)\n }\n\n output.unshift(2);\n\n return output\n .filter(item => item !== false);\n}", "function sieve(n) {\n\tfor (let i = 0; i < n; i++) {\n\t\tif (esPrimo(i)) {\n\t\t\tconsole.log(i)\n\t\t}\n\t}\n}", "function sieve(n) {\n let arr = [];\n for (let i = 2; i <= n; i++) arr[i - 2] = i;\n\n for (let i = 2; i * i <= n; i++) {\n // we stop if the square of i is greater than n\n if (arr[i - 2] != 0) {\n // if the number is marked then all it's factors are marked so we move to the next number\n for (let j = Math.pow(i, 2); j <= n; j++) {\n // we start checking from i^2 because all the previous factors of i would be already marked\n if (arr[j - 2] % i == 0) arr[j - 2] = 0;\n }\n }\n }\n return arr;\n}", "function sieve(limit){\n\n\tvar arr =[];\n\t//generate array with numbers 0,1, ...limit\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\n\t//remove all non-prime numbers using sieve method\n\tfor (var j =2; j < limit; j++){\n\t\tfor (var k= 2; k <limit/j; k++){\n\t\t\tarr[j*k] = 0;\n\t\t}\n\t}\n\treturn arr;\n}", "function findPrimes(n) {\n const primes = new Array(n + 1).fill(true);\n\n for (let i = 2; Math.pow(i, 2) <= n; i++) {\n if (primes[i]) {\n for (let j = Math.pow(i, 2); j <= n; j = j + i) {\n primes[j] = false;\n }\n }\n }\n\n for (let i = 2; i <= n; i++) {\n if (primes[i]) console.log(i);\n }\n}", "function solutionThree(){\n var x = 600851475143;\n var z = Math.ceil(x/2);\n z = z % 2 == 0 ? z - 1 : z;\n var l = 0;\n factor:for(i = z; i > 0; i-=2){//Skip over all even numbers as they can't be prime\n l++;\n if(l==100000000){//Cheaper than i%n==0\n l=0;\n global.gc();//Run with option --expose-gc\n }\n\n\n if(x%i==0){//is factor\n for(k = 3; k < Math.sqrt(i); k++){//I is always odd so never divisible by 2 so can start at 3\n //Only need to check up to the sqrt. If k > sqrt then we have already checked the possibilities\n if(i%k==0){//!prime\n continue factor;\n }\n }\n return i;//prime\n }\n }\n}", "function findPrimes(max) {\n //Create variables for our loops and empty arrays to .push to\n var sieve = [];\n var i;\n var j;\n var primes = [];\n //Loop through max starting at 2(first prime number) \n for(i = 2; i <= max; ++i) {\n //If not(!) a sieve number..\n if(!sieve[i]) {\n //Push i to the primes array\n primes.push(i);\n \n for(j = i << 1; j<=max; j+=i) {\n //add other numbers(non primes) to sieve array\n sieve[j] = true;\n }\n }\n }\n return primes;\n }", "function sieve(maximum) {\n const primeFlags = new Array(maximum + 1).fill(true);\n primeFlags[0] = false;\n primeFlags[1] = false;\n for (let i = 2; Math.pow(i, 2) <= maximum; i += 1) {\n if (!primeFlags[i]) {\n continue;\n }\n for (let j = 2; j * i <= maximum; j += 1) {\n primeFlags[j * i] = false;\n }\n }\n return primeFlags.map((p, n) => p && n).filter(n => n);\n}", "function solution(N) {\n\n let uniqueMap = {};\n for (let i = 2;i <= N; i++) {\n uniqueMap[i] = uniqueMap[i] || _isPrimeNum(i);\n let rotations = _getRotations(i);\n rotations.map(rotation => {\n uniqueMap[i] &= _isPrimeNum(rotation);\n });\n }\n let primes = Object.keys(uniqueMap).filter(rotation => {return uniqueMap[rotation]});\n return primes.length;\n}", "function getPrimes(max) {\n if (max > 0) {\n const sieve = [];\n let iCount = 0;\n let jCount = 0;\n const primes = [];\n for (iCount = 2; iCount <= max; ++iCount) {\n if (!sieve[iCount]) {\n primes.push(iCount);\n for (jCount = iCount << 1; jCount <= max; jCount += iCount) {\n sieve[jCount] = true;\n }\n }\n }\n store = primes;\n }\n}", "function primeListNew(max) {\n console.time();\n var numList = [];\n for (let i = 0; i <= max; i++) {\n numList.push(true);\n }\n //turn all even index to false\n for (let i = 4; i < numList.length; i+=2) {\n numList[i] = false;\n }\n for (let i = 3; i < Math.sqrt(numList.length); i+=2) {\n for (let j = i; i * j < numList.length; j++) {\n numList[i * j] = false;\n }\n }\n var primeList = []\n for (let i = 2; i < numList.length; i++) {\n if (numList[i]) {\n primeList.push(i);\n }\n }\n console.timeEnd();\n return primeList;\n}", "function isPrimeSieve(n) {\n if (n === 2 || n === 3) {\n return true;\n }\n return sieve[n];\n }", "function findPrimes(n) {\n var i, s, p, ans;\n s = new Array(n);\n for (i = 0; i < n; i++)\n s[i] = 0;\n s[0] = 2;\n p = 0; //first p elements of s are primes, the rest are a sieve\n for (; s[p] < n; ) { //s[p] is the pth prime\n for (i = s[p] * s[p]; i < n; i += s[p]) //mark multiples of s[p]\n s[i] = 1;\n p++;\n s[p] = s[p - 1] + 1;\n for (; s[p] < n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)\n }\n ans = new Array(p);\n for (i = 0; i < p; i++)\n ans[i] = s[i];\n return ans;\n }", "function findPrimes(n) {\n var i,s,p,ans;\n s=new Array(n);\n for (i=0;i<n;i++)\n s[i]=0;\n s[0]=2;\n p=0; //first p elements of s are primes, the rest are a sieve\n for(;s[p]<n;) { //s[p] is the pth prime\n for(i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]\n s[i]=1;\n p++;\n s[p]=s[p-1]+1;\n for(; s[p]<n && s[s[p]]; s[p]++); //find next prime (where s[p]==0)\n }\n ans=new Array(p);\n for(i=0;i<p;i++)\n ans[i]=s[i];\n return ans;\n }", "function problem10(){\n let c=2;\n let x=3;\n while( x < 2000000 ){\n if(fasterPrime(x) === true){\n c+=x;\n }\n x+=2;\n }\n return c;\n}", "function getPrimes(max) {\n var sieve = [];\n var i;\n var j;\n var primes = [2];\n for (i = 3; i <= max; i+=2) {\n if (!sieve[i]) {\n // i has not been marked -- it is prime\n primes.push(i);\n for (j = i << 1; j <= max; j += i) {\n // make all multiples equal true, so they don't get pushed\n sieve[j] = true; \n }\n }\n }\n return primes;\n }", "function findSmallerPrimes() {\n for (let i = 0; i < 1000; i++) {\n isPrime(i);\n }\n}", "function reSieve(multiple, array) {\n\n let funVariable = multiple + multiple;\n\n let max = array.length+2;\n\n while (funVariable < max) {\n let position = array.indexOf(funVariable);\n array[position] = false;\n funVariable = funVariable + multiple;\n }\n\n return array;\n\n // return array.map(num => {\n // if (num <= multiple || num % multiple !== 0) {\n // return num;\n // } else {\n // return false;\n // }\n // });\n}", "function prime3(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n const result = [2];\n for(let i = 0; i < data.length; i += 1) {\n if (data[i] == 0) {\n result.push(2 * i + 1);\n }\n }\n return result;\n }", "function problem7(){\n c=1;\n x=3;\n while( c < 10001 ){\n if(fasterPrime(x)){\n c++;\n }\n x+=2;\n }\n return x-2;\n}", "function euler_phi(n)\n{\n\treturn eratosthenes(n).length;\n}", "function PrimeMover(num) {\n var primes = [2];\n for (var i = 3; i <= 10^4; i += 2) {\n var prime = true;\n if (num === primes.length) {\n return primes[primes.length-1];\n }\n for (var j = 2; j <= i / 2; j++) {\n if (i % j === 0) {\n prime = false;\n }\n }\n if (prime) {\n primes.push(i);\n }\n }\n}", "function bench03(n, state) {\n\tvar nHalf = n >> 1, // div 2\n\t\tx, sieve1, i, j, m;\n\n\tif (!state.bench03Sieve) {\n\t\tstate.bench03Sieve = typeof Uint8Array !== \"undefined\" ? new Uint8Array(nHalf + 1) : new Array(nHalf + 1); // set the size we need, only for odd numbers\n\t}\n\tsieve1 = state.bench03Sieve;\n\n\t// initialize sieve\n\tif (sieve1.fill) {\n\t\tsieve1.fill(0);\n\t} else {\n\t\tfor (i = 0; i <= nHalf; i++) {\n\t\t\tsieve1[i] = 0; // odd numbers are possible primes\n\t\t}\n\t}\n\n\t// compute primes\n\ti = 0;\n\tm = 3;\n\tx = 1; // number of primes below n (2 is prime)\n\twhile (m * m <= n) {\n\t\tif (!sieve1[i]) {\n\t\t\tx++; // m is prime\n\t\t\tj = (m * m - 3) >> 1; // div 2\n\t\t\twhile (j < nHalf) {\n\t\t\t\tsieve1[j] = 1;\n\t\t\t\tj += m;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t\tm += 2; // or: =2 * i + 3;\n\t}\n\n\t// count remaining primes\n\twhile (m <= n) {\n\t\tif (!sieve1[i]) {\n\t\t\tx++; // m is prime\n\t\t}\n\t\ti++;\n\t\tm += 2;\n\t}\n\treturn x;\n}", "function sumPrime(num) {\n // Function to get the primes up to max in an array\n function getPrimes(max) {\n var sieve = [];\n var i;\n var j;\n var primes = [2];\n for (i = 3; i <= max; i+=2) {\n if (!sieve[i]) {\n // i has not been marked -- it is prime\n primes.push(i);\n for (j = i << 1; j <= max; j += i) {\n // make all multiples equal true, so they don't get pushed\n sieve[j] = true; \n }\n }\n }\n return primes;\n }\n // Sum All primes\n var primes = getPrimes(num);\n return primes.reduce((total, item) => total + item);\n}", "function prime(index) {\n\n}", "function problem2(){\n var numArr = [1,2];\n while(numArr[numArr.length-1]<4000000){\n numArr.push( numArr[numArr.length - 2] + numArr[numArr.length - 1] );\n }\n numArr = numArr.filter(function(a){ return a%2===0});\n return numArr.reduce(function(a,b){ return a+b; });\n}", "function atkin(limit) {\n const sieve = new Array(limit).fill(false)\n\n for (let x = 0; x * x < limit; x++) {\n for (let y = 0; y * y < limit; y++) {\n let n = 4 * x * x + y * y\n if (n <= limit && (n % 12 == 1 || n % 12 == 5)) sieve[n] = true\n\n n = 3 * x * x + y * y\n if (n <= limit && n % 12 == 7) sieve[n] = true\n\n n = 3 * x * x - y * y\n if (x > y && n <= limit && n % 12 == 11) sieve[n] = true\n }\n }\n for (let r = 5; r * r < limit; r++) {\n if (sieve[r]) for (let i = r * r; i < limit; i += r * r) sieve[i] = false\n }\n\n const res = [2, 3]\n for (let a = 5; a < limit; a++) {\n if (sieve[a]) res.push(a)\n }\n return res\n}", "function sumPrimes(num) {\n sum = 1;\n for (let i=2;i<=num;i++) {\n console.log(\"-----\");\n console.log(\"i=\"+i);\n for (let j=2;j<i;j++) {\n console.log(\"j=\"+j);\n if (i % j == 0) {\n break;\n }\n }\n sum = sum + i;\n console.log(\"sum=\"+sum);\n }\n return sum;\n}", "function findPrime2(max) {\n var arr = []\n for (let i = 2; i <= max; i++) {\n arr.push(i)\n }\n // console.log(\"Prime Array: \" + arr)\n for (let i = 0; i < (Math.ceil(Math.sqrt(max))); i++) {\n for (let j = arr[i];arr[i]*j <= arr[arr.length -1]; j++) {\n // console.log(\"we are at number :\" + arr[i] )\n // var multval = arr[i]*j\n // console.log(\"multiple is:\" + multval)\n var multiple = arr.indexOf(arr[i]*j)\n // console.log(\"multiple index is :\" + multiple)\n if (multiple != -1) {\n arr.splice(multiple,1)\n // console.log(\"removed \" + multiple + \"new array :\" + arr)\n }\n }\n }\n return arr\n}", "function getPrimes(max) {\n var sieve = [];\n var i;\n var j;\n var primes = [];\n for (i = 2; i <= max; ++i) {\n if (!sieve[i]) {\n // i has not been marked -- it is prime\n primes.push(i);\n for (j = i << 1; j <= max; j += i) {\n sieve[j] = true;\n }\n }\n }\n\n return primes;\n }", "function randTruePrime_(ans,k) {\n var c,w,m,pm,dd,j,r,B,divisible,z,zz,recSize,recLimit;\n\n if (primes.length==0)\n primes=findPrimes(30000); //check for divisibility by primes <=30000\n\n if (pows.length==0) {\n pows=new Array(512);\n for (j=0;j<512;j++) {\n pows[j]=Math.pow(2,j/511.0-1.0);\n }\n }\n\n //c and m should be tuned for a particular machine and value of k, to maximize speed\n c=0.1; //c=0.1 in HAC\n m=20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits\n recLimit=20; //stop recursion when k <=recLimit. Must have recLimit >= 2\n\n if (s_i2.length!=ans.length) {\n s_i2=dup(ans);\n s_R =dup(ans);\n s_n1=dup(ans);\n s_r2=dup(ans);\n s_d =dup(ans);\n s_x1=dup(ans);\n s_x2=dup(ans);\n s_b =dup(ans);\n s_n =dup(ans);\n s_i =dup(ans);\n s_rm=dup(ans);\n s_q =dup(ans);\n s_a =dup(ans);\n s_aa=dup(ans);\n }\n\n if (k <= recLimit) { //generate small random primes by trial division up to its square root\n pm=(1<<((k+2)>>1))-1; //pm is binary number with all ones, just over sqrt(2^k)\n copyInt_(ans,0);\n for (dd=1;dd;) {\n dd=0;\n ans[0]= 1 | (1<<(k-1)) | randomBitInt(k); //random, k-bit, odd integer, with msb 1\n for (j=1;(j<primes.length) && ((primes[j]&pm)==primes[j]);j++) { //trial division by all primes 3...sqrt(2^k)\n if (0==(ans[0]%primes[j])) {\n dd=1;\n break;\n }\n }\n }\n carry_(ans);\n return;\n }\n\n B=c*k*k; //try small primes up to B (or all the primes[] array if the largest is less than B).\n if (k>2*m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits\n for (r=1; k-k*r<=m; )\n r=pows[randomBitInt(9)]; //r=Math.pow(2,Math.random()-1);\n else\n r=0.5;\n\n //simulation suggests the more complex algorithm using r=.333 is only slightly faster.\n\n recSize=Math.floor(r*k)+1;\n\n randTruePrime_(s_q,recSize);\n copyInt_(s_i2,0);\n s_i2[Math.floor((k-2)/bpe)] |= (1<<((k-2)%bpe)); //s_i2=2^(k-2)\n divide_(s_i2,s_q,s_i,s_rm); //s_i=floor((2^(k-1))/(2q))\n\n z=bitSize(s_i);\n\n for (;;) {\n for (;;) { //generate z-bit numbers until one falls in the range [0,s_i-1]\n randBigInt_(s_R,z,0);\n if (greater(s_i,s_R))\n break;\n } //now s_R is in the range [0,s_i-1]\n addInt_(s_R,1); //now s_R is in the range [1,s_i]\n add_(s_R,s_i); //now s_R is in the range [s_i+1,2*s_i]\n\n copy_(s_n,s_q);\n mult_(s_n,s_R); \n multInt_(s_n,2);\n addInt_(s_n,1); //s_n=2*s_R*s_q+1\n \n copy_(s_r2,s_R);\n multInt_(s_r2,2); //s_r2=2*s_R\n\n //check s_n for divisibility by small primes up to B\n for (divisible=0,j=0; (j<primes.length) && (primes[j]<B); j++)\n if (modInt(s_n,primes[j])==0 && !equalsInt(s_n,primes[j])) {\n divisible=1;\n break;\n } \n\n if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2\n if (!millerRabinInt(s_n,2)) //this line represents 75% of the total runtime for randTruePrime_ \n divisible=1;\n\n if (!divisible) { //if it passes that test, continue checking s_n\n addInt_(s_n,-3);\n for (j=s_n.length-1;(s_n[j]==0) && (j>0); j--); //strip leading zeros\n for (zz=0,w=s_n[j]; w; (w>>=1),zz++);\n zz+=bpe*j; //zz=number of bits in s_n, ignoring leading zeros\n for (;;) { //generate z-bit numbers until one falls in the range [0,s_n-1]\n randBigInt_(s_a,zz,0);\n if (greater(s_n,s_a))\n break;\n } //now s_a is in the range [0,s_n-1]\n addInt_(s_n,3); //now s_a is in the range [0,s_n-4]\n addInt_(s_a,2); //now s_a is in the range [2,s_n-2]\n copy_(s_b,s_a);\n copy_(s_n1,s_n);\n addInt_(s_n1,-1);\n powMod_(s_b,s_n1,s_n); //s_b=s_a^(s_n-1) modulo s_n\n addInt_(s_b,-1);\n if (isZero(s_b)) {\n copy_(s_b,s_a);\n powMod_(s_b,s_r2,s_n);\n addInt_(s_b,-1);\n copy_(s_aa,s_n);\n copy_(s_d,s_b);\n GCD_(s_d,s_n); //if s_b and s_n are relatively prime, then s_n is a prime\n if (equalsInt(s_d,1)) {\n copy_(ans,s_aa);\n return; //if we've made it this far, then s_n is absolutely guaranteed to be prime\n }\n }\n }\n }\n }", "function prime4(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n\n // clear 3's\n for (let j = 4; j < data.length; j += 3) {\n data[j] = 1;\n }\n\n let step = 2;\n let u = 1;\n const result = [2, 3];\n for(let i = 2; i < data.length; i += step) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n result.push(k);\n if (u < data.length) {\n u = i * (1 + k); // (i + 2 * i**2 + i\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n step = 3 - step;\n }\n\n return result;\n }", "function sumPrimes(num) {\n let myNums = [];\n for(let i = 3; i <= num; i+=2){\n myNums.push(i);\n }\n myNums = myNums.filter(x => {\n if(x === 3 || x === 5 || x === 7 || x === 11){\n return true;\n }else if(x % 3 === 0 || x % 5 === 0 || x % 7 === 0 || x % 11 === 0){\n return false;\n }\n return true;\n });\n let j = 4;\n while(Math.pow(myNums[j],2) < num){\n myNums.splice(myNums.indexOf(Math.pow(myNums[j],2)),1);\n j++;\n }\n let u = 4;\n let h = u + 1;\n while(myNums[u] * myNums[h] <= num){\n while(myNums[u] * myNums[h] <= num){\n myNums.splice(myNums.indexOf(myNums[u] * myNums[h]),1);\n h++;\n }\n u++;\n h = u+1;\n }\n console.log(myNums);\n return 2 + myNums.reduce((x,y) => x+y);\n}", "function solve(args) {\n var i = +args,\n\t\tj,\n\t\tisPrime;\n\n for (i; i >= 2; i -= 1) {\n for (j = 2; j <= Math.floor(Math.sqrt(i)) ; j += 1) {\n if (i % j === 0) {\n isPrime = false;\n break;\n } else {\n isPrime = true;\n }\n }\n\n if (isPrime) {\n return i;\n }\n }\n}", "function printPrime(value) {\n let primes = [];\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n console.log(` i ${i} limit ${limit} `)\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n console.log(` j ${j} `)\n primes[j] = false;\n }\n }\n }\n for(let i = 2; i < value; i++) {\n // if(primes[i] === true) {\n console.log(i + \" \" + primes[i]);\n // }\n }\n}", "function getPrime(x,y){\n for(let i=x;i<y;i++){\n let flag = true;\n for(let a=2;a<i;a++){\n if(i%a==0 && i!==a){\n flag= false\n break\n }\n }\n if(flag==true){\n console.log(i)\n }\n }\n}", "function primefactor(max) {\n for (var i = max; i > 0; i--) {\n if (i % max == 0) {\n console.log(i)\n for (var j = 2; j <= i; j++) {\n if (j == i) {\n return i\n }\n if (i % j == 0) {\n break\n }\n }\n }\n }\n}", "function sumPrimes(num) {\r\n var count;\r\n var sum = 0;\r\n for(var i = 2; i <= num; i++){\r\n count = 0;\r\n for(var j = 1; j < i; j++){\r\n if(i % j === 0){\r\n count++; \r\n }\r\n } \r\n if (count === 1){\r\n sum += i;\r\n }\r\n }\r\n return sum;\r\n}", "function primes(n) {\n var realNumbers = [];\n for(i=0; i<=n; i++) {\n realNumbers.push(true);\n }\n var primeNumbers = [];\n for (i=0; i<=n; i++) {\n if (i == 0 || i == 1 || realNumbers[i] === false) {\n continue;\n }\n primeNumbers.push(i);\n for (j=i; true; j++) {\n if (i*j < realNumbers.length) {\n realNumbers[i*j] = false;\n } else {\n break;\n }\n }\n }\n return primeNumbers;\n}", "function all_primes_intherange(lowerLimit, upperLimit) {\r\n let checker = false;\r\n let primeList = [];\r\n if (+lowerLimit%2 === 0){\r\n loop1:for (let i = +lowerLimit+1; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true; \r\n } else { checker = false;break;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n } else {\r\n for (let i = +lowerLimit; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true;\r\n } else { checker = false;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n }\r\n return primeList;\r\n}", "function sumPrimes(num) {\n\n //array starts with the first prime numb since its the only non-odd prime.\n var arr = [2];\n\n\nfunction isOdd(n) {\n return Math.abs(n % 2) == 1;\n}\n \nfunction checkIfNOTPrime(max,counter) {\n return Math.abs(max % counter) == 0;\n}\n \n\n //add all odd numbers to array. if not prime , then arr.pop()\n for(var i = 2;i<=num;i++){\n if(isOdd(i)){\n arr[i] =i;\n \n //check all numbers up to i if they can be divided by i\n for(var j = 1;j<i;j++){\n if(checkIfNOTPrime(i,arr[j])){\n arr.pop();\n break;\n\n }\n } \n }\n }\n\n \n \n function add(a, b) {\n return a + b;\n }\n \n //adding all primes to get the sum\n var sum = arr.reduce(add, 0);\n\n\n\n return sum;\n}", "function sumAllPrimes() {}", "function numPrimorial(n) {\r\n let j;\r\n let arr = new Set;\r\n\r\n function createPrimeArr(length) {\r\n if (arr.size == n) return;\r\n for (let i = 1; i <= length; i++) {\r\n let tempArr = [];\r\n for (j = 0; j <= i; j++) {\r\n if (i % j == 0) tempArr.push(i);\r\n }\r\n\r\n if (tempArr.length == 2) {\r\n\r\n arr.add(tempArr[0])\r\n };\r\n };\r\n createPrimeArr(length + 1)\r\n };\r\n createPrimeArr(n)\r\n return arr\r\n}", "function solution(limit = 4000000) {\n let [a, b] = [0, 1];\n let sm = 0;\n\n while (b < limit) {\n [a, b] = [b, a + b];\n if (!(b & 1)) {\n sm += b;\n }\n }\n\n return sm\n}", "function sumPrime(num) {\r\n function isPrime(num) {\r\n var primeNumbers = [];\r\n var sieve = [];\r\n for (var i = 2; i <= num; i++) {\r\n if (!sieve[i]) {\r\n primeNumbers.push(i);\r\n for (var j = i; j <= num; j += i) {\r\n sieve[j] = true;\r\n }\r\n }\r\n }\r\n return primeNumbers;\r\n }\r\n return isPrime(num).reduce((x, y) => x + y);\r\n}", "function randTruePrime_(ans, k) {\n var c, m, pm, dd, j, r, B, divisible, z, zz, recSize;\n\n if (primes.length == 0)\n primes = findPrimes(30000); //check for divisibility by primes <=30000\n\n if (pows.length == 0) {\n pows = new Array(512);\n for (j = 0; j < 512; j++) {\n pows[j] = Math.pow(2, j / 511. - 1.);\n }\n }\n\n //c and m should be tuned for a particular machine and value of k, to maximize speed\n c = 0.1; //c=0.1 in HAC\n m = 20; //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits\n recLimit = 20; //stop recursion when k <=recLimit. Must have recLimit >= 2\n\n if (s_i2.length != ans.length) {\n s_i2 = dup(ans);\n s_R = dup(ans);\n s_n1 = dup(ans);\n s_r2 = dup(ans);\n s_d = dup(ans);\n s_x1 = dup(ans);\n s_x2 = dup(ans);\n s_b = dup(ans);\n s_n = dup(ans);\n s_i = dup(ans);\n s_rm = dup(ans);\n s_q = dup(ans);\n s_a = dup(ans);\n s_aa = dup(ans);\n }\n\n if (k <= recLimit) { //generate small random primes by trial division up to its square root\n pm = (1 << ((k + 2) >> 1)) - 1; //pm is binary number with all ones, just over sqrt(2^k)\n copyInt_(ans, 0);\n for (dd = 1; dd; ) {\n dd = 0;\n ans[0] = 1 | (1 << (k - 1)) | Math.floor(Math.random() * (1 << k)); //random, k-bit, odd integer, with msb 1\n for (j = 1; (j < primes.length) && ((primes[j] & pm) == primes[j]); j++) { //trial division by all primes 3...sqrt(2^k)\n if (0 == (ans[0] % primes[j])) {\n dd = 1;\n break;\n }\n }\n }\n carry_(ans);\n return;\n }\n\n B = c * k * k; //try small primes up to B (or all the primes[] array if the largest is less than B).\n if (k > 2 * m) //generate this k-bit number by first recursively generating a number that has between k/2 and k-m bits\n for (r = 1; k - k * r <= m; )\n r = pows[Math.floor(Math.random() * 512)]; //r=Math.pow(2,Math.random()-1);\n else\n r = .5;\n\n //simulation suggests the more complex algorithm using r=.333 is only slightly faster.\n\n recSize = Math.floor(r * k) + 1;\n\n randTruePrime_(s_q, recSize);\n copyInt_(s_i2, 0);\n s_i2[Math.floor((k - 2) / bpe)] |= (1 << ((k - 2) % bpe)); //s_i2=2^(k-2)\n divide_(s_i2, s_q, s_i, s_rm); //s_i=floor((2^(k-1))/(2q))\n\n z = bitSize(s_i);\n\n for (; ; ) {\n for (; ; ) { //generate z-bit numbers until one falls in the range [0,s_i-1]\n randBigInt_(s_R, z, 0);\n if (greater(s_i, s_R))\n break;\n } //now s_R is in the range [0,s_i-1]\n addInt_(s_R, 1); //now s_R is in the range [1,s_i]\n add_(s_R, s_i); //now s_R is in the range [s_i+1,2*s_i]\n\n copy_(s_n, s_q);\n mult_(s_n, s_R);\n multInt_(s_n, 2);\n addInt_(s_n, 1); //s_n=2*s_R*s_q+1\n\n copy_(s_r2, s_R);\n multInt_(s_r2, 2); //s_r2=2*s_R\n\n //check s_n for divisibility by small primes up to B\n for (divisible = 0, j = 0; (j < primes.length) && (primes[j] < B); j++)\n if (modInt(s_n, primes[j]) == 0 && !equalsInt(s_n, primes[j])) {\n divisible = 1;\n break;\n }\n\n if (!divisible) //if it passes small primes check, then try a single Miller-Rabin base 2\n if (!millerRabinInt(s_n, 2)) //this line represents 75% of the total runtime for randTruePrime_ \n divisible = 1;\n\n if (!divisible) { //if it passes that test, continue checking s_n\n addInt_(s_n, -3);\n for (j = s_n.length - 1; (s_n[j] == 0) && (j > 0); j--); //strip leading zeros\n for (zz = 0, w = s_n[j]; w; (w >>= 1), zz++);\n zz += bpe * j; //zz=number of bits in s_n, ignoring leading zeros\n for (; ; ) { //generate z-bit numbers until one falls in the range [0,s_n-1]\n randBigInt_(s_a, zz, 0);\n if (greater(s_n, s_a))\n break;\n } //now s_a is in the range [0,s_n-1]\n addInt_(s_n, 3); //now s_a is in the range [0,s_n-4]\n addInt_(s_a, 2); //now s_a is in the range [2,s_n-2]\n copy_(s_b, s_a);\n copy_(s_n1, s_n);\n addInt_(s_n1, -1);\n powMod_(s_b, s_n1, s_n); //s_b=s_a^(s_n-1) modulo s_n\n addInt_(s_b, -1);\n if (isZero(s_b)) {\n copy_(s_b, s_a);\n powMod_(s_b, s_r2, s_n);\n addInt_(s_b, -1);\n copy_(s_aa, s_n);\n copy_(s_d, s_b);\n GCD_(s_d, s_n); //if s_b and s_n are relatively prime, then s_n is a prime\n if (equalsInt(s_d, 1)) {\n copy_(ans, s_aa);\n return; //if we've made it this far, then s_n is absolutely guaranteed to be prime\n }\n }\n }\n }\n }", "findPrime(s1, s2) {\n var count = 0, flag = 0, k = 0;\n var prime = [];\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n count++;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n prime[k++] = i;\n }\n }\n return prime;\n }", "function solutionTwo(){\n var last = 0;\n var current = 1;\n var next = 0;\n var evenSum = 0;\n while((next = current + last)<4000000){\n if(next%2==0){\n evenSum += next;\n }\n last = current;\n current = next;\n }\n return evenSum;\n}", "function primeMover(num) {\n\t var firstSort = [1,2,3];\n\t \n\t for(var i = 4; i < 10000; i++) {\n\t\t \n\t\t if(i % 2 !== 0 && i % 3 !== 0){\n\t\t\t\tprimeArray.push(i);\n\t\t\t\t}\n\t }\n\t\n\tfor(var j = 0; j < firstSort.length; j++){\n\t\tfor(var k = 0; k < firstSort.length; k++) {\n\t\t\t\n\t\t}\n\t}\n\t \n\tconsole.log(primeArray);\n\t\n\t return primeArray[num - 1];\n }", "function solution(N) {\n function primeFactors(n) {\n const factors = [];\n let divisor = 2;\n\n while (n >= 2) {\n if (n % divisor == 0) {\n factors.push(divisor);\n n = n / divisor;\n } else {\n divisor++;\n }\n }\n return factors;\n }\n\n const primesFound = primeFactors(N);\n\n // for (let i = 0; i <= N; i++) {\n // if (primeFactors(i + 1)) {\n // console.log('prime', i + 1, primeFactors(i + 1));\n // largestFound = i + 1;\n // } /* else {\n // console.log('not');\n // } */\n // }\n return primesFound[primesFound.length - 1];\n}", "function primeSummation(n) {\n let arr = [2];\n let nextElement = 3;\n let sum = 2;\n while (nextElement < n) {\n for (let elem of arr) {\n if (elem > Math.sqrt(nextElement)) {\n arr.push(nextElement);\n sum += nextElement;\n break;\n } else {\n if (nextElement % elem === 0) {\n break;\n }\n }\n }\n nextElement += 2;\n }\n return sum;\n}", "checkPrime(s1, s2) {\n var count = 0, flag = 0, k = 0;\n var array = [];\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n count++;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n array[k++] = i;\n }\n }\n return array;\n }", "function getPrimes(max) {\r\n var sieve = [];\r\n var i;\r\n var j;\r\n var primes = [];\r\n for (i = 2; i <= max; ++i) {\r\n if (!sieve[i]) {\r\n // i has not been marked -- it is prime\r\n primes.push(i);\r\n for (j = i < 1; j <= max; j += i) {\r\n sieve[j] = true;\r\n }\r\n }\r\n }\r\n\r\n return primes;\r\n }", "function binominv(n,p,a) {\n var setOfReals=[];\n //big enough for most purposes!\n for (j=0;j<1000000000000;j++) {\n var result = jStat.binomial.cdf(j,n,p);\n if(result>a) { \n console.log(j);\n return(j);\n }\n }\n}", "findPrime(s1, s2) {\n var flag = 0, k = 0;\n var prime = [];\n\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n prime[k++] = i;\n }\n }\n return prime;\n }", "function allPrimesLessThanN(n) {\n for (let i = 0; i < n; i++) {\n if (isPrime2(i)) {\n \n }\n }\n}", "function euler2() {\n // Good luck!\n return true;\n}", "function isPrime(n){\n console.log(\"Các số nguyên tố trong khoảng từ 1 đến \"+n)\n if(n <2){\n console.log(\"không có số nguyên tố nào cả\")\n \n }else{\n console.log(2)\n for(var i = 3; i <= n; i++ ){\n \n for(var j=2; j < Math.sqrt(i); j++){\n if(i % j === 0){\n return 0;\n \n }\n console.log(i) \n }\n \n }\n \n }\n \n \n}", "function sieveMultiplesOf(multiple, max) {\n let output = [];\n let iterator = numsFrom(multiple);\n\n while (E.lastIn(output) < max) {\n let cur = iterator();\n\n if (cur % multiple != 0) {\n output.push(cur)\n } else {\n output.push(false)\n }\n }\n\n return E.cleanResult(max, output);\n}", "function test_prime(n)\n{ \n if (n===1) {return false; }\n else if(n === 2)\n{ return true; }\nelse {\nfor(var x = 2; x < n; x++) {\n if(n % x === 0) \n{ return false; } \n}\n return true; \n }\n}", "function evenFib(){\n var fibo = [2, 4],\n sum = 0;\n\n while( sum < 4000000) {\n var len = fibo.length;\n sum = fibo[len - 2] + fibo[len - 1];\n fibo.push(sum)\n }\n\n return sum\n}", "function smallestMult(n) {\n let sieveOfEratosthenes = new Array(n + 1);\n for (let i = 2; i <= n; i++) {\n for (let j = i; j <= n; j += i) {\n if (sieveOfEratosthenes[j] === undefined) sieveOfEratosthenes[j] = i;\n }\n }\n\n let dividers = new Array(n + 1);\n dividers.fill(1);\n\n for (let i = 2; i <= n; i++) {\n let lastDivider = sieveOfEratosthenes[i];\n let max = 1;\n let value = i;\n\n while (value !== 1) {\n let divider = sieveOfEratosthenes[value];\n if (divider !== lastDivider) {\n if (dividers[lastDivider] < max) {\n dividers[lastDivider] = max;\n max = 1;\n }\n } else {\n max *= divider;\n }\n value /= divider;\n lastDivider = divider;\n }\n\n if (dividers[lastDivider] < max) {\n dividers[lastDivider] = max;\n }\n }\n\n let result = 1;\n for (let i = 0; i <= n; i++) {\n result *= dividers[i];\n }\n\n return result;\n}", "function prime (n) {\nvar counter = 0;\nwhile (counter <= n) {\n var notPrime = false;\n counter++\n var i = 2;\n while (i <= counter) {\n if (counter%i===0 && i!==counter) {\n notPrime = true;\n }\n i++;\n }\n if (notPrime === false) {\n console.log(counter);\n }\n}\n}", "function primeIterative(max) {\n var primeObj = {2:4};\n for (let i = 3; i <= max; i+=2) {\n var pointer = false;\n // Object.keys(primeObj).forEach(key => {\n // if (primeObj[key] === i) {\n // primeObj[key] += +key;\n // pointer = true;\n // }\n // });\n for (let j in primeObj) {\n if (primeObj[j] === i) {\n primeObj[j] += +j*2;\n pointer = true;\n }\n }\n if (!pointer) {\n primeObj[i] = i * i;\n }\n }\n // var primeList = [];\n // for (let k in primeObj) {\n // primeList.push(k);\n // }\n return primeObj;\n}", "isPrime(index) {\n var n = 2;\n while (n <= index / 2) {\n if (index % n == 0) {\n return 0;\n }\n n++;\n }\n return index;\n}", "function euler9() {\n for (let a = 1; a < 1000; a++) {\n for (let b = 2; b < 1000; b++) {\n for (let c = 3; c < 1000; c++) {\n if (a + b + c === 1000 && a ** 2 + b ** 2 === c ** 2) {\n return [a, b, c];\n }\n }\n }\n }\n}", "function primes(limit) {\n let list = [];\n let nonPrimes = [];\n\n //build range\n for (let idx = 2; idx <= limit; idx++) list.push(idx);\n\n // mark nonPrimes\n list.forEach(number => {\n if (!nonPrimes.includes(number)) {\n for (let testNum = number * 2; testNum <= limit; testNum += number) {\n nonPrimes.push(testNum);\n }\n }\n });\n \n // filter out nonPrimes\n return list.filter(number => !nonPrimes.includes(number));\n}", "function checkPrimes(size) {\n var primes = [];\n var isPrime = true;\n for (var i = 2; i < size; i++) {\n isPrime = true;\n for (var j = 2; j < i / 2; j++) {\n if (i % j == 0 ) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n return primes;\n}", "function notPrimes(a,b){\n let arr = [];\n for (let i = a; i < b; i++){\n if (!/[014689]/.test(i)) {\n for (let j = 2; j <= Math.sqrt(i); j++){\n if (i % j === 0) { arr.push(i); break;}\n }\n }\n }\n return arr;\n}", "function findLargestPrimeFactor(number){\n\n//find all the primes between 0 and sqrt(number) (600851475143 by default)\n// we can use sqrt(number) since we don't care about the highest prime\n// we just care about the highest factor\n//starting at the end of the list (aka, starting with large primes) see if any of them divide the number inputed evenly.\n//if so, bob's your uncle.\n number = (number == undefined ? 600851475143 : number);\n // sieve of Eratosthenes\n var sievedPrimes = [];\n var largestPrimeFactor = i;\n for(var i = 2; i < Math.sqrt(number); i++){\n if(sievedPrimes[i] == undefined ){\n for(var degree=1, j = i << 1; j < Math.sqrt(number); j = (i << 1)+(++degree*i)){//we only care about primes < sqrt which greatly limits the search\n sievedPrimes[j] = false;\n }\n if(number%i == 0){\n largestPrimeFactor = i;\n }\n }\n }\n return largestPrimeFactor;\n}", "function nthPrime(p) {\n \"use strict\";\n //create array to hold prime numbers found\n var prime = new Array();\n\n //store first two prime number in prime array\n prime.push(2);\n prime.push(3);\n\n //start testing from number 5\n var number = 5;\n var isPrime;\n var squared;\n\n //start time counter\n var t0 = performance.now();\n\n // already have first two prime numbers so declare count accordingly\n var count = 2;\n while (count != p) {\n isPrime = true;\n squared = Math.sqrt(number);\n\n //check to see if number is prime by testing against found prime numbers\n for (var i = 0; i < prime.length; i++) {\n if (prime[i] <= squared) {\n if (number % prime[i] === 0) {\n isPrime = false;\n break;\n }\n }\n }\n\n //if number is prime add it to array and increase count\n if (isPrime) {\n count++;\n prime.push(number);\n }\n\n //test only odd numbers\n number += 2;\n }\n\n //calculate time taken\n var t1 = performance.now();\n var time = (t1 - t0);\n\n //create a div and attach solution to the webpage\n var solution = document.createElement(\"DIV\");\n var text = document.createTextNode(prime[prime.length - 1]);\n solution.appendChild(text);\n document.getElementById(\"solution\").appendChild(solution);\n\n //create a div and attach time taken to webpage\n var timeStamp = document.createElement(\"DIV\");\n var timeText = document.createTextNode(time.toFixed(1) + \" millisec\");\n timeStamp.appendChild(timeText);\n document.getElementById(\"time\").appendChild(timeStamp);\n}", "function solution(n) {\n let answer = 0;\n let tempArr = [];\n let root = Math.sqrt(n);\n \n for (let i = 0; i <= n; i++) {\n tempArr.push(true);\n }\n \n tempArr[0] = false;\n tempArr[1] = false;\n \n for (let j = 2; j < root; j++) {\n if (tempArr[j]) {\n for (let k = j * j; k <= n; k += j) {\n tempArr[k] = false;\n }\n }\n }\n \n for (let l = 0; l < tempArr.length; l++) {\n if (tempArr[l]) answer += 1;\n }\n \n return answer;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n \n N = 100001\n var bitmap = Array(N).fill(false);\n for (var i = 0; i < A.length; i ++) {\n if (A[i] > 0 && A[i] <= N) {\n bitmap[A[i]] = true;\n }\n }\n \n for(var j = 1; j <= N; j++) {\n if (!bitmap[j]) {\n return j;\n }\n }\n \n return N + 1;\n}", "function suckersHuge(){\n\tsuckerSum = 0;\n\n\tfor (sucker = -300000; sucker < 300001; sucker++){\n\t\tif (sucker % 2 === 0){\n\t\t}\n\t\telse{\n\t\t\tsuckerSum += sucker;\n\t\t}\n\t}\n\tconsole.log(suckerSum);\n}", "function sumPrimes(num) {\n if (typeof num !== 'number') {\n throw new Error('input should be a number.');\n }\n if (num % 1 !== 0) {\n throw new Error('input should be an integer.');\n }\n\n if (num === 1) {\n return 1;\n }\n var res = 0;\n\n for (var i = 2; i <= num; i++) {\n if (i % 2 === 0 && i !== 2) {\n continue;\n }\n\n if (i === 2 || i === 3 || i === 5 || i === 7) {\n res += i;\n continue;\n }\n\n\n\n var flag = true;\n for (var j = 3; j <= Math.sqrt(i); j++) {\n if (i % j === 0) {\n flag = false;\n }\n }\n if (flag) {\n res += i;\n }\n }\n\n return res;\n}", "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function primeincFindPrimeWithWorkers(bits, rng, options, callback) {\n // web workers unavailable\n if(typeof Worker === 'undefined') {\n return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);\n }\n\n // initialize random number\n var num = generateRandom(bits, rng);\n\n // use web workers to generate keys\n var numWorkers = options.workers;\n var workLoad = options.workLoad || 100;\n var range = workLoad * 30 / 8;\n var workerScript = options.workerScript || 'forge/prime.worker.js';\n if(numWorkers === -1) {\n return forge.util.estimateCores(function(err, cores) {\n if(err) {\n // default to 2\n cores = 2;\n }\n numWorkers = cores - 1;\n generate();\n });\n }\n generate();\n\n function generate() {\n // require at least 1 worker\n numWorkers = Math.max(1, numWorkers);\n\n // TODO: consider optimizing by starting workers outside getPrime() ...\n // note that in order to clean up they will have to be made internally\n // asynchronous which may actually be slower\n\n // start workers immediately\n var workers = [];\n for(var i = 0; i < numWorkers; ++i) {\n // FIXME: fix path or use blob URLs\n workers[i] = new Worker(workerScript);\n }\n var running = numWorkers;\n\n // listen for requests from workers and assign ranges to find prime\n for(var i = 0; i < numWorkers; ++i) {\n workers[i].addEventListener('message', workerMessage);\n }\n\n /* Note: The distribution of random numbers is unknown. Therefore, each\n web worker is continuously allocated a range of numbers to check for a\n random number until one is found.\n\n Every 30 numbers will be checked just 8 times, because prime numbers\n have the form:\n\n 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)\n\n Therefore, if we want a web worker to run N checks before asking for\n a new range of numbers, each range must contain N*30/8 numbers.\n\n For 100 checks (workLoad), this is a range of 375. */\n\n var found = false;\n function workerMessage(e) {\n // ignore message, prime already found\n if(found) {\n return;\n }\n\n --running;\n var data = e.data;\n if(data.found) {\n // terminate all workers\n for(var i = 0; i < workers.length; ++i) {\n workers[i].terminate();\n }\n found = true;\n return callback(null, new BigInteger(data.prime, 16));\n }\n\n // overflow, regenerate random number\n if(num.bitLength() > bits) {\n num = generateRandom(bits, rng);\n }\n\n // assign new range to check\n var hex = num.toString(16);\n\n // start prime search\n e.target.postMessage({\n hex: hex,\n workLoad: workLoad\n });\n\n num.dAddOffset(range, 0);\n }\n }\n}", "function test_prime(n)\r\n{\r\n\r\n if (n===1)\r\n {\r\n return false;\r\n }\r\n else if(n === 2)\r\n {\r\n return true;\r\n }else\r\n {\r\n for(var x = 2; x < n; x++)\r\n {\r\n if(n % x === 0)\r\n {\r\n return false;\r\n }\r\n }\r\n return true; \r\n }\r\n}", "function test_prime(n)\n{\n\n if (n===1)\n {\n return false;\n }\n else if(n === 2)\n {\n return true;\n }else\n {\n for(var x = 2; x < n; x++)\n {\n if(n % x === 0)\n {\n return false;\n }\n }\n return true; \n }\n}", "function test_prime(n)\n{\n if (n===1)\n {\n return false;\n }\n else if(n === 2)\n {\n return true;\n }else\n {\n for(var x = 2; x < n; x++)\n {\n if(n % x === 0)\n {\n return false;\n }\n }\n return true; \n }\n}", "function evenFib() {\n let sum = 0;\n let temp = 0;\n let prev = 1;\n let next = 2;\n const MAX = 4000000;\n\n while (next < MAX) {\n if (next % 2 == 0) sum += next;\n temp = next;\n next = prev + next;\n prev = temp;\n }\n return sum;\n}", "function findPrime(nPrimes,startAt){\n var n = 100\n k=startAt+nPrimes\n \n while (startAt<=k){\n i=2\n flag = false\n while(i<startAt){\n if(startAt%i===0){\n flag = true\n }\n \n i++\n }\n \n console.log(flag? startAt+' is not a prime':startAt+' is prime')\n startAt++\n }\n}" ]
[ "0.7412198", "0.73908293", "0.7140912", "0.70860124", "0.7053972", "0.7002826", "0.6992587", "0.6902719", "0.6829928", "0.6818398", "0.6794026", "0.6762354", "0.66830647", "0.6665328", "0.6628076", "0.6616925", "0.6615266", "0.6578122", "0.6536002", "0.64150083", "0.63946134", "0.6359027", "0.63588035", "0.6356762", "0.63531566", "0.6281184", "0.6264596", "0.6231668", "0.62187237", "0.6211669", "0.6200346", "0.61827993", "0.61785764", "0.61754465", "0.6167209", "0.6138565", "0.6129181", "0.6127872", "0.61217916", "0.61133885", "0.6093976", "0.60895157", "0.60719544", "0.6065016", "0.6042144", "0.60394347", "0.6033539", "0.6030079", "0.60256314", "0.60179377", "0.60100657", "0.6002787", "0.5988609", "0.5971238", "0.5964928", "0.59646267", "0.59598625", "0.5953776", "0.59228987", "0.5915121", "0.590998", "0.59022784", "0.5894386", "0.5893236", "0.58546704", "0.58505094", "0.5849703", "0.58139795", "0.57949215", "0.578387", "0.57796603", "0.57751787", "0.5769327", "0.5768929", "0.5753385", "0.5750766", "0.57472026", "0.5739477", "0.5732479", "0.5728767", "0.5717681", "0.5713941", "0.5713924", "0.56944704", "0.5691936", "0.5685266", "0.5672119", "0.56511605", "0.5643433", "0.56433886", "0.56432194", "0.56432194", "0.56432194", "0.56432194", "0.56432194", "0.56432194", "0.56355935", "0.5632362", "0.56282955", "0.56280315", "0.5627344" ]
0.0
-1
return all prime numbers from 0 to that number
function sieveOfEratosthenes(n) { let primes = []; for(let i=0; i <= n; i++) { if(isPrime(i)) primes.push(i); } return primes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function getPrimeNumbers(num) {\n let primes = [];\n for (let i = num; i > 1; i--) {\n if (isPrime(i)) {\n primes.push(i);\n }\n }\n return primes;\n }", "function primes(limit) {\n let list = [];\n let nonPrimes = [];\n\n //build range\n for (let idx = 2; idx <= limit; idx++) list.push(idx);\n\n // mark nonPrimes\n list.forEach(number => {\n if (!nonPrimes.includes(number)) {\n for (let testNum = number * 2; testNum <= limit; testNum += number) {\n nonPrimes.push(testNum);\n }\n }\n });\n \n // filter out nonPrimes\n return list.filter(number => !nonPrimes.includes(number));\n}", "function prime(num) {\n // Generate an array containing every prime number between 0 and the num specified (inclusive)\n\tvar primeNum = [];\n for(var i = 2; i <= num; i++) {\n \tif( prime2(i) ) {\n \tprimeNum.push(i);\n }\n }\n return primeNum;\n}", "function findPrime() {\n prime = [2];\n const value = document.getElementById(\"input\").value;\n\n for (let number = 3; number <= value; number++) {\n let numArr = [];\n for (let divider = 2; divider < number; divider++) {\n numArr.push(number % divider);\n }\n\n let isZero = numArr.includes(0);\n\n if (!isZero) {\n prime.push(number);\n }\n }\n console.log(prime);\n}", "function primeSieve(num){\n var primes = [];\n for(var i = 0; i <= num; i++){\n primes.push(1);\n }\n for(var j = 2; j <= Math.floor(Math.sqrt(primes.length)); j++){\n console.log('j', j);\n if(primes[j] === 1){\n for(var k = j * j; k <= num; k += j){\n primes[k] = 0; \n }\n }\n }\n return primes; \n}", "function notPrimes(a,b){\n let arr = [];\n for (let i = a; i < b; i++){\n if (!/[014689]/.test(i)) {\n for (let j = 2; j <= Math.sqrt(i); j++){\n if (i % j === 0) { arr.push(i); break;}\n }\n }\n }\n return arr;\n}", "function getPrimes(int) {\r\n var primes = [];\r\n var curr = 2n;\r\n \r\n while (curr < int) {\r\n if ((int / curr) * curr === int) {\r\n int /= curr;\r\n primes.push(curr);\r\n console.log(curr);\r\n } else {\r\n curr += 1n;\r\n }\r\n }\r\n primes.push(int);\r\n \r\n return primes;\r\n}", "function allPrimesLessThanN(n) {\n for (let i = 0; i < n; i++) {\n if (isPrime2(i)) {\n \n }\n }\n}", "function primes(count) {\n const primeNums = [];\n let i = 2;\n \n while (primeNums.length < count) {\n if (isPrime(i)) primeNums.push(i);\n i += 1;\n }\n \n return primeNums;\n}", "function sieve(limit){\n\t// console.log(\"starting sieve\");\n\tvar arr = []; \n\t//initialize an array\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\tarr[1]=0;\n\t//check all 2*n, 3*n, 4*n,etc... and make their entries 0\n\t//whatever remains must be a prime\n\tfor (var j=2; j < limit; j++){\n\t\tif (arr[j]!=0){\n\t\t\tfor (var k=2; k < limit/j; k++){\n\t\t\tarr[k*j] = 0;\t\n\t\t\t}\t\n\t\t}\n\t}\n\treturn arr;\n}", "function getPrime(x,y){\n for(let i=x;i<y;i++){\n let flag = true;\n for(let a=2;a<i;a++){\n if(i%a==0 && i!==a){\n flag= false\n break\n }\n }\n if(flag==true){\n console.log(i)\n }\n }\n}", "function divisors(num){\n var divs = [];\n for(var i=num-1;i>1;i--){\n if(num%i === 0){\n divs.unshift(i);\n }\n }\n if(divs.length < 1){\n return `${num} is prime`\n } else {\n return divs;\n }\n}", "function showPrimes(limit) {\n for(let number=2; number<=limit; number++) {\n\n let isPrime = true;\n \n for (let factor=2; factor<number; factor++) {\n if (number % factor === 0) {\n //isPrime = false;\n //break; // no sense in checking the rest of the numbers\n }\n }\n\n if (isPrime) console.log(number);\n } \n}", "function showPrimes(limit) {\n for (let i = 0; i <= limit; i++) {\n if (isPrime(i)) {\n console.log(i);\n }\n }\n}", "function isPrime(num) {\n return [...Array(num + 1).keys()].filter(el => num % el === 0).length === 2;\n}", "function prime2(n) {\n const data = [];\n for (let i = 1; i < n; i += 2) {\n data.push(i);\n }\n data[0] = 0;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] > 0) {\n let k = data[i];\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 0;\n }\n }\n }\n const result = [2];\n for (let i of data) {\n if (i > 0) {\n result.push(i);\n }\n }\n return result;\n }", "function PrimeMover(num) {\n var primes = [2];\n for (var i = 3; i <= 10^4; i += 2) {\n var prime = true;\n if (num === primes.length) {\n return primes[primes.length-1];\n }\n for (var j = 2; j <= i / 2; j++) {\n if (i % j === 0) {\n prime = false;\n }\n }\n if (prime) {\n primes.push(i);\n }\n }\n}", "function printPrimes(){\n var isPrime = true;\n for(let i = 2; i <= 100; i++) {\n isPrime = true;\n for (let j = 2; j <= i/2; j++) {\n if (i%j === 0) {\n isPrime = false;\n break;\n }\n }\n if (isPrime) {\n console.log(i);\n }\n }\n}", "function showPrimes(limit) {\n for (number = 2; number <= limit; number++)\n if (isPrime(number)) console.log(number);\n}", "function showPrimes(limit) {\n for (let number = 2; number <= limit; number++) {\n // 2 - current (number)\n\n let isPrime = true;\n for (let factor = 2; factor < number; factor++) {\n if (number % factor === 0) {\n isPrime = false;\n break;\n }\n }\n if (isPrime) console.log(number);\n }\n}", "function isPrime(num) {\n for(var i = 2; i < num; i++) {\n if(num % i === 0) \n }\n\n }", "function primeList() {\n // For max=60M, computes 3.5 million primes in 15 seconds\n // For max=10M, computes 67k primes in 2 seconds.\n\n // Initialize variables\n let max = 10000000; // Maximum number to check if prime.\n let a = new Array(max);\n let out = []\n\n // Initialize sieve array\n for (var i=0; i<=max; i++) {\n a[i]=1;\n }\n\n // Mark all composite numbers\n for (var i=2; i<=max; i++) {\n for (var j=2; i*j<=max; j++) {\n a[i*j]=0;\n }\n }\n\n // Generate output list of prime numbers\n for (var i=2; i<=max; i++) {\n if (a[i]==1) {\n out.push(i)\n }\n }\n\n return out;\n}", "function printAllPrimesUpTo(max){\n for (let i = 2; i <= max; i++) {\n let possiblePrime = checkPrime(i);\n if (possiblePrime) {\n console.log(possiblePrime);\n }\n }\n}", "function prime3(n) {\n const data = new Int8Array((n + 1) / 2);\n data[0] = 1;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] === 0) {\n let k = 2 * i + 1;\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 1;\n }\n }\n }\n const result = [2];\n for(let i = 0; i < data.length; i += 1) {\n if (data[i] == 0) {\n result.push(2 * i + 1);\n }\n }\n return result;\n }", "function getPrimes(max) {\n var sieve = [];\n var i;\n var j;\n var primes = [2];\n for (i = 3; i <= max; i+=2) {\n if (!sieve[i]) {\n // i has not been marked -- it is prime\n primes.push(i);\n for (j = i << 1; j <= max; j += i) {\n // make all multiples equal true, so they don't get pushed\n sieve[j] = true; \n }\n }\n }\n return primes;\n }", "function primes(n) {\n var realNumbers = [];\n for(i=0; i<=n; i++) {\n realNumbers.push(true);\n }\n var primeNumbers = [];\n for (i=0; i<=n; i++) {\n if (i == 0 || i == 1 || realNumbers[i] === false) {\n continue;\n }\n primeNumbers.push(i);\n for (j=i; true; j++) {\n if (i*j < realNumbers.length) {\n realNumbers[i*j] = false;\n } else {\n break;\n }\n }\n }\n return primeNumbers;\n}", "function problem3(num){\n for(var x = 2; x<=num; x++){\n if(isPrime(x) !== true){\n }\n else if (num%x===0){\n num = num/x;\n }\n else if (isPrime(num) == true)\n return num;\n }\n}", "function sieve(limit){\n\n\tvar arr =[];\n\t//generate array with numbers 0,1, ...limit\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\n\t//remove all non-prime numbers using sieve method\n\tfor (var j =2; j < limit; j++){\n\t\tfor (var k= 2; k <limit/j; k++){\n\t\t\tarr[j*k] = 0;\n\t\t}\n\t}\n\treturn arr;\n}", "function prime(){\r\n \r\n\r\nnumArray = numArray.filter((number) => {\r\n for (var i = 2; i <= Math.sqrt(number); i++) {\r\n if (number % i === 0) return false;\r\n }\r\n return true;\r\n\r\n\r\n});\r\n\r\nconsole.log(numArray);\r\n }", "function isPrime(n){\n console.log(\"Các số nguyên tố trong khoảng từ 1 đến \"+n)\n if(n <2){\n console.log(\"không có số nguyên tố nào cả\")\n \n }else{\n console.log(2)\n for(var i = 3; i <= n; i++ ){\n \n for(var j=2; j < Math.sqrt(i); j++){\n if(i % j === 0){\n return 0;\n \n }\n console.log(i) \n }\n \n }\n \n }\n \n \n}", "function primenum(){\n var num=+prompt('Enter a number');\n if(num<3){\n console.log('Not a prime number');\n } else {\n checkPrimenum();\n }\n\n function checkPrimenum() {\n for (var a=2;a<num;a++) {\n for (var b=2;b<a;b++) {\n if (a%b == 0) break;\n }\n if (b == a){\n console.log(a);\n }\n }\n } \n}", "isPrime(number)\n{\n if(number==0 || number == 1)\n {\n return false;\n }\n else\n {\n for (let index = 2; index < number; index++)\n {\n if (number % index == 0) \n {\n return false;\n }\n }\n return true;\n }\n}", "function primeSieve(n) {\n var array = [], upperLimit = Math.sqrt(n), output = [];\n\n //makes an array from 2 to (n-1)\n for (var i = 0; i < n; i++){\n array.push(true);\n }\n\n //removes multiples of primes starting from 2,3,5\n for (var i = 2; i <= upperLimit; i++){\n if (array[i]) {\n for (var j = i * i; j < n; j += i) {\n array[j] = false;\n }\n }\n }\n\n //all array[i]set to true are primes for(var i = 2; i < n; i++){\n for (var i = 2; i < n; i++){\n if (array[i]){\n output.push(i);\n }\n }\n return output;\n}", "function primeGen(num) {\n const array = [];\n for (let i = 2; i < num; i++) {\n if (isPrime(i)) array.push(i);\n }\n\n return array;\n}", "function findSmallerPrimes() {\n for (let i = 0; i < 1000; i++) {\n isPrime(i);\n }\n}", "function primeGenerator(n) {\n\tvar result = [];\n\tvar counter = 2;\n\t\n\twhile (result.length < n) {\n\t\tif (testPrime(counter)) {\n\t\t\tresult.push(counter);\n\t\t}\n\t\tcounter++;\n\t}\n\treturn result;\n}", "function findPrimes(n) {\n const primes = new Array(n + 1).fill(true);\n\n for (let i = 2; Math.pow(i, 2) <= n; i++) {\n if (primes[i]) {\n for (let j = Math.pow(i, 2); j <= n; j = j + i) {\n primes[j] = false;\n }\n }\n }\n\n for (let i = 2; i <= n; i++) {\n if (primes[i]) console.log(i);\n }\n}", "function prime(index) {\n\n}", "function getPrimes(max) {\n var sieve = [];\n var i;\n var j;\n var primes = [];\n for (i = 2; i <= max; ++i) {\n if (!sieve[i]) {\n // i has not been marked -- it is prime\n primes.push(i);\n for (j = i << 1; j <= max; j += i) {\n sieve[j] = true;\n }\n }\n }\n\n return primes;\n }", "isPrime(number) {\n if (number == 0 || number == 1) {\n return false;\n }\n for (let index = 2; index < number; index++) {\n if (number % index == 0) {\n return false;\n }\n\n }\n return true;\n}", "function test_prime(n) {\n console.log(\"prime clicked\");\n console.log(n);\n\n if (n <= 1) {\n return false;\n } else if (n === 2 || n == 3) {\n return true;\n } else {\n for (var x = 2; x <= Math.floor(Math.sqrt(n)); x++) {\n if (n % x === 0) {\n console.log(x);\n return false;\n }\n }\n return true;\n }\n}", "function getPrime() {\n var i = 0;\n var j = 0;\n\n limit_numbers = document.getElementById('limit').value;\n\n //loop till i equals to limit_numbers of numbers\n for (i = 1; i <= limit_numbers; i++) {\n count = 0;\n\n for (j = 1; j <= i; j++) {\n // % modules will give the reminder value, so if the reminder is 0 then it is divisible\n if (i % j == 0) {\n //increment the value of count\n count++;\n }\n }\n\n\n //prime number should be exactly divisible by 2 times only (itself and 1)\n if (count == 2) {\n document.getElementById(\"result\").insertAdjacentHTML('beforeend', i + '<br>');\n }\n }\n}", "function showPrimes(n) {\n nextPrime: for (let i = 2; i < n; i++) {\n \n for (let j = 2; j < i; j++) {\n if (i % j == 0) continue nextPrime;\n }\n \n alert( i ); // a prime\n }\n }", "function PrimeValues(value) {\n let primes = [], tempArr=[];\n\n //fills an array with 'true' from 2 to the given value.\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n\n //work way thru array tagging primes & non-primes\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n primes[j] = false;\n }\n }\n }\n\n // remove nonprimes from array.\n for(let i = 2; i < value; i++) {\n if(primes[i] === true) {\n tempArr.push(i);\n }\n }\n return tempArr;\n }", "function checkPrime(number){\n var pom = true\n for (var i = 2; i <= number; i++){\n if ((number %i ) === 0 && number !== i){\n pom = false;\n }\n }\n return pom;\n}", "function sumPrimes(num) {\n sum = 1;\n for (let i=2;i<=num;i++) {\n console.log(\"-----\");\n console.log(\"i=\"+i);\n for (let j=2;j<i;j++) {\n console.log(\"j=\"+j);\n if (i % j == 0) {\n break;\n }\n }\n sum = sum + i;\n console.log(\"sum=\"+sum);\n }\n return sum;\n}", "function sumPrimes(num) {\n // CREATE ARRAY TO STORE PRIMES\n var result = [];\n // GO OVER THE NUMBERS +1 BECAUSE WE WANT TO TEST THE GIVEN NUMBER AS WELL\n for (var i = 1; i < num + 1; i++) {\n // 2 IS THE FIRST PRIME SO WE PUSH\n if (i === 2) {\n result.push(i);\n } else {\n var x = 1;\n // WHILE THE X IS SMALLER THEN THE I UNTIL THE LAST\n while (x < i) {\n x++;\n if (i % x === 0) {\n break;\n }\n // -1 BECAUSE WE LOOK IF X<I THIS IS THE LAST PRIME IN I\n if (x === i - 1) result.push(i);\n }\n }\n }\n // console.log(result)\n return result.reduce((a, b) => a + b);\n}", "function getPrimes(max) {\r\n var sieve = [];\r\n var i;\r\n var j;\r\n var primes = [];\r\n for (i = 2; i <= max; ++i) {\r\n if (!sieve[i]) {\r\n // i has not been marked -- it is prime\r\n primes.push(i);\r\n for (j = i < 1; j <= max; j += i) {\r\n sieve[j] = true;\r\n }\r\n }\r\n }\r\n\r\n return primes;\r\n }", "function testPrimeNum(num){\n for(var i=2; i<num; i++){\n if(num%i===0){\n return false;\n }\n return num>1;\n }\n}", "function primeNum(p) {\nvar isPrime = true;\nfor (var i = 2; i < 10; i++){\nif (p % i === 0 && p !== i) {\n isPrime = false;\n break;\n }\n }\n return isPrime;\n}", "function sumPrimes(num) {\r\n var count;\r\n var sum = 0;\r\n for(var i = 2; i <= num; i++){\r\n count = 0;\r\n for(var j = 1; j < i; j++){\r\n if(i % j === 0){\r\n count++; \r\n }\r\n } \r\n if (count === 1){\r\n sum += i;\r\n }\r\n }\r\n return sum;\r\n}", "function nPrimeList(n) {\n var primelist = []\n for (let i = 2; primelist.length < n; i++) {\n if (isPrime(i)) {\n primelist.push(i);\n }\n }\n return primelist;\n}", "function primeNumber(number) {\n if (number == 1) {\n return false;\n }else if(number===2){\n return true\n }\n for(var i=2; i<number;i++){\n if(number%i===0){\n return false\n }\n }\n return true\n}", "function isPrime(number){\n //determine if number is 1\n if(number === 1){\n return false;\n }\n//0 gives you NaN and all the numbers are divisible by 1. Therefore, you\n//start at 2.\n for(var i = 2; i < number; i++){\n if(number % i === 0){ //if the statement is true, then return false\n return false;\n }\n }\n return true;\n}", "function printPrime(value) {\n let primes = [];\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n console.log(` i ${i} limit ${limit} `)\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n console.log(` j ${j} `)\n primes[j] = false;\n }\n }\n }\n for(let i = 2; i < value; i++) {\n // if(primes[i] === true) {\n console.log(i + \" \" + primes[i]);\n // }\n }\n}", "function checkPrimeNumber(start, end) {\n console.log('The prime numbers between ' + start + ' and ' + end + ' are:');\n for (let i = start; i <= end; i++) {\n let flag = false;\n for (let j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = true;\n break;\n }\n }\n\n if (i > 1 && flag === false) {\n console.log(i);\n }\n }\n\n}", "function primefactor(max) {\n for (var i = max; i > 0; i--) {\n if (i % max == 0) {\n console.log(i)\n for (var j = 2; j <= i; j++) {\n if (j == i) {\n return i\n }\n if (i % j == 0) {\n break\n }\n }\n }\n }\n}", "function primeNumber(number) {\n for (let i = 2; i < number; i++) {\n if (number % i === 0) {\n return false;\n }\n }\n return true;\n}", "function all_primes_intherange(lowerLimit, upperLimit) {\r\n let checker = false;\r\n let primeList = [];\r\n if (+lowerLimit%2 === 0){\r\n loop1:for (let i = +lowerLimit+1; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true; \r\n } else { checker = false;break;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n } else {\r\n for (let i = +lowerLimit; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true;\r\n } else { checker = false;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n }\r\n return primeList;\r\n}", "function test_prime(n)\n{ \n if (n===1) {return false; }\n else if(n === 2)\n{ return true; }\nelse {\nfor(var x = 2; x < n; x++) {\n if(n % x === 0) \n{ return false; } \n}\n return true; \n }\n}", "checkPrime(s1, s2) {\n var count = 0, flag = 0, k = 0;\n var array = [];\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n count++;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n array[k++] = i;\n }\n }\n return array;\n }", "function checkPrime(number) {\n \n for (var i = 2; i < number; i++){\n if (number % i === 0) {\n return false\n }\n }\n \n return true;\n}", "function isPrimeNumber(number) {\n    if (number <= 0) {\n        return false;\n    }\n    for (var i = 2; i < number; i++) {\n        if (number % i === 0) {\n            return false;\n        }\n    }\n    return true;\n}", "function showPrimes(n) {\n nextPrime: for (let i = 2; i < n; i++) {\n\n for (let j = 2; j < i; j++) {\n if (i % j == 0) continue nextPrime;\n }\n\n alert( i ); // a prime\n }\n}", "function checkPrimes(size) {\n var primes = [];\n var isPrime = true;\n for (var i = 2; i < size; i++) {\n isPrime = true;\n for (var j = 2; j < i / 2; j++) {\n if (i % j == 0 ) {\n isPrime = false;\n }\n }\n if (isPrime) {\n primes.push(i);\n }\n }\n return primes;\n}", "function generatePrime(num) {\r\n var isPrime;\r\n for (let i = 2; i <= num; i++) {\r\n isPrime = true;\r\n for (let j = 2; j <= Math.sqrt(i); j++) {\r\n if (i % j == 0) {\r\n isPrime = false;\r\n break;\r\n }\r\n }\r\n if (isPrime) {\r\n console.log(i);\r\n }\r\n }\r\n}", "function primesArray(input) {\n //initialising array\n let primes = [];\n //avoid returning 1 as a prime value\n let i = 2;\n\n //setting condition - total number of values returned should be equal to n\n while (primes.length < input) {\n //if i passes prime test add it to the array\n if (isPrime(i)) {\n primes.push(i);\n }\n //increment in and add 1 to i\n i += 1;\n }\n return primes;\n}", "function generatePrimes(limit) {\n const marks = new Array(limit + 1).fill(false);\n for (let i = 2; i * i <= limit; i++) {\n if (!marks[i]) { // If not prime...\n // Mark all multiples as non-prime\n for (let j = i * i; j <= limit; j += i) {\n marks[j] = true;\n }\n }\n }\n const primes = [];\n for (let i = 0; i <= limit; i++) {\n if (i > 1 && !marks[i]) {\n primes.push(i);\n }\n }\n return primes;\n}", "function listPrimes(n) {\n const list = [];\n const output = [];\n // Make an array from 2 to (n-1)\n for (let i = 0; i < n; i += 1) {\n list.push(true);\n }\n // remove multiples of primes starting from 2,3,5...\n for (let i = 2; i <= Math.sqrt(n); i += 1) {\n if (list[i]) {\n for (let j = i * i; j < n; j += i) {\n list[j] = false;\n }\n }\n }\n\n // All array[i] set to ture are primes\n for (let i = 2; i < n; i += 1) {\n if (list[i]) {\n output.push(i);\n }\n }\n return output;\n}", "function prime (n) {\nvar counter = 0;\nwhile (counter <= n) {\n var notPrime = false;\n counter++\n var i = 2;\n while (i <= counter) {\n if (counter%i===0 && i!==counter) {\n notPrime = true;\n }\n i++;\n }\n if (notPrime === false) {\n console.log(counter);\n }\n}\n}", "function primeFactorize(v)\n{let factors=[];\n for(k=1;k<v;k++)\n {\n if(v%k===0&&isPrime(k))\n {\n if(!factors.includes(k))\n factors.push(k);\n }\n }\n for(j=0;j<factors.length;j++)\n {\n console.log(factors[j]+\" \");\n }\n}", "function checkPrime(x) {\n for (let i = 2; i <= x/2; i++) {\n if (x%i === 0) {\n return null;\n }\n }\n return x;\n}", "function checkPrime(number){\n //var faktor = [];\n var jumlahFaktor = 0;\n for(let i=1; i<=number; i++){\n if(number%i === 0){\n //faktor.push(i);\n jumlahFaktor++;\n }\n }\n if(jumlahFaktor === 2){\n return true;\n } else {\n return false;\n }\n }", "function prime(number) {\n for (var i = 2; i < number; i++) {\n if (number % i === 0) {\n return false;\n }\n\n }\n return true;\n}", "function notPrimes(a,b) {\n let nonPrimeArr = [];\n for(let i = a; i <= b; i++) {\n if(!isPrime(i) && checkForPrimeDigits(i)) {\n nonPrimeArr.push(i)\n }\n }\n return nonPrimeArr;\n\n function checkForPrimeDigits(num) {\n let numStr = num.toString();\n for(let elem of numStr) {\n if(elem!=='2' && elem!=='3' && elem!=='5' && elem!=='7') {\n return false;\n }\n }\n return true;\n }\n function isPrime(num) {\n if(num < 2) return false;\n for(let i=2; i < num; i++){\n if(num%i===0) return false;\n }\n return true;\n }\n}", "isPrime(index) {\n var n = 2;\n while (n <= index / 2) {\n if (index % n == 0) {\n return 0;\n }\n n++;\n }\n return index;\n}", "function isPrime(number) { \n if (number === 1) return false\n else if (number === 2) return true\n else if (number % 2 === 0) return false\n for (let j = 3; j <= Math.floor(Math.sqrt(number)); j+=2) {\n if (!(number % j)) return false\n }\n return true\n}", "function sumPrimes(num) {\n \nvar Sum=2;\nvar primeNum=[2]\n\n//Checks for every number lower or equals to num\n for (var i=3;i<=num;i++){\n var test=0;\n \n //Check if the number is prime (is if divisible by any other prime?)\n //If it is, adds one to test value. If test value stays to 0, the number is prime\n //and is added to the sum (value Sum) and to the array containing all prime.\n for (var j=0;j<primeNum.length;j++){\n if (i%primeNum[j]==0)\n {test+=1;}\n }\n\n if (test ==0)\n {Sum+=i;\n primeNum.push(i) \n }\n \n } \n \n return Sum;\n}", "function getPrimeFactors(num) {\n const solution = [];\n let divisor = 2;\n while (num > 2) {\n if (num % divisor === 0) {\n solution.push(divisor);\n num = num / divisor;\n } else divisor++;\n }\n return solution;\n}", "function isPrime(num) {\n if(num < 2) return false;\n \n for (let i = 2; i < num; i++){\n if( num % i === 0){\n return false;\n }\n }\n return true;\n }", "function isPrime(v)\n{ let count=0;\n for(i=1;i<=v/2;i++)\n {\n if(v%i==0)\n count++\n }\n if(count>1)\n return false;\n else \n return true;\n}", "function isPrime(num){\n\n // if any of the values between 2 and the num\n // var can evenly go into num then return false\n for(let i = 2; i < num; i++){\n if(num % i === 0){\n return false;\n }\n }\n return true;\n}", "function primesToN(n) {\n\tvar result = [];\n\tfor (var i = 2; i <= n; i++) {\n\t\tif (testPrime(i)) {\n\t\t\tresult.push(i);\n\t\t}\n\t}\n\treturn result;\n}", "function prime(num) {\n for (var i = numArr.length - 1;i >= 0; i--) {\n for (var j = 2; j < numArr[i]; j++) {\n var number = numArr[i];\n if (number % j === 0) {\n numArr.splice(i, 1);\n $('#result').append(numArr + '<br>');\n }\n }\n }\n}", "function get_prime_factors(number) {\n number = Math.floor(number);\n if (number == 1) {\n //alert(\"Warning: 1 has no prime factorization.\");\n return 1;\n }\n var factorsout = [];\n var n = number;\n var q = number;\n var loop;\n\n for (var i = 0; i < PRIMES.length; i++) {\n if (PRIMES[i] > n) break;\n\n factorsout.push(0);\n\n if (PRIMES[i] == n) {\n factorsout[i]++;\n break;\n }\n\n loop = true;\n\n while (loop) {\n q = n / PRIMES[i];\n\n if (q == Math.floor(q)) {\n n = q;\n factorsout[i]++;\n continue;\n }\n loop = false;\n }\n }\n\n return factorsout;\n}", "function isPrime(num) {\n num = Math.abs (num);\nif (num < 2) {return false;}\nfor (let i=2;i<num;i++) { \n if (num%i === 0){ \n return false;}\n}\nreturn true;\n}", "function prim(x) {\n if (x < 2) return false;\n\n for (let i = 2; i < x; i++) {\n if (x % i === 0) {\n return false;\n }\n }\n return true;\n}", "function getPrimeRange(from, to){\n\n\tfor(let i = from; i <= to; i++){\n\t\tif (i===2 || i===3){\n console.log(i);\n\t\t} else if((i%2===0) || (i%3===0) ){\n\t\t continue;\n\t }else{\n\t\t console.log(i);\n\t }\n\t}\n}", "function divisors(integer) {\n let x = [];\n for (let i = 2; i < integer; i++) {\n if (integer % i === 0) x.push(i);\n }\n\n if (!x.length) return `${integer} is prime`;\n else return x;\n}", "function isPrime(num) {\n if(num===1) {\n return false\n }\n else if (num === 2) {\n return true\n }\n \n for(var i = 3; i < num-1; i++)\n if(num % i === 0) {\n return false\n }\n return true\n}", "function numPrimorial(n) {\r\n let j;\r\n let arr = new Set;\r\n\r\n function createPrimeArr(length) {\r\n if (arr.size == n) return;\r\n for (let i = 1; i <= length; i++) {\r\n let tempArr = [];\r\n for (j = 0; j <= i; j++) {\r\n if (i % j == 0) tempArr.push(i);\r\n }\r\n\r\n if (tempArr.length == 2) {\r\n\r\n arr.add(tempArr[0])\r\n };\r\n };\r\n createPrimeArr(length + 1)\r\n };\r\n createPrimeArr(n)\r\n return arr\r\n}", "function howManyPrimes(max) {\n var primeNumbers = []\n for(var i = 0; i < max; i++){\n if(isPrime(i)) primeNumbers.push(i);\n }\n return primeNumbers\n }", "function nth_prime(n) {\n\n}", "function primeSieve(max) {\n let output = sieveMultiplesOf(2, max)\n let counter = 3;\n let baseMultipes = [2,3]\n\n while (counter*2 < max) {\n output = reSieve(counter, output);\n counter = findNextNumberInArray(counter, output)\n }\n\n output.unshift(2);\n\n return output\n .filter(item => item !== false);\n}", "function isPrime(num) {\n for(var i = 2; i < num; i++){\n if(num % i === 0){ \n return false;\n }\n }\n //return num !== 1;\n return true;\n }", "function is_prime(num){\n if(num <= 1){\n return false\n }\n for(let i = 2; i < Math.floor(Math.sqrt(num)) + 1 ; i++){\n if(parseInt(num % i) === 0 ){\n return false\n }\n\n }\n return true\n}", "function findPrime(num) {\n var result = true;\n for (var i = 2; i < num; i++) {\n if (num % i === 0) {\n return !result;\n }\n } return result;\n}", "function demoFun(num,prime){\nvar x=0\nfor(var i=2;i<num;i++){\nif(num%i == 0){\nx=1\nbreak;\n}\n}\nif(x == 0){\nprime()\n}\n}", "function primeNumber(a) {\n for (let i = 2; i < a; i++) {\n if(!showPrime(i)) continue;\n }\n}" ]
[ "0.74690133", "0.74147207", "0.7381841", "0.73522687", "0.7327391", "0.726779", "0.72537005", "0.7204794", "0.71823853", "0.71614563", "0.7159606", "0.7132848", "0.7123628", "0.70880824", "0.7079946", "0.70765793", "0.70729786", "0.70672655", "0.70388967", "0.7024804", "0.7012129", "0.70062256", "0.700214", "0.69989026", "0.69966185", "0.6995851", "0.69860876", "0.6974041", "0.69740015", "0.69708866", "0.69705313", "0.6953228", "0.69443977", "0.694421", "0.69437367", "0.69429344", "0.6936631", "0.69227123", "0.6909818", "0.6900834", "0.68991023", "0.68911374", "0.6886065", "0.6884574", "0.6883733", "0.6880095", "0.6877267", "0.6865516", "0.68639565", "0.6862327", "0.68613833", "0.6851419", "0.6848462", "0.68388635", "0.6837943", "0.6835246", "0.68314177", "0.68160206", "0.6810627", "0.68057305", "0.679796", "0.67946273", "0.6793346", "0.6791243", "0.6787326", "0.678684", "0.67836374", "0.6780724", "0.67742884", "0.6772975", "0.6771908", "0.6761016", "0.6756866", "0.6756573", "0.67493355", "0.6742593", "0.6742266", "0.6740699", "0.6737779", "0.6734816", "0.67328715", "0.6727324", "0.6718389", "0.67172456", "0.67107385", "0.67075616", "0.6707221", "0.6701393", "0.6695883", "0.66915333", "0.66886586", "0.668193", "0.66795665", "0.66782916", "0.66768724", "0.6676085", "0.6665146", "0.66584", "0.66582", "0.66486365" ]
0.7023341
20
You are given two positive integers a and b (a < b <= 20000). Complete the function which returns a list of all those numbers in the interval [a, b) whose digits are made up of prime numbers (2, 3, 5, 7) but which are not primes themselves. non prime single digit : 1, 4, 6, 8, 9
function notPrimes(a,b) { let nonPrimeArr = []; for(let i = a; i <= b; i++) { if(!isPrime(i) && checkForPrimeDigits(i)) { nonPrimeArr.push(i) } } return nonPrimeArr; function checkForPrimeDigits(num) { let numStr = num.toString(); for(let elem of numStr) { if(elem!=='2' && elem!=='3' && elem!=='5' && elem!=='7') { return false; } } return true; } function isPrime(num) { if(num < 2) return false; for(let i=2; i < num; i++){ if(num%i===0) return false; } return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function notPrimes(a,b){\n let arr = [];\n for (let i = a; i < b; i++){\n if (!/[014689]/.test(i)) {\n for (let j = 2; j <= Math.sqrt(i); j++){\n if (i % j === 0) { arr.push(i); break;}\n }\n }\n }\n return arr;\n}", "function primes(limit) {\n let list = [];\n let nonPrimes = [];\n\n //build range\n for (let idx = 2; idx <= limit; idx++) list.push(idx);\n\n // mark nonPrimes\n list.forEach(number => {\n if (!nonPrimes.includes(number)) {\n for (let testNum = number * 2; testNum <= limit; testNum += number) {\n nonPrimes.push(testNum);\n }\n }\n });\n \n // filter out nonPrimes\n return list.filter(number => !nonPrimes.includes(number));\n}", "function all_primes_intherange(lowerLimit, upperLimit) {\r\n let checker = false;\r\n let primeList = [];\r\n if (+lowerLimit%2 === 0){\r\n loop1:for (let i = +lowerLimit+1; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true; \r\n } else { checker = false;break;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n } else {\r\n for (let i = +lowerLimit; i <= +upperLimit; i+=2) {\r\n for (let j = 3; j < i/2; j+=2) {\r\n if ( i % j !== 0 ) { checker = true;\r\n } else { checker = false;} \r\n }\r\n if (checker === true) { primeList.push(i);}\r\n }\r\n }\r\n return primeList;\r\n}", "function primeList() {\n // For max=60M, computes 3.5 million primes in 15 seconds\n // For max=10M, computes 67k primes in 2 seconds.\n\n // Initialize variables\n let max = 10000000; // Maximum number to check if prime.\n let a = new Array(max);\n let out = []\n\n // Initialize sieve array\n for (var i=0; i<=max; i++) {\n a[i]=1;\n }\n\n // Mark all composite numbers\n for (var i=2; i<=max; i++) {\n for (var j=2; i*j<=max; j++) {\n a[i*j]=0;\n }\n }\n\n // Generate output list of prime numbers\n for (var i=2; i<=max; i++) {\n if (a[i]==1) {\n out.push(i)\n }\n }\n\n return out;\n}", "checkPrime(s1, s2) {\n var count = 0, flag = 0, k = 0;\n var array = [];\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n count++;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n array[k++] = i;\n }\n }\n return array;\n }", "function checkCoprimeNum(a,b){\n\tif (b===1) {\n\t\treturn true;\n\t}\n\tif (!(a % b)) {\n\t\treturn false;\n\t} else {\n\t\treturn checkCoprimeNum(b, a%b);\n\t}\n}", "function getPrime(x,y){\n for(let i=x;i<y;i++){\n let flag = true;\n for(let a=2;a<i;a++){\n if(i%a==0 && i!==a){\n flag= false\n break\n }\n }\n if(flag==true){\n console.log(i)\n }\n }\n}", "function findSmallerPrimes() {\n for (let i = 0; i < 1000; i++) {\n isPrime(i);\n }\n}", "function primeNumber(a) {\n for (let i = 2; i < a; i++) {\n if(!showPrime(i)) continue;\n }\n}", "findPrime(s1, s2) {\n var count = 0, flag = 0, k = 0;\n var prime = [];\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n count++;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n prime[k++] = i;\n }\n }\n return prime;\n }", "function primenum(){\n var num=+prompt('Enter a number');\n if(num<3){\n console.log('Not a prime number');\n } else {\n checkPrimenum();\n }\n\n function checkPrimenum() {\n for (var a=2;a<num;a++) {\n for (var b=2;b<a;b++) {\n if (a%b == 0) break;\n }\n if (b == a){\n console.log(a);\n }\n }\n } \n}", "findPrime(s1, s2) {\n var flag = 0, k = 0;\n var prime = [];\n\n for (var i = s1; i <= s2; i++) {\n for (var j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = 0;\n break;\n }\n else {\n flag = 1;\n }\n }\n if (flag == 1) {\n prime[k++] = i;\n }\n }\n return prime;\n }", "function isPrimeNumb (numb) {\n \n var result = true;\n \n for (var i = 2; i < numb; i++) {\n if (numb % i === 0 && numb !== i ) {\n result = false;\n }\n }\n return result;\n}", "function isPrimeNumber (a) {\n for (var i = 2; i < a; i++) {\n if (a % i == 0) {\n return false;\n }\n }\n return true;\n}", "function checkPrimeNumber(start, end) {\n console.log('The prime numbers between ' + start + ' and ' + end + ' are:');\n for (let i = start; i <= end; i++) {\n let flag = false;\n for (let j = 2; j < i; j++) {\n if (i % j == 0) {\n flag = true;\n break;\n }\n }\n\n if (i > 1 && flag === false) {\n console.log(i);\n }\n }\n\n}", "function prime2(n) {\n const data = [];\n for (let i = 1; i < n; i += 2) {\n data.push(i);\n }\n data[0] = 0;\n for(let i = 1; i < data.length; i+= 1) {\n if (data[i] > 0) {\n let k = data[i];\n let u = i * (1 + k);\n if (u > data.length) { break; }\n for (let j = u; j < data.length; j += k) {\n data[j] = 0;\n }\n }\n }\n const result = [2];\n for (let i of data) {\n if (i > 0) {\n result.push(i);\n }\n }\n return result;\n }", "function showPrimes(limit) {\n for(let number=2; number<=limit; number++) {\n\n let isPrime = true;\n \n for (let factor=2; factor<number; factor++) {\n if (number % factor === 0) {\n //isPrime = false;\n //break; // no sense in checking the rest of the numbers\n }\n }\n\n if (isPrime) console.log(number);\n } \n}", "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function primes(n) {\n var realNumbers = [];\n for(i=0; i<=n; i++) {\n realNumbers.push(true);\n }\n var primeNumbers = [];\n for (i=0; i<=n; i++) {\n if (i == 0 || i == 1 || realNumbers[i] === false) {\n continue;\n }\n primeNumbers.push(i);\n for (j=i; true; j++) {\n if (i*j < realNumbers.length) {\n realNumbers[i*j] = false;\n } else {\n break;\n }\n }\n }\n return primeNumbers;\n}", "function funcIsPrimeOrFactors(numNumber) {\n // body... \n var numHalf = Math.floor(numNumber / 2);\n var arrFactors = [];\n\n for (var i = 2; i <= numHalf; i++) {\n var numQuotient = Math.floor(numNumber / i);\n var numRemainder = numNumber % i;\n if (numRemainder === 0) {\n arrFactors.push([i, numQuotient]);\n }\n }\n console.log(arrFactors);\n return [arrFactors.length === 0, arrFactors];\n}", "function PrimeValues(value) {\n let primes = [], tempArr=[];\n\n //fills an array with 'true' from 2 to the given value.\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n\n //work way thru array tagging primes & non-primes\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n primes[j] = false;\n }\n }\n }\n\n // remove nonprimes from array.\n for(let i = 2; i < value; i++) {\n if(primes[i] === true) {\n tempArr.push(i);\n }\n }\n return tempArr;\n }", "function showPrimes(limit) {\n for (let number = 2; number <= limit; number++) {\n // 2 - current (number)\n\n let isPrime = true;\n for (let factor = 2; factor < number; factor++) {\n if (number % factor === 0) {\n isPrime = false;\n break;\n }\n }\n if (isPrime) console.log(number);\n }\n}", "function getPrime() {\n var i = 0;\n var j = 0;\n\n limit_numbers = document.getElementById('limit').value;\n\n //loop till i equals to limit_numbers of numbers\n for (i = 1; i <= limit_numbers; i++) {\n count = 0;\n\n for (j = 1; j <= i; j++) {\n // % modules will give the reminder value, so if the reminder is 0 then it is divisible\n if (i % j == 0) {\n //increment the value of count\n count++;\n }\n }\n\n\n //prime number should be exactly divisible by 2 times only (itself and 1)\n if (count == 2) {\n document.getElementById(\"result\").insertAdjacentHTML('beforeend', i + '<br>');\n }\n }\n}", "function printPrimes(){\n var isPrime = true;\n for(let i = 2; i <= 100; i++) {\n isPrime = true;\n for (let j = 2; j <= i/2; j++) {\n if (i%j === 0) {\n isPrime = false;\n break;\n }\n }\n if (isPrime) {\n console.log(i);\n }\n }\n}", "function testPrimeNum(num){\n for(var i=2; i<num; i++){\n if(num%i===0){\n return false;\n }\n return num>1;\n }\n}", "function primeSieve(n) {\n var array = [], upperLimit = Math.sqrt(n), output = [];\n\n //makes an array from 2 to (n-1)\n for (var i = 0; i < n; i++){\n array.push(true);\n }\n\n //removes multiples of primes starting from 2,3,5\n for (var i = 2; i <= upperLimit; i++){\n if (array[i]) {\n for (var j = i * i; j < n; j += i) {\n array[j] = false;\n }\n }\n }\n\n //all array[i]set to true are primes for(var i = 2; i < n; i++){\n for (var i = 2; i < n; i++){\n if (array[i]){\n output.push(i);\n }\n }\n return output;\n}", "function PrimeTest(a){\n if (isNaN(a) || !isFinite(a) || a % 1 || a < 2) return false; \n var m = Math.sqrt(a);\n for (var i = 2; i <= m; i++) if (a % i==0) return false;\n return true;\n}", "function multiples(num1, num2) {\n let new_array = [];\n for (let i = 1; i <= 100; i++) {\n if (i % num1 === 0 && i % num2 === 0) {\n new_array.push(i);\n }\n } //end of for\n return new_array;\n } //end of multiples", "function sieve(limit){\n\n\tvar arr =[];\n\t//generate array with numbers 0,1, ...limit\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\n\t//remove all non-prime numbers using sieve method\n\tfor (var j =2; j < limit; j++){\n\t\tfor (var k= 2; k <limit/j; k++){\n\t\t\tarr[j*k] = 0;\n\t\t}\n\t}\n\treturn arr;\n}", "function getPrimes(int) {\r\n var primes = [];\r\n var curr = 2n;\r\n \r\n while (curr < int) {\r\n if ((int / curr) * curr === int) {\r\n int /= curr;\r\n primes.push(curr);\r\n console.log(curr);\r\n } else {\r\n curr += 1n;\r\n }\r\n }\r\n primes.push(int);\r\n \r\n return primes;\r\n}", "function problem10() {\n \"use strict\";\n var i, j, k, l, m, s, a; // i, j, k are counters, others are defined as we go\n l = Math.floor((2000000 - 1) / 2); //not sure why we're going halfway\n a = [];\n for (i = 0; i < l; i += 1) {\n a[i] = true; // make a whole bunch of numbers true\n }\n m = Math.sqrt(2000000); // first part that makes sense\n for (i = 0; i <= m; i += 1) { \n if (a[i]) { // all a[i] are already true\n j = 2 * i + 3; // all primes can be represented as 2k+3, certainly not for all k in Z as k = 3 gives 9 which is not prime\n k = i + j; // initialize k as a multiple of 3; k = 2i + 3 + i = 3i+3 = 3(i+1);\n while (k < l) {\n a[k] = false; // makes sense \n k += j; // make k a multiple of j and set it to false\n }\n }\n } // this doesn't seem like the seive of eratosthenes\n s = 2;\n for (i = 0; i < l; i += 1) { // now I see why we halved limit\n if (a[i]) {\n s += 2 * i + 3; // because here we use the 2k + 3\n }\n }\n return s;\n\n}", "function sieve(limit){\n\t// console.log(\"starting sieve\");\n\tvar arr = []; \n\t//initialize an array\n\tfor (var i =0; i < limit; i++){\n\t\tarr.push(i);\n\t}\n\tarr[1]=0;\n\t//check all 2*n, 3*n, 4*n,etc... and make their entries 0\n\t//whatever remains must be a prime\n\tfor (var j=2; j < limit; j++){\n\t\tif (arr[j]!=0){\n\t\t\tfor (var k=2; k < limit/j; k++){\n\t\t\tarr[k*j] = 0;\t\n\t\t\t}\t\n\t\t}\n\t}\n\treturn arr;\n}", "function primeListNew(max) {\n console.time();\n var numList = [];\n for (let i = 0; i <= max; i++) {\n numList.push(true);\n }\n //turn all even index to false\n for (let i = 4; i < numList.length; i+=2) {\n numList[i] = false;\n }\n for (let i = 3; i < Math.sqrt(numList.length); i+=2) {\n for (let j = i; i * j < numList.length; j++) {\n numList[i * j] = false;\n }\n }\n var primeList = []\n for (let i = 2; i < numList.length; i++) {\n if (numList[i]) {\n primeList.push(i);\n }\n }\n console.timeEnd();\n return primeList;\n}", "function allPrimesLessThanN(n) {\n for (let i = 0; i < n; i++) {\n if (isPrime2(i)) {\n \n }\n }\n}", "function prime(a){\n\n for(let i=2;i<a;i++){\n\n if(a%i == 0){\n return \"Nu este prim\"\n }\n }\n\n return \"Este prim\";\n\n}", "function potentialPrimes(min, max) {\n const start = (min % 2 === 0) ? min + 1 : min;\n return range(start, max + 1, 2);\n}", "function showPrimes(limit) {\n for (number = 2; number <= limit; number++)\n if (isPrime(number)) console.log(number);\n}", "function sieveOfEratosthenes2(n){\n var primes = [];\n\n for(var i = 0; i <= n; i++) primes[i] = true;\n primes[0] = false;\n primes[1] = false;\n\n for(var i = 2; i <= Math.sqrt(n); i++){\n for(var j = 2; j*i <= n; j++){\n primes[i * j] = false;\n }\n }\n\n var result = [];\n for(var i = 0; i < primes.length; i++){\n if(primes[i]) result.push(i);\n }\n\n return result;\n}", "isPrime(number)\n{\n if(number==0 || number == 1)\n {\n return false;\n }\n else\n {\n for (let index = 2; index < number; index++)\n {\n if (number % index == 0) \n {\n return false;\n }\n }\n return true;\n }\n}", "function listPrimes(n) {\n const list = [];\n const output = [];\n // Make an array from 2 to (n-1)\n for (let i = 0; i < n; i += 1) {\n list.push(true);\n }\n // remove multiples of primes starting from 2,3,5...\n for (let i = 2; i <= Math.sqrt(n); i += 1) {\n if (list[i]) {\n for (let j = i * i; j < n; j += i) {\n list[j] = false;\n }\n }\n }\n\n // All array[i] set to ture are primes\n for (let i = 2; i < n; i += 1) {\n if (list[i]) {\n output.push(i);\n }\n }\n return output;\n}", "function SeiveOfEratosthenes(n){\n prime = Array.from({length: n+1}, (_, i) => true);\n for(i=2; i<=n; i++){\n //if its true finally, its a prime.\n if(prime[i]== true){\n //to go through the multiples.\n for(p = i*i; p<=n; p+=i){\n prime[p] = false;\n };\n };\n };\n //loop to print out primes\n textarea = document.getElementById('textarea');\n textarea.textContent = 'Prime Numbers upto ' + `${n}` + ' : ';\n for(i=2; i<=n;i++){\n if(prime[i] == true){\n textarea.textContent += i + \", \";\n };\n };\n\n}", "function getPrimeNumbers(num) {\n let primes = [];\n for (let i = num; i > 1; i--) {\n if (isPrime(i)) {\n primes.push(i);\n }\n }\n return primes;\n }", "function findPrimes(startFrom, endAt)\n\t{\n\t// INSERT YOUR CODE HERE\n\t}", "function printPrime(value) {\n let primes = [];\n for(let i = 2; i < value; i++) {\n primes[i] = true;\n }\n let limit = Math.sqrt(value);\n for(let i = 2; i < limit; i++) {\n console.log(` i ${i} limit ${limit} `)\n if(primes[i] === true) {\n for(let j = i * i; j < value; j += i) {\n console.log(` j ${j} `)\n primes[j] = false;\n }\n }\n }\n for(let i = 2; i < value; i++) {\n // if(primes[i] === true) {\n console.log(i + \" \" + primes[i]);\n // }\n }\n}", "function isPrime(n){\n console.log(\"Các số nguyên tố trong khoảng từ 1 đến \"+n)\n if(n <2){\n console.log(\"không có số nguyên tố nào cả\")\n \n }else{\n console.log(2)\n for(var i = 3; i <= n; i++ ){\n \n for(var j=2; j < Math.sqrt(i); j++){\n if(i % j === 0){\n return 0;\n \n }\n console.log(i) \n }\n \n }\n \n }\n \n \n}", "function prime(){\r\n \r\n\r\nnumArray = numArray.filter((number) => {\r\n for (var i = 2; i <= Math.sqrt(number); i++) {\r\n if (number % i === 0) return false;\r\n }\r\n return true;\r\n\r\n\r\n});\r\n\r\nconsole.log(numArray);\r\n }", "function testPrimeNum(n){\n if(n===1){\n return false;\n }else if(n===2){\n return true;\n }else{\n for(var i=2; i<n;i++){\n if(n%i===0){\n return false;\n }\n }\n return true;\n }\n}", "function isPriNum (num){\n if (num%1 !== 0 | num ===1){\n return false;\n }\n \n if(num === 2){\n return true\n }\n if (num%2 === 0){\n return false\n }\n\n else{\n for (var a = num-2; a >= 2; a = a-2){\n if (num%a === 0){\n return false\n } \n }\n return true\n }\n}", "function euclids(a,b){ \n var temp;\n if(a<b){\n temp=a;\n a=b;\n b=temp;\n }\n if(a%b==0){\n return(b);\n }\n return(euclids(a%b,b));\n}", "function generatePrimes(limit) {\n const marks = new Array(limit + 1).fill(false);\n for (let i = 2; i * i <= limit; i++) {\n if (!marks[i]) { // If not prime...\n // Mark all multiples as non-prime\n for (let j = i * i; j <= limit; j += i) {\n marks[j] = true;\n }\n }\n }\n const primes = [];\n for (let i = 0; i <= limit; i++) {\n if (i > 1 && !marks[i]) {\n primes.push(i);\n }\n }\n return primes;\n}", "isPrime(number) {\n if (number == 0 || number == 1) {\n return false;\n }\n for (let index = 2; index < number; index++) {\n if (number % index == 0) {\n return false;\n }\n\n }\n return true;\n}", "function cekPrime (param1){\n for(var i=2;i< param1; i++){\n if(param1 % i==0){\n return false;\n }\n }\n return true;\n}", "function findPrime() {\n prime = [2];\n const value = document.getElementById(\"input\").value;\n\n for (let number = 3; number <= value; number++) {\n let numArr = [];\n for (let divider = 2; divider < number; divider++) {\n numArr.push(number % divider);\n }\n\n let isZero = numArr.includes(0);\n\n if (!isZero) {\n prime.push(number);\n }\n }\n console.log(prime);\n}", "function primeNum(p) {\nvar isPrime = true;\nfor (var i = 2; i < 10; i++){\nif (p % i === 0 && p !== i) {\n isPrime = false;\n break;\n }\n }\n return isPrime;\n}", "function isPrime(num) {\n num = Math.abs (num);\nif (num < 2) {return false;}\nfor (let i=2;i<num;i++) { \n if (num%i === 0){ \n return false;}\n}\nreturn true;\n}", "function h$ghcjsbn_isPrime_b(b, rounds) {\n ASSERTVALID_B(b, \"isPrime\");\n throw new Error(\"isPrime_b\");\n}", "function divisors(num){\n var divs = [];\n for(var i=num-1;i>1;i--){\n if(num%i === 0){\n divs.unshift(i);\n }\n }\n if(divs.length < 1){\n return `${num} is prime`\n } else {\n return divs;\n }\n}", "function isPrime(num){\n\n // if any of the values between 2 and the num\n // var can evenly go into num then return false\n for(let i = 2; i < num; i++){\n if(num % i === 0){\n return false;\n }\n }\n return true;\n}", "function prime(a)\n{\n let i,flag=true;\n for(i=2;i<=a/2;i++)\n {\n if(a%i==0)\n {\n flag=false;\n break;\n }\n }\n if(flag===false)\n {\n console.log(`${a} is not a prime`);\n }\n else\n {\n console.log(`${a} is a prime`);\n }\n}", "function findPrime2(max) {\n var arr = []\n for (let i = 2; i <= max; i++) {\n arr.push(i)\n }\n // console.log(\"Prime Array: \" + arr)\n for (let i = 0; i < (Math.ceil(Math.sqrt(max))); i++) {\n for (let j = arr[i];arr[i]*j <= arr[arr.length -1]; j++) {\n // console.log(\"we are at number :\" + arr[i] )\n // var multval = arr[i]*j\n // console.log(\"multiple is:\" + multval)\n var multiple = arr.indexOf(arr[i]*j)\n // console.log(\"multiple index is :\" + multiple)\n if (multiple != -1) {\n arr.splice(multiple,1)\n // console.log(\"removed \" + multiple + \"new array :\" + arr)\n }\n }\n }\n return arr\n}", "function getPowers(a_limit, b_limit) {\n var powers = new Array();\n\n for(var a = 2; a <= a_limit; a++) {\n for(var b = 2; b <= b_limit; b++) {\n var power = a ** b;\n if(!(powers.includes(power))) {\n powers.push(power);\n }\n }\n }\n powers = powers.sort(function(a,b) {return a-b});\n return powers;\n}", "function generatePrime(num) {\r\n var isPrime;\r\n for (let i = 2; i <= num; i++) {\r\n isPrime = true;\r\n for (let j = 2; j <= Math.sqrt(i); j++) {\r\n if (i % j == 0) {\r\n isPrime = false;\r\n break;\r\n }\r\n }\r\n if (isPrime) {\r\n console.log(i);\r\n }\r\n }\r\n}", "function isPrime (number) { // <== HELPER FUNCTION\n if (number < 2) {\n return false;\n }\n for (let i = 2; i < number; i++) {\n if (number % i === 0)\n return false;\n }\n return true;\n}", "function showPrimes(limit) {\n for (let i = 0; i <= limit; i++) {\n if (isPrime(i)) {\n console.log(i);\n }\n }\n}", "function sumPrimes(num) {\n\n //array starts with the first prime numb since its the only non-odd prime.\n var arr = [2];\n\n\nfunction isOdd(n) {\n return Math.abs(n % 2) == 1;\n}\n \nfunction checkIfNOTPrime(max,counter) {\n return Math.abs(max % counter) == 0;\n}\n \n\n //add all odd numbers to array. if not prime , then arr.pop()\n for(var i = 2;i<=num;i++){\n if(isOdd(i)){\n arr[i] =i;\n \n //check all numbers up to i if they can be divided by i\n for(var j = 1;j<i;j++){\n if(checkIfNOTPrime(i,arr[j])){\n arr.pop();\n break;\n\n }\n } \n }\n }\n\n \n \n function add(a, b) {\n return a + b;\n }\n \n //adding all primes to get the sum\n var sum = arr.reduce(add, 0);\n\n\n\n return sum;\n}", "function primeFactorize(v)\n{let factors=[];\n for(k=1;k<v;k++)\n {\n if(v%k===0&&isPrime(k))\n {\n if(!factors.includes(k))\n factors.push(k);\n }\n }\n for(j=0;j<factors.length;j++)\n {\n console.log(factors[j]+\" \");\n }\n}", "function test_prime(n)\n{ \n if (n===1) {return false; }\n else if(n === 2)\n{ return true; }\nelse {\nfor(var x = 2; x < n; x++) {\n if(n % x === 0) \n{ return false; } \n}\n return true; \n }\n}", "function checkPrime(number){\n //var faktor = [];\n var jumlahFaktor = 0;\n for(let i=1; i<=number; i++){\n if(number%i === 0){\n //faktor.push(i);\n jumlahFaktor++;\n }\n }\n if(jumlahFaktor === 2){\n return true;\n } else {\n return false;\n }\n }", "function sieveOfEratosthenes(n) {\n let primes = [];\n\n for(let i=0; i <= n; i++) {\n if(isPrime(i)) primes.push(i);\n }\n return primes;\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function bnIsProbablePrime(t) {\nvar i, x = this.abs();\nif(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {\n for(i = 0; i < lowprimes.length; ++i)\n if(x.data[0] == lowprimes[i]) return true;\n return false;\n}\nif(x.isEven()) return false;\ni = 1;\nwhile(i < lowprimes.length) {\n var m = lowprimes[i], j = i+1;\n while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];\n m = x.modInt(m);\n while(i < j) if(m%lowprimes[i++] == 0) return false;\n}\nreturn x.millerRabin(t);\n}", "function sumPrimes(num) {\n let myNums = [];\n for(let i = 3; i <= num; i+=2){\n myNums.push(i);\n }\n myNums = myNums.filter(x => {\n if(x === 3 || x === 5 || x === 7 || x === 11){\n return true;\n }else if(x % 3 === 0 || x % 5 === 0 || x % 7 === 0 || x % 11 === 0){\n return false;\n }\n return true;\n });\n let j = 4;\n while(Math.pow(myNums[j],2) < num){\n myNums.splice(myNums.indexOf(Math.pow(myNums[j],2)),1);\n j++;\n }\n let u = 4;\n let h = u + 1;\n while(myNums[u] * myNums[h] <= num){\n while(myNums[u] * myNums[h] <= num){\n myNums.splice(myNums.indexOf(myNums[u] * myNums[h]),1);\n h++;\n }\n u++;\n h = u+1;\n }\n console.log(myNums);\n return 2 + myNums.reduce((x,y) => x+y);\n}", "function displayPrimeNumbers() {\r\n var isPrimeArr = [];\r\n var inputIsValid = validateInput();\r\n //inputIsValid ? console.log('Input is valid'):console.log('Input not valid'); //todo Will remove later\r\n\r\n var startNum = document.forms['cFlowForm'].txt_startValue.value;\r\n var endNum = document.forms['cFlowForm'].txt_endValue.value;\r\n\r\n if (inputIsValid) {\r\n for (var i = startNum; i <= endNum; i++) {\r\n if (isPrime(i) && i > 2) {\r\n isPrimeArr.push(i);\r\n }\r\n }\r\n createTable(isPrimeArr);\r\n }\r\n}// end of display Prime numbers function", "function displayPrimeNumbers() {\r\n var isPrimeArr = [];\r\n var inputIsValid = validateInput();\r\n //inputIsValid ? console.log('Input is valid'):console.log('Input not valid'); //todo Will remove later\r\n\r\n var startNum = document.forms['cFlowForm'].txt_startValue.value;\r\n var endNum = document.forms['cFlowForm'].txt_endValue.value;\r\n\r\n if (inputIsValid) {\r\n for (var i = startNum; i <= endNum; i++) {\r\n if (isPrime(i) && i > 2) {\r\n isPrimeArr.push(i);\r\n }\r\n }\r\n createTable(isPrimeArr);\r\n }\r\n}// end of display Prime numbers function", "function isPrime(num) {\n return [...Array(num + 1).keys()].filter(el => num % el === 0).length === 2;\n}", "function primeListSoE(max) {\n console.time();\n var numList = [];\n for (let i = 0; i <= max; i++) {\n numList.push(true);\n }\n //turn all even index to false\n for (let i = 4; i < numList.length; i+=2) {\n numList[i] = false;\n }\n for (let i = 3; i < Math.sqrt(numList.length); i+=2) {\n if (numList[i] != false) {\n for (let j = i; i * j < numList.length; j+=2) {\n numList[i * j] = false;\n }\n }\n }\n // var primeList = [];\n // for (let i = 2; i < numList.length; i++) {\n // if (numList[i]) {\n // primeList.push(i);\n // }\n // }\n\n console.timeEnd();\n // return primeList;\n while (numList[numList.length - 1] === false) {\n numList.pop();\n }\n return numList.length - 1;\n}", "function is_prime(num){\n if(num <= 1){\n return false\n }\n for(let i = 2; i < Math.floor(Math.sqrt(num)) + 1 ; i++){\n if(parseInt(num % i) === 0 ){\n return false\n }\n\n }\n return true\n}", "function primeList(max) {\n console.time()\n var primelist = []\n for (let i = 2; i <= max; i++) {\n if (isPrime(i)) {\n primelist.push(i);\n }\n }\n console.timeEnd();\n return primelist;\n}", "function ErastosthenesSieve(N1, N2)\n{\n N1=parseInt(N1);\n\tN2=parseInt(N2);\n\tvar m = 0;\n\tvar prime=new Array();\n if (N2<N1)\n\t{\n\t\t//swap\n\t\tvar temp=N1;\n\t\tN1=N2;\n\t\tN2=temp;\n\t}\n\t\n\tfor(var n = N1;n<=N2; n++)\n\t{\n\t\ti=IsPrime(n);\n if (i == 1)\n\t\t{\n prime[m] = n;\n m ++;\n\t\t}\n\t}\n\t\n\treturn prime;\n}", "function prime(num) {\n for (var i = numArr.length - 1;i >= 0; i--) {\n for (var j = 2; j < numArr[i]; j++) {\n var number = numArr[i];\n if (number % j === 0) {\n numArr.splice(i, 1);\n $('#result').append(numArr + '<br>');\n }\n }\n }\n}", "function printAllPrimesUpTo(max){\n for (let i = 2; i <= max; i++) {\n let possiblePrime = checkPrime(i);\n if (possiblePrime) {\n console.log(possiblePrime);\n }\n }\n}", "function isprime(num){\n if(num === 0 || num === 1){\n return false;\n }\n\n var limit = Math.ceil(Math.pow(num, 1/2));\n if(num !== 2){\n for (var i = 2; i <= limit; i++){\n if(num % i == 0){\n return false\n }\n }\n }\n return true;\n}", "function solve(a,b){\n //..\n let len = a + b;\n let str = '2';\n let strArr = [2];\n \n for (var i = 2; ; i++) {\n let flag = true;\n for (var x = 0; x < strArr.length; x++) {\n if (i % strArr[x] === 0) {\n flag = false;\n }\n }\n if (flag) {\n str += i.toString();\n strArr.push(i);\n }\n if (str.length > len) {\n break;\n }\n }\n let result = str.slice(a, len);\n return result;\n}", "function nPrimeList(n) {\n var primelist = []\n for (let i = 2; primelist.length < n; i++) {\n if (isPrime(i)) {\n primelist.push(i);\n }\n }\n return primelist;\n}", "print(n1, n2) {\n var i = 0;\n var num = 0;\n //Empty String\n var primeNumbers = \" \";\n\n for (i = n1; i <= n2; i++) {\n var counter = 0;\n for (num = i; num >= 0; num--) {\n if (i % num == 0) {\n counter = counter + 1;\n }\n }\n if (counter == 2) {\n //Appended the Prime number to the String\n primeNumbers = primeNumbers + i + \" \";\n }\n }\n console.log(\"Prime numbers from \" + n1 + \" to \" + n2 + \" are: \");\n console.log(primeNumbers);\n }", "function isPrime(number) {\n return false;\n}", "function PrimeChecker(num) {\n function Prime(num) {\n if (num === 2) {\n return true;\n }\n if (num === 1 || num % 2 === 0) {\n return false;\n }\n for (let i = 3; i <= Math.sqrt(num); i = i + 2) {\n if (num % i === 0) {\n return false;\n }\n }\n return true;\n }\n\n function permut(string) {\n if (string.length < 2) return [string];\n var permutations = [];\n for (var i = 0; i < string.length; i++) {\n var char = string[i];\n\n if (string.indexOf(char) != i) continue;\n\n var remainingString =\n string.slice(0, i) + string.slice(i + 1, string.length);\n\n var subLoop = permut(remainingString);\n\n for (var subPermutation of subLoop)\n permutations.push(char + subPermutation);\n }\n return permutations;\n }\n let res = 0;\n let digits = num.toString();\n let powerSet = permut(digits);\n console.log('PrimeChecker -> powerSet', powerSet);\n powerSet.forEach((combo) => {\n debugger;\n if (Prime(parseInt(combo))) {\n res = 1;\n }\n });\n\n return res;\n}", "function divisors(integer) {\n let x = [];\n for (let i = 2; i < integer; i++) {\n if (integer % i === 0) x.push(i);\n }\n\n if (!x.length) return `${integer} is prime`;\n else return x;\n}", "function findPrimes(n) {\n const primes = new Array(n + 1).fill(true);\n\n for (let i = 2; Math.pow(i, 2) <= n; i++) {\n if (primes[i]) {\n for (let j = Math.pow(i, 2); j <= n; j = j + i) {\n primes[j] = false;\n }\n }\n }\n\n for (let i = 2; i <= n; i++) {\n if (primes[i]) console.log(i);\n }\n}", "function test_prime(n) {\n console.log(\"prime clicked\");\n console.log(n);\n\n if (n <= 1) {\n return false;\n } else if (n === 2 || n == 3) {\n return true;\n } else {\n for (var x = 2; x <= Math.floor(Math.sqrt(n)); x++) {\n if (n % x === 0) {\n console.log(x);\n return false;\n }\n }\n return true;\n }\n}", "function h$ghcjsbn_isPrime_b(b, rounds) {\n h$ghcjsbn_assertValid_b(b, \"isPrime\");\n throw new Error(\"isPrime_b\");\n}", "function h$ghcjsbn_isPrime_b(b, rounds) {\n h$ghcjsbn_assertValid_b(b, \"isPrime\");\n throw new Error(\"isPrime_b\");\n}", "function h$ghcjsbn_isPrime_b(b, rounds) {\n h$ghcjsbn_assertValid_b(b, \"isPrime\");\n throw new Error(\"isPrime_b\");\n}", "function h$ghcjsbn_isPrime_b(b, rounds) {\n h$ghcjsbn_assertValid_b(b, \"isPrime\");\n throw new Error(\"isPrime_b\");\n}", "function evenDigsBetween(num1, num2) {\n let resArr = [];\n let resArrFinal = [];\n for (let i = num1; i <= num2; i++) {\n resArr.push(i);\n }\n for (let i = 0; i < resArr.length; i++) {\n let tempNum = resArr[i].toString().split(\"\");\n // for (let j = 0; j < resArr[i].toString().length; j++){\n // if (tempNum)\n // }\n if (tempNum.every((dig) => Number(dig) % 2 === 0)) {\n resArrFinal.push(tempNum.join(\"\"));\n }\n }\n // console.log(resArrFinal);\n if (resArrFinal.length === 0) {\n return \"Such numbers doesn't exist\";\n } else {\n return resArrFinal;\n }\n}" ]
[ "0.8612787", "0.7368873", "0.7118093", "0.70932066", "0.7036627", "0.69277114", "0.6901608", "0.68667215", "0.67853785", "0.6782012", "0.67624044", "0.6757332", "0.67366874", "0.67043066", "0.6678171", "0.6563992", "0.6545962", "0.6520927", "0.6482521", "0.647499", "0.64729214", "0.6459936", "0.64575654", "0.6455552", "0.642502", "0.6423537", "0.64211845", "0.6412729", "0.64089704", "0.6406081", "0.6404204", "0.6383904", "0.6381548", "0.63789326", "0.6358631", "0.6353968", "0.6348294", "0.63407373", "0.63383526", "0.63284993", "0.6328351", "0.6320242", "0.6317033", "0.63140804", "0.6313084", "0.6311986", "0.6306881", "0.6300124", "0.62966245", "0.62956375", "0.6277455", "0.6275802", "0.6274349", "0.6260668", "0.6254566", "0.6244517", "0.62430865", "0.62399864", "0.62385714", "0.62301093", "0.6218704", "0.62158984", "0.6214666", "0.6213596", "0.62110955", "0.62093055", "0.6190086", "0.6187473", "0.6182166", "0.6179585", "0.6179585", "0.6179585", "0.6179585", "0.6179585", "0.6179585", "0.6179585", "0.6171402", "0.61673963", "0.61673963", "0.6165939", "0.61658466", "0.61636364", "0.6163182", "0.61619365", "0.6159046", "0.6158471", "0.61559665", "0.6132434", "0.61300725", "0.61279374", "0.6119686", "0.6118794", "0.61168206", "0.61146635", "0.6113008", "0.61122286", "0.61122286", "0.61122286", "0.61122286", "0.6111321" ]
0.84410274
1
this will be the file that renders categories to the page we will bring in the categories reducer and TODO: get the categories to populate TODO: create an action for when active, send category data
function Categories() { const dispatch = useDispatch(); const category = useSelector((state) => state.categories.categoryList); const activate = (category, description) => { dispatch(action.activated(category, description)) } return ( <div> <Typography>Browse our Categories</Typography> {category.map((item) => { return <Button key={item._id} onClick={() => activate(item.name, item.description)}>{ item.name }</Button> })} </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function categories() {\n // assign categories object to a variable\n var categories = memory.categories;\n // loop through categories\n for (category in categories) {\n // call categories render method\n memory.categories[category].render();\n //console.log(memory);\n }\n }", "categ(state,data)\n {\n return state.category=data\n }", "function getCategories() {\n $.get(\"/api/categories\", renderCategoryList);\n }", "async categories() {\n return await this.fetch(\"/categories/list\");\n }", "function executeCodeWhenCategoriesLoads () {\n var categories = JSON.parse(event.target.responseText);\n console.log(\"categories\", categories)\n categoriesToDOM(categories);\n}", "render(){\n\t\tconst { categories } = this.props\n\n\t\treturn (\n\t\t\t<div className=\"col-12-medium\">\n\t\t\t\t<div className=\"row\">\n\t\t\t\t\t<div className=\"col-12-medium\">\n\t\t\t\t\t\t<Link className=\"mobile-menu-link\" to=\"/\" onClick={this.props.toggleMenu}>all</Link>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t\t{\n\t\t\t\t\tcategories.map((category)=> {\n\t\t\t\t\t\tconst {name,path} = category;\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div className=\"row\" key={path}>\n\t\t\t\t\t\t\t\t\t<div className=\"col-12-medium\">\n\t\t\t\t\t\t\t\t\t\t<Link to={path} className=\"mobile-menu-link\" onClick={this.props.toggleMenu}>{name}</Link>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t</div>\n\t\t)\n\t}", "async news_categorys({session,request, response, view}){\n var language_ad = JSON.parse(fs.readFileSync('public/language/'+session.get('lang_ad')+'/back.json', 'utf8'));\n return view.render('back.news_categorys.news_cat',{\n news_cat: 'active',\n title: language_ad.a_m_news_catgory,\n heading:language_ad.a_m_news_catgory,\n btn_add: '/administrator/news_categorys/add'\n })\n }", "handleCategory(event) {\n let category = event.target.innerHTML\n dispatch(fetchCategory(category))\n }", "function Categories(props) {\n const { getAll, categories } = props;\n\n useEffect(() => {\n getAll();\n }, [getAll]);\n\n const catsToRender = [];\n\n if (categories) {\n categories.forEach((category, i) => {\n catsToRender.push(\n <MenuItem\n className=\"menu-item\"\n value={category.name}\n key={i}\n onClick={() => {\n props.changeCategory(category);\n }}\n >\n {category.displayName || category.name}\n </MenuItem>\n );\n });\n }\n\n return (\n <div id=\"categories\" className=\"cont-child\">\n <h2>Browse our Categories</h2>\n <Select\n value={props.currentCategory ? props.currentCategory.name : ''}\n className=\"cat-select\"\n >\n {catsToRender}\n </Select>\n </div>\n );\n}", "async function showCategories() {\n const res = await axios.get(`${MD_BASE_URL}/categories.php`);\n $('<div class=\"col-10\"><h3 class=\"title text-center\">CATEGORIES</h3></div>').appendTo($cateList);\n for (let cate of res.data.categories) {\n generateCatHTML(cate);\n }\n }", "function loadCategories() {\n\tjQuery.post(\n\t\tgetConnectorURL(),\n\t\t{\n\t\t\taction: 'get_categories'\n\t\t},\n\t\tfunction(result) {\n\t\t\tcategories = result.categories;\n\n\t\t\tdb.transaction(\n\t\t\t\tfunction (tx) {\n\t\t\t\t\ttx.executeSql(\"DROP TABLE IF EXISTS categories\");\n\t\t\t\t\ttx.executeSql(\"CREATE TABLE IF NOT EXISTS categories(categoryid INTEGER, category TEXT)\");\n\n\t\t\t\t\tfor (i in categories) {\n\t\t\t\t\t\tconsole.log(categories[i].category);\n\t\t\t\t\t\ttx.executeSql(\"INSERT INTO categories(category) VALUES ('\"+dbEscape(categories[i]['category'])+\"')\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdbError,\n\t\t\t\tdbSuccess\n\t\t\t)\n\t\t},\n\t\t'jsonp'\n\t)\t\n}", "function storeCategories(data){\n return {\n type: STORE_CATEGORIES,\n data\n };\n}", "function displayCategories(categories) {\n\n // empty variable which will contain html string for categories\n let categoriesListingHtml = '';\n\n // variable to create diff id for categories in loop\n let num = 1;\n\n categories['categories'].forEach(category => {\n\n let categoryName = category['category'];\n\n // if not trash categories, concat as string in variable\n if(!trashCategories.includes(categoryName)) {\n categoriesListingHtml += `<li><a id=\"category${num}\" href=\"#\">${categoryName}</a></li>`;\n num++;\n }\n \n });\n\n // add html string to document to display on screen \n document.querySelector('.categories').innerHTML = categoriesListingHtml;\n\n // reset variable so that we can use same category id to add click event listner\n num = 1;\n\n categories['categories'].forEach(category => {\n\n categoryName = category['category'];\n\n if(!trashCategories.includes(categoryName)) {\n\n // add event listener for category, this will be used to get products in that category\n document.getElementById(`category${num}`).addEventListener(\"click\", getProductsInCategory);\n num++;\n }\n \n });\n\n // get products for first category in list\n document.getElementById('category1').click();\n }", "function CategorysList(props){\n if(props.category.length==0){\n props.dispatch(startSetCategorys())\n }\n const handleShow=(id)=>{\n props.history.push(`/category/show/${id}`)\n }\n // var i= false\n // const handleEdit=(id)=>{\n // i= true \n // }\n const handleRemove=(id)=>{\n Swal.fire({\n title:'Are you sure to remove this',\n text:\"Youn wont be able to recover this\",\n icon:\"warning\",\n showCancelButton:true,\n confirmButtonText:\"Yes, delete it\",\n cancelButtonText:\"No, keep it\"\n }).then((result)=>{\n if(result.value){\n props.dispatch(startDeleteCategory(id))\n }\n })\n \n }\n return(\n <div className=\"container\">\n <h2>Categories {props.category.length}</h2>\n \n {props.category.map(category=>{\n return(\n <div className=\"alert alert-success\" role=\"alert\">\n <ul key={category._id} className=\"list-group\">\n <li className=\"list-group-item\"><strong>{category.name} </strong>\n <br/>\n <button className=\"btn btn-primary\" onClick={()=>{handleShow(category._id)}}>Show</button>\n &nbsp;&nbsp;\n \n <button className=\"btn btn-danger\" onClick={()=>{handleRemove(category._id)}}>Remove</button></li>\n </ul>\n </div>\n )\n })}\n \n <button className=\"btn btn-link\"><Link to=\"/category/new\" >Add Category</Link></button>\n \n </div>\n )\n}", "function fetchCategoriesForSelect() {\n fetchOperations.fetchCategories().then(forEachCategory);\n }", "function Category({ categories }) {\n const { name, _id } = categories;\n\n return (\n <div className=\"col-lg-6 col-sm-12 category\" key={_id}>\n <img\n src={require(`../../assets/${name}category.jpg`)}\n alt={name}\n className=\"category-box\"\n />\n <div className=\"category-text\">\n <Link to={`/category/${_id}`}>\n <button className=\"btn btn-lg btn-outline-dark categorybtn\">{name}</button>\n </Link>\n </div>\n </div>\n );\n}", "function getCategories() {\n \n // API call to get categories\n fetch(\"https://my-store2.p.rapidapi.com/catalog/categories\", {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-key\": \"ef872c9123msh3fdcc085935d35dp17730cjsncc96703109e1\",\n \"x-rapidapi-host\": \"my-store2.p.rapidapi.com\"\n }\n })\n .then(response => {\n return response.json();\n })\n .then(response => {\n\n // call display catgories to display it on screen\n displayCategories(response);\n })\n .catch(err => {\n console.error(err);\n });\n }", "render() {\n const { Categories, isloading } = this.state;\n if (isloading) return <div>loading...</div>;\n\n return (\n <div>\n <AppNav />\n <h2>Categories</h2>\n {Categories.map(categoryNext => (\n <div id={categoryNext.catId}>{categoryNext.catName}</div>\n ))}\n </div>\n );\n }", "function displayCategories(categoryData) {\n storeLocalCategories(categoryData);\n let html = '';\n if (categoryData.length) {\n categoryData.forEach(category => {\n html +=\n `<div class=\"panel panel-default category\" id=\"${category.id}\" style=\"background-color:${category.color}\">\n <div class=\"panel-body\">\n <h3 class=\"panel-title\">${category.title}</h3>\n <button class=\"option-btn\" type=\"button\" data-toggle=\"modal\"\n data-target=\"#delete-confirm\"\n data-id=\"${category.id}\"\n data-type=\"category\">\n <span class=\"glyphicon glyphicon-remove\">\n </span>\n </button>\n </div>\n </div>`;\n });\n }\n $('#category-list').html(html);\n makeDeleteModalDynamic();\n}", "function Category() {\n const { categoryId } = useParams();\n\n const filteredCategories = categoriesArray.filter((category) => category.categoryId == categoryId);\n const category = filteredCategories[0];\n console.log(category)\n const breadcrumbPaths = [\n { link: '/', label: \"Home\" },\n { link: '/categories/', label: \"Categories\" },\n { label: category.name },\n ];\n\n\n const categoryCard =\n <div className=\"row\">\n <div className=\"col-md-4 justify-content-center align-self-center px-1 pb-3\">\n <NavLink to={`/categories/` + category.categoryId}>\n <img className=\"img-fluid\" src={category.image} />\n </NavLink>\n </div>\n <div className=\"col-md-8 \">\n <h5 className=\"card-title ps-3\">\n {category.name}\n </h5>\n <div className=\"card-text ps-3\">\n <p >{category.description} </p>\n <p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Odio, possimus. Reiciendis, placeat aliquid, velit nulla culpa voluptatibus nisi eum facilis corporis officiis, aperiam eligendi corrupti magni tempore deserunt ad! Reprehenderit. </p>\n <p >Lorem ipsum dolor, sit amet consectetur adipisicing elit. Odio, possimus. Reiciendis, placeat aliquid, velit nulla culpa voluptatibus nisi eum facilis corporis officiis, aperiam eligendi corrupti magni tempore deserunt ad! Reprehenderit. </p>\n </div>\n </div>\n </div>\n // const { categoryId } = useParams();\n // let location = useLocation();\n // console.log(location)\n\n // if (location.pathname === \"/categories/Landscapes\") {\n // categoryToShow = categoriesArray.filter(category => category.categoryId === \"Landscapes\")\n // } else if (location.pathname === \"/categories/Flowers\") {\n // categoryToShow = categoriesArray.filter(category => category.categoryId === \"Flowers\")\n // } else {\n // categoryToShow = categoriesArray.filter(category => category.categoryId === \"Cats\")\n // }\n\n return (\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col\">\n <Breadcrumb paths={breadcrumbPaths} />\n </div>\n </div>\n <div className=\"row\">\n <div className=\"col\">\n {categoryCard}\n </div>\n </div>\n </div>\n )\n}", "function getCategories() {\n const apicall = 'http://localhost:3010/api/events/categories';\n fetch(apicall, {\n method: 'GET',\n }).then((response) => {\n if (!response.ok) {\n if (response.status === 401) {\n throw response;\n }\n }\n return response.json();\n }).then((json) => {\n setCategoryList(json);\n json.map((category1) =>\n // attach to category state\n setCategories({...categories, [category1.category]: false}),\n );\n })\n .catch((error) => {\n console.log(error);\n });\n }", "function showCategorie(shownCat) {\n let shownCatItems = shopItemsArr.filter(function(item) {\n return item.groups == shownCat.catId;\n });\n\n var breadcrumbArr = [];\n\n fullBreadcrumbArr();\n // let us make a Breadcrumb arr\n function fullBreadcrumbArr() {\n let active = true;\n recursBreadcrumbArrPush(shownCat.catId);\n\n function recursBreadcrumbArrPush(currentCatId) {\n let currentCat = shopCategoriesArr.filter(function(cat) {\n return cat.catId == currentCatId;\n });\n let breadcrumbPart = {\n name: currentCat[0].catName,\n url: '/' + currentCat[0].catAlias,\n active\n };\n active = false;\n breadcrumbArr.push(breadcrumbPart);\n if (\n currentCat[0].catFatherId &&\n !(currentCat[0].catFatherId == 'absent')\n )\n recursBreadcrumbArrPush(currentCat[0].catFatherId);\n }\n\n var breadcrumbShop = {\n name: 'Каталог',\n url: 'shop',\n active: false\n };\n breadcrumbArr.push(breadcrumbShop);\n var breadcrumbMainPage = {\n name: 'Главная',\n url: '/',\n active: false\n };\n breadcrumbArr.push(breadcrumbMainPage);\n breadcrumbArr.reverse();\n\n //urls in arr are not full yet, so:\n let fullUrl = '';\n for (let i = 0; i < breadcrumbArr.length; i++) {\n breadcrumbArr[i].url = fullUrl + breadcrumbArr[i].url;\n fullUrl = breadcrumbArr[i].url;\n }\n }\n\n //console.log(shownCatItems[0]);\n //console.log(shopCategoriesArr);\n //console.log(discount);\n res.render(viewsView, {\n transData: {\n shopItemsArr,\n shopCategoriesArr,\n user: { _id, login, group },\n shownCat,\n shownCatItems,\n breadcrumbArr,\n shopCart,\n page,\n itemsPerPage,\n showDiscountChooser,\n discount,\n priceSettings,\n pageTitle: shownCat.catTitle,\n description: shownCat.catDescription,\n keywords: shownCat.catKeywords\n }\n });\n //console.log(shownCat);\n }", "function drawCatPage() {\n var domNodes = helper.clearDom();\n var subHead = helper.createNode('h2','Select a category','subheader');\n var quizHead = helper.createNode('h1','Quiz','')\n domNodes[0].appendChild(quizHead);\n domNodes[0].appendChild(subHead);\n domNodes[1].appendChild(drawCategories(categories));\n}", "function populateCategories() {\n if (this.status >= 300) return apiFail();\n\n var data = JSON.parse(this.responseText);\n var categoriesEl = byId('categories');\n\n // empty the current list\n while (categoriesEl.firstChild)\n categoriesEl.removeChild(categoriesEl.firstChild);\n\n data.categories.forEach(function (category, idx) {\n var li = document.createElement('li');\n li.textContent = category.title;\n li.dataset.url = category.productsURL;\n li.onclick = selectCategoryClickHandler;\n categoriesEl.appendChild(li);\n });\n\n selectCategory(categoriesEl.firstChild);\n}", "function buildSidebarCategories(all_categories) {\n var sideCat = $('ul#sidebar_categories').empty();\n all_categories.sort(sortName);\n for(i = 0; i < all_categories.length; i++) {\n var cat_item = $('<li>').addClass('hvr-bounce-to-right')\n .append( $('<a>')\n .attr('href', 'blog.html?category=' + all_categories[i].name)\n .html(all_categories[i].name.replace(/_/g,' ').capFirstLetter())\n .append( $('<span>').html(all_categories[i].count) )\n );\n sideCat.append(cat_item);\n }\n $('<div>').addClass('load_all').append(\n $('<a>').attr('href','posts/categories.html').html('All Categories')\n ).insertAfter('ul#sidebar_categories');\n}", "retrieveCategories() {\n return call(`${this.__url__}/categories`, {\n headers: {\n 'Content-Type': 'application/json'\n },\n timeout: this.__timeout__\n })\n }", "function load_categories(){\n\t\tconnect('GET', 'index.php?q=/books/categories', {})\n\t\t\t.done(function(response){\n\t\t\t\tvar cats = $('#fieldCategory');\n\t\t\t\tcats.html('');\n\t\t\t\tfor (var x in response.data){\n\t\t\t\t\tvar id = response.data[x].id;\n\t\t\t\t\tvar description = response.data[x].description;\n\t\t\t\t\tcats.append(`<option value=\"${id}\">${description}</option>`);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.fail(notify_error);\n\t}", "function renderCategoryList(data) {\n if (!data.length) {\n window.location.href = \"/categories\";\n }\n $(\".hidden\").removeClass(\"hidden\");\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createCategoryRow(data[i]));\n }\n categorySelect.empty();\n console.log(rowsToAdd);\n console.log(categorySelect);\n categorySelect.append(rowsToAdd);\n categorySelect.val(category_id);\n }", "function getCategories() {\n\t// JSON file is called here\n\t$.getJSON(\"/api/categories/\", categories => {\n\t\t$.each(categories, (index, category) => {\n\t\t\tif (category.Category == \"Acupuncture\") {\n\t\t\t\t// List items that are new are added here\n\t\t\t\t$(\"#categoryList\").append(\n\t\t\t\t\t$(\"<a />\")\n\t\t\t\t\t\t.html(category.Category + \" <span class='badge badge-success'>New!</span>\")\n\t\t\t\t\t\t.attr(\"class\", \"dropdown-item\")\n\t\t\t\t\t\t.attr(\"href\", \"#\")\n\t\t\t\t\t\t// Click event added to the anchor\n\t\t\t\t\t\t.on(\"click\", e => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$(\"#catNameHeading\").show();\n\t\t\t\t\t\t\t$(\"#categoryName\").text(category.Category);\n\t\t\t\t\t\t\tgetServices(category.Value);\n\t\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// List items are dynamically populated here\n\t\t\t\t$(\"#categoryList\").append(\n\t\t\t\t\t$(\"<a />\")\n\t\t\t\t\t\t.text(category.Category)\n\t\t\t\t\t\t.attr(\"class\", \"dropdown-item\")\n\t\t\t\t\t\t.attr(\"href\", \"#\")\n\t\t\t\t\t\t.on(\"click\", e => {\n\t\t\t\t\t\t\t// Click event added to the anchor\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$(\"#catNameHeading\").show();\n\t\t\t\t\t\t\t$(\"#categoryName\").text(category.Category);\n\t\t\t\t\t\t\tgetServices(category.Value);\n\t\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n}", "componentDidMount(){\n this.loadCategories();\n \n }", "async indexAction () {\n if (this.isPost) {\n return this.fail()\n }\n // 获取分类\n const data = await this.getTermsByTaxonomy('category')\n // this.success(data)\n return this.success({\n found: data.length,\n categories: data\n })\n }", "render(){\n \n const categories =[]\n\n for(let category in this.state.saveData){\n categories.push(\n <CategoryDisplay \n selected = {this.state.selected}\n addHashtag = {this.addHashtag} \n category = {category} \n tags = {this.state.saveData[category]}\n selectHashtag = {this.selectHashtag}\n removeHashtag = {this.removeHashtag}\n deleteCategory = {this.deleteCategory}\n selectAllCategory={this.selectAllCategory}\n clearSelectedCategory={this.clearSelectedCategory}\n deleteHashtag = {this.deleteHashtag}/>)\n }\n\n\n\n return(\n <div className = \"mainContainer\">\n <h1>#GutenTag</h1>\n <div className = \"loader\">\n <HashtagList \n websiteStyle = {this.state.websiteStyle}\n selected = {this.state.selected}\n loadouts ={this.state.loadouts}\n loadoutName ={this.state.loadoutName}\n saveLoadout = {this.saveloadout}\n loadLoadout ={this.loadLoadout}\n deleteLoadout = {this.deleteLoadout}\n changeWebsiteStyle ={this.changeWebsiteStyle}\n clearAllSelected = {this.clearAllSelected}\n deleteLoadout = {this.deleteLoadout}\n />\n <LoadoutDisplay\n loadLoadout ={this.loadLoadout}\n deleteLoadout = {this.deleteLoadout}\n loadouts ={this.state.loadouts}\n />\n </div>\n\n <HashtagInputter \n addCategory = {this.addCategory} \n changeCategoryValue = {this.changeCategoryValue} \n categoryValue = {this.state.categoryValue}/>\n <div className = \"categoryHolder\">\n {categories}\n </div>\n </div>\n )\n }", "function categoryListHandler(e) {\n var parentPath = e.target.id;\n content.style.display = 'block';\n recentActivity.style.display = 'none';\n // update currentParentPath\n currentParentPath = parentPath + '/';\n sendAjaxReq('GET', '/category/all?parent=' + sanitizePath(parentPath), updateAllPanes);\n }", "function displayCategories(categories) {\r\n let htmlString = '';\r\n\r\n //Creates an 'All' category option\r\n htmlString = htmlString + `<li class=\"category-all\">All</li>`;\r\n $.each(categories, function (i, category) {\r\n htmlString = htmlString + getCategoryItemHTML(category);\r\n });\r\n categoryListEl.html(htmlString);\r\n categoryAll = $(\".category-all\");\r\n categoryAll.on('click', function () {\r\n displayAccom(filteredAccommodation);\r\n });\r\n\r\n //Filter accommodation by category\r\n let categoryItems = $(\".category-item\");\r\n categoryItems.on('click', function () {\r\n let categoryid = $(this).data('categoryid');\r\n let filteredAccomByCategory = filterByCategory(filteredAccommodation, categoryid);\r\n displayAccom(filteredAccomByCategory);\r\n });\r\n}", "function loadMenuCategories() {\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n buildCategoriesViewHtml(this);\n }\n };\n xhttp.open(\"GET\", \"https://davids-restaurant.herokuapp.com/categories.json\", true);\n xhttp.send(null);\n}", "async getCategories() {\n // Consultar las categorias a la REST API de event brite\n const responseCategories = await fetch\n (`https://www.eventbriteapi.com/v3/categories/?token=${this.token_auth}`);\n\n // Esperar la respuesta de las categorias y devolver un JSON\n const categories = await responseCategories.json();\n // Devolvemos el resultado\n return {\n categories\n }\n }", "function CategoryList ({ categories }) {\n if (!categories.length) {\n return null\n }\n\n return (\n <nav className='breadcrumbs push-center'>\n <label>Categories:</label>\n <ul className='category-list'>\n <li>\n <NavLink exact to='/' activeClassName='active'>all</NavLink>\n </li>\n {categories.map(({ name, path }) => (\n <li key={`${name}${path}`}>\n <NavLink exact to={`/${path}`} activeClassName='active'>{name}</NavLink>\n </li>\n ))}\n </ul>\n </nav>\n )\n}", "function Homepage() {\n const [categories, setCategories] = useState([]);\n const [tickets, setTickets] = useState([]);\n const [categoryId, setCategoryId] = useState(null);\n\n async function fetchData() {\n\n try {\n let categories = await getAllCategories();\n categories.unshift({ _id: '1', name: 'All' });\n setCategories(categories);\n\n setTickets(await getAllTickets());\n\n } catch (error) {\n\n console.log(error);\n }\n }\n\n useEffect(() => {\n fetchData();\n }, []);\n\n const updateCategoryId = (itemId) => {\n setCategoryId(itemId === \"1\" ? null : itemId);\n }\n\n return <div>\n <Banner />\n <Menu items={categories} ulClass=\"category-menu\" liClass=\"category-item\" liClassClicked=\"category-item-clicked\" onItemClicked={updateCategoryId} />\n <TicketsContainer tickets={tickets} categoryId={categoryId} />\n </div>\n}", "function renderCat() {\n var kittyContainer = document.createElement('SECTION');\n kittyContainer.id = activeCat.id;\n kittyContainer.classList.add('kittyContainer', activeCat.name);\n\n var kittyHeader = document.createElement('H3');\n kittyHeader.classList.add('instruction');\n //kittyHeader.setAttribute('style', 'white-space: pre;');\n kittyHeader.textContent = 'Click on ' + activeCat.name + '!';\n //kittyHeader.textContent += activeCat.name + '!';\n\n var catImage = document.createElement('IMG');\n catImage.classList.add('cat');\n catImage.src = activeCat.url;\n\n var counter = document.createElement('DIV');\n counter.classList.add('counter');\n counter.textContent = 'Clicks: ';\n\n var clickCounter = document.createElement('SPAN');\n clickCounter.classList.add('click-count');\n clickCounter.textContent = activeCat.click;\n\n counter.appendChild(clickCounter);\n\n kittyContainer.append(kittyHeader, catImage, counter);\n\n var parent = document.querySelector('.cat-container');\n parent.appendChild(kittyContainer);\n}", "async categoryselected(pos, value) { \n var acceestoken=await commons.get_token();\n var s3config = require(\"./config/AWSConfig.json\"); \n this.setState({ loading: true });\n this.refs.loaderRef.show();\n if (value == Strings.discover_category_home) {\n this.mixpanelTrack(\"Store Home Page\");\n var cats = this.state.categories;\n var catsLanguage=this.state.categoriesLanguage;\n var cur_staxdata = [];\n var count=0;\n for (var i = 0; i < cats.length; i++) { \n if (cats[i] == Strings.discover_category_favorite||cats[i]==Strings.discover_category_home||cats[i]==Strings.discover_category_new)\n continue;\n var aws_data = require(\"./config/AWSConfig.json\");\n var aws_lamda = require(\"./config/AWSLamdaConfig.json\");\n var urlName=\"\";\n if (this.state.username == null || this.state.username == commons.guestuserkey()) { \n urlName=aws_lamda.commenapis;\n }\n else\n {\n urlName=aws_lamda.contentmanagement;\n } \n await fetch('' + aws_data.path + aws_data.stage + urlName, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization':acceestoken\n },\n body: JSON.stringify({\n \"operation\":\"getContentList\",// \"getSingleCategoryList\",\n \"category\": catsLanguage[i],\n \"widgetname\": \"\"+this.state.searchquery,\n \"userid\": this.state.username,\n \"LastEvaluatedKey\": {}\n }),\n }).then((response) => response.json())\n .then(async (responseJson) => { \n var catstax_obj = {}; \n catstax_obj[\"category\"] = cats[i];\n catstax_obj[\"key\"] = count;\n catstax_obj[\"staxdata\"] = responseJson.data;\n for (var j = 0; j < catstax_obj[\"staxdata\"].length; j++) {\n catstax_obj[\"staxdata\"][j].staxpreview = s3config.s3path + \"/\" + s3config.s3bucketname + \"/\" + s3config.s3storefolder + \"/Thumbnail_\" + catstax_obj[\"staxdata\"][j].staxid + \".jpg\" + \"?time=\" + catstax_obj[\"staxdata\"][j].createtime;\n }\n if(catstax_obj[\"staxdata\"].length>0)\n cur_staxdata.push(catstax_obj);\n var last_val_map = this.state.last_key_val_mapping;\n if (responseJson.hasOwnProperty(\"LastEvaluatedKey\"))\n last_val_map[cats[i]] = responseJson.LastEvaluatedKey;\n this.setState({\n catgorychoosen: Strings.discover_category_home,\n staxdata: cur_staxdata,\n staxdata_categorized: [],\n last_key_val_mapping: last_val_map,\n loading: false\n });\n count++;\n this.refs.loaderRef.hide();\n })\n .catch((error) => {\n console.error(error);\n });\n }\n }\n else {\n var aws_data = require(\"./config/AWSConfig.json\");\n var aws_lamda = require(\"./config/AWSLamdaConfig.json\");\n var operation =\"getContentList\"// \"getSingleCategoryList\"\n this.mixpanelTrack(value);\n if (value == Strings.discover_category_new)\n {\n var urlName=\"\";\n if (this.state.username == null || this.state.username == commons.guestuserkey()) { \n urlName=aws_lamda.commenapis;\n }\n else\n {\n urlName=aws_lamda.contentmanagement;\n } \n await fetch('' + aws_data.path + aws_data.stage +urlName, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization':acceestoken\n },\n body: JSON.stringify({\n \"operation\": \"getLatestStax\"\n }),\n }).then((response) => response.json())\n .then(async (responseJson) => {\n var resp = [];\n resp = responseJson;\n for (var j = 0; j < resp.length; j++) {\n resp[j].key=responseJson[j].contentid;\n resp[j].staxpreview = s3config.s3path + \"/\" + s3config.s3bucketname + \"/\" + s3config.s3storefolder + \"/Thumbnail_\" + responseJson[j].contentid + \".jpg\" + \"?time=\" + resp[j].createtime;\n }\n this.setState({\n loading: false,\n staxdata_categorized: resp,\n catgorychoosen: value\n });\n this.refs.loaderRef.hide();\n })\n .catch((error) => {\n console.error(error);\n }); \n }\n else{\n if (value == Strings.discover_category_favorite)\n {\n operation = \"getfavouriteContentList\";\n }\n var cats=this.state.categories;\n var catsLanguage=this.state.categoriesLanguage;\n var valueDisplay=\"\"\n for(var i=0;i<catsLanguage.length;i++)\n {\n if (value ==cats[i])\n {\n valueDisplay=value;\n value=catsLanguage[i];\n break;\n }\n }\n var urlName=\"\";\n if (this.state.username == null || this.state.username == commons.guestuserkey()) { \n urlName=aws_lamda.commenapis;\n }\n else\n {\n urlName=aws_lamda.contentmanagement;\n } \n await fetch('' + aws_data.path + aws_data.stage + urlName, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization':acceestoken\n },\n body: JSON.stringify({\n \"operation\": operation,\n \"category\": value,\n \"widgetname\": \"\"+this.state.searchquery,\n \"userid\": this.state.username,\n \"LastEvaluatedKey\": {}\n }),\n }).then((response) => response.json())\n .then(async (responseJson) => {\n var last_val_map = this.state.last_key_val_mapping;\n if (responseJson.hasOwnProperty(\"LastEvaluatedKey\"))\n last_val_map[value] = responseJson.LastEvaluatedKey;\n else\n delete last_val_map[value];\n var resp = [];\n\n if (value == Strings.discover_category_favorite)\n resp = responseJson;\n else\n resp = responseJson.data;\n for (var j = 0; j < resp.length; j++) {\n resp[j].staxpreview = s3config.s3path + \"/\" + s3config.s3bucketname + \"/\" + s3config.s3storefolder + \"/Thumbnail_\" + resp[j].staxid + \".jpg\" + \"?time=\" + resp[j].createtime;\n }\n this.setState({\n loading: false,\n staxdata_categorized: resp,\n catgorychoosen: valueDisplay\n });\n this.refs.loaderRef.hide(); \n })\n .catch((error) => {\n this.setState({ loading: false });\n this.refs.loaderRef.hide();\n console.error(error);\n });\n }\n }\n }", "populateCategories() {\n\t\tthis.m_catMenu.innerHTML = \"\";\n\t\tCONFIG.CATEGORIES.forEach(function(item) {\n\t\t\tGUI.m_catMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t}", "function renderCategoryHeader() {\n const postSectionDiv = document.getElementById(\"post-section\");\n //Declaring variables for dynamic rendering of Category Header\n let activeIcon = \"\";\n let activeTitle = \"\";\n let activeDescription = \"\";\n\n //Check which category is active then return the category name\n let activeCategoryName = \"\";\n const categoriesArray = document\n .getElementById(\"category-navbar\")\n .querySelectorAll(\"a\");\n for (let i = 0; i < categoriesArray.length; i++) {\n if (categoriesArray[i].classList.contains(\"active-category\")) {\n activeCategoryName = categoriesArray[i].innerText;\n }\n }\n\n //Switch Case - active Icon, Title, Description\n switch (activeCategoryName) {\n case \"All\":\n activeIcon = \"fas fa-bars fa-3x\";\n activeTitle = \"<h2>All</h2>\";\n activeDescription =\n \"<p>All the adventures in the world await. Join us now and be an adventurer!</p>\";\n break;\n case \"Terra\":\n activeIcon = \"fas fa-mountain fa-3x\";\n activeTitle = \"<h2>Terra</h2>\";\n activeDescription =\n \"<p>Welcome to the Terra adventures, where land-loving creatures like you gather for a Rocky journey.</p>\";\n break;\n case \"Ocean\":\n activeIcon = \"fas fa-water fa-3x\";\n activeTitle = \"<h2>Ocean</h2>\";\n activeDescription =\n \"<p>Welcome to the Ocean adventures, where sea-loving creatures like you gather for a Wavy journey.</p>\";\n break;\n case \"Forest\":\n activeIcon = \"fas fa-tree fa-3x\";\n activeTitle = \"<h2>Forest</h2>\";\n activeDescription =\n \"<p>Welcome to the Forest adventures, where greenery-loving creatures like you gather for a Leafy journey.</p>\";\n break;\n case \"City\":\n activeIcon = \"fas fa-city fa-3x\";\n activeTitle = \"<h2>City</h2>\";\n activeDescription =\n \"<p>Welcome to the City adventures, where metropolis-loving creatures like you gather for an Ambient journey.</p>\";\n break;\n case \"Foodie\":\n activeIcon = \"fas fa-utensils fa-3x\";\n activeTitle = \"<h2>Foodie</h2>\";\n activeDescription =\n \"<p>Welcome to the Foodie adventures, where dessert-loving creatures like you gather for a Sugary journey.</p>\";\n break;\n case \"Games-night\":\n activeIcon = \"fas fa-gamepad fa-3x\";\n activeTitle = \"<h2>Games-night</h2>\";\n activeDescription =\n \"<p>Welcome to the Games-night adventures, where boardgames-loving creatures like you gather for an Elated journey.</p>\";\n break;\n case \"Energetic\":\n activeIcon = \"fas fa-glass-cheers fa-3x\";\n activeTitle = \"<h2>Energetic</h2>\";\n activeDescription =\n \"<p>Welcome to the Energetic adventures, where festive-loving creatures like you gather for a Zestful journey.</p>\";\n break;\n case \"Kiddos\":\n activeIcon = \"fas fa-child fa-3x\";\n activeTitle = \"<h2>Kiddos</h2>\";\n activeDescription =\n \"<p>Welcome to the Kiddos adventures, where children-loving creatures like you gather for an Uplifting journey.</p>\";\n break;\n }\n\n //Render Category Header - Main Page\n postSectionDiv.innerHTML = `\n <div class=\"col-2\">\n <div class=\"square-icon-bg\">\n <i class=\"${activeIcon}\"></i>\n </div> \n </div>\n <div class=\"col-10\">\n ${activeTitle}\n ${activeDescription}\n </div>\n `;\n}", "getCategories() {\n\t\tfetch(`https://maximum-arena-3000.codio-box.uk/api/categories/${this.state.prop_ID}`, {\n\t\t\tmethod: \"GET\",\n\t\t\tbody: null,\n\t\t\theaders: {\n\t\t\t\t\"Authorization\": \"Basic \" + btoa(this.context.user.username + \":\" + this.context.user.password)\n\t\t\t}\n\t\t})\n\t\t\t.then(status)\n\t\t\t.then(json)\n\t\t\t.then(dataFromServer => {\n\t\t\t\tthis.setState({\n\t\t\t\t\tcategories: dataFromServer,\n\t\t\t\t});\n\t\t\t\tconsole.log(dataFromServer, 'categories here')\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.log(error)\n\t\t\t\tmessage.error('Could not get the categories. Try Again!', 5);\n\t\t\t});\n\t}", "function addCategoryListener() {\n $('#category-sidebar').on('click', '.category', function() {\n $('.category').removeClass('selectedCategory');\n if ($(this).attr('id') == 'all-categories') {\n getAcronymData(displayAcronymEntries);\n $(this).addClass('selectedCategory');\n //collapses categories list in mobile only\n $('#mobile-category-collapse').collapse('hide');\n } else {\n const categoryId = $(this).attr('id');\n getAcronymData(displayAcronymEntriesByCategory(categoryId));\n $(this).addClass('selectedCategory');\n //collapses categories list in mobile only\n $('#mobile-category-collapse').collapse('hide');\n }\n\n });\n}", "function fetchCategories(){\n return fetch(catURL)\n .then(resp => resp.json())\n .then(categories=>{\n categoryData = categories\n displayCategories(categories)\n })\n}", "function getCategories() {\n $.ajax({\n type: \"GET\",\n url: \"getCategories\",\n success: (data) => makeCategoriesHTML(data)\n })\n}", "function prepareCategories() {\n var categories = {},\n page,\n pagesData;\n\n // iterator to build categories\n for (page in pages) {\n pagesData = pages[page].data;\n\n if (pages.hasOwnProperty(page) && pagesData.title !== undefined) {\n // check if already defined with category or not\n if(categories[pagesData.category] === undefined){\n categories[pagesData.category] = { list: [] };\n }\n\n // build pages list for each category\n listItemsforCategory(categories[pagesData.category], pagesData);\n }\n }\n\n // return the categories\n return categories;\n }", "function mapDispatchToProps (dispatch) {\n return {\n selectCategory: (data) => dispatch(selectCategory(data)),\n };\n}", "function readCategories_index(obj) {\n // Create tag div for categories\n $.each(obj.categories, function(index, value){\n var category = value.toLowerCase().replace(/ /g, '-');\n\n // Add sidebar\n var temp = `<a class=\"list-group-item list-group-item-action\" \n id=\"list-${category}-list\" \n data-toggle=\"list\" \n href=\"#list-${category}\" \n role=\"tab\" \n aria-controls=\"${category}\">\n ${value}\n </a>`;\n $(\".sidebar-js\").append(temp);\n \n // Add main-content\n temp = `<div class=\"tab-pane fade\" id=\"list-${category}\" role=\"tabpanel\" aria-labelledby=\"list-${category}-list\">\n <h4>${value}</h4>\n <hr>\n <div class=\"card-columns mt-4 list-${category}-js\">\n\n </div>\n </div>`;\n $(\".content-js\").append(temp);\n })\n $(`#list-${obj.categories[0].toLowerCase().replace(/ /g, '-')}-list`).addClass('active')\n $(`#list-${obj.categories[0].toLowerCase().replace(/ /g, '-')}`).addClass('active show')\n}", "getCategories(req, res) {\n db.items.getAllCategories()\n .then(result => res.status(200).send(result));\n }", "function prepareCategories(data) {\n const newCategory = {\n 'parent_id': parseInt(data['Parent ID']) || 0,\n 'name': data['Category Name'],\n 'description': data['Category Description'],\n 'sort_order': parseInt(data['Sort Order']) || 0,\n 'page_title': data['Page Title'],\n 'meta_keywords': [data['Meta Keywords']],\n 'meta_description': data['Meta Description'],\n 'image_url': data['Category Image URL'],\n 'is_visible': yesNoToBoolean(data['Category Visible']) || true,\n 'search_keywords': data['Search Keywords'],\n 'default_product_sort': data['Default Product Sort'] || 'use_store_settings'\n };\n if (data['Category URL'] && data['Custom URL']) {\n newCategory['custom_url'] = {\n 'url': data['Category URL'],\n 'is_customized': yesNoToBoolean(data['Custom URL'])\n };\n }\n \n return categoryArray.push(newCategory);\n }", "function displayCategory() {\n displayHeading();\n displayList();\n}", "allCategories(context) {\n axios.get('/categories')\n .then((response)=>{\n context.commit('allcategories', response.data.categories)//allcategories used in mutations & categories comes from controller\n })\n }", "async function getcategaries() {\n const response = await fetch(\"http://localhost:8000/api/categaries\");\n const body = await response.json();\n console.log(\"response from api : \", body);\n setCategories(\n body.plantCategories.map(({ category, id }) => ({\n label: category,\n value: id,\n }))\n );\n }", "async getAllCategories() {\n const data = await this.get('jokes/categories');\n return data;\n }", "constructor() {\n\t\tthis.categories = [];\n\t}", "function loadCategories() {\n\t\tlet categories = new wp.api.collections.Categories()\n\n\t\tcategories.fetch().done( () => {\n\t\t\tconsole.log(categories);\n\t\t\t\t//clearCategories();\n\t\t\t\tcategories.each( category => loadCategory( category.attributes ) );\n\t\t});\n\t}", "function addCategory() {\n ajaxCall('action=add-category&new_category=' + categoryName.value.trim(),\n function(response) {\n categoryCloseButton.click();\n console.log(response);\n var data = JSON.parse(response);\n console.log(data);\n var cat = data.category;\n var index = data.index;\n insertCategoryInSidebar(cat, index);\n insertCategoryInMenuList(cat, index);\n insertCategoryInSelect(cat, index);\n window.location.hash = '#category-' + cat;\n });\n }", "async readCategories() {\n let response = await fetch(url + 'get/categories');\n let data = await response.json();\n return data\n }", "componentWillMount() {\n this.props.actions.getListCategory();\n }", "function getCategories() {\r\n\t\t// body...\r\n\t\t$.ajax({\r\n url: URL+'categories/',\r\n type: 'GET',\r\n dataType: 'json',\r\n headers: {\r\n 'auth': '12345'\r\n },\r\n contentType: 'application/json;',\r\n success: function (result) {\r\n // CallBack(result);\r\n console.log(result);\r\n\r\n $.each(result.data, function(key,val){\r\n \tcategories_menu += '<li><a href=\"categories.html?id='+val.idCategories+'\">'+val.categoriesName+'</a></li>';\r\n \tcategories_menu_mm += '<li class=\"page_menu_item menu_mm\"><a href=\"categories.html?id='+val.idCategories+'\">'+val.categoriesName+'</a></li>';\r\n });\r\n $('#menu_categories').append(categories_menu);\r\n $('.page_menu_selection').append(categories_menu_mm);\r\n },\r\n error: function (error) {\r\n \r\n }\r\n });\r\n\t}", "componentWillMount(){\n\t\tthis.props.getAllCategories();\n\t}", "function initiateCategories() \n{\n\tdocument.getElementById(\"categoryTitle\").innerHTML = \"Select Category\";\n\tdocument.getElementById(\"backBtn\").setAttribute(\"disabled\", \"disabled\");\n\n\tsetCategories(strPath);\n}", "getcategory(state){\n return state.category\n }", "function postCategories(request, response, next) {\n categories.post()\n .then(data => {\n response.status(200).json(data);\n });\n}", "function listCategoriesOnPage() {\n categories = JSON.parse(JSONtext);\n for (i = 0; i < categories.length; i++) {\n if (categories[i].category == \"Daily\") {\n createAndReturnCategoryDivElement(i, dailyElement);\n }\n if (categories[i].category == \"Fruit & vegetable\") {\n createAndReturnCategoryDivElement(i, fruitVegetableElement);\n }\n if (categories[i].category == \"Meat\") {\n createAndReturnCategoryDivElement(i, meatElement);\n }\n if (categories[i].category == \"Seafood\") {\n createAndReturnCategoryDivElement(i, seafoodElement);\n }\n if (categories[i].category == \"Household & cleaning\") {\n createAndReturnCategoryDivElement(i, houseElement);\n }\n if (categories[i].category == \"Breakfast & cereal\") {\n createAndReturnCategoryDivElement(i, breakfastElement);\n }\n if (categories[i].category == \"Bakery\") {\n createAndReturnCategoryDivElement(i, bakeryElement);\n }\n if (categories[i].category == \"Frozen food\") {\n createAndReturnCategoryDivElement(i, frozenElement);\n }\n if (categories[i].category == \"Snacks Crisps\") {\n createAndReturnCategoryDivElement(i, snacksElement);\n }\n if (categories[i].category == \"Beverages Soda\") {\n createAndReturnCategoryDivElement(i, beveragesElement);\n }\n if (categories[i].category == \"Pasta & rice\") {\n createAndReturnCategoryDivElement(i, pastaElement);\n }\n }\n}", "function _dex_getCategories(){ // Step 1 of 2 – Gets top-level categories\n var t=new Date().getTime(),out={},ar=LibraryjsUtil.getHtmlData(\"http://www.dexknows.com/browse-directory\",/\\\"http:\\/\\/www\\.dexknows\\.com\\/local\\/(\\w+\\/\\\">.+)<\\/a>/gm)//return ar;\n ,i=ar.length;while(i--){ar[i]=ar[i].split('/\">');ar[i][1]=ar[i][1].replace(/&amp;/g,\"&\");out[ar[i][0]]={\"displayName\":ar[i][1]}}\n LibraryjsUtil.write2fb(\"torrid-heat-2303\",\"dex/categories/\",\"put\",out)}//function test(){/*print2doc*/Logger.log(_dex_getCategories())}", "function SideNavigation() {\n \n return (\n <div className=\"sideNavigation\">\n <ul>\n <Link to={'/catalog'}>\n <li>All</li>\n </Link>\n {categories.map(category =>\n <Link key={category.name} to={`/catalog/${category.name}`}>\n <li>{category.name}</li>\n </Link>)}\n </ul>\n <Switch>\n <Route path={'/catlog/:categoryName'} />\n </Switch>\n </div>\n )\n}", "render() {\n var linkPrefix = \"/categories/\"\n return(\n <div id=\"home-wrapper\">\n <img src=\"https://metrouk2.files.wordpress.com/2015/10/giphy15.gif\" alt=\"Mountain View\"/>\n <h1>View all categories</h1>\n <ul>\n {this.props.data.map((category, i) =>\n <a href={linkPrefix.concat(category.id)}><li key={i}> <h3> {category.name} </h3></li></a>\n )}\n </ul>\n </div>\n )\n }", "async index({ request, response, view }) {\n try {\n let pagination = request.only([\"page\", \"limit\"]);\n const page = parseInt(pagination.page, 10) || 1;\n const limit = parseInt(pagination.limit, 10) || 10;\n const categories = await Category.query().paginate(page, limit);\n categories.toJSON();\n return response.status(200).json({\n ...categories,\n status: 1\n });\n } catch (e) {\n throw e;\n }\n }", "function clickCategories(e) {\n setList(PRODUCTS[e.target.dataset.category]);\n }", "function mapStateToProps({ categories }) {\r\n return {\r\n categories: categories.categories\r\n }\r\n}", "function callCategories() {\r\n smoothTopScroll();\r\n hideAllBoxes();\r\n activeSet = 0;\r\n document.getElementById(\"pagetitle\").innerHTML = \"Categories\";\r\n Object.keys(categoriesEnum).forEach(function(key) {\r\n generateBox(key, categoriesEnum, 0, categoriesEnum[key], categoriesInfoText);\r\n });\r\n}", "function sortByCategory() {\n _$variablesListContent.empty();\n _currentSortMode = \"byCategory\";\n _$navPath.text(FC.Settings.LAYERS_BY_CATEGORY_MESSAGE);\n _$sortControl.attr(\"title\", \"Sort by name\");\n\n _categories.forEach(function (category) {\n // create category container\n var $categoryContainer = $(_categoryContainerTempalte).clone(true, true);\n var $categoryName = $categoryContainer.find(\".category-name\");\n $categoryName.text(category);\n\n // add variables to category\n var $categoryContent = $categoryContainer.find(\".category-content\");\n _variables.sort(function (a, b) {\n if(a.Description < b.Description) return -1;\n if(a.Description > b.Description) return 1;\n return 0;\n }).forEach(function (variable) {\n if (-1 === variable.Categories.indexOf(category)) {\n return false;\n }\n\n createVariableTile(variable).appendTo($categoryContent);\n });\n\n $categoryContainer.appendTo(_$variablesListContent);\n });\n\n _$variablesList.nanoScroller();\n }", "constructor() {\n /**\n * Array of subcategories. Can be empty.\n * @member {Array.<module:models/Category>} categories\n */\n this.categories = undefined\n\n /**\n * The localized description of the category.\n * @member {String} description\n */\n this.description = undefined\n\n /**\n * The id of the category.\n * @member {String} id\n */\n this.id = undefined\n\n /**\n * The URL to the category image.\n * @member {String} image\n */\n this.image = undefined\n\n /**\n * The localized name of the category.\n * @member {String} name\n */\n this.name = undefined\n\n /**\n * The localized page description of the category.\n * @member {String} page_description\n */\n this.page_description = undefined\n\n /**\n * The localized page keywords of the category.\n * @member {String} page_keywords\n */\n this.page_keywords = undefined\n\n /**\n * The localized page title of the category.\n * @member {String} page_title\n */\n this.page_title = undefined\n\n /**\n * The id of the parent category.\n * @member {String} parent_category_id\n */\n this.parent_category_id = undefined\n\n /**\n * The URL to the category thumbnail.\n * @member {String} thumbnail\n */\n this.thumbnail = undefined\n }", "async function getCategory() {\r\n let request = {\r\n method: 'GET',\r\n redirect: 'follow'\r\n }\r\n\r\n if (token === \"\" || typeof token === 'undefined') {\r\n addAgentMessage(\"Sorry I cannot perform that. Please login first!\")\r\n return;\r\n }\r\n\r\n const serverReturn = await fetch(ENDPOINT_URL + '/categories', request);\r\n\r\n if (!serverReturn.ok) {\r\n addAgentMessage(\"There was a problem accessing the list of categories. Please try again!\");\r\n return;\r\n }\r\n\r\n const serverResponse = await serverReturn.json()\r\n\r\n let categories = serverResponse.categories;\r\n\r\n // comma separated; using 'and' to give the assistant a more of human personality \r\n let message = \"We offer products for \" + categories.length + \" total categories: \\n\"\r\n message += categories.splice(0, categories.length - 1).join(', ') + \", and \" + categories[0] + \".\"\r\n addAgentMessage(message);\r\n\r\n\r\n }", "getAllCategories(req,res,next){\n const categories = req.params.categories\n interestModel.indexCategory(categories)\n .then(interests => {\n res.locals.interests = interests;\n next();\n })\n .catch(e => next(e));\n }", "function categories() {\n loadingWheel(true);\n getData(false);\n fetch(dataUrl)\n .then(response => response.json())\n .then(category => {\n let categoryList = category.trivia_categories;\n categoryList.forEach(category => {\n\n let categoryOption = document.createElement(\"option\");\n let categoryName = document.createElement(\"p\");\n let name = document.createTextNode(category.name);\n\n categoryName.appendChild(name);\n categoryOption.appendChild(categoryName);\n categoryOption.id = category.id;\n categoryOption.classList.add(\"category\");\n document.getElementById(\"categoryList\").appendChild(categoryOption);\n });\n loadingWheel(false);\n start.classList.remove(\"hide\");\n })\n .catch(() => console.error());\n}", "renderCatButtons(data, filteredCategory)\n {\n if(filteredCategory === undefined)\n return null;\n \n if(data.category === filteredCategory[0].category)\n {\n return(\n\n <div id=\"open-note\" key={\"render\" + data.noteId}>\n <p className=\"menu-p\">{data.title}</p>\n <span className=\"note-time\">Last edited:&nbsp;</span><Moment className=\"note-time\" format=\"DD MMM YYYY, HH:mm:ss\">{data.timestamp}</Moment>\n <br/>\n <CatBtn className=\"edit-btn btn\" id=\"catBtn\" label=\"E\" key={\"btn\" + data.noteId} onClick={() => { this.props.handleSingleNote(data.noteId, \"edit\"); this.props.setOpen(false); }}>\n\n {data.body}\n </CatBtn>&nbsp;&nbsp;&nbsp;\n <CatBtn className=\"delete-btn btn\" label=\"E\" key={\"delBtn\" + data.noteId} id={\"delBtn\" + data.noteId} onClick={() => { this.props.handleSingleNote(data.noteId, \"delete\") }}>\n Delete\n </CatBtn>\n </div>\n )\n }\n }", "function addCategories(categories) {\n categories.forEach(element => {\n $(\".menu__container\").append(\n `<div id=\"category-${element.id}\" class=\"category\">\n <h3>${element.name}</h3>\n </div>`\n );\n })\n}", "render() {\n return (\n <table>\n <thead>\n <tr>\n <th>Names of Categories</th>\n <th>Add a Post to a Category</th>\n </tr>\n </thead>\n <tbody>\n {this.props.categories.map((category, i) =>\n <tr key={i}><td>\n <Link to={'/' + category.name}>{category.name}</Link>\n </td><td>\n <Link to={'/' + category.name + '/new'}>\n <AddIcon size={20} />\n </Link>\n </td></tr>)}\n </tbody>\n </table>\n )\n }", "createListItems() {\n //This is used to give active class to the selected category\n jQuery('.active_cat').removeClass('active_cat');\n jQuery(\"#category_\" + this.props.category.cat_id).addClass(\"active_cat\");\n\n //Store the selected meal under sub category(sub menu) to get access in order page\n if (this.props.meal)\n sessionStorage.setItem(\"selected_meal\", JSON.stringify(this.props.meal));\n\n //creates the sub category(sub menu) cards layout, selectMeal is the action triggered when meal card is clicked\n return this.props.category.sub_cat.map((meal, index) => {\n return (\n <div key={index} className=\"col-md-4 col-lg-3 col-sm-6 col-xs-12 cards\" onClick={() => this.props.selectMeal(meal)}>\n <img src={meal.subcat_thumbnail} alt=\"meal pic\" />\n <div style={{ padding: '5px' }}>\n <label>{meal.subcat_name}</label>\n <p>{meal.subcat_desc}</p>\n <label style={{ right: '0', position: 'absolute', bottom: '0', marginRight: '20px', color: 'red' }}>{meal.subcat_price}</label>\n </div>\n </div>\n );\n });\n }", "handleCategory(categoryName) {\n\t\tthis.props.onCategoryCheck(categoryName);\n\t}", "function App() {\n\n // TODO: figure out how to get csv loading working in browser\n // (using JSON file currently, but that's not as easy to edit)\n // csv().fromFile('./assets/products.csv')\n // .then(data => {\n\n // });\n\n let Categories = categories.map((category, index) => (\n <Category name={category.name} items={category.items} key={index}></Category>\n ));\n\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\n <h1 className='App-name'>Shopping List App</h1>\n </header>\n\n <CategoryList>\n {Categories}\n </CategoryList>\n\n </div>\n );\n}", "componentDidMount() {\n this.props.fetchCategories();\n }", "getCategories3() {\n this.config.getWithUrl(this.config.url + '/wp-json/wp/v2/categories/19').then((data) => {\n if (this.page2 == 1) {\n this.categories = [];\n }\n this.categories = data;\n // console.log(data.data.length);\n if (data.length == 0) { // if we get less than 10 products then infinite scroll will de disabled\n //this.shared.toast(\"All Categories Loaded!\");\n this.getRandomImage();\n }\n else\n this.getCategories3();\n }, function (response) {\n // console.log(\"Error while loading categories from the server\");\n // console.log(response);\n });\n }", "static category(req, dynamoDb, callback) {\n const params = {\n TableName: process.env.POSTS_TABLE,\n FilterExpression: 'category = :val',\n ExpressionAttributeValues: {\n ':val': req.query.category\n }\n };\n dynamoDb.scan(params, function (err, data) {\n if (err) {\n console.error(err);\n callback('render', 'error', {error: err});\n } else {\n let posts = data.Items.filter(p => !p.staging);\n posts.map(p => {\n p.content = markdown.render(p.content);\n p.title = markdown.renderInline(p.title);\n });\n posts.sort((a, b) => {\n return new Date(b.published_on) - new Date(a.published_on);\n });\n let left = posts.slice(0, data.Count / 2);\n let center = posts.slice(data.Count / 2);\n callback('render', 'posts/subindex', {heading: req.query.category,\n left: left, center: center});\n }\n });\n }", "function get_categories_view() {\r\n\tvar cats = this.get_categories().map(function(obj) {\r\n\t\tvar str = '<a href=\"' + obj.getURI() + '\">' + obj.title + '</a>';\r\n\t\treturn str.replace(/&(?!\\w+;)/g, '&amp;')\r\n\t}).join(', ');\r\n\r\n\treturn this.categories != null ? new XMLList(cats) : '';\r\n}", "function category_list(id){ \n $.ajax({\n url: \"/sessions/category.json\",\n type: \"POST\",\n data: {\n category_id: id\n }\n });\n\n $.ajax({\n url: \"/product/get_product_list.json\",\n type: \"POST\",\n data: {\n category_id: id\n },\n\t\tsuccess: function(data){\n\t\t\tmethod=data.method;\n\t\t\tmystatus=data.status;\n\t\t\tgender=data.gender;\n\t\t\tproduct_page=\"\"\n\t\t\tfor(i=0;i<data.products.length;i++){\n\t\t\t\tproduct=data.products[i];\n\t\t\t\tuser=data.users[i];\n\t\t\t\tupload=data.uploads[i];\n\t\t\t\tproduct_text=make_product_text(product,user,method,mystatus,gender,upload);\n\t\t\t\tproduct_page+=product_text\n\t\t\t}\n\n\t\t\t\t$(\"#product_page\").html(product_page);\n\t\t}\n\t});\n\tif($(\"#toggle_\"+id).hasClass(\"collapsed\")==true){\n\t\t$(\"#category_fold_\"+id).text(\"-\");\n\t}\n\telse{\n\t\t$(\"#category_fold_\"+id).text(\"+\");\n\t}\n}", "categoryPage(req) {\n return __awaiter(this, void 0, void 0, function* () {\n });\n }", "function handleCategoryChange() {\n var newResponseCategory = $(this).val();\n getResponses(newResponseCategory);\n }", "setCategories(state, categories) {\n state.categories = categories;\n }", "async getCategoriesAPI() {\n // quary the api\n const categoriesResponse = await fetch(`https://www.eventbriteapi.com/v3/categories/?token=${this.auth_token}`);\n\n // hold for the response and return result in json format\n\n const categories = await categoriesResponse.json();\n return {\n categories\n }\n }", "function createRestaurantCategories()\r\n {\r\n\r\n Y.Array.each(configuration.categories, function (category) {\r\n\r\n var categoryContainer = Y.Node.create('<li id=\"'+category.containerId+'\" class=\"draggable\"></li>');\r\n\r\n var categoryTitle = Y.Node.create('<h3 class=\"restaurant-category-title\"></h3>')\r\n //The image won't be a draggable-anchor until all the information is loaded\r\n categoryTitle.append('<img src=\"img/drag.png\" class=\"draggable-anchor-disabled\" alt=\"Drag\" /> '+\r\n category.title);\r\n\r\n categoryContainer.append(categoryTitle);\r\n\r\n categoryContainer.append('<div class=\"loading\"></div>');\r\n\r\n var categoryList = Y.Node.create('<ul class=\"restaurant-list hidden\"></ul>');\r\n categoryList.append('<li class=\"no-results hidden\">We haven\\'t found any restaurant</li>');\r\n\r\n categoryContainer.append(categoryList);\r\n\r\n Y.Node.one('#restaurant-categories').append(categoryContainer);\r\n\r\n\r\n });\r\n\r\n }", "static getCategories(req, res, next){\n CategorySchema.find({}, function(err, categories){\n res.send(categories)\n })\n }", "componentDidMount() {\n this.props.fetchCategories()\n }", "function SidebarSubCat ({ data, setChannel }) {\n\n return ( \n \n <>\n \n <div />\n <ul className='channel-list'>\n {data.map(item=>\n \n <li key={item.id} className='channel' onClick={()=>setChannel(item.name)}>\n #\n {item.name}\n </li>)}\n </ul>\n \n </>\n );\n}", "setCategoryFromStorage() {\n // check for category. if none set to all.\n let currCat = localStorage.getItem('category');\n if (!currCat) {\n // set default.\n localStorage.setItem('category', 'restaurants');\n currCat = 'restaurants';\n }\n IndexAnimationsObj.category = currCat;\n // set list-group button to active for current category\n this.$categoryButtons.children().each(function (index) {\n if ($(this).val() === currCat) {\n $(this).addClass('active');\n // set card-map-zone filter display to category name\n $('.cat-display').text($(this).text());\n }\n });\n }", "addCategoryToDisplay () {\n this.createSection([\"div\", \"p\"], ['id'], ['category'], 'qwerty');\n document.querySelector('#category p')\n .innerHTML = `<span style=\"font-size:16px\">the category is</span>\n </br><span style=\"font-weight:500\">${this.category}</span>`;\n }", "render() {\n return (\n <>\n <div className=\"App\">\n <h3>Community Event Categories</h3>\n <CategoriesContainer />\n </div>\n </>\n );\n }" ]
[ "0.73967123", "0.69341886", "0.6782816", "0.6651629", "0.66173035", "0.65676314", "0.6554418", "0.6543957", "0.6488017", "0.6430285", "0.6400187", "0.63998014", "0.633934", "0.63388056", "0.63328326", "0.6329658", "0.6308752", "0.6296203", "0.6268805", "0.62648886", "0.6259283", "0.6252115", "0.62490153", "0.62271243", "0.62066305", "0.6202681", "0.6188901", "0.6183594", "0.6182001", "0.6146169", "0.6139284", "0.6137556", "0.6134977", "0.6131716", "0.61142766", "0.6113094", "0.609169", "0.60663754", "0.6058145", "0.60565305", "0.60551566", "0.60462046", "0.6043342", "0.60420376", "0.60401976", "0.6031414", "0.6030365", "0.6021328", "0.60211116", "0.602096", "0.60138655", "0.6008984", "0.6008041", "0.60074556", "0.5999799", "0.59962523", "0.59911436", "0.5986619", "0.59812504", "0.5980802", "0.5978512", "0.5966379", "0.5961865", "0.5954507", "0.59514445", "0.5946993", "0.59420633", "0.5934391", "0.59270036", "0.5914472", "0.5913885", "0.5901181", "0.5877286", "0.5876999", "0.5876958", "0.5875468", "0.5863746", "0.58592546", "0.58529395", "0.585186", "0.58471704", "0.58460945", "0.584054", "0.5838555", "0.58368415", "0.5827172", "0.58241904", "0.58141816", "0.58112735", "0.580836", "0.58047205", "0.5802344", "0.5801523", "0.5801121", "0.5797283", "0.5794463", "0.5790135", "0.57875544", "0.5780759", "0.5780699" ]
0.6727549
3
swap ranks of index p1 with index p2
function swap(p1, p2, MAX) { p1 = validateIndex(p1, MAX); p2 = validateIndex(p2, MAX); if(p1 == p2) return; dbo.collection("names").findOne({rank: p1}, function(err, ar1) { dbo.collection("names").findOne({rank: p2}, function(err, ar2) { var temp = ar1.name ar1.name = ar2.name; ar2.name = temp; temp = ar1.id; ar1.id = ar2.id; ar2.id = temp; temp = ar1.complaints; ar1.complaints = ar2.complaints; ar2.complaints = temp; dbo.collection("names").updateOne( { rank: p1 }, {$set:ar1}, { upsert: true } ); dbo.collection("names").updateOne( { rank: p2}, {$set: ar2}, { upsert: true } ); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "swapNodes(idx1, idx2) {\n const VALS = this.values;\n\n const temp = VALS[idx1];\n VALS[idx1] = VALS[idx2];\n VALS[idx2] = temp;\n }", "_swap(idx1, idx2) {\n let _tempElement = this._elementHeap[idx1];\n let _tempPriority = this._priorityHeap[idx1];\n\n this._elementHeap[idx1] = this._elementHeap[idx2];\n this._priorityHeap[idx1] = this._priorityHeap[idx2];\n\n this._elementHeap[idx2] = _tempElement;\n this._priorityHeap[idx2] = _tempPriority;\n\n this._indexLookup[this._elementHeap[idx1]] = idx1;\n this._indexLookup[this._elementHeap[idx2]] = idx2;\n }", "function swapValues(arr, idx1, idx2) {\n\n }", "function swap(index1, index2) {\n tmp = arr[index1];\n arr[index1] = arr[index2];\n arr[index2] = tmp;\n }", "function swap(index1, index2) {\n tmp = arr[index1];\n arr[index1] = arr[index2];\n arr[index2] = tmp;\n }", "function swap(idx1, idx2, arr) {\n let temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "swap(index1, index2) {\n const s = this.store;\n [s[index1], s[index2]] = [s[index2], s[index1]];\n }", "function swap( index1, index2, arr ) {\n const temp = arr[ index1 ];\n arr[ index1 ] = arr[ index2 ];\n arr[ index2 ] = temp;\n}", "function indexSwap(itemsToSort, leftIndex, rightIndex) {\n var tempVar = itemsToSort[leftIndex];\n itemsToSort[leftIndex] = itemsToSort[rightIndex];\n itemsToSort[rightIndex] = tempVar;\n}", "function swap(arr, idx1, idx2) {\n let temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function swap(arr, idx1, idx2) {\n var temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function swap(arr, idx1, idx2) {\n let temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function swap(arr, idx1, idx2) {\n return [arr[idx1], arr[idx2]] = [arr[idx2], arr[idx1]];\n}", "function swap(index1, index2) {\n console.log(`Swap: ${arr[index1]} e ${arr[index2]}`);\n tmp = arr[index1];\n arr[index1] = arr[index2];\n arr[index2] = tmp;\n \n }", "function swap(arr, idx1, idx2){\n // add whatever you parameters you deem necessary, good luck!\n [arr[idx1], arr[idx2]] = [arr[idx2],arr[idx1]]\n return arr;\n}", "function swap(arr, index1, index2){\n var temp = arr[index1];\n arr[index1] = arr[index2];\n arr[index2] = temp;\n}", "function swap(arr, index1, index2) {\n var temp = arr[index1]\n arr[index1] = arr[index2]\n arr[index2] = temp\n return arr\n}", "function swapPairs(idx1, idx2, arr) {\n\tvar temp = arr[idx1];\n\tarr[idx1] = arr[idx2];\n\tarr[idx2] = temp;\n\tconsole.log(\"swap is\", arr)\n\treturn arr;\n}", "function swap(arr, index1, index2) {\n var temp = arr[index1]; // store value of arr[index1]\n arr[index1] = arr[index2]; // assign value of arr[index2] to arr[index1]\n arr[index2] = temp; // assign value of arr[index1] to arr[index2] from temp store\n}", "function swap(array, idx1, idx2) {\n var temp = array[idx1];\n array[idx1] = array[idx2];\n array[idx2] = temp;\n}", "swap(firstIndex, secondIndex) {\r\n\r\n let temp = this.heapContainer[firstIndex];\r\n this.heapContainer[firstIndex] = this.heapContainer[secondIndex];\r\n this.heapContainer[secondIndex] = temp;\r\n }", "function heapSwap(i,j) {\n var a = heap[i]\n var b = heap[j]\n heap[i] = b\n heap[j] = a\n index[a] = j\n index[b] = i\n }", "function heapSwap(i,j) {\n\t var a = heap[i]\n\t var b = heap[j]\n\t heap[i] = b\n\t heap[j] = a\n\t index[a] = j\n\t index[b] = i\n\t }", "function heapSwap(i,j) {\n\t var a = heap[i]\n\t var b = heap[j]\n\t heap[i] = b\n\t heap[j] = a\n\t index[a] = j\n\t index[b] = i\n\t }", "function swapArr(arr, idx1, idx2) {\n var temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function swapArr(arr, idx1, idx2) {\n var temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function swapArr(arr, idx1, idx2) {\n var temp = arr[idx1];\n arr[idx1] = arr[idx2];\n arr[idx2] = temp;\n}", "function bubbleSortSwap(index1, index2, array) {\n var temp = array[index2];\n array[index2] = array[index1];\n array[index1] = temp;\n }", "_swap(i, j) {\n const temp = this._nodes[i];\n this._nodes[i] = this._nodes[j];\n this._nodes[j] = temp;\n }", "swap(indexOne, indexTwo) {\n const tmp = this.heapContainer[indexTwo];\n this.heapContainer[indexTwo] = this.heapContainer[indexOne];\n this.heapContainer[indexOne] = tmp;\n }", "function swap(array, index1, index2) {\n var aux = array[index1];\n array[index1] = array[index2];\n array[index2] = aux;\n}", "function swap(arr, index1, index2) {\n\tconst value1 = arr[index1],\n\t\tvalue2 = arr[index2]\n\tarr[index1] = value2\n\tarr[index2] = value1\n\t//![arr[index2], arr[index1]] = [arr[index1], arr[index2]] //! Why doesnt this work?\n}", "function swap(input, index_A, index_B) {\n let temp = input[index_A];\n \n input[index_A] = input[index_B];\n input[index_B] = temp\n }", "function swap(arr, idxA, idxB) {\n const temp = arr[idxA]\n arr[idxA] = arr[idxB]\n arr[idxB] = temp\n}", "function sortByRank(a, b) {\n return a.rank < b.rank ? 1 : -1;\n}", "function swapItems(arr,index1,index2){\n temp=arr[index1];\n arr[index1]=arr[index2];\n arr[index2]=temp;\n return arr;\n}", "function swap (arr, pos1, pos2) {\n var arr = arr, pos1 = pos1, pos2 = pos2, temp;\n\n temp = arr[pos1];\n arr[pos1] = arr[pos2];\n arr[pos2] = temp;\n\n return arr;\n}", "function compareRanks( rank1, rank2 ) {\r\n\treturn ( Ranks[ rank1].index - Ranks[ rank2 ].index );\r\n}", "swap(/*heapNode[]*/ arr, i, j) {\n let temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }", "swapQueues(index1, index2) {\n var temp = this.queues[index1];\n this.queues[index1] = this.queues[index2];\n this.queues[index2] = temp;\n }", "function swap(items, leftIndex, rightIndex){\n var temp = items[leftIndex];\n items[leftIndex] = items[rightIndex];\n items[rightIndex] = temp;\n}", "swap(color1, color2) {\r\n let colorStore = color1.color;\r\n let indexStore = color1.index;\r\n color1.update(color2.color, color2.index);\r\n color2.update(colorStore, indexStore);\r\n }", "function correctPPPRank(matches) {\n const fixed = matches.results\n .sort((a, b) => a.pppmRank - b.pppmRank)\n .map((result, index) => (\n {\n ...result,\n pppmRank: index + 1,\n pppmRankOrig: result.pppmRank,\n }\n ));\n\n return { ...matches, results: fixed };\n}", "function swap (arr, i1, i2) {\n var tmp = arr[i1]\n arr[i1] = arr[i2]\n arr[i2] = tmp\n return arr\n}", "function swap(arr, i1, i2) {\n var temp = arr[i1];\n arr[i1] = arr[i2];\n arr[i2] = temp;\n }", "function iter_swap(x, y) {\r\n var _a;\r\n _a = __read([y.value, x.value], 2), x.value = _a[0], y.value = _a[1];\r\n}", "function swap( arr, posA, posB ) {\n var temp = arr[posA];\n arr[posA] = arr[posB];\n arr[posB] = temp;\n}", "function numSwap(num1, num2){\n switchNodes(nodes[num1], nodes[num2]);\n switchColors(nodes[num1], nodes[num2]);\n}", "function sortRanks(){\n\tvar temp = ranking;\n\tvar initValue = 4.2;\n\t for (var j = 0; j < 32; j++){\n\t\tvar index = 0;\n\t\tvar value = 10000;\n\t\tfor (var i = 0; i < temp.length; i++) {\n\t\t\tif (temp[i] < value) {\n\t\t\t\tvalue = temp[i];\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\t\ttemp[index] = 100000; //max out so won't pick this team again\n\t\tsortedTeams[j] = index;\n\t\tscaleVals[j] = initValue; //set scale value based on rank\n\t\tinitValue -= .1;\n\t }\n}", "function switchIndexValues(arr, leftIndex, rightIndex) {\n // Hold the left indexes value because it will get overridden;\n var placeholder = arr[leftIndex];\n\n // Set the left indexes value to the right\n arr[leftIndex] = arr[rightIndex];\n\n // Set the right indexes value to the left\n arr[rightIndex] = placeholder;\n }", "function swap(arr, i1, i2) {\n var temp = arr[i1];\n arr[i1] = arr[i2];\n arr[i2] = temp;\n}", "function swap (a, b) {\n let temp = sortedArray[a]\n sortedArray[a] = sortedArray[b]\n sortedArray[b] = temp\n }", "function swap(array, posA, posB) {\n var temp = array[posA]; \n array[posA] = array[posB]; \n array[posB] = temp; \n }", "function swap(array, posA, posB) {\n var temp = array[posA]; \n array[posA] = array[posB]; \n array[posB] = temp; \n }", "function swap(A, indexA, indexB) {\n var temp = A[indexA];\n A[indexA] = A[indexB];\n A[indexB] = temp;\n}", "function swap(range, x, y) {\n var tmp = range[x];\n range[x] = range[y];\n range[y] = tmp;\n}", "function swap(arr,xp, yp)\n{\n var temp = arr[xp];\n arr[xp] = arr[yp];\n arr[yp] = temp;\n}", "swap (oldIndex = 0, newIndex = 0) {\n const temp = this.board[newIndex]\n this.$set(this.board, newIndex, this.board[oldIndex])\n this.$set(this.board, oldIndex, temp)\n }", "function rankCompare(a, b) {\n if (a.points < b.points)\n return 1;\n if (a.points > b.points)\n return -1;\n return 0;\n }", "function swap(values, boxes, indices, i, j) {\n var temp = values[i];\n values[i] = values[j];\n values[j] = temp;\n\n var k = 4 * i;\n var m = 4 * j;\n\n var a = boxes[k];\n var b = boxes[k + 1];\n var c = boxes[k + 2];\n var d = boxes[k + 3];\n boxes[k] = boxes[m];\n boxes[k + 1] = boxes[m + 1];\n boxes[k + 2] = boxes[m + 2];\n boxes[k + 3] = boxes[m + 3];\n boxes[m] = a;\n boxes[m + 1] = b;\n boxes[m + 2] = c;\n boxes[m + 3] = d;\n\n var e = indices[i];\n indices[i] = indices[j];\n indices[j] = e;\n}", "_swapSettings(index1, index2) {\n var data = this.ldapSettingsData;\n\n var temp = data[index2];\n data[index2] = data[index1];\n data[index1] = temp;\n }", "function swapIndex() {\r\n if (index == 0) {\r\n index = 2;\r\n } else {\r\n if (!(outputMath.length > 0)) {\r\n index = 0;\r\n }\r\n }\r\n indexSwap = true;\r\n}", "function swap(a, i1, i2) {\n var t = a[i1];\n a[i1] = a[i2];\n a[i2] = t;\n }", "function swap(array, i, j){\n // quickSortCount++;\n const tmp = array[i];\n array[i] = array[j];\n array[j] = tmp;\n}", "function rearrangePinIndices() {\n var pins = document.querySelectorAll('.image_wrap .image_con > .image_pin');\n var pinsArray = Array.prototype.slice.call(pins, 0);\n pinsArray.sort(function(a, b) {\n return (a.dataset.pinIndex ? parseInt(a.dataset.pinIndex, 10) : Number.MAX_VALUE)\n - (b.dataset.pinIndex ? parseInt(b.dataset.pinIndex, 10) : Number.MAX_VALUE);\n });\n\n // set new index\n for(var i = 0; i < pinsArray.length; i++) {\n if(pinsArray[i].dataset.pinIndex != (i + 1)) setPinIndex(pinsArray[i], i + 1);\n }\n }", "function sortByRank(a, b) {\n if (readingdata[a][\"rank\"] === readingdata[b][\"rank\"]) return 0;\n return readingdata[a][\"rank\"] < readingdata[b][\"rank\"] ? -1 : 1;\n}", "function swap_2(a, b){ //cach truyen tham chieu\n return [b, a];\n}", "function swap(arr, i, j) {\r\n let tmp = arr[i];\r\n arr[i] = arr[j]\r\n arr[j] = tmp\r\n\r\n}", "function swap(node, depth, k){\n if(depth % k === 0){\n [indexes[node-1][0], indexes[node-1][1]] = [indexes[node-1][1], indexes[node-1][0]];\n }\n \n let outArr = [];\n if(indexes[node-1][0] !== -1) outArr.push(...swap(indexes[node-1][0], depth+1, k));\n outArr.push(String(node));\n if(indexes[node-1][1] !== -1) outArr.push(...swap(indexes[node-1][1], depth+1, k));\n return outArr;\n }", "function swap (arr, i, j) {\n const tmp = arr[i]\n arr[i] = arr[j]\n arr[j] = tmp\n}", "swapRows(row1, row2)\r\n {\r\n for (var c = 0; c < this.n; c++)\r\n this.swapEntries([row1, c], [row2, c]);\r\n }", "function swap(arr, val1, val2)\n{\n let temp = arr[val2];\n arr[val2] = arr[val1];\n arr[val1] = temp;\n}", "swapEntries(rc1, rc2)\r\n {\r\n var r1 = rc1[0];\r\n var c1 = rc1[1];\r\n var r2 = rc2[0];\r\n var c2 = rc2[1];\r\n\r\n var temp = this.matrix[r1][c1];\r\n this.matrix[r1][c1] = this.matrix[r2][c2];\r\n this.matrix[r2][c2] = temp;\r\n }", "function swapNodes(indexes, queries) {\n /*\n * Write your code here.\n */\n function swap(node, depth, k){\n if(depth % k === 0){\n [indexes[node-1][0], indexes[node-1][1]] = [indexes[node-1][1], indexes[node-1][0]];\n }\n \n let outArr = [];\n if(indexes[node-1][0] !== -1) outArr.push(...swap(indexes[node-1][0], depth+1, k));\n outArr.push(String(node));\n if(indexes[node-1][1] !== -1) outArr.push(...swap(indexes[node-1][1], depth+1, k));\n return outArr;\n }\n \n const out = [];\n for(let i = 0; i < queries.length; i++){\n out.push(swap(1, 1, queries[i]));\n }\n return out;\n}", "siftDown(currentIdx, endIdx, heap) {\n // Get childOne index\n\t\t// While not at the end of heap tree or leaf of heap tree\n\t\t// \t\tGet childTwo index\n\t\t// \t\tif there is a childTwo and childTwoValue < childOneValue\n\t\t// \t\t\tvalue to swap is childTwoValue\n\t\t// \t\telse\n\t\t/// \t\tvalue to swap is childOneValue\n\t\t// \t\tif valueToSwap < value at currentIdx\n\t\t// \t\t\tswap two value\n\t\t// \t\t\tupdate currentIdx to be index of valueToSwap\n\t\t// \t\t\tre-calculate childOne index\n\t\t// \t\telse \n\t\t// \t\t\tno swap needed\n let childOneIdx = currentIdx * 2 + 1;\n while (childOneIdx <= endIdx) {\n const childTwoIdx = currentIdx * 2 + 2 <= endIdx ? currentIdx * 2 + 2 : -1;\n let idxToSwap; \n if (childTwoIdx !== -1 && heap[childTwoIdx] < heap[childOneIdx]) {\n idxToSwap = childTwoIdx;\n } else {\n idxToSwap = childOneIdx;\n }\n\n if (heap[idxToSwap] < heap[currentIdx]) {\n this.swap(idxToSwap, currentIdx, heap);\n currentIdx = idxToSwap;\n childOneIdx = currentIdx * 2 + 1;\n } else {\n return;\n }\n }\n }", "function swap(currentPosition,nextPosition,array){\n\t\tvar temp = array[currentPosition];\n\t\tarray[currentPosition] = array[nextPosition];\n\t\tarray[nextPosition] = temp;\n\t}", "function sortQuick(index1, index2){\r\n if(index2 - index1 > 1){\r\n\tvar pivotIndex = index1;\r\n\tfor(var i=index1+1;i<index2;i++){\r\n\t if(arr[pivotIndex].val >= arr[i].val){\r\n\t\tvar holder = arr[i];\r\n\t\tfor(var j=i;j>pivotIndex;j--){\r\n\t\t arr[j] = arr[j-1];\r\n\t\t}\r\n\t\tarr[pivotIndex] = holder;\r\n\t\tpivotIndex++;\r\n\t }\r\n\t}\r\n\tcallWith_.push([index1, pivotIndex]);\r\n\tcallWith_.push([pivotIndex+1, index2]);\r\n }\r\n}", "function swap(arr,j, i){\nlet temp=arr[i];\narr[i] = arr[j];\narr[j] = temp;\n}", "function _swapArrayItems(array, leftIndex, rightIndex) {\n const temp = array[leftIndex];\n array[leftIndex] = array[rightIndex];\n array[rightIndex] = temp;\n }", "swap(a, b) {\n\n let temp = this.harr[a]\n this.harr[a] = this.harr[b]\n this.harr[b] = temp\n\n }", "function swap(i, j) {\n displayBuffer.push(['swap', i, j]); // Do not delete this line (for display)\n console.log(\"swap - implement me !\");\n let tmp = csvData[i];\n csvData[i] = csvData[j];\n csvData[j] = tmp;\n // [csvData[i], csvData[j]] = [csvData[j], csvData[i]]\n}", "function rerank(Data){\n Data.sort(function(a, b){\n aSolved = parseInt(a[\"solved\"]);\n bSolved = parseInt(b[\"solved\"]);\n aPoints = parseInt(a[\"points\"]);\n bPoints = parseInt(b[\"points\"]);\n aIndex = parseInt(a[\"index\"]);\n bIndex = parseInt(b[\"index\"]);\n aTotalAttempts = parseInt(a[\"totalAttempts\"]);\n bTotalAttempts = parseInt(b[\"totalAttempts\"]);\n if(aSolved != bSolved) { \n //Sort by number of items that were solved first\n return ((aSolved > bSolved) ? -1 : ((aSolved < bSolved) ? 1 : 0));\n } else if(aPoints != bPoints) {\n // Then sort by lower points\n return ((aPoints < bPoints) ? -1 : ((aPoints > bPoints) ? 1 : 0));\n } else if(aTotalAttempts != bTotalAttempts && aPoints !== 0 && aPoints !== bPoints) {\n // Then sort by lower total attempts\n return ((aTotalAttempts < bTotalAttempts) ? -1 : ((aTotalAttempts > bTotalAttempts) ? 1 : 0));\n } else {\n // Then sort by Index\n return ((aIndex < bIndex) ? -1 : ((aIndex > bIndex) ? 1 : 0));\n }\n });\n \n // Put rank to attribute \"rank\" and to attribute \"showrank\"\n var index = 1;\n var lastpoint = -1;\n var lastsolved = -1;\n for (var i = 0; i <= Data.length - 1; i++) {\n if(lastpoint == Data[i][\"points\"] && lastsolved == Data[i][\"solved\"]){\n Data[i][\"showrank\"] = index;\n } else {\n Data[i][\"showrank\"] = i + 1;\n index = i + 1;\n }\n lastpoint = Data[i][\"points\"];\n lastsolved = Data[i][\"solved\"];\n Data[i][\"rank\"] = i + 1;\n }\n\n // Sort back by Index\n Data.sort(function(a,b) {\n aIndex = parseInt(a[\"index\"]);\n bIndex = parseInt(b[\"index\"]);\n return ((aIndex < bIndex) ? -1 : ((aIndex > bIndex) ? 1 : 0));\n });\n //console.log(Data);\n\n return Data;\n\n}", "function swapTowardCenter(arr){\n for (let i = 0; i < arr.length/2; i++) {\n var temporaryVarForSwitchingIndex = arr[i]\n arr[i] = arr[arr.length - 1-i] \n arr[arr.length - 1-i] = temporaryVarForSwitchingIndex \n \n }\n return arr \n}", "function swap (arr, i, j){\n var temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n}", "function swap(arr, a, b) {\r\n let temp = arr[a];\r\n arr[a] = arr[b];\r\n arr[b] = temp;\r\n}", "function swap(arr, i, j) {\n var temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n}", "function swap(arr, x, y) {\n var tmp = arr[x];\n arr[x] = arr[y];\n arr[y] = tmp;\n }", "function swapArray(array, num1, num2){\n let temp = array[num1];\n array[num1] = array[num2];\n array[num2] = temp;\n}", "function swap(arr, i, j) {\n let temp = arr[j];\n arr[j] = arr[i];\n arr[i] = temp;\n}", "function goalTemplateSwap(index1,index2) {\n\t\t\t\tif (Math.abs(index1 - index2) == 1) {\n\t\t\t\t\tif (index2 >= 0 && index2 < self.goalTemplates.length) {\n\t\t\t\t\t\t// swap data\n\t\t\t\t\t\tvar tmp = self.goalTemplates[index1];\n\t\t\t\t\t\tself.goalTemplates[index1] = self.goalTemplates[index2];\n\t\t\t\t\t\tself.goalTemplates[index2] = tmp;\n\t\t\t\t\t\tGoalTemplateManager.save( self.goalTemplates );\n\t\t\t\t\t\t// setup UI\n\t\t\t\t\t\tvar cs = $(\".box_goal_templates\").children();\n\t\t\t\t\t\tgoalTemplateSetupUI(self.goalTemplates[index1],\n\t\t\t\t\t\t\t\t\t\t\t$(cs[index1]) );\n\t\t\t\t\t\tgoalTemplateShow(cs[index1]);\n\t\t\t\t\t\tgoalTemplateSetupUI(self.goalTemplates[index2],\n\t\t\t\t\t\t\t\t\t\t\t$(cs[index2]));\n\t\t\t\t\t\tgoalTemplateShow(cs[index2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function normalizeRanks(g){var min=_.minBy(_.map(g.nodes(),function(v){return g.node(v).rank}));_.forEach(g.nodes(),function(v){var node=g.node(v);if(_.has(node,\"rank\")){node.rank-=min}})}", "function swapNeighbors() {\n \n $(\".swap\").each(function() {\n \n var windowWidth = $(window).width();\n var item1 = $(this).children(\".swap1\");\n var item2 = $(this).children(\".swap2\");\n \n \n if(windowWidth < 799){\n $(item2).insertBefore(item1);\n }\n if(windowWidth > 800){\n $(item1).insertBefore(item2);\n }\n });\n \n}", "function swap(arr, i, j) {\n var temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n}", "function swap (a, b) {\n [array[a], array[b]] = [array[b], array[a]];\n }", "function swap(arr, i, j) {\n console.log(i, j)\n let temp = arr[i]\n arr[i] = arr[j]\n arr[j] = temp\n return arr\n}", "function swap(array, a, b) {\n let temp = array[b];\n array[b] = array[a]\n array[a] = temp\n}", "swapItems(itemIndex1, itemIndex2) {\n const items = this.props.items.slice();\n const temp = items[itemIndex1];\n items[itemIndex1] = items[itemIndex2];\n items[itemIndex2] = temp;\n\n this.props.onChange(items);\n }", "function sortByRangeIndex(a,b){return a.index-b.index;}", "function numberSwap(a, b) {}", "siftUp(currentIdx, heap) {\n // Get parentNode index of node at currentIdx\n let parentIdx = Math.floor((currentIdx - 1) / 2);\n\n // While not at root index\n // Compare value at parentIdx and currentIdx\n // If currentNode < parentNode\n // Peform swap\n // re-calculate currentIdx and parentIdx \n while (currentIdx > 0 && heap[currentIdx] < heap[parentIdx]) {\n this.swap(currentIdx, parentIdx, heap);\n currentIdx = parentIdx;\n parentIdx = Math.floor((currentIdx - 1) / 2);\n }\n }" ]
[ "0.7171404", "0.7030536", "0.68232614", "0.6681308", "0.6681308", "0.6655838", "0.6653531", "0.6548508", "0.65203524", "0.6495802", "0.6488088", "0.64756966", "0.6435612", "0.64281464", "0.6386124", "0.63697207", "0.6349006", "0.6334449", "0.63189596", "0.6303532", "0.6256077", "0.62495434", "0.62495124", "0.62495124", "0.62433535", "0.62433535", "0.62433535", "0.618733", "0.61797637", "0.61424804", "0.6132423", "0.6114178", "0.60912424", "0.6070108", "0.60521066", "0.6015288", "0.601335", "0.59751976", "0.59725195", "0.5967636", "0.5940243", "0.5881435", "0.58202463", "0.58195984", "0.5813561", "0.5806994", "0.58008987", "0.57966846", "0.57884634", "0.5787183", "0.57605475", "0.57404834", "0.573234", "0.5710186", "0.5690672", "0.5684593", "0.56765234", "0.5655936", "0.5650746", "0.5640597", "0.56367886", "0.56263894", "0.56255925", "0.5619857", "0.5618011", "0.55843514", "0.5578176", "0.55417526", "0.55343175", "0.5524347", "0.552227", "0.5520196", "0.55095017", "0.55087656", "0.5504345", "0.5501932", "0.5499227", "0.5495652", "0.5490029", "0.54892725", "0.547238", "0.5469611", "0.545949", "0.5455492", "0.5447723", "0.54284674", "0.54235417", "0.5417265", "0.54122216", "0.53963083", "0.5389001", "0.53859156", "0.53792745", "0.5372321", "0.5371659", "0.53652173", "0.53643507", "0.5358712", "0.5355849", "0.53532314" ]
0.69879603
2
Handlers that decide when the first movestart is triggered
function mousedown(e){ var data; if (!isLeftButton(e)) { return; } data = { target: e.target, startX: e.pageX, startY: e.pageY, timeStamp: e.timeStamp }; add(document, mouseevents.move, mousemove, data); add(document, mouseevents.cancel, mouseend, data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function first_slide(ev)\n {\n ev.preventDefault();\n activate(0); // Move the \"active\" class\n // console.log(\"first: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "onMove() {\n }", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "_moveToStart() {\n // moveCount can disturb the method logic.\n const initialMoveCount = this._settings.moveCount;\n this._settings.moveCount = 1;\n\n for (let pos = 1; pos < this._settings.startPosition; pos++) {\n this._rightMoveHandler();\n }\n this._settings.moveCount = initialMoveCount;\n }", "function isFirstTimePlay() {\n if (store.getState().activeGameState.stars == 0) {\n gameMenutoPrologueStateChangeStarter();\n } else {\n gameMenutoBattleMapStateChangeStarter();\n }\n }", "function firstItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(0);\n\t}", "function firePreviousFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToPreviousFrame();\n }", "function firePreviousFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToPreviousFrame();\n }", "function start(){\n //Add a track\n var track = media.addTrack( \"Track1\" );\n //Add more tracks...\n media.addTrack( \"Track\" + Math.random() );\n media.addTrack( \"Track\" + Math.random() );\n\n //Add a track event\n var event = track.addTrackEvent({\n type: \"text\",\n popcornOptions: {\n start: 0,\n end: 3,\n text: \"This is some text here.... Isn't it nice?\",\n target: \"Right1\"\n }\n });\n var superevent = track.addTrackEvent({\n type: \"supertext\",\n popcornOptions: {\n start: 5,\n end: 10,\n text: \"SUPER\",\n target: \"Right2\",\n defaultTransition: 600\n }\n });\n var superevent2 = butter.tracks[ 1 ].addTrackEvent({\n type: \"supertext\",\n popcornOptions: {\n start: 5,\n end: 10,\n text: \"SUPERrrrrrrr\",\n }\n });\n\n //Try uncommenting and see what happens....\n /*\n //Add a track event to the third track\n butter.tracks[ 2 ].addTrackEvent({ \n type: \"footnote\",\n popcornOptions: {\n start: 1,\n end: 2,\n text: \"More text!!!!\"\n target: \"Bottom\"\n }\n });\n */\n\n } //start", "goToFirst() {\n this.stream.goToFirst();\n this.updateScrubberValues({ animate: true, forceHeightChange: true });\n }", "checkForBeginning() {\n if (this.leftPage !== 1) {\n this.onFirstPage = false;\n } else {\n this.onFirstPage = true;\n }\n }", "movePress( press ) {\n sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener movePress' );\n sceneryLog && sceneryLog.InputListener && sceneryLog.push();\n\n this.reposition();\n\n sceneryLog && sceneryLog.InputListener && sceneryLog.pop();\n }", "function _moveStart() {\n\t\t\t\t// TODO does anything need to be included in this event?\n\t\t\t\t// TODO make cancelable\n\t\t\t\t$fire(this._timetable, \"moveStart\");\n\t\t\t}", "function battleStartEventAdding() {\n if (store.getState().lastAction == 'BATTLE_ON') {\n setTimeout(function(){\n addEvent(battleMap1, 'click', preventGamePause, 'event');\n addEvent(landingPageBody, 'click', pageBodyClicked, undefined);\n addEvent(battleMapGamePauseid, 'click', pauseElementClicked, 'event');\n addEvent(battleMapPauseButtonid, 'click', pageBodyClicked, 'stop');\n }, 600);\n }\n }", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n if (bu2.state == 1) startAnimation(); // Entweder Animation fortsetzen ...\n else stopAnimation(); // ... oder stoppen\n }", "function preMenuPlayButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'MAIN_MENU',\n previousPage: 'PRE_MENU'\n }\n });\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: mainMenuMusicSource\n }\n });\n store.dispatch( {\n type: SFX_ON,\n payload: {\n status: 'ON',\n }\n });\n }", "function gameMenutoPrologueStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'PROLOGUE',\n previousPage: 'GAME_MENU'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: battleMap1MusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: battleMap1MusicSource\n }\n });\n }\n }", "function nextListItemHandlerAuto () {\n\t\t_logger.log(_prefix, 'nextListItemHandlerAuto called');\n\t\tif (!_mainVideoEnded) {\n\t\t\t// handle 'next playlist item' event when current playlist video have been interrupted\n\t\t\tnextListItemHandler();\n\t\t}\n\t}", "onMove(){\n // HACK(mike): Get around the fact that the store fires two messages\n // sequentially when the board is reset.\n if (this.store.board.moveCount === 0 ||\n (this.store.board.moveCount === 1 && this.store.computerFirst))\n return;\n\n this.emote(\"default\");\n }", "function BeforeMoveActions() {\n EnableTrackBoard();\n EnableMineDrag();\n}", "handleGameStartEvent(data) {\n console.log('in handleGameStartEvent handler ');\n this.setGameStartAndPlayerMove();\n }", "onStart(side) {\n\t\t\t\tthis.add('-sidestart', side, 'move: Stunning Spikes');\n\t\t\t}", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n enableInput(false); // Eingabefelder deaktivieren\n if (bu2.state == 1) startAnimation(); // Entweder Animation starten bzw. fortsetzen ...\n else stopAnimation(); // ... oder stoppen\n reaction(); // Eingegebene Werte übernehmen und rechnen\n paint(); // Neu zeichnen\n }", "onStart(side) {\n\t\t\t\tthis.add('-sidestart', side, 'move: Toxic Spikes');\n\t\t\t\tthis.effectData.layers = 1;\n\t\t\t}", "onStart(side) {\n\t\t\t\tthis.add('-sidestart', side, 'move: Sticky Needles');\n\t\t\t}", "function setup_goToStart(){\n // what happens when we move to 'goToStart' section of a trial\n wp.trialSection = 'goToStart';\n unstageArray(fb_array);\n\n // update objects\n choiceSet.arc.visible = false;\n choiceSet.arc_glow.visible = false;\n startPoint.sp.visible = true;\n startPoint.sp_glow.visible = false;\n\n // update messages\n msgs.goToStart.visible = true;\n msgs.tooSlow.visible = false;\n\n stage.update();\n }", "function doFirst() {\n myMovie = document.getElementById('myMovie');\n playButton = document.getElementById('playButton');\n bar = document.getElementById('defaultBar');\n progressBar = document.getElementById('progressBar');\n\n playButton.addEventListener('click', playOrPause, false);\n bar.addEventListener('click', clickedBar, false);\n}", "function jumpToFirst() {\n\t\t\tif (options.SliderTypeVert) {\n\t\t\t\t$SliderWindow.animate({\n\t\t\t\t\tmarginTop: '0px'\n\t\t\t\t}, 0);\n\t\t\t// horizontal slider\n\t\t\t} else if (!options.SliderTypeFade) {\n\t\t\t\t$SliderWindow.animate({\n\t\t\t\t\tright: '0px'\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t}", "receiveFirstPieces(data) {\n\t\tthis.nextPiece = new Piece(data.nextPiece);\n\t\tthis.nextPieceBox.updatePiece(this.nextPiece);\n\t\tthis.piece = new Piece(data.piece);\n\t\tthis.statBox.updateCounts(this.piece.type);\n\t\tthis.stopwatch.start();\n\t}", "startAt(first_move) {\n this.move_index = typeof first_move==\"number\" ? first_move-1 : -1; //which move to load if provided, else -1\n\n this.draw_everything();\n }", "function scrollHandler() { \n\t\tif ( isNextSceneReached(true) ) {\n runNextScene();\n\t\t} else if ( isPrevSceneReached(true) ) {\n runPrevScene();\n\t\t}\n }", "function start() {\n\tif (event == 'start1') {\n\t\tplayer.direction = 'LEFT';\n\t\tif (variables.prologue.text1 == false) {\n\t\t\ttextBox = messages.prologue.msg1;\n\t\t\tvariables.prologue.text1 = true;\n\t\t}\n\t\tif (textBox == undefined) {\n\t\t\tif (variables.prologue.text1 == true && variables.prologue.text2 == false) {\n\t\t\t\ttextBox = messages.prologue.msg2;\n\t\t\t\tvariables.prologue.text2 = true;\n\t\t\t} else if (variables.prologue.text1 == true && variables.prologue.text2 == true) {\n\t\t\t\ttextBox = undefined;\n\t\t\t\tevent = 'start2';\n\t\t\t}\n\t\t}\n\t} else if (event == 'start2') {\n\t\tif (currentStage == levels.prologue.office) {\n\t\t\t//Adom\n\t\t\tentities.push({\n\t\t\t\tname: \"Adom\",\n\t\t\t\ttype: 'NPC',\n\t\t\t\tid: 'AdomBR',\n\t\t\t\tpos: {\n\t\t\t\t\tx: 1,\n\t\t\t\t\ty: 7,\n\t\t\t\t},\n\t\t\t\tcolor: 'blue',\n\t\t\t});\n\t\t\tentities.push({\n\t\t\t\tname: \"Adom\",\n\t\t\t\ttype: 'NPC',\n\t\t\t\tid: 'AdomBL',\n\t\t\t\tpos: {\n\t\t\t\t\tx: 0,\n\t\t\t\t\ty: 7,\n\t\t\t\t},\n\t\t\t\tcolor: 'blue',\n\t\t\t});\n\t\t\tentities.push({\n\t\t\t\tname: \"Adom\",\n\t\t\t\ttype: 'NPC',\n\t\t\t\tid: 'AdomTR',\n\t\t\t\tpos: {\n\t\t\t\t\tx: 1,\n\t\t\t\t\ty: 6,\n\t\t\t\t},\n\t\t\t\tcolor: 'blue',\n\t\t\t});\n\t\t\tentities.push({\n\t\t\t\tname: \"Adom\",\n\t\t\t\ttype: 'NPC',\n\t\t\t\tid: 'AdomTL',\n\t\t\t\tpos: {\n\t\t\t\t\tx: 0,\n\t\t\t\t\ty: 6,\n\t\t\t\t},\n\t\t\t\tcolor: 'blue',\n\t\t\t});\n\t\t\tplayerList.forEach(function(ele) {\n\t\t\t\tif (ele.id == 'Adom') {\n\t\t\t\t\tele.room = levels.prologue.office;\n\t\t\t\t\tele.pos.x = 1;\n\t\t\t\t\tele.pos.y = 7;\n\t\t\t\t}\n\t\t\t});\n\t\t\tplayer.direction = 'UP';\n\t\t\tif (variables.prologue.text3 == false) {\n\t\t\t\ttextBox = messages.prologue.msg3;\n\t\t\t\tvariables.prologue.text3 = true;\n\t\t\t}\n\t\t\tif (textBox == undefined) {\n\t\t\t\tif (variables.prologue.text3 == true && variables.prologue.text4 == false) {\n\t\t\t\t\ttextBox = messages.prologue.msg4;\n\t\t\t\t\tvariables.prologue.text4 = true;\n\n\t\t\t\t} else if (variables.prologue.text3 == true && variables.prologue.text4 == true && variables.prologue.text5 == false) {\n\t\t\t\t\ttextBox = messages.prologue.msg5;\n\t\t\t\t\tvariables.prologue.text5 = true;\n\n\t\t\t\t} else if (variables.prologue.text3 == true && variables.prologue.text4 == true && variables.prologue.text5 == true && variables.prologue.text6 == false) {\n\t\t\t\t\ttextBox = messages.prologue.msg6;\n\t\t\t\t\tvariables.prologue.text6 = true;\n\n\t\t\t\t} else if (variables.prologue.text3 == true && variables.prologue.text4 == true && variables.prologue.text5 == true && variables.prologue.text6 == true && variables.prologue.text7 == false) {\n\t\t\t\t\ttextBox = messages.prologue.msg7;\n\t\t\t\t\tvariables.prologue.text7 = true;\n\n\t\t\t\t} else if (variables.prologue.text3 == true && variables.prologue.text4 == true && variables.prologue.text5 == true && variables.prologue.text6 == true && variables.prologue.text7 == true && variables.prologue.text8 == false) {\n\t\t\t\t\ttextBox = messages.prologue.msg8;\n\t\t\t\t\tvariables.prologue.text8 = true;\n\n\t\t\t\t} else {\n\t\t\t\t\tevent = 'start3';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (event == 'start3') {\n\t\t//Spencer\n\t\tentities.push({\n\t\t\tname: \"Spencer\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'SpencerBR',\n\t\t\tpos: {\n\t\t\t\tx: 1,\n\t\t\t\ty: 3,\n\t\t\t},\n\t\t\tcolor: 'yellow',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Spencer\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'SpencerBL',\n\t\t\tpos: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 3,\n\t\t\t},\n\t\t\tcolor: 'yellow',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Spencer\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'SpencerTR',\n\t\t\tpos: {\n\t\t\t\tx: 1,\n\t\t\t\ty: 2,\n\t\t\t},\n\t\t\tcolor: 'yellow',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Spencer\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'SpencerTL',\n\t\t\tpos: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 2,\n\t\t\t},\n\t\t\tcolor: 'yellow',\n\t\t});\n\t\tplayerList.forEach(function(ele) {\n\t\t\tif (ele.id == 'Spencer') {\n\t\t\t\tele.room = levels.prologue.office;\n\t\t\t}\n\t\t});\n\t\t//Ray\n\t\tentities.push({\n\t\t\tname: \"Ray\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'RayBR',\n\t\t\tpos: {\n\t\t\t\tx: 1,\n\t\t\t\ty: 5,\n\t\t\t},\n\t\t\tcolor: 'orange',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Ray\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'RayBL',\n\t\t\tpos: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 5,\n\t\t\t},\n\t\t\tcolor: 'orange',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Ray\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'RayTR',\n\t\t\tpos: {\n\t\t\t\tx: 1,\n\t\t\t\ty: 4,\n\t\t\t},\n\t\t\tcolor: 'orange',\n\t\t});\n\t\tentities.push({\n\t\t\tname: \"Ray\",\n\t\t\ttype: 'NPC',\n\t\t\tid: 'RayTL',\n\t\t\tpos: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 4,\n\t\t\t},\n\t\t\tcolor: 'orange',\n\t\t});\n\t\tplayerList.forEach(function(ele) {\n\t\t\tif (ele.id == 'Ray') {\n\t\t\t\tele.room = levels.prologue.office;\n\t\t\t}\n\t\t});\n\n\t\tevent = 'start4';\n\t} else if (event == 'start4') {\n\t\tif (variables.prologue.text12 == false) {\n\t\t\tplayer.direction = 'LEFT';\n\t\t\tplayerList.forEach(function(ele) {\n\t\t\t\tif (ele.id == 'Chris') {\n\t\t\t\t\tele.direction = 'LEFT';\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tplayer.direction = 'UP';\n\t\t}\n\t\tif (variables.prologue.text9 == false) {\n\t\t\ttextBox = messages.prologue.msg9;\n\t\t\tvariables.prologue.text9 = true;\n\t\t}\n\t\tif (textBox == undefined) {\n\t\t\tif (variables.prologue.text9 == true && variables.prologue.text10 == false) {\n\t\t\t\ttextBox = messages.prologue.msg10;\n\t\t\t\tvariables.prologue.text10 = true;\n\n\t\t\t} else if (variables.prologue.text9 == true && variables.prologue.text10 == true && variables.prologue.text11 == false) {\n\t\t\t\ttextBox = messages.prologue.msg11;\n\t\t\t\tvariables.prologue.text11 = true;\n\n\t\t\t} else if (variables.prologue.text9 == true && variables.prologue.text10 == true && variables.prologue.text11 == true && variables.prologue.text12 == false) {\n\t\t\t\tplayerList.forEach(function(ele) {\n\t\t\t\t\tif (ele.id == 'Chris') {\n\t\t\t\t\t\tele.direction = 'DOWN';\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttextBox = messages.prologue.msg12;\n\t\t\t\tvariables.prologue.text12 = true;\n\n\t\t\t} else {\n\t\t\t\tevent = 'tutorial1';\n\t\t\t}\n\t\t}\n\t}\n}", "function gameMenutoBattleMapStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'BATTLE_MAP',\n previousPage: 'GAME_MENU'\n }\n });\n store.dispatch( {\n type: BATTLE_ON,\n payload: {\n battleState: 'BATTLE_ON'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: battleMap1MusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: battleMap1MusicSource\n }\n });\n }\n }", "handleClick () {\n super.handleClick()\n this.player_.trigger('next')\n }", "function jumpToFirst() {\n\t\t\tif (options.sliderType === 'vertical') {\n\t\t\t\t$sliderWindow.animate({\n\t\t\t\t\tmarginTop: '0px'\n\t\t\t\t}, 0);\n\t\t\t} else if (options.sliderType === 'horizontal') {\n\t\t\t\t$sliderWindow.animate({right: '0px'}, 0);\n\t\t\t}\n\t\t}", "goNextMove() {\n let piecesToMove = null; // this holds the pieces that are allowed to move\n let piecesToStayStill = null; // the others\n if (this.WhiteToMove == true) {\n // white is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.White); // get the info from the model\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.Black);\n } else {\n // black is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.Black);\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.White);\n }\n // add listeners for the pieces to move\n piecesToMove.forEach(curPiece => {\n this.GameView.bindMouseDown(\n curPiece.RowPos,\n curPiece.ColPos,\n this.mouseDownOnPieceEvent\n );\n });\n\n // remove listeners for the other pieces\n piecesToStayStill.forEach(curPiece => {\n // TRICKY: remove piece and add it again to remove the listeners !\n this.GameView.removePieceFromBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n this.GameView.putPieceOnBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n });\n this.WhiteToMove = !this.WhiteToMove; // switch player\n }", "setPastFirstMove() {\n\t\tthis.isFirstMove = false;\n\t}", "function touchStarted(){\n x=0;\n if (osc1control=='enabled'){osc1.start();}\n // if (osc2control=='enabled'){osc2.start();}\n //if (osc3control=='enabled'){osc3.start();}\n //if (osc4control=='enabled'){osc4.start();}\n }", "function dogOneRandomEventMove(){\n if (dogOneCurrentStep == 3 || dogOneCurrentStep == 6 || dogOneCurrentStep == 9 || dogOneCurrentStep == 12 || dogOneCurrentStep == 16 || dogOneCurrentStep == 19){\n dogOneRandomEvent()\n return;\n }\n }", "checkFirstMove(e) {\n let state = new DragManager.DragState(e, this, true);\n if (!state.moved()) {\n // not a move\n return false;\n }\n return this.executeFirstMove(state);\n }", "guessFirst(){\n\n //Check if game is still running and names match\n if(this.props.tweet.name === this.props.firstHandle && this.props.status){\n this.props.win();\n } else if (this.props.status) {\n this.props.lose();\n }\n \n //Cycle in new tweet\n this.props.cycleTweets();\n }", "function setHandler() {\n $('.single_card').off('click').on('click', function () {\n var siblingsInfront = $(this).prevAll();\n roloToCard(siblingsInfront);\n });\n }", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n enableInput(false); // Eingabefelder deaktivieren\n on = (bu2.state == 1); // Flag für Animation\n slow = cbSlow.checked; // Flag für Zeitlupe\n reaction(true); // Eingegebene Werte übernehmen, rechnen, Ausgabe aktualisieren\n }", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Move_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const beacon = xy_locs(player_relative, _PLAYER_NEUTRAL)\n if (!beacon) {\n return FUNCTIONS.no_op()\n }\n const axis = 0\n const beacon_center = numpy.round(numpy.mean(beacon, axis))\n return FUNCTIONS.Move_screen('now', beacon_center)\n }\n return FUNCTIONS.select_army('select')\n }", "setupFirstPlay() {\n const media = this.mainPlaylistLoader_.media();\n\n // Check that everything is ready to begin buffering for the first call to play\n // If 1) there is no active media\n // 2) the player is paused\n // 3) the first play has already been setup\n // then exit early\n if (!media || this.tech_.paused() || this.hasPlayed_) {\n return false;\n }\n\n // when the video is a live stream and/or has a start time\n if (!media.endList || media.start) {\n const seekable = this.seekable();\n\n if (!seekable.length) {\n // without a seekable range, the player cannot seek to begin buffering at the\n // live or start point\n return false;\n }\n\n const seekableEnd = seekable.end(0);\n let startPoint = seekableEnd;\n\n if (media.start) {\n const offset = media.start.timeOffset;\n\n if (offset < 0) {\n startPoint = Math.max(seekableEnd + offset, seekable.start(0));\n } else {\n startPoint = Math.min(seekableEnd, offset);\n }\n }\n\n // trigger firstplay to inform the source handler to ignore the next seek event\n this.trigger('firstplay');\n // seek to the live point\n this.tech_.setCurrentTime(startPoint);\n }\n\n this.hasPlayed_ = true;\n // we can begin loading now that everything is ready\n this.load();\n return true;\n }", "function start() {\n classes.isTransition = true;\n original.addEventListener('transitionend', end);\n }", "function flyToHome() {\r\n $('#main').data('clicked', true);\r\n toggleSvgButton('#main', true);\r\n\r\n closePanel2();\r\n\r\n let selectedAsset = main;\r\n onPickedAsset(selectedAsset);\r\n }", "function first_move(){\n computer_first_move = false;\n // select the center cell in case the player hadn't\n if (!$(cells[center_cell]).hasClass(user_clicked)) return center_cell;\n // otherwise select any corner cell\n else return select_corner_cell_available(); \n }", "function onReady() {\n\t\t\t \tsendNowPlaying();\n\t\t\t \tsendCurState();\t\n\t\t\t }", "function startMoveBoardManager() {\n if(!boardManagerIsMoved)\n boardManagerIsMoved = true;\n}", "function initiateAsccend(){\r\n //se quitan las colisionas dañinans con android1 / android2\r\n unsubscribe1();\r\n unsubscribe2();\r\n //velocidad de ascenso\r\n obj.setStaticVelY(-2.5);\r\n scene.time.addEvent({\r\n delay: 700,\r\n callback: () => (stop2(scene, obj))\r\n });\r\n //despues de 700 steps se para la apisonadora\r\n function stop2(){\r\n obj.sprite.setSensor(true)\r\n obj.setStaticVelY(0);\r\n //se reajusta su posicion\r\n obj.sprite.x = obj.initialX;\r\n obj.sprite.y = obj.initialY;\r\n //se vuelve a llamar a su metodo inicial con un delay de 200 steps pero con una n menor (hasta que n==0)\r\n scene.time.addEvent({\r\n delay: 2000,\r\n callback: () => (obj.startCycle(n-1, 0))\r\n });\r\n }\r\n }", "triggerInitialEvents() {\n let _this = this;\n if (_this.$movingBorderMenu === null) {\n _this.eventWaiting = true;\n return;\n }\n _this.eventWaiting = false;\n _this.$movingBorderMenu.find('li.selected, li.ops-active').trigger('mouseover');\n _this.$movingBorderMenu.find('li.selected a, li.ops-active a').trigger('click');\n }", "waitEvent() {\n if (this.currentElementsArray.length > 0 && this.trigger == false) {\n this.trigger = true;\n this.eventEmmiter.emit('trigger');\n }\n }", "function frameStart(){\n\n\t\t$('#navPart1').css({'background-color':'yellow', 'color':'blue'});\n\t\t$('#cap1').stop().animate({'left':'455px','top':'300px'}, 1500, 'swing');\n\t\t$('#cap2').stop().animate({'left':'450px','top':'350px'}, 1500, 'swing');\n\t\t$('#cap19').stop().animate({'left':'-80px','top':'800px'}, 1500, 'swing');\n\t\t$('#start').stop().animate({'left':'670px','top':'450px'}, 1500, 'swing');\n\t\tsetTimeout(function(){\n\t\t\t$('#start').show();\n\t\t}, 2500);\n\t\t$('#start').on('click', function(){\n\t\t\t$('#start').off('click');\n\t\t\t$('#start').stop().hide();\n\t\t\tdocument.getElementById('click').play();\n\t\t\t$('.captions').stop().animate({'bottom':'-100px','left':'-101%'},1500,'swing');\n\t\t\tframeOne();\n\t\t});\n\t}", "function gameMenutoMainMenuButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'MAIN_MENU',\n previousPage: 'GAME_MENU'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: mainMenuMusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: mainMenuMusicSource\n }\n });\n }\n }", "function defaultEventHandler(onscreenElementIndex) {\n\n if (config.videos[config.currentVideoIndex].onscreenElements[onscreenElementIndex].defaultAction.jumpToName != undefined) {\n loadNewVideo(config.videos[config.currentVideoIndex].onscreenElements[onscreenElementIndex].defaultAction.jumpToName, true);\n $(\"#myPlayerIDContainer\").css(\"display\", \"block\");\n assignWeights(config.videos[config.currentVideoIndex].onscreenElements[onscreenElementIndex].defaultAction.weightings);\n //if (config.videos[config.currentVideoIndex].onscreenElements[onscreenElementIndex].lastQuestion) {\n //}\n }\n}", "function Start(params) {\n O_turn = false\n boxElements.forEach(box =>{\n box.classList.remove(O_mark)\n box.classList.remove(X_mark)\n box.removeEventListener('click',handle)\n box.addEventListener('click',handle,{once:true})\n });\n Refesh()\n results_popBox.classList.remove('show')\n}", "function handle() {\n /*\n We don't fire this if the user is touching the screen and it's moving.\n This could lead to a mis-fire\n */\n if (!config.is_touch_moving) {\n /*\n Gets the playlist attribute from the element.\n */\n let playlist = this.getAttribute(\"data-amplitude-playlist\");\n\n /*\n If the playlist is null, we handle the global repeat.\n */\n if (playlist == null) {\n handleGlobalRepeat();\n }\n\n /*\n If the playlist is set, we handle the playlist repeat.\n */\n if (playlist != null) {\n handlePlaylistRepeat(playlist);\n }\n }\n }", "setUpNextAction (protagonist, actionTemplate, actionEvent) {\n const actionReady = new ActionReadyEvent(protagonist, actionEvent.actionId);\n\n actionEvent.addOutcome(\n actionReady,\n this,\n actionEvent.t + actionTemplate.secondsUntilNextAction()\n );\n }", "function reactionButton1 () {\n t0 = new Date(); // Anfangszeitpunkt (s) \n on = true; // Animation einschalten\n order(); // Falls nötig, Nummerierung der Einzelkräfte ändern\n }", "pressedStart()\n\t\t\t{\n\t\t\tif(this.gamestate === 'starting')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'choose';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'choose')\n\t\t\t\t{\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'stats')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'bedroom';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'bedroom')\n\t\t\t\t{\n\t\t\t\tthis.menu.RunFunction(this);\n\t\t\t\t}\n\t\t\t}", "handleNext() {\n this.currentMovePrevented = false;\n\n // Call the bound `onNext` handler if available\n const currentStep = this.steps[this.currentStep];\n if (currentStep && currentStep.options && currentStep.options.onNext) {\n currentStep.options.onNext(this.overlay.highlightedElement);\n }\n\n if (this.currentMovePrevented) {\n return;\n }\n\n this.moveNext();\n }", "function userTouchedContinue() {\n TileSum.game.state.start('Play');\n }", "function CreateEvents() {\n mc.on('press panstart panmove', function(e) {\n ShadowOpacity(0, 0.1);\n\n // TODO: add smooth scale animation, problems with transition\n UpdateCardPos(currCard, e);\n });\n\n mc.on('pressup panend', function(e) {\n var dist = Math.abs(e.deltaX);\n var dir = Math.sign(e.deltaX);\n\n // Do we take action or snap back\n if(dist >= bp) {\n if(dir > 0) {\n SnapRight(currCard, e);\n }\n else if(dir < 0) {\n SnapLeft(currCard, e);\n }\n }\n else {\n SnapBack(currCard);\n ShadowOpacity(maxOpacity, 0.3);\n }\n });\n\n heart.addEventListener(\"click\", function() {\n ToggleLiked();\n });\n}", "_firstButtonClickHandler() {\n const that = this;\n\n that.first();\n }", "function doFirst (){\n\tbarSize=600;\n\tsvid=document.getElementById('samplevid');\n\tplB=document.getElementById('playButton');\n\tdB=document.getElementById('defaultBar');\n\tprB=document.getElementById('progressBar');\n\n\tplB.addEventListener('click', playOrPause, false);\n\tdB.addEventListener('click', clickedBar, false);\n\n}", "function setupFsm() {\n // when jumped to drag mode, enter\n fsm.when(\"* -> drag\", function() {});\n fsm.when(\"drag -> *\", function(exit, enter, reason) {\n if (reason == \"drag-finish\") {}\n });\n }", "check_GameMovie(){\n if(this.scene.showGameMovie){\n for (let i = this.model.playsCoords.length - 1; i >= 0; i--) {\n let playCoords = this.model.playsCoords[i];\n let playValues = this.model.playsValues[i];\n this.view.setPieceToStartPos(playCoords[0], playCoords[1], playValues[1]);\n }\n this.state = 'WAIT_GM_1st_ANIMATION_END';\n \n }\n }", "function nextListItemHandler () {\n\t\t_logger.log(_prefix, 'nextListItemHandler called');\n\t\tif (Date.now() - _nextListItemTime < 1000) {\n\t\t\t// protects again 'playlistitem' event fired twice within 1 second\n\t\t\t_logger.log(_prefix, 'Already got playlistitem event. Ignore current one.');\n\t\t\treturn;\n\t\t}\n\t\t_nextListItemTime = Date.now();\n\t\tif (!_player.playlist.currentIndex || typeof _player.playlist.currentIndex !== 'function') {\n\t\t\t// player not support playlisting\n\t\t\treturn;\n\t\t}\n\t\tif (_playlistIdx === _player.playlist.currentIndex()) {\n\t\t\t// ignore second call event handler for same playlist item\n\t\t\treturn;\n\t\t}\n\t\t_player.off('timeupdate', checkPrepareTime);\n\t\t_savedMarkers = null;\n\t\t_prerollNeedClickToPlay = false;\n\t\tshowCover(true);\n\t\tif (_player.playlist && _player.playlist.currentIndex) {\n\t\t\t_playlistIdx = _player.playlist.currentIndex();\n\t\t}\n\t\tif (_adRenderer === _rendererNames.IMA) {\n\t\t\tif (_player.ima3 && typeof _player.ima3 !== 'function' && _player.ima3.hasOwnProperty('adsManager')) {\n\t\t\t\tdelete _player.ima3.adsManager;\n\t\t\t\tdelete _player.ima3.adsRequest;\n\t\t\t\tdelete _player.ima3._playSeen;\n\t\t\t}\n\t\t}\n\t\tvar loadedmetadataHandler = function () {\n\t\t\t_player.off('loadedmetadata', loadedmetadataHandler);\n\t\t\t_player.off('playing', playHandler);\n\t\t\t_mainVideoEnded = false;\n\t\t\tif (needPlayAdForPlaylistItem(_player.playlist.currentIndex())) {\n\t\t\t\t// for first video in playlist we already handle loadedmatadata event\n\t\t\t\tif (_player.playlist.currentIndex() > 0) {\n\t\t\t\t\t_logger.log(_prefix, 'start ads preparation for current playlist item');\n\t\t\t\t\tstartRenderingPreparation();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (_markersHandler && _player.markers && _player.markers.destroy) {\n\t\t\t\t_player.markers.destroy();\n\t\t\t}\n\t\t\tshowCover(false);\n\t\t\t_logger.log(_prefix, 'Ad did not play due to frequency settings');\n\t\t\t// disable autostart playing next video in playlist\n\t\t\t_player.playlist.autoadvance(null);\n\t\t};\n\t\tvar playHandler = function () {\n\t\t\tif (_contentDuration === 0 && _player.duration() > 0) {\n\t\t\t\tloadedmetadataHandler();\n\t\t\t}\n\t\t};\n\n\t\t_contentDuration = 0;\n\t\t// start waiting for loadedmetadata or playing event to start preparing ads data\n\t\t_player.one('loadedmetadata', loadedmetadataHandler);\n\t\t_player.one('playing', playHandler);\n\t\tvar waitTime = 4;\n\t\tsetTimeout(function () {\n\t\t\t// make sure event listeners removed\n\t\t\t_player.off('loadedmetadata', loadedmetadataHandler);\n\t\t\t_player.off('playing', playHandler);\n\t\t\tif (_contentDuration === 0) {\n\t\t\t\tif (_player.duration() > 0) {\n\t\t\t\t\tloadedmetadataHandler();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t_logger.log(_prefix, 'Did not receive main video duration during ' + waitTime + 'seconds');\n\t\t\t\t\tshowCover(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}, waitTime * 1000);\n\t}", "function setHandler(){\n\t$('.single_card').off('click').on('click',function(){\n\t\tvar siblingsInfront = $(this).prevAll();\n\t\t\troloToCard(siblingsInfront);\n\t});\n}", "onStart(side) {\n\t\t\t\tthis.effectData.gMaxLayers = 0;\n\t\t\t\tthis.effectData.layers = 0;\n\t\t\t\tthis.add('-sidestart', side, 'move: Toxic Spikes');\n\t\t\t\tif ( this.activeMove.id === 'gmaxmalodor' ){\n\t\t\t\t\tthis.effectData.gMaxLayers = 1;\n\t\t\t\t\tthis.effectData.layers = 1;\n\t\t\t\t} else {\n\t\t\t\t\tthis.effectData.layers = 1;\n\t\t\t\t}\n\t\t\t}", "function onSecondButtonPressed() {\n\t\t\t\t\t//do nothing\n\t\t\t\t}", "function stillHandler() { \n Options.scenes.forEach(function(scene) {\n \tif ( pageYOffset > scene.offset) {\n \t\tscene.action(scene.target);\n \t}\n });\n }", "function letBotMoveProceed(callback) {\n if ((current_turn === tictactoe.first_player) && (player1.type === 'bot')) {\n var move_made = bot_move();\n callback(current_turn, move_made)\n toggleTurn();\n }\n }", "function start(){\n addXandOListener();\n addResetListener();\n}", "function originDestinationMoveStart() {\n if (tabControl.isTabShowing(tabControl.TABS.DIRECTIONS)) {\n showSpinner();\n }\n }", "setupFirstPlay() {\n let seekable;\n let media = this.masterPlaylistLoader_.media();\n\n // check that everything is ready to begin buffering\n // 1) the active media playlist is available\n if (media &&\n // 2) the video is a live stream\n !media.endList &&\n\n // 3) the player is not paused\n !this.tech_.paused() &&\n\n // 4) the player has not started playing\n !this.hasPlayed_) {\n\n this.load();\n\n // trigger the playlist loader to start \"expired time\"-tracking\n this.masterPlaylistLoader_.trigger('firstplay');\n this.hasPlayed_ = true;\n\n // seek to the latest media position for live videos\n seekable = this.seekable();\n if (seekable.length) {\n this.tech_.setCurrentTime(seekable.end(0));\n }\n\n return true;\n }\n return false;\n }", "function mainMenuStartButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'LOAD_SAVED',\n previousPage: 'MAIN_MENU'\n }\n });\n }", "function slideStart()\n{\n\n\tcontinueFollow='continue';\n\t\tsliderDrag();\n}", "function _presentingStateChangedForPlaybackStart(e) {\n if (e.newValue != PresentingState$WAITING) {\n _self.presentingState.removeListener(_presentingStateChangedForPlaybackStart);\n _eventSource.fire(Playback$playbackstart);\n }\n }", "function _presentingStateChangedForPlaybackStart(e) {\n if (e.newValue != PresentingState$WAITING) {\n _self.presentingState.removeListener(_presentingStateChangedForPlaybackStart);\n _eventSource.fire(Playback$playbackstart);\n }\n }", "doStart () {\n\t\tif (typeof this.state.isShuffle != \"boolean\") {\n\t\t\tthis.state.isShuffle = false;\n\t\t}\n\t\tif (typeof this.state.minItemDisplayDuration != \"number\") {\n\t\t\tthis.state.minItemDisplayDuration = 300;\n\t\t}\n\t\telse {\n\t\t\tif (this.state.minItemDisplayDuration < 0) {\n\t\t\t\tthis.state.minItemDisplayDuration = 0;\n\t\t\t}\n\t\t}\n\t\tif (typeof this.state.maxItemDisplayDuration != \"number\") {\n\t\t\tthis.state.maxItemDisplayDuration = 900;\n\t\t}\n\t\telse {\n\t\t\tif (this.state.maxItemDisplayDuration < 0) {\n\t\t\t\tthis.state.maxItemDisplayDuration = 0;\n\t\t\t}\n\t\t}\n\t\tif (typeof this.state.minStartPositionDelta != \"number\") {\n\t\t\tthis.state.minStartPositionDelta = 0;\n\t\t}\n\t\tif (typeof this.state.maxStartPositionDelta != \"number\") {\n\t\t\tthis.state.maxStartPositionDelta = 0;\n\t\t}\n\n\t\tthis.isPaused = false;\n\t\tthis.lastCommandTime = 0;\n\t\tthis.nextCommandTime = 0;\n\t\tthis.lastPauseTime = 0;\n\t}", "function callNext(){\r\n\tvar trig =arguments[0];\r\n\ti++;\r\n\tif(trig==\"mouse\"){\r\n\t\t$(\"#liveDemo-show\").one(\"click\",function(){showNext()})\r\n\t}else{\r\n\t\tsetTimeout(\"showNext()\",trig*1000)\r\n\t}\r\n}", "function callback1(direction) {\n if(direction==\"left\"){\n moveSlide();\n }else if(direction==\"right\"){\n backSlide();\n }\n }", "moveStart(evt) {\r\n evt.preventDefault();\r\n this.held = true;\r\n this.position = this.getPos(evt);\r\n this.update();\r\n }", "function handleStart() {\n $('.first-question').on('click', function(event){\n renderMain(false, true);\n })\n}", "function autoPlay() {\r\n if (settings.autoPlayDirection == 'forward') {\r\n last2first();\r\n } else if (settings.autoPlayDirection == 'backward') {\r\n first2last();\r\n }\r\n}", "function sequencing() {\n if (started) {\n $('.simonButton').removeClass('clicks');\n cpuTurn(0);\n playerTurn(0);\n }\n}", "function startOver() { }", "_firstRendered() { }", "function battleMapTowerBuildStarted() {\n let tempTowerSlotToBuild = store.getState().towerSlotToBuild.split('_')[2];\n let tempTowerToBuild = store.getState().towerToBuild;\n let tempActualTower = ('tower_slot_' + tempTowerSlotToBuild);\n let tempData = 0;\n mainSfxController(towerBuildingSfxSource);\n\n if(tempTowerSlotToBuild == 7) {\n battleMap1BuildHereTextid.classList.add('nodisplay');\n }\n\n let tempParameters = [tempTowerSlotToBuild, tempTowerToBuild];\n\n for (let i = 0; i < store.getState().animationendListened.length; i++) {\n if (store.getState().animationendListened[i][0] == tempActualTower && store.getState().animationendListened[i][1] == 'animationend') {\n tempData = 1;\n }\n }\n\n if (tempData !== 1){\n towerSlotEventListenerWatcherStateChangeStarter(tempActualTower, 'animationend');\n addEvent(battleMap1TowerPlaceList[tempTowerSlotToBuild - 1], 'animationend', battleMapTowerBuildFinished, tempParameters);\n }\n }", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Move_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const minerals = xy_locs(player_relative, _PLAYER_NEUTRAL)\n if (!minerals) {\n return FUNCTIONS.no_op()\n }\n const marines = xy_locs(player_relative, _PLAYER_SELF)\n let axis = 0\n const marine_xy = numpy.round(numpy.mean(marines, axis)) //Average location.\n axis = 1\n const distances = numpy.norm(numpy.tensor(minerals).sub(marine_xy), 'euclidean', axis)\n const closest_mineral_xy = minerals[numpy.argMin(distances).arraySync()]\n return FUNCTIONS.Move_screen('now', closest_mineral_xy)\n }\n return FUNCTIONS.select_army('select')\n }", "reposition() {\n sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener reposition' );\n sceneryLog && sceneryLog.InputListener && sceneryLog.push();\n\n this.matrixProperty.set( this.computeMatrix() );\n\n sceneryLog && sceneryLog.InputListener && sceneryLog.pop();\n }", "function startInteraction(ev) {\n app.ui.moveOutput.clear();\n ev.preventDefault();\n }", "function startEvents(){\r\n if (!startIsClicked){\r\n startIsClicked = true;\r\n eventLoop(0);\r\n }\r\n}", "function backToStart() {\n var realStartPos = basePosY + NUM_POS_START_Y;\n if ( isDefaultType() ) {\n $refreshMain.css('top', realStartPos + 'px');\n $refreshMain.css('-webkit-transform', 'scale(' + 0 + ')');\n } else {\n // Distance must greater than NUM_POS_MIN_Y\n $refreshMain.css('top', customNavTop + 'px');\n /* $refreshMain.css('-webkit-transform', 'translateY(' + realStartPos + 'px)'); */\n }\n setTimeout(function(){\n // Handle button action\n if(!isShowLoading){\n $refreshMain.css('opacity', 0);\n $refreshMain.hide();\n }\n }, 300);\n }", "function pageleft(e) {\n setMedia();\n if (media.currentTime > trjs.dmz.winsize())\n media.currentTime = media.currentTime - (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n else\n media.currentTime = 0;\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function CalculateComputerFirstMove() {\n\n if ($(\".modeactive\").text() === game.modelegend) {\n\n game.comfirst = false;\n Makefirtsmove();\n\n } else if ($(\".modeactive\").text() === game.modenormal) {\n //on normal mode first two computer moves are random\n \n \n RandomMove();\n if (game.moves === 3) {\n game.comfirst = false;\n }\n }\n}", "function inBetweenNext() {\r\r // =======================================================\r var idmove = charIDToTypeID( \"move\" );\r var desc10 = new ActionDescriptor();\r var idnull = charIDToTypeID( \"null\" );\r var ref7 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idTrgt = charIDToTypeID( \"Trgt\" );\r ref7.putEnumerated( idLyr, idOrdn, idTrgt );\r desc10.putReference( idnull, ref7 );\r var idT = charIDToTypeID( \"T \" );\r var ref8 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idNxt = charIDToTypeID( \"Nxt \" );\r ref8.putEnumerated( idLyr, idOrdn, idNxt );\r desc10.putReference( idT, ref8 );\r executeAction( idmove, desc10, DialogModes.NO );\r\r // =======================================================\r var idnextFrame = stringIDToTypeID( \"nextFrame\" );\r var desc43 = new ActionDescriptor();\r var idtoNextWholeSecond = stringIDToTypeID( \"toNextWholeSecond\" );\r desc43.putBoolean( idtoNextWholeSecond, false );\r executeAction( idnextFrame, desc43, DialogModes.NO );\r\r}", "transitionCompleted() {\n // implement if needed\n }" ]
[ "0.6078157", "0.6058513", "0.6043513", "0.6043513", "0.6019449", "0.6016569", "0.59896827", "0.5972413", "0.5972413", "0.59477246", "0.5897895", "0.58940095", "0.58647436", "0.5821168", "0.5813959", "0.5802339", "0.57808834", "0.57383794", "0.5729757", "0.5729566", "0.5721087", "0.5719931", "0.567671", "0.5639697", "0.561928", "0.5609919", "0.55982476", "0.55712503", "0.5548261", "0.55440307", "0.5537666", "0.55229646", "0.5521203", "0.5510181", "0.55020535", "0.5498845", "0.54972804", "0.54862416", "0.5475514", "0.54736614", "0.546284", "0.54524857", "0.5442579", "0.5423188", "0.54214007", "0.5417381", "0.5415106", "0.54107153", "0.5399883", "0.5395793", "0.5381004", "0.53807133", "0.53773373", "0.53757423", "0.53748184", "0.53735554", "0.53716505", "0.53707844", "0.53648096", "0.5359473", "0.535771", "0.5349075", "0.5347009", "0.5345828", "0.5338479", "0.5337155", "0.5327966", "0.5324991", "0.5322159", "0.53203887", "0.5311199", "0.5307673", "0.52964664", "0.5291057", "0.5282161", "0.5281717", "0.52736753", "0.52727234", "0.52707136", "0.5267611", "0.5266057", "0.5266057", "0.5265797", "0.5258519", "0.5251232", "0.5244933", "0.5244079", "0.5232293", "0.52268887", "0.52246714", "0.5223545", "0.5220878", "0.5218672", "0.5217459", "0.5215336", "0.52151364", "0.5211698", "0.52108634", "0.52104056", "0.5206568", "0.52058446" ]
0.0
-1
Logic for deciding when to trigger a movestart.
function checkThreshold(e, template, touch, fn) { var distX = touch.pageX - template.startX, distY = touch.pageY - template.startY; // Do nothing if the threshold has not been crossed. if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } triggerStart(e, template, touch, distX, distY, fn); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "triggerPulled() {\n if (this.state.traitorInGame && !this.state.showCountdown) {\n Vibration.vibrate();\n this.state.triggersRemaining = this.state.triggersRemaining - 1;\n if (this.state.triggersRemaining <= 0) {\n //Traitor won as tracer ran out of triggers\n this.state.triggersRemaining = 0;\n this.gameWonActions(\"Traitor\", null);\n }\n else {\n this.determineWinner();\n }\n }\n }", "playTimeLine(){\n\t\tif(this.timeLine.isTimeLineMoving() === false){\n\t\t\tthis.timeLine.playTimeLine();\n\t\t\tthis.setPopUpNotShowAble();\n\t\t\tthis.mainChart.isMoving(true);\n\t\t}\n\t\telse{\n\t\t\tthis.setPopUpShowAble();\n\t\t\tthis.timeLine.pauseTimeLine();\n\t\t\tthis.mainChart.isMoving(false);\n\t\t}\n\t}", "function BeforeMoveActions() {\n EnableTrackBoard();\n EnableMineDrag();\n}", "trigger (event) {\r\n if (event==='get_hungry'){\r\n if (this.initial==='sleeping'||this.initial==='busy'){\r\n this.rsteps=[];\r\n this.usteps.push(this.initial);\r\n this.initial='hungry';\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n\r\n }\r\n else if (event==='get_tired') {\r\n if (this.initial==='busy') {\r\n this.rsteps=[];\r\n this.usteps.push(this.initial);\r\n this.initial = 'sleeping';\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n else if (event==='study') {\r\n if (this.initial==='normal') {\r\n this.rsteps=[];\r\n this.usteps.push(this.initial);\r\n this.initial = 'busy';\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n else if (event==='eat') {\r\n if(this.initial==='hungry') {\r\n this.rsteps=[];\r\n this.usteps.push(this.initial);\r\n this.initial = 'normal';\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n else if (event==='get_up') {\r\n if (this.initial==='sleeping') {\r\n this.rsteps=[];\r\n this.usteps.push(this.initial);\r\n this.initial = 'normal';\r\n }\r\n else {\r\n throw new Error();\r\n }\r\n }\r\n else{\r\n throw new Error();\r\n }\r\n }", "onMove(){\n // HACK(mike): Get around the fact that the store fires two messages\n // sequentially when the board is reset.\n if (this.store.board.moveCount === 0 ||\n (this.store.board.moveCount === 1 && this.store.computerFirst))\n return;\n\n this.emote(\"default\");\n }", "waitEvent() {\n if (this.currentElementsArray.length > 0 && this.trigger == false) {\n this.trigger = true;\n this.eventEmmiter.emit('trigger');\n }\n }", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Move_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const beacon = xy_locs(player_relative, _PLAYER_NEUTRAL)\n if (!beacon) {\n return FUNCTIONS.no_op()\n }\n const axis = 0\n const beacon_center = numpy.round(numpy.mean(beacon, axis))\n return FUNCTIONS.Move_screen('now', beacon_center)\n }\n return FUNCTIONS.select_army('select')\n }", "function tickevent(delta) {\n if (!ticketypause[delta]) {\n t = tick[delta];\n switch (t.status) {\n case 'initpause':\n tick[delta].events = t.pause_events;\n tick[delta].status = 'pause';\n tick[delta].position = t.item * t.distance;\n tickpos(delta);\n break;\n case 'pause':\n tick[delta].events = tick[delta].events - 1;\n if (tick[delta].events == 0) {\n tick[delta].status = 'initmove';\n }\n break;\n case 'initmove':\n tick[delta].events = t.transition_events;\n tick[delta].status = 'move';\n break;\n case 'move':\n tick[delta].position = tick[delta].position + t.transition_distance\n tick[delta].events = tick[delta].events - 1;\n tickpos(delta);\n if (tick[delta].events == 0) {\n tick[delta].status = 'initpause';\n tick[delta].item = tick[delta].item + 1;\n if (tick[delta].item == tick[delta].count) {\n tick[delta].item = 0;\n }\n }\n break;\n }\n }\n}", "function _moveStop() {\n\t\t\t\t$fire(this._timetable, \"moveStop\");\n\t\t\t}", "function moveOn() {\r\n stop = true;\r\n}", "function _moveStart() {\n\t\t\t\t// TODO does anything need to be included in this event?\n\t\t\t\t// TODO make cancelable\n\t\t\t\t$fire(this._timetable, \"moveStart\");\n\t\t\t}", "onMoveChange() {\n\t\tif (!this.state.activePlayer) {\n\t\t\treturn;\n\t\t}\n\t\tconst move = this.state.move;\n\t\t\n\t\t// Make sure we rerender\n\t\tthis.forceUpdate();\n\n\t\t// Return if this move isn't ready to send yet\n\t\tif (!move.card ||\n\t\t\tmove.card.type === 'DECOY' && !move.target ||\n\t\t\tmove.card.type === 'HORN' && !move.range) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This move is ready to send\n\t\tmove.playerId = this.state.playerId;\n\t\tmove.type = 'PLAY';\n\t\tthis.state.server.emit('move', move);\n\t}", "function powerTrigger(player, posX, posY)\n{\n //Check which player triggered the powerup\n //This client's player\n if (player == currentPlayer)\n {\n //Movement powerup\n if (map[((posY*mapWidth)+posX)] == 4)\n {\n window.dispatchEvent(thisPlayerMovePow);\n }\n //Vision powerup\n else if (map[((posY*mapWidth)+posX)] == 5)\n {\n window.dispatchEvent(thisPlayerVisionPow);\n }\n }\n //The opponent\n else\n {\n //Movement powerup\n if (map[((posY*mapWidth)+posX)] == 4)\n {\n window.dispatchEvent(oppPlayerMovePow);\n }\n //Vision powerup\n else if (map[((posY*mapWidth)+posX)] == 5)\n {\n window.dispatchEvent(oppPlayerVisionPow);\n }\n }\n}", "onTriggerAction(data, triggerCount) {\n super.onTriggerAction(data);\n\n if(triggerCount === 0) {\n this.transportControl(\"previous\");\n } else {\n if(this.roonActiveOutput && this.roonActiveOutput.isSeekAllowed) {\n\n let amount = triggerCount;\n if(triggerCount < 3) {\n amount = 5;\n } else {\n amount = Math.pow(2, triggerCount);\n }\n\n // Guardrails\n amount = Math.min(amount, 45);\n this.transportSeek(\"relative\", -amount);\n }\n }\n }", "function onClickDisk(e) {\n if(Tocadiscos.moverAguja == 1 && player.paused){\n let newCurrentTime = 0;\n screenX = e.x,\n screenY = e.y,\n offsetLeft = disk.offsetParent.offsetLeft + disk.offsetLeft,\n //clientRect = disk.of,\n minX = ([2,4].indexOf(Tocadiscos.disco) === -1) ? 136 : 146,\n maxX = ([2,4].indexOf(Tocadiscos.disco) === -1) ? disk.offsetWidth : disk.offsetWidth - 10,\n minY = 61,\n maxY = disk.offsetHeight - 61,\n moveMaxX = offsetLeft + minX,\n moveMinX = offsetLeft + maxX,\n distance = {\n x: screenX - offsetLeft,\n y: screenY - (disk.offsetParent.offsetTop + disk.offsetTop)\n };\n\n // Obtener la duración total\n let duration = (Tocadiscos.reproductorTipo == ReproductorTipo.Playlist) ? player.duration : getSecondsTime(Tocadiscos.valorTiempoGeneral);\n\n duration = (Tocadiscos.mostrarTiempoGeneral == 1) ? getSecondsTime(Tocadiscos.valorTiempoGeneral) : duration;\n //console.log(distance, minY, maxY);\n\n // Si los valores de X y Y del cursor están dentro del rango permitido\n if((distance.x >= minX && distance.x <= maxX) && (distance.y >= minY && distance.y <= maxY)){\n distance = Math.abs((distance.x - minX) - (maxX - minX));\n maxX = maxX - minX;\n\n newCurrentTime = Math.floor(distance * duration / maxX);\n newCurrentTime = (newCurrentTime > duration) ? duration : (newCurrentTime < 0) ? 0 : newCurrentTime;\n //console.log(newCurrentTime, distance, `min: ${minX}`, `max: ${maxX}`);\n\n if(Tocadiscos.mostrarTiempoGeneral === 1){\n updateIndicators(newCurrentTime, duration);\n timeArmMoving = newCurrentTime;\n }else{\n player.currentTime = newCurrentTime;\n currentTime = newCurrentTime;\n }\n }\n }\n}", "animateTV () {\r\n if (this.tvpower === \"off\") {\r\n this.tvleft.anims.play('leftscreenon', true);\r\n this.tvright.anims.play('rightscreenon', true);\r\n this.tvpower = \"on\";\r\n }\r\n else {\r\n this.tvleft.anims.play('leftscreenoff');\r\n this.tvright.anims.play('rightscreenoff');\r\n this.tvpower = \"off\";\r\n }\r\n }", "function Fly() {\n var message = 'Do you want to activate the movement of the Vite Aerea?'\n\n var choice = confirm(message)\n\n if (choice == true) {\n setInterval(function () {\n vite.rotate([0,1], PI/45);\n }, 60);\n }\n\n}", "function movable(){\n\t\toldTop = parseInt(this.style.top);\n\t\toldLeft = parseInt(this.style.left);\n\t\tif (oldTop == emptyTop && oldLeft == (eLeft-100) || oldTop == emptyTop && oldLeft == (eLeft+100) || oldTop == (emptyTop-100) && oldLeft == eLeft || oldTop == (emptyTop+100) && oldLeft == eLeft){\n\t\t\t$(this).addClass('movablepiece');\t\n\t\t}\n\t\telse{\n\t\t\t$(this).removeClass(\"movablepiece\");\n\t\t}\n\t}", "function move(){\n if(onboatA==1 || onboatA==4 || onboatA==7 ||\n\t onboatA==11 || onboatA==14 || onboatA==17 ||\n\t onboatB==1 || onboatB==4 || onboatB==7 ||\n\t onboatB==11 || onboatB==14 || onboatB==17\n\t )//only professer, employer and police are above to move the boat,otherwise tha alert come out.\n\t {\n\t\tif (profCheck() && employerCheck() && policeCheck())\n\t\t{\t\n\t\t\tif(direction)\n\t\t\t{\t\n\t\t\t\tclearInterval(intervalid);\n\t\t\t\ts = 0;\n\t\t\t\tA = onboatA;\n\t\t\t\tB = onboatB;\n\t\t\t\t\n\t\t\t\tIntervalID = setInterval(AtoCh, 30);\n\t\t\t\tmovement = movement + 1;\n\t\t\t\tdirection=false;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tclearInterval(IntervalID);\n\t\t\t\ts = 300;\n\t\t\t\tA = onboatA;\n\t\t\t\tB = onboatB;\n\t\t\t\tintervalid = setInterval(CtoAh, 30);\n\t\t\t\tmovement = movement + 1;\n\t\t\t\tdirection=true;\n\t\t\t}//here set the movement of pedometer\n\t\t\tpart1Able=part2Able=true;\n\t\t\tonboatA=onboatB=0;\n\t\t\t\n\t\t\tsetTimeout(\"foo()\", 430);\n\t\t}//Delay implementation\n\t}\n\telse\n\t\talert(\"Only Professor, Employer and Police are able to move the boat\");\n}", "isScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}", "isCastling(move) {\n return (move.flags.indexOf('k') >= 0 || move.flags.indexOf('q') >= 0);\n }", "function timesPress() {\n\ttimesModel = true;\n\tisHumanTimes = true;\n\tstart.style.display =\"none\";\n\tbutton3.style.display = 'block';\n\tif (!humanModel){\n\t\ttimesModel = false;\n\t\taimove();\t\n\t}\n\t\n}", "function handleWinningMove() {\n printYes();\n}", "function dogOneRandomEventMove(){\n if (dogOneCurrentStep == 3 || dogOneCurrentStep == 6 || dogOneCurrentStep == 9 || dogOneCurrentStep == 12 || dogOneCurrentStep == 16 || dogOneCurrentStep == 19){\n dogOneRandomEvent()\n return;\n }\n }", "function gameMenutoBattleMapStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'BATTLE_MAP',\n previousPage: 'GAME_MENU'\n }\n });\n store.dispatch( {\n type: BATTLE_ON,\n payload: {\n battleState: 'BATTLE_ON'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: battleMap1MusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: battleMap1MusicSource\n }\n });\n }\n }", "isScheduled() {\n\n\t\t\treturn this._mixer._isActiveAction( this );\n\n\t\t}", "function musicButtonStateChangeStarter() {\n if (store.getState().musicStatus == 'OFF') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: store.getState().currentMusicSource\n }\n });\n return\n }\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: store.getState().currentMusicSource\n }\n });\n return\n }\n }", "function togglePukiDragEvent(obj, con){\n\tswitch(con){\n\t\tcase 'drag':\n\t\t\tobj.target.offset = {x:obj.target.x-(obj.stageX / scalePercent), y:obj.target.y- (obj.stageY / scalePercent)};\n\t\t\t\n\t\t\tif(pukiInteract) {\n\t\t\t\tpukiDragging = true;\n\t\t\t\tpukiGravityActive = true;\n\t\t\t\t\n\t\t\t\tif(pukiAction == \"grab\") {\n\t\t\t\t\ttoySelected.dragging = false;\n\t\t\t\t} else if(pukiAction == \"rubberduck\") {\n\t\t\t\t\ttoySelected.alpha = 1;\n\t\t\t\t}else if(curAnimate == \"bubble\") {\n\t\t\t\t\tpukiDragging = false;\n\t\t\t\t\tpukiGravityActive = true;\n\t\t\t\t\t\n\t\t\t\t\tpopBubble();\n\t\t\t\t}\n\t\t\t\tpukiAction = \"air\";\n\t\t\t}\n\t\tbreak;\n\t\t\n\t\tcase 'move':\n\t\t\tif(pukiDragging){\n\t\t\t\tpuki_arr.x = (obj.stageX / scalePercent) + obj.target.offset.x;\n\t\t\t\tpuki_arr.y = (obj.stageY / scalePercent) + obj.target.offset.y;\n\t\t\t}\n\t\tbreak;\n\t\t\n\t\tcase 'release':\n\t\t\tpukiDragging = false;\n\t\tbreak;\n\t}\n}", "function moveForward(rover){\n console.log(`----${rover.name}----`);\n console.log(\"moveForward was called\");\n switch (rover.direction) {\n case 'N':\n if (rover.y > 0) {\n rover.y--;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.y++\n console.log(`There is an other Rover at (${rover.x},${rover.y-1}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.y++;\n console.log(`There is an ${o} at (${rover.x},${rover.y-1}). Change your way!`);\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'W':\n if (rover.x > 0) {\n rover.x--;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.x++\n console.log(`There is an other Rover at (${rover.x-1},${rover.y}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.x++;\n console.log(`There is an ${o} at (${rover.x-1},${rover.y}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'S':\n if (rover.y < 9) {\n rover.y++;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.y--\n console.log(`There is an other Rover at (${rover.x},${rover.y+1}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.y--;\n console.log(`There is an ${o} at (${rover.x},${rover.y+1}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'E':\n if (rover.x < 9) {\n rover.x++;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.x--\n console.log(`There is an other Rover at (${rover.x+1},${rover.y}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.x--;\n console.log(`There is an ${o} at (${rover.x+1},${rover.y}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n }\n console.log(`Direction: ${rover.direction}`);\n console.log(`Position: (${rover.x},${rover.y})`);\n rover.travelLog.push({x: rover.x, y: rover.y});\n}", "function TriggerAction () \n{\n for (var receiver : TriggeringReceiver in receivers) \n if (receiver.justSetActive) receiver.object.SetActive(true);\n else receiver.object.SendMessage(receiver.callFunction, receiver.parameter, SendMessageOptions.DontRequireReceiver);\n \n if (triggerByButton == \"\") objectInTrigger = null;\n \n triggeringTime = Time.time + autoTriggeringDelay;\n \n}", "function gameMenutoPrologueStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'PROLOGUE',\n previousPage: 'GAME_MENU'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: battleMap1MusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: battleMap1MusicSource\n }\n });\n }\n }", "move(from, fromIx, fromCount, to, toIx) {\n let evdata = {\n success: false,\n from: from, \n fromIx: fromIx,\n fromCount: fromCount,\n to: to,\n toIx: toIx\n };\n if (!this.canMove(from, fromIx, fromCount, to, toIx)) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n let card = false;\n let dest = false;\n if (from == 'w') {\n card = this.waste.pop();\n } \n else if (from == 'f') {\n card = this.foundations[fromIx - 1].pop();\n }\n else if (from == 't') {\n let t = this.tableau[fromIx - 1];\n card = t.slice(t.length - fromCount);\n t.length = t.length - fromCount;\n }\n if (to == 't') {\n dest = this.tableau[toIx - 1];\n }\n else if (to == 'f') {\n dest = this.foundations[toIx - 1];\n }\n if (!card || !dest) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n if (Array.isArray(card)) {\n card.forEach((c) => { \n dest.push(c); \n });\n }\n else {\n dest.push(card);\n }\n evdata.success = true;\n this._event(Game.EV.MOVE, evdata); \n if (from == 't') {\n let last = this.tableau[fromIx - 1].last();\n this._event(Game.EV.REVEAL, {\n tableau: fromIx,\n card: last\n });\n }\n return true;\n }", "change_move_status () {\r\n if(this.spaces_moved_hv > 0 || this.spaces_moved_d > 0){\r\n this.move_status =\r\n this.move_status == 0 ? 1 : 0;\r\n }\r\n }", "function battleMapOptionsMenuCloseManualpauseOffStateChangeStarter() {\n store.dispatch( {\n type: MANUALPAUSE_OFF,\n payload: {\n manualPaused: false\n }\n });\n }", "function BeginMoveState()\n{\n\t$.Msg('BMS');\n\tvar order = {\n\t\tOrderType : dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_POSITION,\n\t\tPosition : [0, 0, 0],\n\t\tQueue : OrderQueueBehavior_t.DOTA_ORDER_QUEUE_NEVER,\n\t\tShowEffects : false\n\t};\n\n\tvar localHeroIndex = Players.GetPlayerHeroEntityIndex( Players.GetLocalPlayer() );\n\tvar isRanged = (Abilities.GetBehavior( Entities.GetAbility( localHeroIndex, 10 ) ) & DOTA_ABILITY_BEHAVIOR.DOTA_ABILITY_BEHAVIOR_POINT) !== 0;\n\n\tinAction = true;\n\n\t(function tic()\n\t{\n\t\tif ( GameUI.IsMouseDown( 0 ) )\n\t\t{\n\t\t\tif (GameUI.IsShiftDown() && isRanged){\n\t\t\t\tBeginRangedAttack(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (GameUI.IsControlDown()){\n\t\t\t\torder.OrderType = dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_DIRECTION;\n\t\t\t\tvar abil = Entities.GetAbility( localHeroIndex, 4 )\n\t\t\t\t$.Msg(Abilities.GetAbilityName(abil));\n\t\t\t\tif (!Abilities.IsPassive(abil) && Abilities.IsCooldownReady(abil) && !Abilities.IsInAbilityPhase(abil)){\n\t\t\t\t\torder = {\n\t\t\t\t\t\tOrderType : dotaunitorder_t.DOTA_UNIT_ORDER_CAST_NO_TARGET,\n\t\t\t\t\t\tAbilityIndex : abil,\n\t\t\t\t\t\tQueue : false,\n\t\t\t\t\t\tShowEffects : false\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\torder.OrderType = dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_POSITION;\n\t\t\t}\n\n\t\t\t$.Schedule( 1.0/30.0, tic );\n\t\t\tvar mouseWorldPos = GameUI.GetScreenWorldPosition( GameUI.GetCursorPosition() );\n\t\t\tif ( mouseWorldPos !== null )\n\t\t\t{\n\t\t\t\torder.Position = mouseWorldPos;\n\t\t\t\thasMoved = true;\n\t\t\t\tGame.PrepareUnitOrders( order );\n\t\t\t}\n\t\t}\n\t\telse{ inAction = false;} \n\t})();\n}", "function checkFrontLegClick(pos) {\n if (currentPosition === PositionEnums.STANDING) {\n let isShaking = bodyParts[PartEnums.FRONT_LEG].isShaking;\n if (!isShaking) {\n if (checkStandingFLC(pos)) {\n console.log(\"Leg clicked, shaking: \" + isShaking);\n isAnimating = true;\n init();\n bodyParts[PartEnums.FRONT_LEG].isShaking = !isShaking;\n nextFrame();\n }\n }\n }\n}", "castlingMove(from, to) {\n // Remember the from piece (it's a king)\n let fromPiece = this.game.get(from);\n // Remove the king\n this.game.remove(from);\n // Place the king in the destination square\n this.game.put(fromPiece, to);\n // Now we need to position the rook correctly\n let turn = this.game.turn();\n let backRank = turn === this.game.WHITE ? 1 : 8;\n // Handle kingside\n if (this.currentMove.castlingFlag === 'k') {\n // Remove the existing rook\n this.game.remove(`h${backRank}`);\n // Put it in its castled position\n this.game.put({\n type: 'r',\n color: turn\n }, `f${backRank}`);\n }\n // Handle queenside\n else if (this.currentMove.castlingFlag === 'q') {\n // Remove the existing rook\n this.game.remove(`a${backRank}`);\n // Put it in its castled position\n this.game.put({\n type: 'r',\n color: turn\n }, `d${backRank}`);\n }\n this.castling[turn] = undefined;\n\n // Now handle end of turn stuff like disabling input\n this.disableInput();\n\n // Clear all highlights from the board\n this.clearHighlights();\n\n // Update the board based on the new position\n this.board.position(this.game.fen(), true);\n setTimeout(() => {\n // Now we need to check only for captures and offer them\n this.currentMove.from = undefined;\n this.currentMove.to = undefined;\n this.currentMove.captureSquare = undefined;\n this.currentMove.castlingFlag = undefined;\n this.flipTurn();\n this.moveCompleted();\n placeSFX.play();\n }, this.config.moveSpeed * 1.1);\n }", "function moveForward(rover){\nswitch(rover.direction){ //switch para ver en que dirección esta el rover y if para ver si esta en el limite del grid 10x10.\n case 'W':\n if (rover.positionX < 0 || rover.positionX > 10 ){\n console.log(\"limite\");\n }else{ //else - sino esta en el limite se puede mover adelante.\n rover.positionX -= 1;\n }\n break;\n case 'N': \n if (rover.positionY <= 0 || rover.positionY > 10){\n console.log(\"limite\");\n }else{ \n rover.positionY -=1;\n }\n break;\n case 'S':\n if (rover.positionY < 0 || rover.positionY >10){\n console.log(\"limite\");\n }else{\n rover.positionY +=1;\n }\n break;\n case 'E':\n if (rover.positionX < 0 || rover.positionX >10){\n console.log(\"limite\");\n }else{\n rover.positionX +=1;\n }\n break;\n } \nconsole.log(\"Avanza\"); \n}", "function stillMoving(){\n if(!moving) return false;\n tap = TAP_DEFAULT;\n return true;\n }", "function touchStarted(){\n x=0;\n if (osc1control=='enabled'){osc1.start();}\n // if (osc2control=='enabled'){osc2.start();}\n //if (osc3control=='enabled'){osc3.start();}\n //if (osc4control=='enabled'){osc4.start();}\n }", "function determineAction()\n {\n Game.lastTimedEvent = 0;\n\n switch (Game.prevCounter)\n {\n // Case 0 and 1 is pointless since user hasn't placed a bet.\n\n case 2:\n Game.counter = 2;\n break;\n\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n Game.lastTimedEvent = 0;\n drawNormalHand(false);\n Game.counter = Game.prevCounter;\n break;\n \n case 8:\n case 9:\n Game.counter = 8;\n break;\n \n case 10:\n case 11:\n Game.counter = Game.prevCounter;\n break;\n\n case 12:\n Game.counter = 12;\n drawNormalHand(true);\n break;\n\n case 13:\n case 14:\n case 15:\n Game.counter = Game.prevCounter;\n break;\n\n default: \n alert(\"It's not a bug, it's an easter egg.\");\n break;\n }\n }", "onStart(target) {\n\t\t\t\tconst noEncore = [\n\t\t\t\t\t'assist', 'copycat', 'encore', 'mefirst', 'metronome', 'mimic', 'mirrormove', 'naturepower', 'sketch', 'sleeptalk', 'struggle', 'transform',\n\t\t\t\t];\n\t\t\t\tconst move = target.lastMove;\n\t\t\t\tif ( target.lastMove ) console.log( target.lastMove.id );\n\t\t\t\tlet moveIndex = move ? target.moves.indexOf(move.id) : -1;\n\t\t\t\tif (!move || move.isZ || move.isMax || noEncore.includes(move.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {\n\t\t\t\t\t// it failed\n\t\t\t\t\tdelete target.volatiles['encore'];\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tthis.effectData.move = move.id;\n\t\t\t\tthis.add('-start', target, 'Encore');\n\t\t\t\tif (!this.willMove(target)) {\n\t\t\t\t\tthis.effectData.duration++;\n\t\t\t\t}\n\t\t\t}", "function moveBackward(rover){\n console.log(`----${rover.name}----`);\n console.log(\"moveBackward was called\");\n switch (rover.direction) {\n case 'N':\n if (rover.y < 9) {\n rover.y++;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.y--\n console.log(`There is an other Rover at (${rover.x},${rover.y+1}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.y--;\n console.log(`There is an ${o} at (${rover.x},${rover.y+1}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'W':\n if (rover.x < 9) {\n rover.x++;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.x--\n console.log(`There is an other Rover at (${rover.x+1},${rover.y}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.x--;\n console.log(`There is an ${o} at (${rover.x+1},${rover.y}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'S':\n if (rover.y > 0) {\n rover.y--;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.y++\n console.log(`There is an other Rover at (${rover.x},${rover.y-1}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.y++;\n console.log(`There is an ${o} at (${rover.x},${rover.y-1}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n case 'E':\n if (rover.x > 0) {\n rover.x--;\n if (rover1.x === rover2.x && rover1.y === rover2.y) {\n rover.x++\n console.log(`There is an other Rover at (${rover.x-1},${rover.y}). Change your way!`);\n } else if (grid[rover.y][rover.x] === o) {\n rover.x++;\n console.log(`There is an ${o} at (${rover.x-1},${rover.y}). Change your way!`)\n }\n } else {\n console.log(\"canceled command, you are on the grid limit!\");\n }\n break;\n }\n console.log(`Direction: ${rover.direction}`);\n console.log(`Position: (${rover.x},${rover.y})`);\n rover.travelLog.push({x: rover.x, y: rover.y});\n}", "onMove() {\n }", "checkForActivity() { \n // -------- DELAY -------- //\n if (this.delayParamTrackActive) {\n if (!this.delayParamTrackActive_Y) { // X-axis control on\n if (this.delayFrozen) { // if delay track HAS been frozen with X-axis control on\n noStroke();\n this.delaySignal.drawLavenderCircle();\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.delaySignal.x_coordinate, this.delaySignal.y_coordinate, this.delayFrozenX, this.delayFrozenY);\n\n fill(189, 127, 220); // draw circle to show where end of line is\n noStroke();\n circle(this.delayFrozenX, this.delayFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if delay track has not been frozen, track mouse x-axis and apply effect param\n var dt = map(mouseX, 0, w, 1, 0.005);\n if (dt < 0.0001) {dt = 0.0001}; // range control\n if (dt > 1) {dt = 1;}\n this.delay.delayTime.rampTo(dt, 0.3);\n noStroke();\n this.delaySignal.drawLavenderCircle();\n\n // draw line to show degree of target param manipulation\n stroke(189, 127, 220);\n strokeWeight(5);\n line(this.delaySignal.x_coordinate, this.delaySignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // y-axis control on\n if (this.delayFrozen) { // if delay track has been frozen with y-axis control on\n noStroke();\n this.delaySignal.drawGoldCircle(); // keep drawing circle above button\n\n stroke(214, 214, 31); // draw line to show degree of effect param\n strokeWeight(5); \n line(this.delaySignal.x_coordinate, this.delaySignal.y_coordinate, this.delayFrozenX, this.delayFrozenY);\n\n fill(214, 214, 31); // draw circle to show where end of line is\n noStroke(); \n circle(this.delayFrozenX, this.delayFrozenY, 0.3 * this.parentButHt);\n }\n \n else { // if delay track has not been frozen, track mouse y-axis and apply effect param\n var dt = map(mouseY, h, 0, 1, 0.0001); // map delay time to mouse y-axis on screen\n if (dt < 0.0001) {dt = 0.0001}; // range control\n if (dt > 1) {dt = 1;}\n this.delay.delayTime.rampTo(dt, 0.3); // apply new delay time\n noStroke();\n this.delaySignal.drawGoldCircle(); // draw signal circle\n\n // draw line to show degree of target param manipulation\n stroke(214, 214, 31);\n strokeWeight(5);\n line(this.delaySignal.x_coordinate, this.delaySignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default )blue signal circle\n else if (!this.delayParamTrackActive && this.delayActive) { \n noStroke();\n this.delaySignal.drawActiveCircle();\n }\n\n // -------- AMP MOD -------- //\n if (this.ampModParamTrackActive) { // activate amp mod frequency tracking mouse on screen\n if (!this.ampModParamTrackActive_Y) { // ---- X-AXIS ---- //\n if (this.ampModFrozen) { // if effect HAS been frozen in place on x-axis control\n noStroke();\n this.ampModSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.ampModSignal.x_coordinate, this.ampModSignal.y_coordinate, this.ampModFrozenX, this.ampModFrozenY);\n\n fill(189, 127, 220); // draw circle to show end of line\n noStroke();\n circle(this.ampModFrozenX, this.ampModFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect is NOT frozen, track mouse x-axis and apply effect param\n var am = map(mouseX, 0, w, 1, 200); // scale amp mod freq to mouse x-axis\n this.ampModLFOParamTrack.frequency.rampTo(am, 0.1); // apply scaled amp mod freq\n noStroke();\n this.ampModSignal.drawLavenderCircle(); // draw signal circle\n\n // draw line to show degree of target param manipulation\n stroke(189, 127, 220);\n strokeWeight(5);\n line(this.ampModSignal.x_coordinate, this.ampModSignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // ---- Y-AXIS ---- //\n if (this.ampModFrozen) { // if effect HAS been frozen in place on x-axis control\n noStroke();\n this.ampModSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.ampModSignal.x_coordinate, this.ampModSignal.y_coordinate, this.ampModFrozenX, this.ampModFrozenY);\n\n fill(214, 214, 31); // draw circle to show end of line\n noStroke();\n circle(this.ampModFrozenX, this.ampModFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect is NOT frozen, track mouse y-axis and apply effect param\n var am = map(mouseY, h, 0, 1, 200); // scale amp mod freq to mouse y-axis\n this.ampModLFOParamTrack.frequency.rampTo(am, 0.1); // apply scaled amp mod freq\n noStroke();\n this.ampModSignal.drawGoldCircle(); // draw signal circle\n\n // draw line to show degree of target param manipulation\n stroke(214, 214, 31);\n strokeWeight(5);\n line(this.ampModSignal.x_coordinate, this.ampModSignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default )blue signal circle\n else if (!this.ampModParamTrackActive && this.ampModActive) {\n noStroke();\n this.ampModSignal.drawActiveCircle();\n }\n\n // -------- FILTER SWEEP -------- //\n if (this.filterSweepParamTrackActive) { // activate filter sweep frequency tracking mouse on screen\n if (!this.filterSweepParamTrackActive_Y) { // ---- X-AXIS ---- //\n if (this.filterSweepFrozen) { // if effect HAS been frozen\n noStroke();\n this.filterSweepSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.filterSweepSignal.x_coordinate, this.filterSweepSignal.y_coordinate, this.filterSweepFrozenX, this.filterSweepFrozenY);\n\n fill(189, 127, 220); // draw circle to show end of line\n noStroke();\n circle(this.filterSweepFrozenX, this.filterSweepFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n var fs = map(mouseX, 0, w, 0.5, 30); // scale filter sweep freq to x-axis mouse on screen\n this.filterSweep.frequency.rampTo(fs, 0.1); // apply scaled value\n noStroke();\n this.filterSweepSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.filterSweepSignal.x_coordinate, this.filterSweepSignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // ---- Y-AXIS ---- //\n if (this.filterSweepFrozen) { // if effect HAS been frozen\n noStroke();\n this.filterSweepSignal.drawGoldCircle();\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.filterSweepSignal.x_coordinate, this.filterSweepSignal.y_coordinate, this.filterSweepFrozenX, this.filterSweepFrozenY);\n\n fill(214, 214, 31); // draw circle to show end of line\n noStroke();\n circle(this.filterSweepFrozenX, this.filterSweepFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n var fs = map(mouseY, h, 0, 0.5, 30); // scale filter sweep freq to y-axis mouse on screen\n this.filterSweep.frequency.rampTo(fs, 0.1); // apply scaled value\n noStroke();\n this.filterSweepSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.filterSweepSignal.x_coordinate, this.filterSweepSignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default )blue signal circle\n else if (!this.filterSweepParamTrackActive && this.filterSweepActive) {\n noStroke();\n this.filterSweepSignal.drawActiveCircle();\n }\n\n // -------- FREQ SHIFTER -------- //\n if (this.freqShifterParamTrackActive) { // activate frequency shifter base frequency tracking mouse on screen\n if (!this.freqShifterParamTrackActive_Y) { // ---- X-AXIS ---- //\n if (this.freqShifterFrozen) { // if effect HAS been frozen\n noStroke();\n this.freqShifterSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.freqShifterSignal.x_coordinate, this.freqShifterSignal.y_coordinate, this.freqShifterFrozenX, this.freqShifterFrozenY);\n\n fill(189, 127, 220); // draw circle to show end of line\n noStroke();\n circle(this.freqShifterFrozenX, this.freqShifterFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n //var frs = map(mouseX, 0, w, 0, 500); // scale x-axis value for freqshifter base freq\n var frs = map(mouseX, 0, w, -24, 20); // scale x-axis value for freqshifter base freq\n //this.freqShifterParamTrack.frequency.rampTo(frs, 0.1); // apply scaled value\n //if (frs == 0) {frs= 0.001};\n this.freqShifter.pitch = frs;\n noStroke();\n this.freqShifterSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.freqShifterSignal.x_coordinate, this.freqShifterSignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // ---- Y-AXIS ---- //\n if (this.freqShifterFrozen) { // if effect HAS been frozen\n noStroke();\n this.freqShifterSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.freqShifterSignal.x_coordinate, this.freqShifterSignal.y_coordinate, this.freqShifterFrozenX, this.freqShifterFrozenY);\n\n fill(214, 214, 31); // draw circle to show end of line\n noStroke();\n circle(this.freqShifterFrozenX, this.freqShifterFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n //var frs = map(mouseY, h, 0, 0, 500); // scale y-axis value for freqshifter base freq\n var frs = map(mouseY, h, 0, -24, 20); // scale y-axis value for freqshifter base freq\n //this.freqShifterParamTrack.frequency.rampTo(frs, 0.1); // apply scaled value\n this.freqShifter.pitch = frs;\n noStroke();\n this.freqShifterSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.freqShifterSignal.x_coordinate, this.freqShifterSignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default) blue signal circle\n else if (!this.freqShifterParamTrackActive && this.freqShifterActive) {\n noStroke();\n this.freqShifterSignal.drawActiveCircle();\n }\n\n // -------- PLAYBACK RATE -------- //\n if (this.playbackRateParamTrackActive) { // activate play rate tracking mouse on screen\n if (!this.playbackRateParamTrackActive_Y) { // ---- X-AXIS ---- //\n if (this.playbackRateFrozen) { // if effect HAS been frozen\n noStroke();\n this.playbackRateSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.playbackRateSignal.x_coordinate, this.playbackRateSignal.y_coordinate, this.playbackRateFrozenX, this.playbackRateFrozenY);\n\n fill(189, 127, 220); // draw circle to show end of line\n noStroke();\n circle(this.playbackRateFrozenX, this.playbackRateFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n var pr = map(mouseX, 0, w, 0.001, 2.0); // scale value of mouse x-axis on screen to playback rate\n this.player.playbackRate = pr; // apply scaled value\n noStroke();\n this.playbackRateSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.playbackRateSignal.x_coordinate, this.playbackRateSignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // ---- Y-AXIS ---- //\n if (this.playbackRateFrozen) { // if effect HAS been frozen\n noStroke();\n this.playbackRateSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.playbackRateSignal.x_coordinate, this.playbackRateSignal.y_coordinate, this.playbackRateFrozenX, this.playbackRateFrozenY);\n\n fill(214, 214, 31); // draw circle to show end of line\n noStroke();\n circle(this.playbackRateFrozenX, this.playbackRateFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n var pr = map(mouseY, h, 0, 0.001, 2.0); // scale value of mouse y-axis on screen to playback rate\n if (pr < 0) {\n pr = 0;\n } \n this.player.playbackRate = pr; // apply scaled value\n noStroke();\n this.playbackRateSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.playbackRateSignal.x_coordinate, this.playbackRateSignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default) blue signal circle\n else if (!this.playbackRateParamTrackActive && this.playbackRateActive) {\n noStroke();\n this.playbackRateSignal.drawActiveCircle();\n }\n\n // -------- PANNER -------- //\n if (this.pannerParamTrackActive) { // activate play rate tracking mouse on screen\n if (!this.pannerParamTrackActive_Y) { // ---- X-AXIS ---- //\n if (this.pannerFrozen) { // if effect HAS been frozen\n noStroke();\n this.pannerSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.pannerSignal.x_coordinate, this.pannerSignal.y_coordinate, this.pannerFrozenX, this.pannerFrozenY);\n\n fill(189, 127, 220); // draw circle to show end of line\n noStroke();\n circle(this.pannerFrozenX, this.pannerFrozenY, 0.3 * this.parentButHt);\n }\n\n else {\n var ap = map(mouseX, 0, w, 1, 40); // scale value of mouse x-axis on screen to panner rate\n this.pannerParamTrack.frequency.rampTo(ap, 0.2); // apply scaled value\n noStroke();\n this.pannerSignal.drawLavenderCircle(); // draw signal circle\n\n stroke(189, 127, 220); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.pannerSignal.x_coordinate, this.pannerSignal.y_coordinate, mouseX, mouseY);\n }\n }\n else { // ---- Y-AXIS ---- //\n if (this.pannerFrozen) { // if effect HAS been frozen\n noStroke();\n this.pannerSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.pannerSignal.x_coordinate, this.pannerSignal.y_coordinate, this.pannerFrozenX, this.pannerFrozenY);\n\n fill(214, 214, 31); // draw circle to show end of line\n noStroke();\n circle(this.pannerFrozenX, this.pannerFrozenY, 0.3 * this.parentButHt);\n }\n\n else { // if effect has NOT been frozen\n var ap = map(mouseY, h, 0, 1, 40); // scale value of mouse y-axis on screen to panner rate\n this.pannerParamTrack.frequency.rampTo(ap, 0.2); // apply scaled value\n noStroke();\n this.pannerSignal.drawGoldCircle(); // draw signal circle\n\n stroke(214, 214, 31); // draw line to show degree of target param manipulation\n strokeWeight(5);\n line(this.pannerSignal.x_coordinate, this.pannerSignal.y_coordinate, mouseX, mouseY);\n }\n }\n }\n // if NO effect param tracking is active, then default effects will take over, and (default) blue signal circle\n else if (!this.pannerParamTrackActive && this.pannerActive) {\n noStroke();\n this.pannerSignal.drawActiveCircle();\n }\n \n if (this.reverbActive) {\n noStroke();\n this.reverbSignal.drawActiveCircle();\n }\n if (this.reverseActive) {\n noStroke();\n this.reverseSignal.drawActiveCircle();\n }\n }", "Smotion(desloc)\n\t{\n\t\t// If the key A is pressed then moves the vehicle backward and turn left\n\t\tif (this.keysdirectionPress[0]){\n\t\t\tthis.angleDirection -= desloc/5;\n\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\n\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\tthis.angleDirection += desloc/5;\n\t\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\t\t\t}\n\t\t\tthis.frontLeftWheel.update(desloc,5);\n\t\t\tthis.frontRightWheel.update(-desloc,5);\n\t\t\tthis.backLeftWheel.update(desloc,0);\n\t\t\tthis.backRightWheel.update(-desloc,0);\n\t\t} else \n\t\t\t// If the key D is pressed then moves the vehicle backward and turn rigth\n\t\t\tif (this.keysdirectionPress[1]){\n\t\t\t\tthis.angleDirection += desloc/5;\n\t\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\n\t\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\t\tthis.angleDirection -= desloc/5;\n\t\t\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\t\t\t\t}\n\t\t\t\tthis.frontLeftWheel.update(desloc,-5);\n\t\t\t\tthis.frontRightWheel.update(-desloc,-5);\n\t\t\t\tthis.backLeftWheel.update(desloc,0);\n\t\t\t\tthis.backRightWheel.update(-desloc,0);\n\t\t\t}\n\n\t\t// If only key W is pressed then moves the vehicle backward straight\n\t\tif ( !(this.keysdirectionPress[0] || this.keysdirectionPress[1]) ){\n\t\t\tthis.position[2] -= desloc*Math.cos(this.angleDirection);\n\t\t\tthis.position[0] += desloc*Math.sin(this.angleDirection);\n\n\t\t\t// If the next position is out of limits or has altimetry other than 0 then revert the movement\n\t\t\tif ( ! this.checkNextPosition(this.position[0],this.position[2])){\n\t\t\t\tthis.position[2] += desloc*Math.cos(this.angleDirection);\n\t\t\t\tthis.position[0] -= desloc*Math.sin(this.angleDirection);\n\t\t\t}\n\t\t\tthis.frontLeftWheel.update(desloc,0);\n\t\t\tthis.frontRightWheel.update(-desloc,0);\n\t\t\tthis.backLeftWheel.update(desloc,0);\n\t\t\tthis.backRightWheel.update(-desloc,0);\n\t\t}\n\t}", "function makeMove(){\n miniMax(boardState, 'computer');\n boardState[computerMove] = 2;\n $('#p' + computerMove).html(computer);\n $('#' + computerMove).css('pointer-events', 'none');\n if(checkWin(boardState) === 2){\n showWin();\n } else if(checkWin(boardState) === 3){\n $('.square').css({'background' : '#BDBDBD', 'border-color' : '#BDBDBD'});\n wait = window.setTimeout(function(){\n $('#message').html('Tie! <br>Play Again?');\n $('.board').css('opacity', 0.2);\n $('.pop-up').css({'opacity' : '1', 'pointer-events' : 'auto'});\n }, 1000);\n }\n }", "function moveForward(rover){\n console.log(\"moveForward was called\");\n\tswitch (rover.direction) {\n\t\tcase \"N\":\n\t\t\tif (rover.y===0) {\n\t\t\t\tconsole.log(\"Boundary exceeded! Rover has not been moved.\");\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\trover.y--;\n\t\t\t\trover.travelLog.push(`(${rover.x},${rover.y})`);\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase \"W\":\n\t\t\tif (rover.x===0) {\n\t\t\t\tconsole.log(\"Boundary exceeded! Rover has not been moved.\");\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\trover.x--;\n\t\t\t\trover.travelLog.push(`(${rover.x},${rover.y})`);\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase \"S\":\n\t\t\tif (rover.y===9) {\n\t\t\t\tconsole.log(\"Boundary exceeded! Rover has not been moved.\");\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\trover.y++;\n\t\t\t\trover.travelLog.push(`(${rover.x},${rover.y})`);\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase \"E\":\n\t\t\tif (rover.x===9) {\n\t\t\t\tconsole.log(\"Boundary exceeded! Rover has not been moved.\");\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\trover.x++;\n\t\t\t\trover.travelLog.push(`(${rover.x},${rover.y})`);\n\t\t\t\tconsole.log(`Rover's coordinates are (${rover.x},${rover.y}).`);\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n}", "function offensive_move() {\n \n if ($(cells[left_upper_cell]).hasClass(machine_clicked)) {\n if ($(cells[upper_center_cell]).hasClass(machine_clicked) && $(cells[right_upper_cell]).hasClass(empty_cell)) return right_upper_cell;\n if ($(cells[right_upper_cell]).hasClass(machine_clicked) && $(cells[upper_center_cell]).hasClass(empty_cell)) return upper_center_cell;\n if ($(cells[left_center_cell]).hasClass(machine_clicked) && $(cells[left_lower_cell]).hasClass(empty_cell)) return left_lower_cell;\n\n \n if ($(cells[left_lower_cell]).hasClass(machine_clicked) && $(cells[left_center_cell]).hasClass(empty_cell)) return left_center_cell;\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[right_lower_cell]).hasClass(empty_cell)) return right_lower_cell;\n if ($(cells[right_lower_cell]).hasClass(machine_clicked) && $(cells[center_cell]).hasClass(empty_cell)) return center_cell;\n }\n\n if ($(cells[upper_center_cell]).hasClass(machine_clicked)) {\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[lower_center_cell]).hasClass(empty_cell)) return lower_center_cell;\n if ($(cells[lower_center_cell]).hasClass(machine_clicked) && $(cells[center_cell]).hasClass(empty_cell)) return center_cell;\n }\n\n if ($(cells[left_center_cell]).hasClass(machine_clicked)) {\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[right_center_cell]).hasClass(empty_cell)) return right_center_cell;\n if ($(cells[right_center_cell]).hasClass(machine_clicked) && $(cells[center_cell]).hasClass(empty_cell)) return center_cell;\n }\n\n if ($(cells[right_upper_cell]).hasClass(machine_clicked)) {\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[left_lower_cell]).hasClass(empty_cell)) return left_lower_cell;\n if ($(cells[left_lower_cell]).hasClass(machine_clicked) && $(cells[center_cell]).hasClass(empty_cell)) return center_cell;\n if ($(cells[right_center_cell]).hasClass(machine_clicked) && $(cells[right_lower_cell]).hasClass(empty_cell)) return right_lower_cell;\n if ($(cells[right_lower_cell]).hasClass(machine_clicked) && $(cells[right_center_cell]).hasClass(empty_cell)) return right_center_cell;\n }\n\n if ($(cells[left_lower_cell]).hasClass(machine_clicked)) {\n if ($(cells[lower_center_cell]).hasClass(machine_clicked) && $(cells[right_lower_cell]).hasClass(empty_cell)) return right_lower_cell;\n if ($(cells[right_lower_cell]).hasClass(machine_clicked) && $(cells[lower_center_cell]).hasClass(empty_cell)) return lower_center_cell;\n }\n\n if ($(cells[left_upper_cell]).hasClass(empty_cell)) {\n if ($(cells[upper_center_cell]).hasClass(machine_clicked) && $(cells[right_upper_cell]).hasClass(machine_clicked)) return left_upper_cell;\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[right_lower_cell]).hasClass(machine_clicked)) return left_upper_cell;\n if ($(cells[left_center_cell]).hasClass(machine_clicked) && $(cells[left_lower_cell]).hasClass(machine_clicked)) return left_upper_cell;\n }\n\n if ($(cells[left_center_cell]).hasClass(empty_cell) &&\n $(cells[center_cell]).hasClass(machine_clicked) &&\n $(cells[right_center_cell]).hasClass(machine_clicked)) return left_center_cell;\n\n if ($(cells[upper_center_cell]).hasClass(empty_cell) &&\n $(cells[center_cell]).hasClass(machine_clicked) &&\n $(cells[lower_center_cell]).hasClass(machine_clicked)) return upper_center_cell;\n\n if ($(cells[left_lower_cell]).hasClass(empty_cell) &&\n $(cells[lower_center_cell]).hasClass(machine_clicked) &&\n $(cells[right_lower_cell]).hasClass(machine_clicked)) return left_lower_cell;\n\n if ($(cells[right_upper_cell]).hasClass(empty_cell)) {\n if ($(cells[right_center_cell]).hasClass(machine_clicked) && $(cells[right_lower_cell]).hasClass(machine_clicked)) return right_upper_cell;\n if ($(cells[center_cell]).hasClass(machine_clicked) && $(cells[left_lower_cell]).hasClass(machine_clicked)) return right_upper_cell;\n }\n }", "function movePieces() {\n currentTime--\n timeLeft.textContent = currentTime\n autoMoveCars()\n autoMoveLogs()\n moveWithLogLeft()\n moveWithLogRight()\n lose()\n }", "function tie() {\n hero.classList.add('defendRun');\n heroBlockSound.play();\n monsta.classList.add('monstaDefend');\n disallowDefendClick();\n setTimeout(function() {\n hero.classList.remove('defendRun');\n monsta.classList.remove('monstaDefend');\n allowDefendClick();\n }, 1400);\n}", "function scheduleNextPart() {\n \tif ((currentPos+1) < schedule.length) {\t\t\t\t// If we're not at the end of schedule...\n\t \tSeniorDads.Music.SetBreakPoint(\t\t\t\t\t\t// Set the next part to execute at the next music breakpoint.\n\t \t\t\tschedule[currentPos+1].trackPos, \n\t \t\t\tschedule[currentPos+1].patternPos, \n\t \t\t\tdoNextPart\n\t \t);\n\t \tif (DEBUG) \t\t\t// If we're debugging, display when the next part is going to happen.\n\t\t \tdocument.getElementById('scheduleInfo').innerHTML = \"<br/><br/>Playing schedule part \" + currentPos + \" of \" + schedule.length +\n\t \t\t\". Next part will be played at module position track \" + SeniorDads.Music.BreakPoint_Track +\", position \" + SeniorDads.Music.BreakPoint_Pattern + \n\t \t\t\". \";\n \t}\n \telse {\t\t// If we're at the end of the schedule, reset schedule/\n \t\tif (DEBUG) document.getElementById('scheduleInfo').innerHTML = \"<br/><br/>End of schedule. Resetting. \";\t// If we're debugging, display that we're at the end of schedule\n \t\tresetContent();\t\t\t\t\t\t// Reset any content that needs reset\n\t\t\t\tcurrentPos = 0;\t\t\t\t\t\t// Reset schedule pointer\n\t \tSeniorDads.Music.SetBreakPoint(\t\t// And get ready to start the demo again as soon as the music re-starts\n\t\t \t\t\tschedule[currentPos+1].trackPos, \n\t\t \t\t\tschedule[currentPos+1].patternPos, \n\t\t \t\t\tdoNextPart\n\t\t \t);\n \t}\n }", "function makeAutoMove(t) {\n moveSnake(direction);\n setAutoMoveTimer();\n}", "function Update () \r\n{\r\n\t\r\n\ttrainTimer = trainTimer - Time.fixedDeltaTime;\r\n\t//Debug.Log (\"trainTimer : \" + trainTimer);\r\n\r\n\t// The step size is equal to speed times frame time.\r\n\tstep = speed * Time.deltaTime;\r\n\t\r\n\t// hit the backspace button to see if the train array completed correctly\r\n\t/*if (Input.GetKeyDown (KeyCode.Backspace))\r\n\t{\r\n\t\r\n\t\tif (switchHit == false)\r\n\t\t\tswitchHit = true;\r\n\t\t\ttheTrain.SetActive (true);\r\n\t\r\n\t}*/\r\n\t\r\n\t// If the time has counted down and is either at or less than zero\r\n\tif (trainTimer <= 0)\r\n\t{\r\n\t\r\n\t\tswitchHit = true;\r\n\t\ttheTrain.SetActive (true);\r\n\t\r\n\t}\r\n\t\r\n\t// IF THE TRAIN IS NOT MOVING AND THE SWITCH HAS BEEN HIT\r\n\tif (!isMoving && switchHit)\r\n\t{\r\n\t\t\r\n\t\t// start moving around the track\r\n\t\tTravelTrack ();\r\n\t\r\n\t}\r\n\t\r\n}", "moveTo() {\r\n this.move();\r\n if(this.position.x+this.width/2 > this.movingTo.x) {\r\n this.movement.x = -this.speed;\r\n this.side = false;\r\n } if(this.position.x+this.width/2 < this.movingTo.x) {\r\n this.movement.x = this.speed;\r\n this.side = true;\r\n }\r\n if(this.position.y+this.height/2 > this.movingTo.y) {\r\n this.movement.y = -this.speed;\r\n } if(this.position.y+this.height/2 < this.movingTo.y) {\r\n this.movement.y = this.speed;\r\n }\r\n }", "function moveForward(rover){\r\n let outBoundaries=false; \r\n \r\n switch(rover.direction){ \r\n case \"N\":\r\n { \r\n if(rover.position.y===0)\r\n outBoundaries=true;\r\n else\r\n {\r\n rover.position.y--; \r\n rover.travelLog.push({x:rover.position.x,y:rover.position.y});\r\n }\r\n \r\n }\r\n break;\r\n case \"W\":\r\n {\r\n if(rover.position.x===0)\r\n outBoundaries=true;\r\n else\r\n {\r\n rover.position.x--; \r\n rover.travelLog.push({x:rover.position.x,y:rover.position.y});\r\n } \r\n \r\n }\r\n break;\r\n case \"S\":\r\n { \r\n if(rover.position.y===9)\r\n outBoundaries=true;\r\n else\r\n {\r\n rover.position.y++; \r\n rover.travelLog.push({x:rover.position.x,y:rover.position.y});\r\n } \r\n \r\n }\r\n break;\r\n case \"E\":\r\n {\r\n if(rover.position.x===9)\r\n outBoundaries=true;\r\n else\r\n {\r\n rover.position.x++; \r\n rover.travelLog.push({x:rover.position.x,y:rover.position.y});\r\n } \r\n }\r\n break;\r\n } \r\n\r\n if(outBoundaries)\r\n console.log(\"You can't place player outside of the board!\");\r\n\r\n}", "function fly(){\n\t\n\t\tclient.takeoff();\n\t\tclient.after(1000, function() \n\t\t\t{\n\t\t\tthis.clockwise(0.5);\n\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\t \n }", "takeAction(){\n let currentPosition = this.currentPlayer.positionOnBoard;\n let space = propertyData[currentPosition];\n\n // player lands on a property| railroad | utilities space (STATE)\n if (space.streetName) {\n console.log(\"I'm on a property\");\n } else if (space.name.includes('Railroad')) {\n console.log(\"I'm on a railroad\");\n } else if (space.name.includes('Electric')) {\n console.log(\"I'm on Electric utility space\");\n } else if (space.name.includes('Waterworks')) {\n console.log(\"I'm on WaterWorks utility space\");\n }\n \n // ✅ player lands on a TAX space\n else if (space.name.includes('Income Tax')) {\n this.currentPlayer.pay(space.price);\n\n } else if (space.name.includes('Luxury Tax')) {\n this.currentPlayer.pay(space.price);\n\n } \n \n // player lands on Community Chest | Chance space (STATE)\n else if (space.name.includes('Community')) {\n console.log(\"Pick a card from Comm chest deck\");\n } else if (space.name.includes('Chance')) {\n console.log(\"Pick a card from Chance deck\");\n } \n \n // player lands on spaces with NO actions\n else if (space.name.includes('Jail')) {\n console.log(\"I'm rotting in jail\");\n } else if (space.name.includes('Visiting')) {\n console.log(\"I'm just visiting. Do nothing\");\n } else if (space.name.includes('Parking')) {\n console.log(\"I'm on free parking. Do nothing\");\n } \n\n // player lands on GO TO JAIL space\n else if (space.name.includes('Go To')) {\n console.log(\"Time to go to jail\");\n this.currentPlayer.goToJail();\n } \n \n // player lands on GO, collect salary\n else if (currentPosition === 0) {\n console.log(\"Time to collect salary $200\");\n this.currentPlayer.collect(200);\n }\n}", "trigger(loudness) {\n if (this.triggerChord !== null) {\n this.triggerChord.forEach(v => {\n let voice = this.__getVoice__();\n Object.assign(voice, this.properties);\n voice.note(v, loudness);\n this.__runVoice__(voice, this);\n });\n } else if (this.triggerNote !== null) {\n let voice = this.__getVoice__();\n Object.assign(voice, this.properties);\n voice.note(this.triggerNote, loudness);\n this.__runVoice__(voice, this);\n } else {\n let voice = this.__getVoice__();\n Object.assign(voice, this.properties);\n voice.trigger(loudness);\n this.__runVoice__(voice, this);\n }\n }", "function battleMapTowerBuildStarted() {\n let tempTowerSlotToBuild = store.getState().towerSlotToBuild.split('_')[2];\n let tempTowerToBuild = store.getState().towerToBuild;\n let tempActualTower = ('tower_slot_' + tempTowerSlotToBuild);\n let tempData = 0;\n mainSfxController(towerBuildingSfxSource);\n\n if(tempTowerSlotToBuild == 7) {\n battleMap1BuildHereTextid.classList.add('nodisplay');\n }\n\n let tempParameters = [tempTowerSlotToBuild, tempTowerToBuild];\n\n for (let i = 0; i < store.getState().animationendListened.length; i++) {\n if (store.getState().animationendListened[i][0] == tempActualTower && store.getState().animationendListened[i][1] == 'animationend') {\n tempData = 1;\n }\n }\n\n if (tempData !== 1){\n towerSlotEventListenerWatcherStateChangeStarter(tempActualTower, 'animationend');\n addEvent(battleMap1TowerPlaceList[tempTowerSlotToBuild - 1], 'animationend', battleMapTowerBuildFinished, tempParameters);\n }\n }", "function gettingDraggedAway(){\n\tstory(\"The guy out of the middle of nowhere hits you to the ground and while you are dazed he starts to drag you\");\n\tchoices = [\"Throw up\",\"Pass out\",\"Grab something from the ground\"];\n\tanswer = setOptions(choices);\n}", "function starttriggers() {\r\n // If completion and not a completion refresh, send now\r\n if (__scd.t >= 300 && __scd.t < 400) {\r\n if (__sco.oldtype != \"3\")\r\n __sco.management.sendtoapi();\r\n }\r\n else {\r\n // If the triggers have already been set up and we are using load then this is a re-run, otherwise set the triggers up\r\n if (__sco.type(__sco.management.trigger.set) == \"boolean\" && (__sco.contains(__sco.config.triggers, \"load\") || __sco.support.touchscreen))\r\n __sco.management.callback(\"load\");\r\n else\r\n __sco.management.trigger.setup();\r\n }\r\n }", "trigger(event) {\r\n if(this.currentState === this.config.initial && event === 'study'){\r\n this.currentState = 'busy';\r\n this.recordStates.push(this.currentState);\r\n this.currentStatePosition++;\r\n this.recordMethods.push('trigger');\r\n } else if (this.config.states[this.currentState].transitions[event]){\r\n this.currentState = this.config.states[this.currentState].transitions[event];\r\n this.recordStates.push(this.currentState);\r\n this.currentStatePosition++;\r\n this.recordMethods.push('trigger');\r\n } else throw new Error('Event isn\\'t exist in current state ');\r\n }", "function clickwalk(t) { \n arrived = true;\n if (player.x < t.x - 5){\n player.x += 10;\n arrived = false;\n }\n if (player.x > t.x + 6){\n player.x -= 10;\n arrived = false;\n }\n if (player.y < t.y - 9){\n player.y += 10;\n arrived = false;\n }\n if (player.y > t.y + 2){\n player.y -= 10;\n arrived = false;\n } \n if (arrived == true){\n clearInterval(pace);\n }\n}", "function moveLeft() {\n moveOn();\n }", "function movePieces() {\n currentTime--;\n timeLeft.textContent = currentTime;\n autoMoveCars();\n autoMoveLogs();\n moveWithLogLeft();\n moveWithLogRight();\n lose();\n \n }", "function soundButtonStateChangeStarter() {\n if (store.getState().sfxStatus == 'OFF') {\n store.dispatch( {\n type: SFX_ON,\n payload: {\n status: 'ON',\n }\n });\n return\n }\n if (store.getState().sfxStatus == 'ON') {\n store.dispatch( {\n type: SFX_OFF,\n payload: {\n status: 'OFF',\n }\n });\n return\n }\n }", "function small_turn(dir) {\n const motor_dur_small_turn = 55;\n const motor_spd_forward = 500;\n const motor_spd_reverse = -500; \n \n //value of motor duration and speed corresponds to the angles that robot\n //should turn. In this case, we want the robot to make small turns.\n \n //speed of motor have the same absolute values so each motor will rotate \n //the same amount but in opposite directions\n \n if (dir === \"left\") {\n ev3_runForTime(motorA, motor_dur_small_turn, motor_spd_forward);\n ev3_runForTime(motorB, motor_dur_small_turn, motor_spd_reverse);\n ev3_pause(100);\n } else if (dir === \"right\") {\n ev3_runForTime(motorA, motor_dur_small_turn, motor_spd_reverse);\n ev3_runForTime(motorB, motor_dur_small_turn, motor_spd_forward);\n ev3_pause(100);\n } else {}\n}", "function small_turn(dir) {\n const motor_dur_small_turn = 55;\n const motor_spd_forward = 500;\n const motor_spd_reverse = -500; \n \n //value of motor duration and speed corresponds to the angles that robot\n //should turn. In this case, we want the robot to make small turns.\n \n //speed of motor have the same absolute values so each motor will rotate \n //the same amount but in opposite directions\n \n if (dir === \"left\") {\n ev3_runForTime(motorA, motor_dur_small_turn, motor_spd_forward);\n ev3_runForTime(motorB, motor_dur_small_turn, motor_spd_reverse);\n ev3_pause(100);\n } else if (dir === \"right\") {\n ev3_runForTime(motorA, motor_dur_small_turn, motor_spd_reverse);\n ev3_runForTime(motorB, motor_dur_small_turn, motor_spd_forward);\n ev3_pause(100);\n } else {}\n}", "function checkOnTick(event, tp, wp, EP, radStart){\n // this function checks the logic loop every MSTICK seconds\n // only checks timing things - interaction with objects should be\n // added with addEventListener in a easeljs object's construction\n if (wp.trialSection==='goToStart'){\n var pxMouse = stage.mouseX;\n var pyMouse = stage.mouseY;\n var inStartPoint = withinRad(pxMouse, pyMouse, tp.pxStart, tp.pyStart,\n radStart);\n if(inStartPoint){\n var tNow = getTime();\n if(tNow - wp.tInStart > EP.MSMINTIMEINSTART){\n setup_makeChoice();\n }\n }\n } // end goToStart\n else if (wp.trialSection==='makeChoice'){\n if(EP.MSMAXTIMETOCHOICE !== null){ // if choice time constraint\n var tNow = getTime();\n if(tNow - wp.tChoiceStarted > EP.MSMAXTIMETOCHOICE){\n setup_tooSlow();\n }\n }\n } // end makeChoice\n else if (wp.trialSection==='showFeedback'){\n var tNow = getTime();\n if(tNow - wp.tFeedbackOn > EP.MSSHOWFEEDBACK){\n setup_nextTrial();\n }\n }\n else if (wp.trialSection==='tooSlow'){\n var tNow = getTime();\n if(tNow - wp.tTooSlow > EP.MSTOOSLOW){\n msgs.tooSlow.visible = false;\n setup_goToStartPoint();\n }\n } // end tooSlow\n stage.update(event);\n }", "function letBotMoveProceed(callback) {\n if ((current_turn === tictactoe.first_player) && (player1.type === 'bot')) {\n var move_made = bot_move();\n callback(current_turn, move_made)\n toggleTurn();\n }\n }", "function roversMoves(rover, roverStill, indication) {\n if (rover.position[0]>10) {\n rover.position[0] = 0;\n } else if (rover.position[0]<0) {\n rover.position[0] = 9;\n }; \n if (rover.position[1]>10) {\n rover.position[1] = 0;\n } else if (rover.position[1]<0) {\n rover.position[1] = 9;\n };\n switch(moveRover[indication]) {\n case 'F':\n goForward(rover, roverStill);\n break;\n case 'B':\n goBackward(rover, roverStill);\n break;\n case 'R':\n switch(rover.direction) {\n case 'N':\n rover.direction = \"E\";\n break;\n case 'E':\n rover.direction = \"S\";\n break;\n case 'S':\n rover.direction = \"W\";\n break;\n case 'W':\n rover.direction = \"N\";\n break;\n }\n break;\n case 'L':\n switch(rover.direction) {\n case 'N':\n rover.direction = \"W\";\n break;\n case 'E':\n rover.direction = \"N\";\n break;\n case 'S':\n rover.direction = \"E\";\n break;\n case 'W':\n rover.direction = \"S\";\n break;\n }\n break;\n }\n if (avisoObstacle == true) {\n console.log(\"El Rover ha encontrado un obstaculo!!\");\n return indications = indications + moveRover.length + 1;\n };\n if (avisoRoverStill == true) {\n console.log(\"El Rover ha encontrado otro Rover!!\");\n return indications = indications + moveRover.length + 1;\n };\n}", "function Update () \r\n{\r\n\t\r\n\t// The step size is equal to speed times frame time.\r\n\tstep = speed * Time.deltaTime;\r\n\t\r\n\t// if this police officer is waiting (isWaiting == true)\r\n\tif (isWaiting)\r\n\t{\r\n\t\t\r\n\t\t// stop him from moving\r\n\t\tstillPursuiting = false;\r\n\t\r\n\t}\r\n\t\r\n\t// If this police officer is not moving and the \"MeasuredDistance\" is less than the REQUIRED DISTANCE\r\n\t/////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\t//// ALSO CHECK IF THE COP IS TOUCHING ANOTHER COP (SO THEY DONT JUST STACK ONTOP OF EACHOTHER)\r\n\t/////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\tif (!moving && MeasureDistance () < dist)\r\n\t{\r\n\t\r\n\t\t// set that the cop is \"stillPursuiting\"\r\n\t\tstillPursuiting = true;\r\n\t\t\r\n\t\tInPursuit ();\r\n\t\r\n\t}\r\n\t\r\n}", "function humanClicked(event)\n{\n if( origBoard[event.target.id] !== 'O' && origBoard[event.target.id] !== 'X' )\n {\n var status = gameAdvance(event.target.id,human);\n if(status==0 && !checkTie())\n {\n gameAdvance(bestSpot(),computer);\n }\n }\n}", "function delayedMove(recentWeapons, action) {\n const { srcId, tgtId, sendAt, percentageEnergyCap } = action.payload;\n const MODE = action.MODE;\n\n const match = df.getMyPlanets().filter((t) => t.locationId == srcId);\n\n // console.log(MODE, sendAt, Date.now() / 1000, srcId, tgtId);\n\n\n if (match.length == 0 && MODE !== \"WR\") {\n //Should delete self on this case\n terminal.println(\"[DELAYED]: Lost source; deleting action\", 4);\n return true; //should we return true here to delete itself?\n }\n const source = match[0];\n const target = df.getPlanetWithId(tgtId);\n\n\n if (MODE == \"WR\" && target.owner == df.account) {\n terminal.println(\"[DELAYED WR]: target acquired\", 4);\n return \"DONE\"; //only DONE when target is acquired\n }\n\n if (checkNumInboundVoyages(tgtId) >= 6) {\n //Too many inbound\n terminal.println(\"[DELAYED]: Too many inbounds\", 4);\n return; // will wait\n }\n\n if (!isWeaponReady(recentWeapons, source)) {\n terminal.println(\"[DELAYED]: TOOSOON\", 4);\n return;\n };\n\n //// if ASAP mode, check trigger level oe return; Note Pester is no longer here ///\n if (MODE == \"ASAP\" || MODE == \"WR\") {\n if (planetEnergy(source) < (100 - percentageEnergyCap) / 100 * source.energyCap) {\n terminal.println(\"[DELAYED ASAP/WR]: not enough health\", 4);\n return;\n }\n }\n\n\n // use our method ///\n let FORCES = Math.ceil(source.energy - source.energyCap * percentageEnergyCap / 100);\n let SILVER = 0;\n\n if (MODE == \"WR\") {\n FORCES = Math.ceil(source.energy - 10 * percentageEnergyCap / 100);\n // see if we should send silver\n if (target.silver < 0.6 * target.silverCap) {\n SILVER = 0.6 * target.silverCap - target.silver;\n SILVER = (SILVER < source.silver) ? SILVER : source.silver;\n }\n } // always send 90%\n\n\n if (sendAt < Date.now() / 1000) {\n console.log(\n `[DELAYED]: ${srcId.substring(8)} ATTACK LAUNCH ${Date(sendAt * 1000)}`\n );\n terminal.println(\"[DELAYED]: LAUNCHING ATTACK\", 4);\n\n //send attack\n terminal.println(`df.move('${srcId}', '${tgtId}', ${FORCES}, 0)`);\n seldonMove(source, target, FORCES, SILVER, recentWeapons);\n return true;\n } else {\n terminal.println(`[DELAYED]: ATTACK SCHEDULED in ${Math.round(sendAt - Date.now() / 1000)} seconds`);\n }\n return;\n }", "move(_timeslice) {\n switch (this.state) {\n case CUSTOMER_SITUATION.QUEUE: // Customer is in queue, but hasn't ordered yet\n let nextCustomer = KebapHouse.customers[KebapHouse.customers.indexOf(this) - 1];\n if (nextCustomer != undefined) { // When this customer isn't at the front of the line\n if ((new KebapHouse.Vector((nextCustomer.position.x - this.position.x), (nextCustomer.position.y - this.position.y)).length < 100)) {\n this.velocity.set(0, 0);\n break;\n }\n }\n if (this.position.y < 300) { // Stops customer in front of counter\n this.velocity.set(0, 0);\n this.state = CUSTOMER_SITUATION.WAITING;\n this.waiting();\n break;\n }\n else {\n this.velocity.set(0, -10);\n }\n break;\n case CUSTOMER_SITUATION.LEAVING:\n this.velocity.set(-10, 0);\n break;\n }\n super.move(_timeslice);\n }", "movement_left() {\n if (this.distance != 0) {\n let delay = 1000 / 60;\n this.scene.time.delayedCall(delay, () => {\n this.x -= this.movespeed;\n this.distance -= this.movespeed;\n this.movement_left();\n });\n }\n if (this.distance == 0) { \n console.log(this.x, this.y);\n this.moving = false;\n }\n }", "function Trigger() { }", "moveToTargetLogic(Engine) {\n if (this.item.target.x + (this.item.target.width / 2) < this.item.x + (this.item.width / 2)) {\n this.item.moveLeft = true;\n } else if (this.item.target.x + (this.item.target.width / 2) > this.item.x + (this.item.width / 2)) {\n this.item.moveRight = true;\n }\n if (this.item.target.y + (this.item.target.height / 2) < this.item.y + (this.item.height / 2)) {\n this.item.moveUp = true;\n } else if (this.item.target.y + (this.item.target.height / 2) > this.item.y + (this.item.height / 2)) {\n this.item.moveDown = true;\n }\n\n }", "function ArrowPressed(e) {\n if (e.key == 'ArrowRight' && (pieces[pieces.length - 1].x1 < W - sq || pieces[pieces.length - 1].x2 < W - sq || pieces[pieces.length - 1].x3 < W - sq || pieces[pieces.length - 1].x4 < W - sq && !pieces[pieces.length - 1].rightMargin)) {\n pieces[pieces.length - 1].x1 += sq;\n pieces[pieces.length - 1].x2 += sq;\n pieces[pieces.length - 1].x3 += sq;\n pieces[pieces.length - 1].x4 += sq;\n }\n\n if (e.key == 'ArrowLeft' && (pieces[pieces.length - 1].x1 > 0 || pieces[pieces.length - 1].x2 > 0 || pieces[pieces.length - 1].x3 > 0 || pieces[pieces.length - 1].x4 > 0 && !pieces[pieces.length - 1].leftMargin)) {\n pieces[pieces.length - 1].x1 -= sq;\n pieces[pieces.length - 1].x2 -= sq;\n pieces[pieces.length - 1].x3 -= sq;\n pieces[pieces.length - 1].x4 -= sq;\n }\n\n if (e.key == 'ArrowDown') {\n seconds = 2\n }\n\n\n if (e.key == 'ArrowUp') {\n pieces[pieces.length - 1].rotate();\n }\n}", "function turnLeft(rover){ // funcion para girar a la izquierda el Rover, un swich para cambiar la direción del rover.\nswitch(rover.direction){\n case 'N':\n rover.direction = 'W';\n break;\n case 'W': \n rover.direction = 'S';\n break;\n case \"S\":\n rover.direction = 'E' ; \n break;\n case 'E':\n rover.direction = 'N';\n break; \n } \n\nconsole.log(\"Gira a la izquierda!\");\n}", "check_GameMovie(){\n if(this.scene.showGameMovie){\n for (let i = this.model.playsCoords.length - 1; i >= 0; i--) {\n let playCoords = this.model.playsCoords[i];\n let playValues = this.model.playsValues[i];\n this.view.setPieceToStartPos(playCoords[0], playCoords[1], playValues[1]);\n }\n this.state = 'WAIT_GM_1st_ANIMATION_END';\n \n }\n }", "onBoardEndTurn(event) {\n if (event.currentTeam !== this.team)\n return;\n\n if (\n this.disposition === 'enraged' ||\n this.disposition === 'exhausted' && this.mRecovery === 1\n )\n event.addResults([{\n unit: this,\n changes: { name:'Furgon', disposition:null },\n }]);\n }", "trigger(event) {\r\n if (!this.config.states[this.state].transitions.hasOwnProperty(event)) {\r\n throw new Error();\r\n }\r\n\r\n switch (event) {\r\n\r\n case 'study' :\r\n this.changeState('busy');\r\n this.prev = (this.prev) ? 'normal' : false;\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'get_tired' :\r\n this.changeState('sleeping');\r\n this.prev = 'busy';\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'get_hungry' :\r\n this.changeState('hungry');\r\n this.prev = (this.prev == 'busy') ? 'busy' : 'sleeping';\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n\r\n case 'eat' :\r\n case 'get up' :\r\n this.changeState('normal');\r\n this.next.pop();\r\n this.possibleRedoCount++;\r\n break;\r\n }\r\n }", "function gameMenutoMainMenuButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'MAIN_MENU',\n previousPage: 'GAME_MENU'\n }\n });\n if (store.getState().musicStatus == 'ON') {\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: mainMenuMusicSource\n }\n });\n } else {\n store.dispatch( {\n type: MUSIC_OFF,\n payload: {\n status: 'OFF',\n src: mainMenuMusicSource\n }\n });\n }\n }", "resumeMovement() {\n // this.xspeed = 0.01;\n // this.xspeed = 0.01;\n // console.log(\"resuming \" + this.lastXSpeed);\n // this.xspeed = this.lastXSpeed;\n // this.yspeed = this.lastYSpeed;\n }", "function pomodoroEnds() {\n\n stopTimer();\n stopAmbientSound();\n increasePomodorosToday();\n var title = \"Time's Up\"\n var msg = \"Pomodoro ended.\" + \"\\n\" + \"You have done \" + Vars.Histogram[getDate()].pomodoros + \" today!\"; //default msg if habit not enabled\n var setComplete = Vars.PomoSetCounter >= Vars.UserData.PomoSetNum - 1;\n //If Pomodoro / Pomodoro Set Habit + is enabled\n if (Vars.UserData.PomoHabitPlus || (setComplete && Vars.UserData.PomoSetHabitPlus)) {\n FetchHabiticaData(true);\n var result = (setComplete && Vars.UserData.PomoSetHabitPlus) ? ScoreHabit(Vars.PomodoroSetTaskId, 'up') : ScoreHabit(Vars.PomodoroTaskId, 'up');\n if (!result.error) {\n var deltaGold = (result.gp - Vars.Monies).toFixed(2);\n var deltaExp = (result.exp - Vars.Exp).toFixed(2);\n var expText = deltaExp < 0 ? \"You leveled up!\" : \"You Earned Exp: +\" + deltaExp;\n msg = \"You Earned Gold: +\" + deltaGold + \"\\n\" + expText;\n FetchHabiticaData(true);\n } else {\n msg = \"ERROR: \" + result.error;\n }\n }\n\n Vars.PomoSetCounter++; //Update set counter\n\n if (setComplete) {\n title = \"Pomodoro Set Complete!\";\n }\n if (Vars.UserData.ManualBreak) {\n manualBreak();\n } else {\n startBreak();\n }\n\n //Badge\n chrome.browserAction.setBadgeBackgroundColor({\n color: \"green\"\n });\n chrome.browserAction.setBadgeText({\n text: \"\\u2713\"\n });\n\n //notify\n notify(title, msg);\n\n //play sound\n playSound(Vars.UserData.pomodoroEndSound, Vars.UserData.pomodoroEndSoundVolume, false);\n}", "function objTriggered(event) {\n // if the textBox is not on the screen, handle the trigger\n if (!textBox.showing) {\n // front/east\n if (event.data.id === 0) {\n // if clicking on keypad\n if ($(this).is(\"#keypad\")) {\n if (!gameBackground.doorOpened) {\n // enter close object view\n showCloserObj(0);\n }\n // if clicking on switch\n } else if ($(this).is(\"#switch\")) {\n // if the fuse is installed\n if (gameBackground.fuseInstalled) {\n // turn off or on the light\n if (!gameBackground.lightOff) {\n // display message\n textBox.insertText(\"I can turn off the light now\");\n gameBackground.lightOff = true;\n } else {\n textBox.insertText(\"Light is back on\");\n gameBackground.lightOff = false;\n }\n // if the fuse is not installed\n } else {\n textBox.insertText(\"It doesn't do anything\\nIs it broken?\");\n }\n SOUND_SWITCH.play();\n // if clicking on panel\n } else if ($(this).is(\"#panel\")) {\n // if the panel is opened\n if (gameBackground.panelOpened) {\n // if the fuse is installed\n if (gameBackground.fuseInstalled) {\n textBox.insertText(\"I think I fixed something at least\");\n } else {\n // if player is holding the fuce\n if (usingFuse) {\n textBox.insertText(\"I suppose it fits\");\n gameBackground.fuseInstalled = true; // install the fuse\n removeItem(1); // remove fuse from the inventory\n SOUND_PLUG_IN.play();\n // not holding the fuse\n } else {\n textBox.insertText(\"It looks like something is missing\");\n textBox.buffer(\"Maybe I can find it somewhere\");\n }\n }\n // if the panel is not opened\n } else {\n // if the player is holding the screwdriver\n if (usingScrewDriver) {\n // open the panel\n gameBackground.panelOpened = true;\n textBox.insertText(\"I unscrewed all the screws and opened the panel!\");\n SOUND_MOVE.play();\n // if not holding the screwdriver\n } else {\n textBox.insertText(\"A panel held by 4 screws\");\n textBox.buffer(\"I wonder if I can get it open with something\");\n SOUND_PANEL.stop();\n SOUND_PANEL.play();\n }\n }\n // if click on door\n } else if ($(this).is(\"#door\")) {\n // if the door is opened\n if (gameBackground.doorOpened) {\n state = \"END\"; // go to game over screen\n endFontHeight = height + height / 4; // initiate font height\n changeDirection(6); // update game background\n // hide inventory and direction indicator\n $inventory.hide();\n $directionIndicator.hide();\n // after 2s, play the music\n setTimeout(function() {\n playing = true;\n }, 2000);\n // display message\n textBox.insertText(\"Now I remeber!\\nI was opening my apartment door...\\nbut ended up in here\");\n textBox.buffer(\"Do I leave the Cube for good?\\nOr find Oliver and bring him home?\");\n // if door is locked\n } else {\n textBox.insertText(\"Door is locked\");\n textBox.buffer(\"I need to enter some kinda of\\npasscode or something?\");\n SOUND_DOOR_LOCKED.play();\n }\n }\n // left/north\n } else if (event.data.id === 1) {\n // if click on plant\n if ($(this).is(\"#plant\")) {\n // move the plant\n if (!gameBackground.plantMoved) {\n textBox.insertText(\"I moved the plant\\nThere's a number hidden under it\");\n gameBackground.plantMoved = true;\n SOUND_MOVE.play();\n }\n // if click on the card\n } else if ($(this).is(\"#card\")) {\n showCloserObj(2);\n // if click on left drawer\n } else if ($(this).is(\"#drawer-left\")) {\n // if drawer is not out\n if (!gameBackground.drawerLeftOut) {\n textBox.insertText(\"There's a screwdriver in this drawer\\nI'm taking it\");\n gameBackground.drawerLeftOut = true;\n addItem(0); // add the screwdriver to the inventory\n SOUND_DRAWER.play();\n }\n // if click on right drawer\n } else if ($(this).is(\"#drawer-right\")) {\n // if the drawer is not out\n if (!gameBackground.drawerRightOut) {\n textBox.insertText(\"It's empty\");\n gameBackground.drawerRightOut = true;\n SOUND_DRAWER.play();\n }\n // if click on book\n } else if ($(this).is(\"#book\")) {\n textBox.insertText(\"The green book named\\n\\\"The Key to the Light Is Under the Cube\\\"\\nhas nothing written on it\");\n textBox.buffer(\"The red book is fully blank\");\n SOUND_READ.play();\n }\n // back\n } else if (event.data.id === 2) {\n // if click on newspaper\n if ($(this).is(\"#newspaper\")) {\n showCloserObj(3);\n // if click on coffee machine\n } else if ($(this).is(\"#coffeemachine\")) {\n // if the coffee machine is not powered\n if (!gameBackground.coffeeMachinePowered) {\n textBox.insertText(\"It doesn't have power\");\n // if not holding the mug\n if (!usingMug) {\n SOUND_CM_SWITCH.play();\n }\n // if the machine is powered\n } else {\n // if the mug is placed\n if (gameBackground.mugPlaced) {\n // if the mug is not heated and machine is not running\n if (!gameBackground.coffeeMachineUsed && !coffeemachineRunning) {\n textBox.insertText(\"It's working!\");\n coffeemachineRunning = true; // set coffee machine to running\n SOUND_CM_WORKING.play();\n // after 12s, mug is heated and machine is not running anymore\n setTimeout(function() {\n gameBackground.coffeeMachineUsed = true;\n coffeemachineRunning = false;\n }, 12000);\n // if mug is heated\n } else {\n // if machine is not running\n if (!coffeemachineRunning) {\n textBox.insertText(\"There's hot water in the mug\");\n textBox.buffer(\"There's something written on the mug!\");\n gameBackground.mugPlaced = false; // remove the mug\n // if mug is not taken, add mug to the inventory\n if (!mugTaken) {\n addItem(2);\n }\n }\n }\n // if mug is not placed\n } else {\n // if the mug is not heated\n if (!gameBackground.coffeeMachineUsed) {\n textBox.insertText(\"I think I can use the coffee machine\\nfor coffee?\");\n textBox.buffer(\"I don't think it has coffee\\nWhat I get probably is gonna be hot water\");\n }\n }\n }\n // if holding the mug\n if (usingMug) {\n // if the machine is not powered\n if (!gameBackground.coffeeMachinePowered) {\n textBox.insertText(\"Yeah, I wish I could get some coffee\");\n textBox.buffer(\"But it doesn't have power\");\n // if powered\n } else {\n textBox.insertText(\"Let's get some coffee or hot water...\");\n }\n gameBackground.mugPlaced = true; // place the mug\n removeItem(2); // remove mug from inventory\n SOUND_PLACE_MUG.play();\n }\n // if click on plug\n } else if ($(this).is(\"#plug\")) {\n // if the machine is not powered\n if (!gameBackground.coffeeMachinePowered) {\n // if holding cord\n if (usingCord) {\n textBox.insertText(\"The extension cord is so useful...\\nin this way\");\n gameBackground.coffeeMachinePowered = true; // machine is powered\n removeItem(3); // remove cord from the inventory\n SOUND_PLUG_IN.play();\n // play after the plug in sound\n setTimeout(function() {\n SOUND_CM_POWERED.play();\n }, 250);\n // if not holding cord\n } else {\n textBox.insertText(\"Where do I plug this in?\");\n textBox.buffer(\"The only power socket is out of reach!\");\n }\n }\n // if click on socket\n } else if ($(this).is(\"#socket\")) {\n // if the machine is not powered\n if (!gameBackground.coffeeMachinePowered) {\n // if holding cord\n if (usingCord) {\n textBox.insertText(\"The extension cord is so useful...\\nin this way\");\n gameBackground.coffeeMachinePowered = true;\n removeItem(3);\n SOUND_PLUG_IN.play();\n setTimeout(function() {\n SOUND_CM_POWERED.play();\n }, 250);\n // if not holding the cord\n } else {\n textBox.insertText(\"Why is the power socket way up there?\");\n }\n // if machine is powered\n } else {\n textBox.insertText(\"I think I can use the coffee machine now\");\n }\n // if click on fuse\n } else if ($(this).is(\"#fuse\")) {\n // if the poster is not tore\n if (!gameBackground.posterOpened) {\n textBox.insertText(\"There's something behind...\");\n gameBackground.posterOpened = true;\n SOUND_POSTER.play();\n } else {\n // if the fuse is not taken\n if (!gameBackground.fuseTaken) {\n textBox.insertText(\"It's a fuse!\\nI'm taking it\");\n gameBackground.fuseTaken = true;\n addItem(1); // add fuse to the inventory\n }\n }\n }\n // right/south\n } else if (event.data.id === 3) {\n // if click on paintings\n if ($(this).is(\"#paintings\")) {\n textBox.insertText(\"There're 3 strange abstract paintings\");\n textBox.buffer(\"I wish I can understand them\");\n // if click on upper left cabin drawer\n } else if ($(this).is(\"#cabin-left\")) {\n if (!gameBackground.cabinLeftOut) {\n textBox.insertText(\"I found a mug in here\\nI'm taking it\");\n gameBackground.cabinLeftOut = true;\n addItem(2); // add mug to the inventory\n SOUND_DRAWER.play();\n }\n // if click on upper right cabin drawer\n } else if ($(this).is(\"#cabin-right\")) {\n if (!gameBackground.cabinRightOut) {\n textBox.insertText(\"There's nothing in it\");\n gameBackground.cabinRightOut = true;\n SOUND_DRAWER.play();\n }\n // if click on bottom cabin drawer\n } else if ($(this).is(\"#cabin-bottom\")) {\n if (!gameBackground.cabinBottomOut) {\n textBox.insertText(\"It's empty except the number written inside\");\n gameBackground.cabinBottomOut = true;\n SOUND_DRAWER.play();\n }\n // if click on manual\n } else if ($(this).is(\"#manual\")) {\n showCloserObj(4);\n }\n // down\n } else if (event.data.id === 4) {\n if (!gameBackground.trapDoorOpened) {\n showCloserObj(1); // show closer view of lock\n } else {\n // if the cord is not taken\n if (!gameBackground.cordTaken) {\n textBox.insertText(\"There's an extension cord under the floor\\nI'm taking it\");\n gameBackground.cordTaken = true;\n addItem(3); // add the cord to the inventory\n }\n }\n // up\n } else if (event.data.id === 5) {\n // if the light is off\n if (gameBackground.lightOff) {\n textBox.insertText(\"The writing on the ceiling...\\nIs it a riddle?\");\n textBox.buffer(\"Nine? What is 9 for?\");\n // if the light is on\n } else {\n textBox.insertText(\"A light on the ceiling\\nIt looks like nothing special\");\n }\n // end\n } else if (event.data.id === 6) {\n // left door\n if ($(this).is(\"#door-exit\")) {\n choiceMade = true;\n // right door\n } else if ($(this).is(\"#door-oliver\")) {\n choiceMade = true;\n endId = 1;\n }\n console.log(\"Game over\");\n SOUND_DOOR_OPEN.play();\n hideTriggers();\n }\n }\n}", "function takeAMasterMove(turn){ ... }", "function inPosA1() {\n\t//TWO LANE ROAD, POSITION A1\n\tif(coordOpt2 == 0 && coordOpt3 == 0){\n\t\trandomNum = Random.value * 10;\n\t\tif(targetDirF == true && randomNum <= 3){\n\t\t\t//do nothing, go forward\n\t\t\tcalculatingMove = false;\n\t\t}else if(targetDirL == true && randomNum > 3 && randomNum <= 6){\n\t\t\t//turn left\n\t\t\ttransform.GetComponent(aiStates).leftCoord = targetTurnL;\n\t\t\ttransform.GetComponent(aiStates).leftState = true;\n\t\t}else if(targetDirR == true && randomNum > 6){\n\t\t\t//turn right\n\t\t\tif(targetTurnR2 == 0){\n\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR1;\n\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t}else{\n\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR2;\n\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t}\n\t\t}else{\n\t\t\t//if none of the above, take first available option\n\t\t\tif(targetDirF == true){\n\t\t\t\t//do nothing, go forward\n\t\t\t\tcalculatingMove = false;\n\t\t\t}else if(targetDirL == true){\n\t\t\t\t//turn left\n\t\t\t\ttransform.GetComponent(aiStates).leftCoord = targetTurnL;\n\t\t\t\ttransform.GetComponent(aiStates).leftState = true;\n\t\t\t}else if(targetDirR == true){\n\t\t\t\t//turn right\n\t\t\t\tif(targetTurnR2 == 0){\n\t\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR1;\n\t\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t\t}else{\n\t\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR2;\n\t\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tDebug.Log(\"Error with turn selection 2ln road\");\n\t\t\t\ttransform.GetComponent(aiStates).startAgain = true;\n\t\t\t}\n\t\t}\n\t\t\n\t//THREE LANE ROAD, POSITION A1\n\t}else if(coordOpt2 == 0 && coordOpt3 != 0){\n\t\trandomNum = Random.value * 10;\n\t\tif(targetDirF == true && randomNum < 6){\n\t\t\t//do nothing, go forward\n\t\t\tcalculatingMove = false;\n\t\t}else if(targetDirR == true){\n\t\t\t//turn right\n\t\t\tif(targetTurnR2 == 0){\n\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR1;\n\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t}else{\n\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR2;\n\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t}\n\t\t}else{\n\t\t\tif(targetDirF == true){\n\t\t\t\t//do nothing, go forward\n\t\t\t\tcalculatingMove = false;\n\t\t\t}else if(targetDirR == true){\n\t\t\t\t//turn right\n\t\t\t\tif(targetTurnR2 == 0){\n\t\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR1;\n\t\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t\t}else{\n\t\t\t\t\ttransform.GetComponent(aiStates).rightCoord = targetTurnR2;\n\t\t\t\t\ttransform.GetComponent(aiStates).rightState = true;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tDebug.Log(\"Error with turn selection 3ln road\");\n\t\t\t\ttransform.GetComponent(aiStates).startAgain = true;\n\t\t\t}\n\t\t}\n\t\n\t//FOUR LANE ROAD, POSITION A1\n\t}else if(coordOpt3 == 0 && coordOpt2 != 0){\n\t\trandomNum = Random.value * 10;\n\t\tif(targetDirF == true && randomNum > 6){\n\t\t\t//do nothing, go forward\n\t\t\tcalculatingMove = false;\n\t\t}else if(targetDirL == true){\n\t\t\t//turn left\n\t\t\ttransform.GetComponent(aiStates).leftCoord = targetTurnL;\n\t\t\ttransform.GetComponent(aiStates).leftState = true;\n\t\t}else{\n\t\t\tif(targetDirF == true){\n\t\t\t\t//do nothing, go forward\n\t\t\t\tcalculatingMove = false;\n\t\t\t}else if(targetDirL == true){\n\t\t\t\t//turn left\n\t\t\t\ttransform.GetComponent(aiStates).leftCoord = targetTurnL;\n\t\t\t\ttransform.GetComponent(aiStates).leftState = true;\n\t\t\t}else{\n\t\t\t\tDebug.Log(\"Error with turn selection 4ln road\");\n\t\t\t\ttransform.GetComponent(aiStates).startAgain = true;\n\t\t\t}\n\t\t}\n\t\t\t\t\n\t//FIVE LANE ROAD, POSITION A1\n\t}else if(coordOpt2 != 0 && coordOpt3 != 0){\n\t\t//5ln road\n\t\t//MUST GO FORWARD\n\t\tcalculatingMove = false;\n\t\tif(targetDirF == false){\n\t\t\ttransform.GetComponent(aiStates).startAgain = true;\n\t\t}\n\t}\n}", "function check_arrow(event){\r\n\r\n const LEFT_KEY = 37;\r\n const RIGHT_KEY = 39;\r\n const UP_KEY = 38;\r\n const DOWN_KEY = 40;\r\n\r\n if(changing_direction) return;\r\n changing_direction = true;\r\n const keyPressed = event.keyCode;\r\n // Use this to check if the snake is moving in the reverse side\r\n const goingUp = dy === -10;\r\n const goingDown = dy === 10;\r\n const goingRight = dx === 10;\r\n const goingLeft = dx === -10;\r\n\r\n if(keyPressed === LEFT_KEY && !goingRight){\r\n dx = -10;\r\n dy = 0;\r\n }\r\n\r\n if(keyPressed === RIGHT_KEY && !goingLeft){\r\n dx = 10;\r\n dy = 0;\r\n }\r\n\r\n if(keyPressed === UP_KEY && !goingDown){\r\n dx = 0;\r\n dy = -10;\r\n }\r\n\r\n if(keyPressed === DOWN_KEY && !goingUp){\r\n dx = 0;\r\n dy = 10;\r\n }\r\n}", "function arrived() {\n\tdoor.GetComponent(DoorController).arrived();\n\tdoor = null;\n\tTime.timeScale = 1;\n}", "moveIsSmart() {}", "isInMovement() {\n //if(this.resOffset !== this.workResOffset || this.canvasStartTime.getJulianMinutes() !== this.workStartTime.getJulianMinutes() || this.canvasEndTime.getJulianMinutes() !== this.workEndTime.getJulianMinutes()) {\n if (this.isPanning || this.isSwiping) {\n return true;\n } else {\n return false;\n }\n }", "function driveLeft(){\r\n if(carLookingFront()){\r\n document.getElementById(\"outputBox\").value=\"You have to TURN the car in the right direction!\";\r\n return false;\r\n } else {\r\n $(\"#car-icon\").animate({\r\n left: \"0\"\r\n }, 1500).removeClass(\"Moved\").css({right: ''});\n document.getElementById(\"outputBox\").value=\"Car goes wiiiiiiiiiii!!!!!\";\r\n fuel--;\r\n animateFuel();\r\n console.log(\"Fuel is \" + fuel);\r\n }\r\n}", "checkSnakeStatus() {\n this.didSnakeEatAnApple();\n this.didSnakeHitAWall();\n this.didSnakeEatItself();\n }", "function setTrigger() {\r\n\t$each(MoCheck.aktJobs, function(job, index) {\r\n\t\tvar aktJobId = job.pos.x + '_' + job.pos.y;\r\n\t\t\t\t\r\n\t\t/* checks if the player can do the job and sets the way time*/\r\n\t\tvar reload_task_points = Tasks.reload_task_points(job.jobCalc.task_skills, job.jobCalc.malus, 'job', job.window, job.jobCalc.jobId);\r\n\t\t\r\n\t\treload_task_points();\r\n\t\tjob.refresh_way_time();\r\n\r\n\t\tvar eventname = 'windowJob_' + aktJobId;\r\n\t\tWEvent.register('jobCalcDuration_' + aktJobId, MoCheck.durationChanged.store(job), eventname);\r\n\t\tWEvent.register('character_speed_changed', job.refresh_way_time.store(job), eventname);\r\n\t\tWEvent.register('character_values_changed', reload_task_points.store(job), eventname);\r\n\t\tWEvent.register('character_values_changed', job.calcDuration.store(job), eventname);\r\n\t\tjob.calcDuration();\r\n\t});\r\n}", "function turnBased() {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n $('.col').click((event) => {\n if ($(event.target).hasClass('highlight')) {\n let currentPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n newBoard.movePlayer(newBoard.activePlayer.character);\n $(event.target).addClass('player').attr('id', `${newBoard.activePlayer.character}`);\n let newPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n collectWeapon(newBoard.activePlayer, currentPlayerCell, newPlayerCell);\n newBoard.switchPlayer();\n if (fightCondition(newPlayerCell) === true) {\n alert('The fight starts now');\n startFight(newBoard.activePlayer, newBoard.passivePlayer);\n }\n else {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n }\n }\n })\n }", "function setPrecondition() {\n var tomorrowDate = new Date(Date.now() + 1000*60*60*24).toLocaleDateString();\n\n try {\n // check if the car is with 0.25 miles of home\n if (isM3Home()) {\n // get start and stop time preferences\n var start_time = Sheets.Spreadsheets.Values.get(SPREADSHEET_ID, 'Smart Climate!B20').values[0];\n var stop_time = Sheets.Spreadsheets.Values.get(SPREADSHEET_ID, 'Smart Climate!B21').values[0];\n \n // specific date/time to create a trigger for tomorrow morning at the preferred start time and stop time\n var estimatedChargeStartTime = new Date (tomorrowDate + ' ' + start_time);\n var estimatedChargeStopTime = new Date (tomorrowDate + ' ' + stop_time);\n \n // create triggers\n if (!doesTriggerExist('preconditionM3Start')) { ScriptApp.newTrigger('preconditionM3Start').timeBased().at(estimatedChargeStartTime).create(); }\n if (!doesTriggerExist('preconditionM3Stop')) { ScriptApp.newTrigger('preconditionM3Stop').timeBased().at(estimatedChargeStopTime).create(); }\n }\n } catch (e) {\n logError(e);\n\n wakeVehicle(M3_VIN);\n Utilities.sleep(WAIT_TIME);\n setPrecondition();\n }\n\n try {\n // check if the car is with 0.25 miles of home\n if (isMXHome()) { \n // get start and stop time preferences\n var start_time = Sheets.Spreadsheets.Values.get(SPREADSHEET_ID, 'Smart Climate!I20').values[0];\n var stop_time = Sheets.Spreadsheets.Values.get(SPREADSHEET_ID, 'Smart Climate!I21').values[0];\n \n // specific date/time to create a trigger for tomorrow morning at the preferred start time and stop time\n var estimatedChargeStartTime = new Date (tomorrowDate + ' ' + start_time);\n var estimatedChargeStopTime = new Date (tomorrowDate + ' ' + stop_time);\n \n // create triggers\n if (!doesTriggerExist('preconditionMXStart')) { ScriptApp.newTrigger('preconditionMXStart').timeBased().at(estimatedChargeStartTime).create(); }\n if (!doesTriggerExist('preconditionMXStop')) { ScriptApp.newTrigger('preconditionMXStop').timeBased().at(estimatedChargeStopTime).create(); }\n }\n } catch (e) {\n logError(e);\n\n wakeVehicle(MX_VIN);\n Utilities.sleep(WAIT_TIME);\n setPrecondition();\n }\n}", "function toggle()\n{\n\tif(speed == 0) \n\t{\n\t\tspeed = 3; //start snake and set button to stop\n\t\tdocument.getElementById(\"toggle\").value = \"Stop\";\n\t}\n\telse \n\t{\n\t\tspeed = 0; //stop the snake and set button to start\n\t\tdocument.getElementById(\"toggle\").value = \"Start\";\n\t}\n}", "startJourney() {\n this.running = true;\n this.previousTime = false;\n this.ui.notify('The journey through the wasteland begins', 'positive');\n this.step();\n }" ]
[ "0.6432564", "0.58268195", "0.57948023", "0.5681667", "0.56473446", "0.5629448", "0.5608625", "0.56054014", "0.55810356", "0.55487853", "0.55378455", "0.5512543", "0.5504311", "0.550009", "0.5433698", "0.54334325", "0.5405912", "0.5402863", "0.5391505", "0.53673637", "0.5357026", "0.5341284", "0.53407604", "0.53305686", "0.53057456", "0.5303403", "0.53030986", "0.52923787", "0.5287061", "0.5276577", "0.52741927", "0.5272956", "0.52717006", "0.52645254", "0.5258589", "0.525658", "0.52554715", "0.5247372", "0.52291036", "0.5208523", "0.52081597", "0.52061504", "0.52003443", "0.5195712", "0.51898474", "0.5185694", "0.51816756", "0.51786685", "0.51764536", "0.51743776", "0.5170309", "0.5168069", "0.51667315", "0.51564205", "0.5152121", "0.51484436", "0.51481634", "0.51469564", "0.51462704", "0.51428837", "0.5142879", "0.5141822", "0.5132687", "0.5130863", "0.51279736", "0.512544", "0.5124394", "0.51214945", "0.51214945", "0.51213557", "0.5120394", "0.5119095", "0.51147515", "0.5111042", "0.5110823", "0.51100904", "0.51095665", "0.5106487", "0.5100506", "0.5097833", "0.5096784", "0.5096618", "0.5093454", "0.50898373", "0.5086846", "0.5080479", "0.50777507", "0.50754535", "0.5072003", "0.5068191", "0.50605375", "0.5060288", "0.50593376", "0.5055504", "0.50533545", "0.50532323", "0.50485015", "0.5047891", "0.50464165", "0.5046337", "0.50447506" ]
0.0
-1
Handlers that control what happens following a movestart
function activeMousemove(e) { var event = e.data.event, timer = e.data.timer; updateEvent(event, e, e.timeStamp, timer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMove() {\n }", "function forwardStep(e) {\n setMedia();\n media.currentTime = media.currentTime + trjs.param.forwardskip;\n }", "move(){\r\n if (this.counter % this.trajectory[this.step][Trajectory.Duration] == 0) {\r\n this.hide()\r\n this.step ++\r\n this.counter= 0\r\n basic.pause(50)\r\n if (this.step == this.trajectory.length) {\r\n this.active = false \r\n } else {\r\n this.y = this.trajectory[this.step][Trajectory.Vertical]\r\n led.plotBrightness(this.x, this.y, this.y == 4 ? 255 : this.brightness)\r\n }\r\n this.show()\r\n }\r\n this.counter ++\r\n }", "function BeforeMoveActions() {\n EnableTrackBoard();\n EnableMineDrag();\n}", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "function fireNextFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToNextFrame();\n }", "_strikePointerMove() {\n for (let i = 0; i < this._pointerMoveCallbacks.length; i++) {\n let currentCallback = this._pointerMoveCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._pointerMoveCallbacks.length; i++) {\n if (this._pointerMoveCallbacks[i][1])\n this._pointerMoveCallbacks.splice(i--, 1);\n }\n }", "transitionToRemap() {\n if (this.tick <= 50) {\n this.tutorial.alpha -= 0.02;\n this.fireToContinue.alpha -= 0.02;\n }\n else if (this.tick <= 100) {\n this.remapHeaderText.alpha += 0.02;\n this.remapKB.alpha += 0.02;\n this.remapButtonText.alpha += 0.02;\n }\n else {\n this.state = 4;\n this.tick = 0;\n this.remapPressText.alpha = 1;\n }\n }", "function follow(event) {\n trail[count%10].style.left = (event.pageX - 4) + \"px\";\n trail[count%10].style.top = (event.pageY - 4) + \"px\";\n count++;\n }", "function inBetweenNext() {\r\r // =======================================================\r var idmove = charIDToTypeID( \"move\" );\r var desc10 = new ActionDescriptor();\r var idnull = charIDToTypeID( \"null\" );\r var ref7 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idTrgt = charIDToTypeID( \"Trgt\" );\r ref7.putEnumerated( idLyr, idOrdn, idTrgt );\r desc10.putReference( idnull, ref7 );\r var idT = charIDToTypeID( \"T \" );\r var ref8 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idNxt = charIDToTypeID( \"Nxt \" );\r ref8.putEnumerated( idLyr, idOrdn, idNxt );\r desc10.putReference( idT, ref8 );\r executeAction( idmove, desc10, DialogModes.NO );\r\r // =======================================================\r var idnextFrame = stringIDToTypeID( \"nextFrame\" );\r var desc43 = new ActionDescriptor();\r var idtoNextWholeSecond = stringIDToTypeID( \"toNextWholeSecond\" );\r desc43.putBoolean( idtoNextWholeSecond, false );\r executeAction( idnextFrame, desc43, DialogModes.NO );\r\r}", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Move_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const beacon = xy_locs(player_relative, _PLAYER_NEUTRAL)\n if (!beacon) {\n return FUNCTIONS.no_op()\n }\n const axis = 0\n const beacon_center = numpy.round(numpy.mean(beacon, axis))\n return FUNCTIONS.Move_screen('now', beacon_center)\n }\n return FUNCTIONS.select_army('select')\n }", "function firePreviousFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToPreviousFrame();\n }", "function firePreviousFrame() {\n // Trigger event for animator.\n // Notice, when animator handles the event, it also gives the callback event back.\n // Then, the flow automatically continues also here.\n firePause();\n changeToPreviousFrame();\n }", "movePress( press ) {\n sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener movePress' );\n sceneryLog && sceneryLog.InputListener && sceneryLog.push();\n\n this.reposition();\n\n sceneryLog && sceneryLog.InputListener && sceneryLog.pop();\n }", "handleClick () {\n super.handleClick()\n this.player_.trigger('next')\n }", "prev() {\n --this.move_index; //decrease move count\n this.draw_everything();\n }", "goNextMove() {\n let piecesToMove = null; // this holds the pieces that are allowed to move\n let piecesToStayStill = null; // the others\n if (this.WhiteToMove == true) {\n // white is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.White); // get the info from the model\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.Black);\n } else {\n // black is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.Black);\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.White);\n }\n // add listeners for the pieces to move\n piecesToMove.forEach(curPiece => {\n this.GameView.bindMouseDown(\n curPiece.RowPos,\n curPiece.ColPos,\n this.mouseDownOnPieceEvent\n );\n });\n\n // remove listeners for the other pieces\n piecesToStayStill.forEach(curPiece => {\n // TRICKY: remove piece and add it again to remove the listeners !\n this.GameView.removePieceFromBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n this.GameView.putPieceOnBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n });\n this.WhiteToMove = !this.WhiteToMove; // switch player\n }", "function frame() {\n if (bottom < newBottom) {\n bottom = bottom + factorBottom\n side = side + factorSide\n elem.style.bottom = bottom + 'px';\n elem.style.right = side + 'px';\n clickable = false; // During the move, clickable is false so no card can be clicked during the movement\n } else {\n\t clearInterval(id);\n moveBack();\n }\n }", "function prev() {\n --move_index; //decrease move count\n draw_everything();\n}", "function handle() {\n /*\n We don't fire this if the user is touching the screen and it's moving.\n This could lead to a mis-fire\n */\n if (!config.is_touch_moving) {\n /*\n Gets the playlist attribute from the element.\n */\n let playlist = this.getAttribute(\"data-amplitude-playlist\");\n\n /*\n If the playlist is null, we handle the global repeat.\n */\n if (playlist == null) {\n handleGlobalRepeat();\n }\n\n /*\n If the playlist is set, we handle the playlist repeat.\n */\n if (playlist != null) {\n handlePlaylistRepeat(playlist);\n }\n }\n }", "onMove(){\n // HACK(mike): Get around the fact that the store fires two messages\n // sequentially when the board is reset.\n if (this.store.board.moveCount === 0 ||\n (this.store.board.moveCount === 1 && this.store.computerFirst))\n return;\n\n this.emote(\"default\");\n }", "function onMouseDownArm(e) {\n player.pause();\n arm.style.cursor = \"col-resize\";\n isMovingArm = true;\n //console.log(\"down\", e);\n}", "function VideoPlayer_Designer_RecordAction(event)\n{\n\t//fire the on ended event\n\tVideoPlayer_OnEnded(event);\n}", "function CastleAxeContinues(mario) {\n map.canscroll = true;\n startWalking(mario);\n}", "function forwardMoveHandler() {\n // one for clicking on button in GUI\n var btn = document.getElementById(\"forward-btn\");\n btn.addEventListener(\"click\", function() {\n\n if (analysisMode.isOn) {\n if (!(analysisMode.inSecondaryLine)) {\n if (analysisMode.counter != (params.mainTree.length - 1)) {\n\n analysisMode.counter++;\n var colour = (analysisMode.counter % 2) == 0 ? \"black\" : \"white\";\n var oppColour = (colour == \"white\") ? \"black\" : \"white\";\n var co = params.mainTree[analysisMode.counter];\n placeMove(board, colour, oppColour, co);\n\n }\n }\n }\n\n });\n\n // add event listener for right arrow keypress\n}", "function end(event) {\n\t\t\t_moving = false;\n\t\t}", "onMove(callback) {\r\n this.listenToMove.push(callback);\r\n }", "function stillHandler() { \n Options.scenes.forEach(function(scene) {\n \tif ( pageYOffset > scene.offset) {\n \t\tscene.action(scene.target);\n \t}\n });\n }", "_onTweenerFinish () {\n this._setPlaybackState('stop');\n this._playbackComplete();\n }", "proceedMove() {\n // Proceed move\n this.PENDING.MOVE.forEach(( item ) => {\n this._move(item)\n })\n }", "move(from, to) {\n // Here is a bunch fo castling logic if there's a castling flag...\n if (this.currentMove.castlingFlag) {\n this.castlingMove(from, to);\n }\n // If it's a capture, handle our special case\n // This won't work for en passant. There are a lot of problems here man.\n else if (this.currentMove.captureSquare) {\n this.capturingMove(from, to);\n }\n else {\n // Handle disabling castling in case they moved a piece that breaks it\n this.handleDisableCastling(from, to);\n // Then do the usual\n super.move(from, to);\n // And also reset our special move data\n this.currentMove.from = undefined;\n this.currentMove.to = undefined;\n this.currentMove.captureSquare = undefined;\n }\n }", "handleNext() {\n this.currentMovePrevented = false;\n\n // Call the bound `onNext` handler if available\n const currentStep = this.steps[this.currentStep];\n if (currentStep && currentStep.options && currentStep.options.onNext) {\n currentStep.options.onNext(this.overlay.highlightedElement);\n }\n\n if (this.currentMovePrevented) {\n return;\n }\n\n this.moveNext();\n }", "function go(evt){\n\tif(mover != ''){\n\t\tsetTransform(mover,evt.layerX,evt.layerY);\n\t}\n}", "move(steps) {\n this.stepchange = steps;\n }", "function pageright(e) {\n setMedia();\n media.currentTime = media.currentTime + (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function makeMove(e) {\n if(e.target.id >= 1 && e.target.id <= 9 && !e.target.classList.contains('selected')) {\n //Increment selected fields counter\n logic.incrementCount();\n //Save selected field to data array\n logic.addField(e.target.id-1);\n //Update UI\n e.target.classList.add('selected');\n e.target.removeEventListener('click', e); \n logic.getActivePlayer() === 1 ? e.target.innerText = 'O' : e.target.innerText = 'X';\n afterMove();\n } \n }", "function move() {\r\n\t\r\n}", "function px(){var t=this;ze(this);var e=ki(this.$interaction,[\"modifystart\",\"modifyend\"]);this.subscribeTo(e,function(e){++t.rev,t.$emit(e.type,e)})}", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "function ctrlFromTo() {\n setMedia();\n if (media.currentTime >= media.endplay && media.endplay !== -1) {\n // console.log(\"pause ctrlFromTo\");\n media.pause();\n setTimer('standard');\n media.lastPosition = media.currentTime;\n media.lastTime = (new Date()).getTime();\n if (media.s1) dehighlight(media.s1);\n if (media.s2) dehighlight(media.s2);\n if (media.s3) dehighlight(media.s3);\n media.s1 = null;\n media.s2 = null;\n media.s3 = null;\n media.currentTime = media.endplay;\n adjustRealInfo.show(media);\n media.endplay = -1;\n trjs.param.isContinuousPlaying = false;\n } else\n adjustRealInfo.show(media);\n }", "function mouveMove() {\n refreshDisplay();\n}", "function playBoardEvents(events){\n if (events.length > 0){\n var boardEvent = events.shift(),\n next = function(){\n playBoardEvents(events)\n }\n\n switch (boardEvent.type) {\n case 'move':\n display.moveJewels(boardEvent.data, next)\n break\n case 'remove':\n display.removeJewels(boardEvent.data, next)\n break\n case 'refill':\n display.refill(boardEvent.data, next)\n break\n default:\n next()\n break\n }\n } else {\n // console.log(board.getBoard())\n display.redraw(board.getBoard(), function() {\n // good to go again\n })\n }\n }", "_strikeActivePointerMove() {\n for (let i = 0; i < this._pointerActiveMoveCallbacks.length; i++) {\n let currentCallback = this._pointerActiveMoveCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._pointerActiveMoveCallbacks.length; i++) {\n if (this._pointerActiveMoveCallbacks[i][1])\n this._pointerActiveMoveCallbacks.splice(i--, 1);\n }\n }", "move () {\n }", "function moveplayhead(e) {\n\t\t\tvar newMargLeft = e.pageX - timeline.offsetLeft;\n\t\t\tif (newMargLeft >= 0 && newMargLeft <= timelineWidth) {\n\t\t\t playhead.style.marginLeft = newMargLeft + \"px\";\n\t\t\t}\n\t\t\tif (newMargLeft < 0) {\n\t\t\t playhead.style.marginLeft = \"0px\";\n\t\t\t}\n\t\t\tif (newMargLeft > timelineWidth) {\n\t\t\t playhead.style.marginLeft = timelineWidth + \"px\";\n\t\t\t}\n\t\t }", "function onClick(evt) {\n if (!dragging && evt.button !== TOC_BUTTON) {\n player.moveToNext();\n }\n evt.stopPropagation();\n evt.preventDefault();\n }", "_documentMoveHandler(event) {\n const that = this;\n if (that._thumbDragged) {\n that.$thumb.removeClass('enable-animation');\n that.$secondThumb.removeClass('enable-animation');\n that.$fill.removeClass('enable-animation');\n\n that._moveThumbBasedOnCoordinates(event, true, that.mechanicalAction !== 'switchWhenReleased');\n }\n }", "function moveOn() {\r\n stop = true;\r\n}", "function handle() {\n /*\n Sets the time out for song ended. This determines if\n we should go to the next song or delay between songs.\n */\n setTimeout(function() {\n /*\n If we continue next, we should move to the next song in the playlist.\n */\n if (config.continue_next) {\n /*\n\t\t\t\t\tIf the active playlist is not set, we set the\n\t\t\t\t\tnext song that's in the songs array.\n\t\t\t\t*/\n if (config.active_playlist == \"\" || config.active_playlist == null) {\n AudioNavigation.setNext(true);\n } else {\n AudioNavigation.setNextPlaylist(config.active_playlist, true);\n }\n } else {\n if (!config.is_touch_moving) {\n /*\n\t\t\t\t\t\tStops the active song.\n\t\t\t\t\t*/\n AmplitudeCore.stop();\n\n /*\n Sync the play pause elements.\n */\n PlayPauseElements.sync();\n }\n }\n }, config.delay);\n }", "_onMouseUp() {\n if (this._animationFrameID) {\n this._didMouseMove();\n }\n this._onMoveEnd();\n }", "function processPlayhead(e) {\n\n\n currentTime = player.currentTime;\n\n //update the progress timer\n\n currentTimeDisp.html(convertSecondsToTimecode(currentTime) + ' /');\n\n if (!isNaN(player.duration)) {\n durationDisp.html(convertSecondsToTimecode(player.duration));\n\n // bars\n var percent = (currentTime / player.duration * 100);\n progressPosition.width(percent.toString() + '%');\n }\n\n\n /* We spend a lot of time just moving the playhead along, this next line does a quick check to see if the playhead has moved before or after cueTimeThisSlide or cueTimeNextSlide. We exit it if it still is, saving us the iteration tasks below. Note the use of global objects.\n */\n\n if (currentTime >= latestCueTimeThisSlide && currentTime <= latestCueTimeNextSlide) {\n return;\n }\n\n\n if (!isNaN(currentTime) && currentTime > 0) {\n if (xmlVideoType != 'panel') {var compTime = slidesData[slidesData.length - 1 ].time}\n else {\n compTime = xmlDuration - 1;\n }\n /* if (xmlVideoType != 'panel') {var compTime = slidesData[slidesData.length - 1 ].time}\n else {\n compTime = xmlDuration - 2;\n }\n if (currentTime >= compTime) {*/\n if (currentTime >= slidesData[slidesData.length - 1 ].time - 1) {\n console.log('At end!');\n // player.pause();\n /*setTimeout(function () {window.location = menu_return_url}, 1000);*/\n doEnd();\n\n\n } //prevent ended event - this is a\n //workaround to handle weird state when player 'ended' event fires.\n\n //test if playhead is no longer between\n for (var i = 0; i < slidesData.length - 1; i++) {\n var cueTimeThisSlide = slidesData[i].time; //note the cuetime variables are global\n // player.pause();\n\n var cueTimeNextSlide = slidesData[i + 1].time;\n\n\n if (currentTime >= cueTimeThisSlide && currentTime <= cueTimeNextSlide) {\n //video.pause(); //enable this line to debug showSlide()\n showSlide('s-' + i.toString());\n latestCueTimeNextSlide = cueTimeNextSlide;\n latestCueTimeThisSlide = cueTimeThisSlide;\n /*if (('s-' + i.toString()) != currentSlide) {\n showSlide('s-' + i.toString());\n break;\n }*/\n }\n }\n\n _lastTime = currentTime;\n\n\n }\n\n }", "handleheroFrame() {\n\t\tif (this.frameX < 3 && this.moving) this.frameX++;\n\t\telse this.frameX = 0;\n\t}", "play () {\n this.el.sceneEl.addEventListener('jump', this.jump)\n this.el.sceneEl.addEventListener('arc-cursor-secondary-click', this.jump)\n }", "function movestart(e) {\n if (e.defaultPrevented) { return; }\n if (!e.moveEnabled) { return; }\n\n var event = {\n startX: e.startX,\n startY: e.startY,\n pageX: e.pageX,\n pageY: e.pageY,\n distX: e.distX,\n distY: e.distY,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n velocityX: e.velocityX,\n velocityY: e.velocityY,\n identifier: e.identifier,\n targetTouches: e.targetTouches,\n finger: e.finger\n };\n\n var data = {\n target: e.target,\n event: event,\n timer: new Timer(update),\n touch: undefined,\n timeStamp: e.timeStamp\n };\n\n function update(time) {\n updateEvent(event, data.touch, data.timeStamp);\n trigger(data.target, 'move', event);\n }\n\n if (e.identifier === undefined) {\n // We're dealing with a mouse event.\n // Stop clicks from propagating during a move\n on(e.target, 'click', preventDefault);\n on(document, mouseevents.move, activeMousemove, data);\n on(document, mouseevents.end, activeMouseend, data);\n } else {\n // In order to unbind correct handlers they have to be unique\n data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n data.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n // We're dealing with a touch.\n on(document, touchevents.move, data.activeTouchmove, data);\n on(document, touchevents.end, data.activeTouchend, data);\n }\n }", "function movestart(e) {\n if (e.defaultPrevented) { return; }\n if (!e.moveEnabled) { return; }\n\n var event = {\n startX: e.startX,\n startY: e.startY,\n pageX: e.pageX,\n pageY: e.pageY,\n distX: e.distX,\n distY: e.distY,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n velocityX: e.velocityX,\n velocityY: e.velocityY,\n identifier: e.identifier,\n targetTouches: e.targetTouches,\n finger: e.finger\n };\n\n var data = {\n target: e.target,\n event: event,\n timer: new Timer(update),\n touch: undefined,\n timeStamp: e.timeStamp\n };\n\n function update(time) {\n updateEvent(event, data.touch, data.timeStamp);\n trigger(data.target, 'move', event);\n }\n\n if (e.identifier === undefined) {\n // We're dealing with a mouse event.\n // Stop clicks from propagating during a move\n on(e.target, 'click', preventDefault);\n on(document, mouseevents.move, activeMousemove, data);\n on(document, mouseevents.end, activeMouseend, data);\n } else {\n // In order to unbind correct handlers they have to be unique\n data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n data.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n // We're dealing with a touch.\n on(document, touchevents.move, data.activeTouchmove, data);\n on(document, touchevents.end, data.activeTouchend, data);\n }\n }", "function moveCards(event) {\n event.from.forEach(function(fromPos, index) {\n var toPos = event.to[index];\n animationQueue.add(function() {\n console.log(\"[START] move card event from \"+fromPos+\" to \"+toPos);\n $(\"#slot_\" + fromPos)\n .one(\"webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend\", function() {\n console.log(\"[END] move card event from \"+fromPos+\" to \"+toPos);\n animationQueue.next();\n })\n .attr(\"id\", \"slot_\" + toPos);\n return false;\n });\n console.log(\"[QUEUED] move card event from \"+fromPos+\" to \"+toPos);\n });\n}", "function frame() {\n //console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos++; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "function callback1(direction) {\n if(direction==\"left\"){\n moveSlide();\n }else if(direction==\"right\"){\n backSlide();\n }\n }", "move() {\n\n }", "function movePieces() {\n currentTime--\n timeLeft.textContent = currentTime\n autoMoveCars()\n autoMoveLogs()\n moveWithLogLeft()\n moveWithLogRight()\n lose()\n }", "step(){\n \n if(this.path.length === 0){\n this.updatePath();\n }\n \n this.move();\n \n }", "function move(e) {\n switch (e.event.code) {\n case 'Numpad1':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowDown':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad3':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowLeft':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowRight':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad7':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowUp':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad9':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n }\n }", "function MOVE(e){\n\n\t/////////Player 1///////////////\n\tplayer1.move(e);\n\n}", "function frame() {\n console.log(\"zaim\");\n if (tos == r) {\n clearInterval(id);\n } else {\n tos--; \n //elem.style.top = pos + 'px'; \n elemt.style.left = tos+\"px\"; \n s=tos;\n //console.log(`avancer pos ${tos}`);\n }\n }", "onMove(callback) {\n this.onMoveObserver.push(callback);\n }", "avancer() {\n\t\tlet fermee = this.cellule.ouverture(this.direction);\n\t\tif (fermee) { //il y a un mur\n\t\t\treturn this.finMouvement();\n\t\t} else if (this.verifierBlocage()===true) { //la porte est bloquee\n return this.finMouvement();\n }\n\t\tthis.visuel.style.transitionDuration = (this.animMouvement) + \"ms\";\n\t\tthis.cellule = this.cellule.voisine(this.direction);\n\n console.log(\"Déplacement: \"+[\"↑\",\"→\",\"↓\",\"←\"][this.direction]+\" / \"+this.cellule.infoDebogage());\n\n\t\tthis.visuel.addEventListener('transitionend', this.evt.visuel.transitionend);\n\t}", "function movestart(e) {\n\t\tif (e.defaultPrevented) { return; }\n\t\tif (!e.moveEnabled) { return; }\n\n\t\tvar event = {\n\t\t\tstartX: e.startX,\n\t\t\tstartY: e.startY,\n\t\t\tpageX: e.pageX,\n\t\t\tpageY: e.pageY,\n\t\t\tdistX: e.distX,\n\t\t\tdistY: e.distY,\n\t\t\tdeltaX: e.deltaX,\n\t\t\tdeltaY: e.deltaY,\n\t\t\tvelocityX: e.velocityX,\n\t\t\tvelocityY: e.velocityY,\n\t\t\tidentifier: e.identifier,\n\t\t\ttargetTouches: e.targetTouches,\n\t\t\tfinger: e.finger\n\t\t};\n\n\t\tvar data = {\n\t\t\ttarget: e.target,\n\t\t\tevent: event,\n\t\t\ttimer: new Timer(update),\n\t\t\ttouch: undefined,\n\t\t\ttimeStamp: e.timeStamp\n\t\t};\n\n\t\tfunction update(time) {\n\t\t\tupdateEvent(event, data.touch, data.timeStamp);\n\t\t\ttrigger(data.target, 'move', event);\n\t\t}\n\n\t\tif (e.identifier === undefined) {\n\t\t\t// We're dealing with a mouse event.\n\t\t\t// Stop clicks from propagating during a move\n\t\t\ton(e.target, 'click', preventDefault);\n\t\t\ton(document, mouseevents.move, activeMousemove, data);\n\t\t\ton(document, mouseevents.end, activeMouseend, data);\n\t\t}\n\t\telse {\n\t\t\t// In order to unbind correct handlers they have to be unique\n\t\t\tdata.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n\t\t\tdata.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n\t\t\t// We're dealing with a touch.\n\t\t\ton(document, touchevents.move, data.activeTouchmove, data);\n\t\t\ton(document, touchevents.end, data.activeTouchend, data);\n\t\t}\n\t}", "_moveRelatedLeftHandler() {\n this._moveLeft();\n }", "function onClick(e) {\r\n onPause();\r\n if (getCarrier(e.yValue) == story.getFrameValue()) {\r\n onPlay();\r\n } else {\r\n story.goToFrame(getCarrier(e.yValue));\r\n onPause();\r\n }\r\n }", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Move_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const minerals = xy_locs(player_relative, _PLAYER_NEUTRAL)\n if (!minerals) {\n return FUNCTIONS.no_op()\n }\n const marines = xy_locs(player_relative, _PLAYER_SELF)\n let axis = 0\n const marine_xy = numpy.round(numpy.mean(marines, axis)) //Average location.\n axis = 1\n const distances = numpy.norm(numpy.tensor(minerals).sub(marine_xy), 'euclidean', axis)\n const closest_mineral_xy = minerals[numpy.argMin(distances).arraySync()]\n return FUNCTIONS.Move_screen('now', closest_mineral_xy)\n }\n return FUNCTIONS.select_army('select')\n }", "function move()\n{\n\n}", "function undo_event() {\n\t\t\t\t$(\"#p4_undo\").on('click', function(e){\n\t\t\t\t\tif (last_position != null) {\n\t\t\t\t\t\tanimate(last_position.color, last_position, last_position.axe_y, \"-\");\n\t\t\t\t\t\tlast_position.color = \"white\";\n\t\t\t\t\t\tallowed_play = true;\n\t\t\t\t\t\tlast_position = null;\n\t\t\t\t\t\tplayer = (player == 2) ? 1 : 2;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}", "onTranslationEnded() {\n // we will stop rendering our WebGL until next drag occurs\n if(this.curtains) {\n this.curtains.disableDrawing();\n }\n }", "function move_car(e)\n{\n switch(e.keyCode)\n {\n case 37:\n //left key pressed\n blueone.next_pos();\n break;\n\n case 39:\n //right key is presed\n redone.next_pos(); \n break;\n\n }\n}", "execute() {\n this.internal.spriteSheet.playForwardAnimation(Animations.walkBackward);\n this.internal.moveController.moveBackward();\n }", "function advanceToNextLevel()\r\n{\t\r\n\taudio.stop({channel : 'custom'});\r\n\taudio.stop({channel : 'secondary'});\r\n\taudio.stop({channel : 'tertiary'});\r\n\t\r\n\tplayingFinishedSound=true;\r\n\ttoDrawArrow=true;\r\n\t\r\n\tplayFinishedSound();\r\n}", "function onBlockMove(event) {\n if (event.type === Blockly.Events.MOVE){\n // this might have changed our program. let's go ahead and update it\n pub.blocklyToHelena(helenaProg);\n }\n if (pub.newBlocklyBlockDraggedIn && event.type === Blockly.Events.CREATE){\n var createdBlock = workspace.getBlockById(event.blockId);\n pub.newBlocklyBlockDraggedIn(createdBlock);\n }\n }", "function run_forward() {\n const motor_dur = 50;\n const motor_spd = -1000;\n \n ev3_runForTime(motorA, motor_dur, motor_spd);\n ev3_runForTime(motorB, motor_dur, motor_spd);\n ev3_pause(10);\n}", "function run_forward() {\n const motor_dur = 50;\n const motor_spd = -1000;\n \n ev3_runForTime(motorA, motor_dur, motor_spd);\n ev3_runForTime(motorB, motor_dur, motor_spd);\n ev3_pause(10);\n}", "function replayBtnHandler(e) {\n\tswitch (e.type)\n\t{\n\t\tcase \"mouseover\" :\n\t\t\tTweenLite.to(btn_replay, .5, {rotation:'+=360'});\n\t\t\tbreak;\n\t\tcase \"mouseout\" :\n\t\t\tbreak;\n\t\tcase \"click\" :\n\t\t\tfirstPlay = false;\n\t\t\tvidFrame = false;\n\t\t\tstartVideo();\n\t\t\tbreak;\n\t}\n\n}", "function moveObj(obj) {\n obj.step();\n }", "function doPlayup() {\r\n\tif (keepGoing) {\r\n\t\tif (copyEv.length) {\r\n\t\t\tif (track[playtrack].midiMess[midEvent].data0<192 || track[playtrack].midiMess[midEvent].data0>207)\r\n\t\t\t\t{noteMessage = [track[playtrack].midiMess[midEvent].data0, track[playtrack].midiMess[midEvent].data1, track[playtrack].midiMess[midEvent].data2];\r\n\t\t\t\t} else { noteMessage = [track[playtrack].midiMess[midEvent].data0, track[playtrack].midiMess[midEvent].data1];}\r\n\t\t\tif (mode==\"Play\"){\tpianoKeypressOut(); scrollPianoOut();}\r\n\t\t\toutportarr[outportindex].send(noteMessage);\r\n\t\t\twaittime = copyEv.shift();\r\n\t\t\tmidEvent++;\r\n\t\t\tsetTimeout(doPlayup, waittime);\r\n\t\t} else { stopPLAY();}\r\n\t}\r\n}", "function _moveStop() {\n\t\t\t\t$fire(this._timetable, \"moveStop\");\n\t\t\t}", "function pageleft(e) {\n setMedia();\n if (media.currentTime > trjs.dmz.winsize())\n media.currentTime = media.currentTime - (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n else\n media.currentTime = 0;\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "step(){\n\t\tif (this.state == 'gameOver' && this.mousePos.pressed == true) {\n\t\t\tthis.restart = true;\n\t\t}\n\t\tif (this.player.health <= 0 || this.enemyHandler.list.length == 0) {\n\t\t\tthis.GameOverScreen();\n\t\t}\n\t\tif (this.state == 'game') {\n\t\t\tvar halfWidth = this.context.canvas.width / 2;\n\t\t\tvar halfHeight = this.context.canvas.height / 2;\n\t\t\tthis.adjustMouseLocation(halfWidth, halfHeight);\n\n\t\t\tthis.handlers.forEach(el => el.handler.step());\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t}", "function moveForward(rover) {\n\n switch (rover.direction) {\n\n case \"N\":\n rover.y++;\n break;\n\n case \"E\":\n rover.x++;\n break;\n\n case \"S\":\n rover.y--;\n break;\n\n case \"W\":\n rover.x--;\n break;\n }\n}", "processMove() {\n let movedPieces = this.gameOrchestrator.gameboard.movePiece(this.firstTile, this.secondTile);\n this.gameMove.setMovedPieces(movedPieces);\n this.gameOrchestrator.gameSequence.addGameMove(this.gameMove);\n }", "onMove(callback) {\n\t\tthis.move_observers.push(callback);\n\t}", "function step() {\n // 1. perform the update, i.e. moving the slider handle and changing the colour of the background\n update(xScale.invert(currentValue));\n // 2. stop moving if the the current value exceeds the width of the slider container\n currentValue = currentValue + sizeOfStep;\n if (currentValue > targetValue ) {\n setMoving(false);\n // if we reach the end of the line set the button to replay \n playButton.text(\"Replay\")\n }\n }", "function backwardStep(e) {\n setMedia();\n if (media.currentTime > trjs.param.backwardskip)\n media.currentTime = media.currentTime - trjs.param.backwardskip;\n else\n media.currentTime = 0;\n }", "function arrowHandler(event){\n event.preventDefault();\n console.log(event.target);\n\n if(event.target.id){\n if(event.target.id.slice(0,5) === \"arrow\"){\n console.log('got em !')\n destination = filmMargin +(event.target.id.slice(5) * vw)\n console.log(destination)\n }\n // filmMargin -= vw;\n // console.log(filmMargin)\n // filmReel.setAttribute('style', `left: ${filmMargin}px`);\n // reachDestination(event.target.id * vw)\n // destination = filmMargin + (event.target.id * vw);\n reachDestination(destination)\n }\n}", "function endMove(event) {\n current.win.style.opacity = 1;\n }", "function movePieces() {\n currentTime--;\n timeLeft.textContent = currentTime;\n autoMoveCars();\n autoMoveLogs();\n moveWithLogLeft();\n moveWithLogRight();\n lose();\n \n }", "async movement(kind,stage,poName){\n if(kind==='forward'){\n await this.forward(stage,poName);\n }\n else if(kind==='backward'){\n await this.backward(stage);\n }\n }", "function TravelMove(nextMove) {\n\tif(gridArr[nextMove].encounter == \"combat\"){ // switch from travel to combat\n\t\tOPC.encounter = \"combat\";\n\t\tcombatRounds = 0;\n\t}\n\telse if(gridArr[nextMove].encounter == \"trap\") {\n\t\tOPC.encounter = \"trap\";\n\t}\n\tOPC.lastPos = OPC.currentPos;\n\tOPC.currentPos = nextMove;\n\tUpdateTileMap();\n}", "function animationGoForward()\n{\n\tif(eventSliderOb != null)\n\t{\n\t\teventSliderOb.moveSliderForward();\n\t}\n}", "function onMouseMoveArm(e) {\n if(isMovingArm)\n onClickDisk({x: e.x, y: e.y});\n}", "_moveToStart() {\n // moveCount can disturb the method logic.\n const initialMoveCount = this._settings.moveCount;\n this._settings.moveCount = 1;\n\n for (let pos = 1; pos < this._settings.startPosition; pos++) {\n this._rightMoveHandler();\n }\n this._settings.moveCount = initialMoveCount;\n }", "function sync_slide(ev)\n {\n let t; // The position in the video\n\n if (ev.type === \"timeupdate\") t = video_elt.currentTime;\n else if (ev.type === \"message\" && ev.data[0] === \"position\") t = ev.data[1];\n else return; // Probably some other \"message\" event\n\n // if (ev.type === \"message\")\n // console.log(\"event \" + ev.type + \"/\" + ev.data[0] + \" \" + ev.data[1]);\n\n // Find index corresponding to time t. Search forward then\n // backward. Most of the time, the video just advances a bit, so\n // we search near the previous position. But if the user seeks the\n // video to a very different location, a binary search would have\n // been better. Still, the timecodes array is probably only a few\n // dozen entries long, so it probably doesn't matter.\n let i = Math.min(current, timecodes.length - 1);\n while (i < timecodes.length - 1 && t > timecodes[i]) i++;\n while (i > 0 && t < timecodes[i]) i--;\n\n // If i is not the current element, move the \"active\" class.\n activate(i);\n }", "preStateChange(action){return;}", "function replayHandler1(e) {\n\n theTimeline.seek(0);\n theTimeline.stop();\n\n creative.dom.expandedHeading.style.opacity = 0;\n creative.dom.expandedBgr.style.opacity = 0;\n creative.dom.expandedCopy.style.opacity = 0;\n\n creative.dom.video1.vidContainer.style.opacity = 1;\n\n Enabler.counter(\"Replay video 1\", true);\n creative.dom.video1.vid.currentTime = 0;\n creative.dom.video1.vid.play();\n creative.dom.video1.vid.volume = 1.0;\n creative.dom.video1.vidUnmuteBtn.style.visibility = 'hidden';\n\n creative.dom.video1.vidMuteBtn.style.visibility = 'visible';\n\n //start end frame tween animation\n //endFrameAnimation();\n //creative.dom.expandedHeading.style.display = 'block';\n\n}" ]
[ "0.6623462", "0.61054426", "0.6044334", "0.59283423", "0.58105344", "0.58105344", "0.5781082", "0.5779033", "0.57457685", "0.57446814", "0.5743252", "0.57212174", "0.57212174", "0.57149047", "0.57080567", "0.57058436", "0.5705688", "0.5704663", "0.57036585", "0.56998116", "0.5694064", "0.56785345", "0.56731695", "0.56699115", "0.56644404", "0.56540895", "0.5640375", "0.5639248", "0.56370115", "0.56356215", "0.5635143", "0.5631858", "0.5610385", "0.5608227", "0.55925184", "0.5590103", "0.558889", "0.55858284", "0.5576064", "0.5568748", "0.5568691", "0.5545699", "0.55396307", "0.5530468", "0.55302334", "0.5523826", "0.5522258", "0.5513477", "0.54876345", "0.5483304", "0.5474748", "0.54682463", "0.5457422", "0.5441193", "0.5441193", "0.5437604", "0.5436766", "0.54363674", "0.5433637", "0.54309464", "0.54273754", "0.54223925", "0.5421893", "0.54185504", "0.5415985", "0.54091656", "0.5404014", "0.5403401", "0.54005146", "0.5400299", "0.53993225", "0.53984326", "0.53983605", "0.5398141", "0.5397313", "0.5384362", "0.5379761", "0.5378485", "0.5378485", "0.5364793", "0.53611284", "0.53584707", "0.53554934", "0.53524137", "0.5346126", "0.5345893", "0.5344675", "0.53419214", "0.5341462", "0.5335882", "0.53356636", "0.5327913", "0.5320687", "0.532056", "0.5319388", "0.53185755", "0.5318243", "0.5312439", "0.5310287", "0.530959", "0.5307785" ]
0.0
-1
Logic for triggering move and moveend events
function updateEvent(event, touch, timeStamp, timer) { var time = timeStamp - event.timeStamp; event.type = 'move'; event.distX = touch.pageX - event.startX; event.distY = touch.pageY - event.startY; event.deltaX = touch.pageX - event.pageX; event.deltaY = touch.pageY - event.pageY; // Average the velocity of the last few events using a decay // curve to even out spurious jumps in values. event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; event.pageX = touch.pageX; event.pageY = touch.pageY; timer.kick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMove() {\n }", "end() {\n if (this.mode !== mode.move) return;\n\n let bbox = this.bbox();\n let x = Box.snap(bbox.x);\n let y = Box.snap(bbox.y);\n this.setPosition(x, y);\n this.moveEndEvent.trigger();\n }", "function end(event) {\n\t\t\t_moving = false;\n\t\t}", "function _moveStop() {\n\t\t\t\t$fire(this._timetable, \"moveStop\");\n\t\t\t}", "onMoveChange() {\n\t\tif (!this.state.activePlayer) {\n\t\t\treturn;\n\t\t}\n\t\tconst move = this.state.move;\n\t\t\n\t\t// Make sure we rerender\n\t\tthis.forceUpdate();\n\n\t\t// Return if this move isn't ready to send yet\n\t\tif (!move.card ||\n\t\t\tmove.card.type === 'DECOY' && !move.target ||\n\t\t\tmove.card.type === 'HORN' && !move.range) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This move is ready to send\n\t\tmove.playerId = this.state.playerId;\n\t\tmove.type = 'PLAY';\n\t\tthis.state.server.emit('move', move);\n\t}", "move(event){\n this.xyE = this.getXY(event);\n }", "function onMove(data){\n\tif(typeof(data.grid) != \"undefined\"){\n\t\tgrid = data.grid;\n\t\tif(!stop_running)\n\t\t\tconfig.runTimeout = setTimeout(run, 100);\n\t}else{\n\t\tdeclare_winner();\n\t}\n\trefresh_view();\n}", "function gestureMove(ev){if(!pointer||!typesMatch(ev,pointer))return;updatePointerState(ev,pointer);runHandlers('move',ev);}", "function MOVE(e){\n\n\t/////////Player 1///////////////\n\tplayer1.move(e);\n\n}", "onMove(callback) {\r\n this.listenToMove.push(callback);\r\n }", "move(from, to) {\n // Here is a bunch fo castling logic if there's a castling flag...\n if (this.currentMove.castlingFlag) {\n this.castlingMove(from, to);\n }\n // If it's a capture, handle our special case\n // This won't work for en passant. There are a lot of problems here man.\n else if (this.currentMove.captureSquare) {\n this.capturingMove(from, to);\n }\n else {\n // Handle disabling castling in case they moved a piece that breaks it\n this.handleDisableCastling(from, to);\n // Then do the usual\n super.move(from, to);\n // And also reset our special move data\n this.currentMove.from = undefined;\n this.currentMove.to = undefined;\n this.currentMove.captureSquare = undefined;\n }\n }", "_onUpdate() {\n const args = [this.x, this.y];\n this.moveHandlers.forEach((callback) => callback(...args));\n }", "handleMove(e) {\n this.handleStartHover = !this.disabled && inBounds(e, this.handleStart);\n this.handleEndHover = !this.disabled && inBounds(e, this.handleEnd);\n }", "movePress( press ) {\n sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener movePress' );\n sceneryLog && sceneryLog.InputListener && sceneryLog.push();\n\n this.reposition();\n\n sceneryLog && sceneryLog.InputListener && sceneryLog.pop();\n }", "move() {\n\n }", "function _moveStart() {\n\t\t\t\t// TODO does anything need to be included in this event?\n\t\t\t\t// TODO make cancelable\n\t\t\t\t$fire(this._timetable, \"moveStart\");\n\t\t\t}", "function mmove(e) {\r\n\t\t\t\t\tif(isDrag==true)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t//prevent default event\r\n\t\t\t\t\t\te.preventDefault();\r\n\r\n\t\t\t\t\t\t//trace mouse\r\n\t\t\t\t\t\t$(e.target).css({\"top\":e.pageY - y + \"px\",\"left\":e.pageX - x + \"px\"});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//mouse up or mouse leave event\r\n\t\t\t\t\t\t$(e.target).on(\"mouseup\",mup);\r\n\t\t\t\t\t\t$(frameBody).on(\"mouseleave\",\"textarea\",mup);\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "move () {\n }", "handleGameStartEvent(data) {\n console.log('in handleGameStartEvent handler ');\n this.setGameStartAndPlayerMove();\n }", "function playerMove( e, obj ) {\n var s = e.key.toLowerCase();\n //move left\n if( s == \"arrowleft\" ) {\n if( gridCellEmpty( obj.i-1, obj.j ) ) {\n putObjInCell( obj, obj.i-1, obj.j );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move right\n else if ( s == \"arrowright\" ) {\n if( gridCellEmpty( obj.i+1, obj.j ) ) {\n putObjInCell( obj, obj.i+1, obj.j );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move up\n else if ( s == \"arrowup\" ) {\n if( gridCellEmpty( obj.i, obj.j-1 ) ) {\n putObjInCell( obj, obj.i, obj.j-1 );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n //move down\n else if ( s == \"arrowdown\" ) {\n if( gridCellEmpty( obj.i, obj.j+1 ) ) {\n putObjInCell( obj, obj.i, obj.j+1 );\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n }\n else if ( s == \" \" ) {\n //pass your turn\n //don't want to get input again until it's our turn again\n engine.unbindEvents( agents[currentAgent] );\n incrementCurrentAgent();\n }\n}", "move(event) {\n event.target.classList.remove('free'); //The 'free' class is removed indcating the space cannot be played again\n event.target.classList.add(this._playClass); //Adds the class for the current player (The 'X' or the 'O')\n event.target.classList.add('taken'); // A class of 'taken' is given showing the space is played\n board.updateBoard(event, this); //Calls the updateBoard method to update the board._board array.\n this.turn = false; //Sets the turn of the player that just moved to false\n\n //Sets the state of the other player's turn to true\n if (this._player === 'player1') {\n player2.turn = true;\n } else if (this._player === 'player2') {\n player1.turn = true;\n } else {\n return false;\n }\n\n //If player 2 is a computer player, the computerMove method is evoked\n if (this._player === 'player1' && player2._isComputer && !player1._isWinner && !player2._isWinner) {\n player2.computerMove();\n }\n }", "function gestureMove(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n runHandlers('move', ev);\n }", "function move() {\r\n\t\r\n}", "onMove(callback) {\n\t\tthis.move_observers.push(callback);\n\t}", "function move(e)\n {\n if (!e)\n e = event;\n shipY = e.pageY;\n return false;\n }", "function gestureMove(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n runHandlers('move', ev);\n }", "function BeforeMoveActions() {\n EnableTrackBoard();\n EnableMineDrag();\n}", "move(direction) {\r\n switch (direction) {\r\n case 'left':\r\n this.moveLeftRight(0);\r\n break;\r\n case 'right':\r\n this.moveLeftRight(1);\r\n break;\r\n case 'down':\r\n this.moveUpDown(1);\r\n break;\r\n case 'up':\r\n this.moveUpDown(0);\r\n break;\r\n }\r\n this.listenToMove.forEach((i) => i(this.gameState)); \r\n if(this.checkLose()) {this.listenToLose.forEach((i) => i(this.gameState));} \r\n if(this.win()) {this.listenToWin.forEach((i) => i(this.gameState));}\r\n }", "_onMouseUp() {\n if (this._animationFrameID) {\n this._didMouseMove();\n }\n this._onMoveEnd();\n }", "proceedMove() {\n // Proceed move\n this.PENDING.MOVE.forEach(( item ) => {\n this._move(item)\n })\n }", "function move(event) {\n if (gameover) { /* PREVENT USER FROM MOVING */ }\n else {\n var left = player.position().left;\n var edge = $('body').width() - player.width();\n\n var key = event.which;\n switch (key) {\n case 37: // left\n if (left <= 8) {\n left = 8;\n } else {\n player.css('left', left - 25);\n // player.animate({'left': left - 25}, 'fast');\n }\n break;\n\n case 39: // right\n if (left >= edge) {\n left = edge;\n } else {\n player.css('left', left + 25);\n // player.animate({'left': left + 25}, 'fast');\n\n }\n break;\n\n /**\n * Sang Min (Samuel) Na\n *\n * when paused, stop fireball, score, and gameSpeed\n * show pause message\n * when unpaused, start fireball, score, and gameSpeed again\n * hide pause message\n */\n case 27: // pause\n if (!paused) {\n clearInterval(score);\n clearInterval(gameSpeedID);\n clearInterval(drawer);\n $('.fires').stop();\n $('.helpers').stop();\n\n paused = !paused;\n msg.children().first().next().hide(); // game over msg\n if (gameover) {\n msg.children().first().next().show();\n }\n msg.fadeIn();\n\n } else {\n paused = !paused;\n\n var fires = $('.fires');\n for (var i = 0; i < fires.length; i++ ) {\n fall(fires.eq(i));\n }\n var helpers = $('.helpers');\n for (var j = 0; j < helpers.length; j++) {\n fall(helpers.eq(j));\n }\n msg.fadeOut();\n\n score = setInterval(scoreUpdate, 100);\n gameSpeedID = setInterval(gameSpeed, 3000);\n drawer = setInterval(draw, speed);\n }\n break;\n }\n }\n }", "function move_out(e, attachedElement) {\r\n log(\"move out: \" + e.clientX + \", \" + e.clientY);\r\n letGo(attachedElement);\r\n}", "function move(e) {\n var newX;\n var newY;\n var movingAllowed;\n e = e || window.event;\n \n switch (e.keyCode) {\n case 38: // arrow up key\n newX = current_x;\n newY = current_y - 3;\n break;\n case 37: // arrow left key\n newX = current_x - 3;\n newY = current_y;\n break;\n case 40: // arrow down key\n newX = current_x;\n newY = current_y + 3;\n break;\n case 39: // arrow right key\n newX = current_x + 3;\n newY = current_y;\n break;\n }\n\n can_Move = canMoveTo(newX, newY);\n if (can_Move === 1) { // 1 means no collision with black, can move\n drawRectangle(newX, newY, \"purple\");\n current_x = newX;\n current_y = newY;\n }\n else if (can_Move === 2) { // rectangle has met the goal.\n round_counter++;\n if(round_counter >= level.length){\n clearInterval(intervalVar);\n make_Screen_White(0, 0, canvas.width, canvas.height);\n context.font = \"20px Arial\";\n context.fillStyle = \"blue\";\n context.textAlign = \"center\";\n context.textBaseline = \"middle\";\n context.fillText(\"Goal!\", canvas.width / 2, canvas.height / 2);\n window.removeEventListener(\"keydown\", move, true);\n }else{\n init();\n }\n }\n }", "function endMove() {\n moveMode = 0;\n drawMethod();\n}", "@action setMoveTarget() {\n this.act = (nextLocation) => {\n this.clearHit()\n this.moveXAndY(nextLocation.x, nextLocation.y)\n this.handleEffects()\n }\n if (this.movementId) { // if already moving, continue in a new direction\n this.startMovement()\n }\n }", "onMove(callback) {\n this.onMoveObserver.push(callback);\n }", "function move() {\n // check if move allowed & then eat food\n hitFood();\n hitBorder();\n hitSnake();\n // actually move the snake\n updatePositions();\n renderSnake();\n document.addEventListener(\"keydown\", turn);\n snake.canTurn = 1;\n}", "function Form_Drag_OnEnd(event)\n{\n\t//trigger final move\n\t__DRAG_DATA.OnMove(event);\n}", "function BeginMoveState()\n{\n\t$.Msg('BMS');\n\tvar order = {\n\t\tOrderType : dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_POSITION,\n\t\tPosition : [0, 0, 0],\n\t\tQueue : OrderQueueBehavior_t.DOTA_ORDER_QUEUE_NEVER,\n\t\tShowEffects : false\n\t};\n\n\tvar localHeroIndex = Players.GetPlayerHeroEntityIndex( Players.GetLocalPlayer() );\n\tvar isRanged = (Abilities.GetBehavior( Entities.GetAbility( localHeroIndex, 10 ) ) & DOTA_ABILITY_BEHAVIOR.DOTA_ABILITY_BEHAVIOR_POINT) !== 0;\n\n\tinAction = true;\n\n\t(function tic()\n\t{\n\t\tif ( GameUI.IsMouseDown( 0 ) )\n\t\t{\n\t\t\tif (GameUI.IsShiftDown() && isRanged){\n\t\t\t\tBeginRangedAttack(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (GameUI.IsControlDown()){\n\t\t\t\torder.OrderType = dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_DIRECTION;\n\t\t\t\tvar abil = Entities.GetAbility( localHeroIndex, 4 )\n\t\t\t\t$.Msg(Abilities.GetAbilityName(abil));\n\t\t\t\tif (!Abilities.IsPassive(abil) && Abilities.IsCooldownReady(abil) && !Abilities.IsInAbilityPhase(abil)){\n\t\t\t\t\torder = {\n\t\t\t\t\t\tOrderType : dotaunitorder_t.DOTA_UNIT_ORDER_CAST_NO_TARGET,\n\t\t\t\t\t\tAbilityIndex : abil,\n\t\t\t\t\t\tQueue : false,\n\t\t\t\t\t\tShowEffects : false\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\torder.OrderType = dotaunitorder_t.DOTA_UNIT_ORDER_MOVE_TO_POSITION;\n\t\t\t}\n\n\t\t\t$.Schedule( 1.0/30.0, tic );\n\t\t\tvar mouseWorldPos = GameUI.GetScreenWorldPosition( GameUI.GetCursorPosition() );\n\t\t\tif ( mouseWorldPos !== null )\n\t\t\t{\n\t\t\t\torder.Position = mouseWorldPos;\n\t\t\t\thasMoved = true;\n\t\t\t\tGame.PrepareUnitOrders( order );\n\t\t\t}\n\t\t}\n\t\telse{ inAction = false;} \n\t})();\n}", "function move(e) {\n switch (e.event.code) {\n case 'Numpad1':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowDown':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad3':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowLeft':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowRight':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad7':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowUp':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad9':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n }\n }", "move() {\n\t\tthis.lastPosition = [ this.x, this.y ];\n\n\t\tthis.x += this.nextMove[0];\n\t\tthis.y += this.nextMove[1];\n\t}", "end(event) {\n //var textEl = event.target.querySelector('p')\n\n // textEl && (textEl.textContent =\n // 'moved a distance of ' +\n // (Math.sqrt(Math.pow(event.pageX - event.x0, 2) +\n // Math.pow(event.pageY - event.y0, 2) | 0))\n // .toFixed(2) + 'px')\n }", "onMove(){\n // HACK(mike): Get around the fact that the store fires two messages\n // sequentially when the board is reset.\n if (this.store.board.moveCount === 0 ||\n (this.store.board.moveCount === 1 && this.store.computerFirst))\n return;\n\n this.emote(\"default\");\n }", "function finishMove(){\n //Cambiar estado hotspot\n $(\".hots\"+id).find(\".in\").removeClass(\"move\");\n $(\".hots\"+id).find(\".out\").removeClass(\"moveOut\");\n $(\".hotspotElement\").removeClass('active');\n $(\".hotspotElement\").css(\"pointer-events\", \"all\");\n \n //Volver a desactivar las acciones de doble click\n $(\"#pano\").off( \"dblclick\");\n //Quitar el cursor de tipo cell\n $(\"#pano\").removeClass(\"cursorAddHotspot\");\n //Mostrar el menu inicial\n showMain();\n }", "function moveNorth(){\n console.log('moving North');\n}", "move() {\n }", "move(steps) {\n this.stepchange = steps;\n }", "move () {\n this._updateGUI()\n\n if (this.isMoving()) {\n //console.log('sorry, im already moving')\n return\n }\n\n let dir = this._state.lastDir\n if (!this._canMove(dir)) return\n\n if (this._state.special) {\n this._slide(dir)\n } else {\n this._roll(dir)\n }\n\n this._updateGUI()\n }", "function Dragging_Move(event)\n{\n\t//has drag data?\n\tif (__DRAG_DATA && __DRAG_DATA.OnMove && __DRAG_DATA.TouchDetail === Browser_GetTouchId(event))\n\t{\n\t\t//call it\n\t\t__DRAG_DATA.OnMove(event);\n\t}\n}", "function gestureMove(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n runHandlers('move', ev);\n }", "function gestureMove(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n runHandlers('move', ev);\n }", "function gestureMove(ev) {\n if (!pointer || !typesMatch(ev, pointer)) return;\n\n updatePointerState(ev, pointer);\n runHandlers('move', ev);\n }", "move() {\n this.position = Utils.directionMap[this.orientation].move(this.position)\n this.log(`I moved and now at x: ${this.position.x} y: ${this.position.y}`)\n }", "function handleMove(event){\n // record click for currentPlayer\n game.recordMove(event);\n\n // check for a winner\n game.checkForWinner();\n\n // switch players\n game.switchPlayer();\n}", "function move()\n{\n\n}", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "function move(e){\n // obstacles(player.x, player.y);\n if (e.keyCode === 37){\n if(player.noMove(player.x-1, player.y)) {\n if(obstacles(player.x-1, player.y)){\n player.x -= 1;\n console.log('moved one spot to what you believe to be left');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be the left.\";\n }\n }\n } \n if (e.keyCode === 39){\n if(player.noMove(player.x+1, player.y)) {\n if(obstacles(player.x+1, player.y)){\n player.x += 1;\n console.log('moved one spot to what you believe to be right');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be the right.\";\n }\n }\n } \n if (e.keyCode === 38){\n if(player.noMove(player.x, player.y-1)){\n if(obstacles(player.x, player.y-1)){\n player.y -= 1;\n console.log('moved one spot to what you believe to be top');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be up.\";\n }\n }\n } \n if (e.keyCode === 40){\n if(player.noMove(player.x, player.y+1)){\n if(obstacles(player.x, player.y+1)){\n player.y += 1;\n console.log('moved one spot to what you believe to be down');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be down.\";\n }\n }\n }\n }", "function movestart(e) {\n\t\tif (e.defaultPrevented) { return; }\n\t\tif (!e.moveEnabled) { return; }\n\n\t\tvar event = {\n\t\t\tstartX: e.startX,\n\t\t\tstartY: e.startY,\n\t\t\tpageX: e.pageX,\n\t\t\tpageY: e.pageY,\n\t\t\tdistX: e.distX,\n\t\t\tdistY: e.distY,\n\t\t\tdeltaX: e.deltaX,\n\t\t\tdeltaY: e.deltaY,\n\t\t\tvelocityX: e.velocityX,\n\t\t\tvelocityY: e.velocityY,\n\t\t\tidentifier: e.identifier,\n\t\t\ttargetTouches: e.targetTouches,\n\t\t\tfinger: e.finger\n\t\t};\n\n\t\tvar data = {\n\t\t\ttarget: e.target,\n\t\t\tevent: event,\n\t\t\ttimer: new Timer(update),\n\t\t\ttouch: undefined,\n\t\t\ttimeStamp: e.timeStamp\n\t\t};\n\n\t\tfunction update(time) {\n\t\t\tupdateEvent(event, data.touch, data.timeStamp);\n\t\t\ttrigger(data.target, 'move', event);\n\t\t}\n\n\t\tif (e.identifier === undefined) {\n\t\t\t// We're dealing with a mouse event.\n\t\t\t// Stop clicks from propagating during a move\n\t\t\ton(e.target, 'click', preventDefault);\n\t\t\ton(document, mouseevents.move, activeMousemove, data);\n\t\t\ton(document, mouseevents.end, activeMouseend, data);\n\t\t}\n\t\telse {\n\t\t\t// In order to unbind correct handlers they have to be unique\n\t\t\tdata.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n\t\t\tdata.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n\t\t\t// We're dealing with a touch.\n\t\t\ton(document, touchevents.move, data.activeTouchmove, data);\n\t\t\ton(document, touchevents.end, data.activeTouchend, data);\n\t\t}\n\t}", "moveActor() {\n // used to work as tunnel if left and right are empty pacman/ghosts can easily move in tunnel\n if (this.tileTo[0] < -1) {\n this.tileTo[0] = this.gameMap.layoutMap.column;\n }\n if (this.tileTo[0] > this.gameMap.layoutMap.column) {\n this.tileTo[0] = -1;\n }\n\n // used to work as tunnel if top and bottom are empty pacman/ghosts can easily move in tunnel\n if (this.tileTo[1] < -1) {\n this.tileTo[1] = this.gameMap.layoutMap.row;\n }\n if (this.tileTo[1] > this.gameMap.layoutMap.row) {\n this.tileTo[1] = -1;\n }\n\n // as our pacman/ghosts needs to move constantly widthout key press,\n // also pacman/ghosts should stop when there is obstacle the code has become longer\n\n // if pacman/ghosts is moving up check of upper box is empty and go otherise stop\n if (this.movingDirection === MOVING_DIRECTION.UP) {\n if (this.isBlockUpperThanActorEmpty()) {\n this.tileTo[1] -= 1;\n }\n }\n\n // if pacman/ghosts is moving down check of down box is empty and go otherise stop\n if (this.movingDirection === MOVING_DIRECTION.DOWN) {\n if (this.isBlockLowerThanActorEmpty()) {\n this.tileTo[1] += 1;\n }\n }\n\n // if pacman/ghosts is moving left check of left box is empty and go otherise stop\n if (this.movingDirection === MOVING_DIRECTION.LEFT) {\n if (this.isBlockLeftThanActorEmpty()) {\n this.tileTo[0] -= 1;\n }\n }\n\n // if pacman/ghosts is moving right check of right box is empty and go otherise stop\n if (this.movingDirection === MOVING_DIRECTION.RIGHT) {\n if (this.isBlockRightThanActorEmpty()) {\n this.tileTo[0] += 1;\n }\n }\n }", "move()\n {\n if (keys !== null)\n {\n //if \"w\" or \"arrow up\" pressed\n if (keys[38] || keys[87])\n {\n this.velY -= 1.5;\n }\n //if \"s\" or \"arrow down\" pressed\n if (keys[40] || keys[83])\n {\n this.velY += 3;\n }\n //if \"a\" or \"arrow left\" pressed\n if (keys[37] || keys[65])\n {\n this.velX -= 2;\n }\n //if \"d\" or \"arrow right\" pressed\n if (keys[39] || keys[68])\n {\n this.velX += 1.5;\n }\n }\n\n //decceleration based on drag coefficient\n this.velX *= this.drag;\n this.velY *= this.drag;\n\n //position change based on velocity change\n this.xPos += this.velX;\n this.yPos += this.velY;\n\n if (winCondition === undefined || winCondition === true)\n {\n //in bounds x axis\n if (this.xPos > WIDTH - 70)\n {\n this.xPos = WIDTH - 70;\n }\n else if (this.xPos < 0)\n {\n this.xPos = 0;\n }\n }\n\n //in bounds y axis\n if (this.yPos > HEIGHT - balloonGround - 120)\n {\n this.yPos = HEIGHT - balloonGround - 120;\n this.hitGround++;\n }\n else if (this.yPos < 0)\n {\n this.yPos = 0;\n }\n }", "move() {\n //Move the kid to the determined location\n this.x = this.nextMoveX;\n this.y = this.nextMoveY;\n //Check in case the kid touches the edges of the map,\n // if so, prevent them from leaving.\n this.handleConstraints();\n }", "update() {\n super.update();\n this.move();\n }", "moveCompleted() {\n // Reset the from so we can\n this.from = null;\n\n if (this.gameOver) return;\n this.changeTurn();\n this.hideMessage();\n }", "moveStart(evt) {\r\n evt.preventDefault();\r\n this.held = true;\r\n this.position = this.getPos(evt);\r\n this.update();\r\n }", "function handleMove(event){\n console.log('Handling player move.');\n // Record the move for the current player.\n game.recordMove(event);\n\n // Check to see if the last move was a winning move.\n game.checkForWinner();\n\n // Rotate players.\n game.switchPlayer();\n}", "playermove(move, playerId, roomId) {\n this.socket.emit(\"playermove\", move, playerId, roomId);\n }", "processMove() {\n let movedPieces = this.gameOrchestrator.gameboard.movePiece(this.firstTile, this.secondTile);\n this.gameMove.setMovedPieces(movedPieces);\n this.gameOrchestrator.gameSequence.addGameMove(this.gameMove);\n }", "move() {\n\n // Horizontal movement\n this.x_location += this.delta_x;\n\n // Vertical movement\n this.y_location += this.delta_y;\n\n }", "function handleMove(event) \n\t\t{\n\t\t\t// validity check\n\t\t if ( !self.active ) return;\n\n\t\t // if this is a touch event, make sure it is the right one\n\t\t // also handle multiple simultaneous touchmove events\n\t\t let touchmoveId = null;\n\n\t\t\t// update events\n\t\t if (event.changedTouches)\n\t\t {\n\t\t \tfor (let i = 0; i < event.changedTouches.length; i++)\n\t\t \t{\n\t\t\t\t\t// move stick\n\t\t \t\tif (self.touchId == event.changedTouches[i].identifier)\n\t\t \t\t{\n\t\t \t\t\ttouchmoveId = i;\n\t\t \t\t\tevent.clientX = event.changedTouches[i].clientX;\n\t\t \t\t\tevent.clientY = event.changedTouches[i].clientY;\n\t\t \t\t}\n\t\t \t}\n\n\t\t\t\t// validity check\n\t\t \tif (touchmoveId == null) return;\n\t\t }\n\n\t\t\t// values needed to determine angle and speed\n\t\t const xDiff = event.clientX - self.dragStart.x;\n\t\t const yDiff = event.clientY - self.dragStart.y;\n\t\t const angle = Math.atan2(yDiff, xDiff);\n\t\t\tconst distance = Math.min(maxDistance, Math.hypot(xDiff, yDiff));\n\t\t\tconst xPosition = distance * Math.cos(angle);\n\t\t\tconst yPosition = distance * Math.sin(angle);\n\n\t\t\t// move stick image to new position\n\t\t stick.style.transform = `translate3d(${xPosition}px, ${yPosition}px, 0px)`;\n\n\t\t\t// deadzone adjustment\n\t\t\tconst distance2 = (distance < deadzone) ? 0 : maxDistance / (maxDistance - deadzone) * (distance - deadzone);\n\t\t const xPosition2 = distance2 * Math.cos(angle);\n\t\t\tconst yPosition2 = -1 * distance2 * Math.sin(angle);\n\t\t const xPercent = parseFloat((xPosition2 / maxDistance).toFixed(4));\n const yPercent = parseFloat((yPosition2 / maxDistance).toFixed(4));\n\n\t\t\t// create angle and angle\n\t\t\tintendedAngle = parseFloat((angle * (180 / Math.PI) + 90).toFixed(0));\n\t\t\tintendedAngle = intendedAngle > 180 ? intendedAngle - 360 : intendedAngle;\n\t\t\tspeedAsPercent = (distance / maxDistance * 100).toFixed(0);\n\t\t \n\t\t\t// update the current value based on above values\n self.value = { x: (xPercent * 100).toFixed(0), y: (yPercent * 100).toFixed(0)};\n\t\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function eventMove ( event, data ) {\n\n\t\t// Fix #498\n\t\t// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n\t\t// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n\t\t// IE9 has .buttons and .which zero on mousemove.\n\t\t// Firefox breaks the spec MDN defines.\n\t\tif ( navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0 ) {\n\t\t\treturn eventEnd(event, data);\n\t\t}\n\n\t\t// Check if we are moving up or down\n\t\tvar movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n\n\t\t// Convert the movement into a percentage of the slider width/height\n\t\tvar proposal = (movement * 100) / data.baseSize;\n\n\t\tmoveHandles(movement > 0, proposal, data.locations, data.handleNumbers);\n\t}", "function mouveMove() {\n refreshDisplay();\n}", "registerMoving() {\n\n // window.addEventListener(\"keydown\", (e) => {\n // if (e.key === \"keydown\") {\n // return true;\n // } else {\n // return false;\n // }\n // })\n window.addEventListener(\"keydown\", (e) => {\n let playerDom = this.gameContainer.children[0];\n let x = parseInt(playerDom.style.left);\n let y = parseInt(playerDom.style.top);\n let modifier = 20;\n switch (e.key) {\n\n case \"ArrowUp\":\n console.log(\"move up\")\n y = y - modifier;\n break\n case \"ArrowDown\":\n console.log(\"move down\");\n y = y + modifier;\n break\n case \"ArrowLeft\":\n console.log(\"move left\")\n x = x - modifier;\n break\n case \"ArrowRight\":\n console.log(\"move right\")\n x = x + modifier;\n break\n }\n\n if (this.checkIfPlayerIsOutsideOfContainer(x, y) === true) {\n this.movePlayerHtml(e.key)\n }\n })\n\n }", "_onMoveEnd() {\n this._map.locate({\n 'watch': true,\n 'setView': false,\n 'enableHighAccuracy': true,\n });\n }", "moveToTargetLogic(Engine) {\n if (this.item.target.x + (this.item.target.width / 2) < this.item.x + (this.item.width / 2)) {\n this.item.moveLeft = true;\n } else if (this.item.target.x + (this.item.target.width / 2) > this.item.x + (this.item.width / 2)) {\n this.item.moveRight = true;\n }\n if (this.item.target.y + (this.item.target.height / 2) < this.item.y + (this.item.height / 2)) {\n this.item.moveUp = true;\n } else if (this.item.target.y + (this.item.target.height / 2) > this.item.y + (this.item.height / 2)) {\n this.item.moveDown = true;\n }\n\n }", "onElementTouchEnd(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "onElementTouchEnd(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "function move()\n{\n\tif (player.direction == MOVE_NONE)\n\t{\n \tplayer.moving = false;\n\t\t//console.log(\"y: \" + ((player.y-20)/40));\n\t\t//console.log(\"x: \" + ((player.x-20)/40));\n \treturn;\n \t}\n \tplayer.moving = true;\n \t//console.log(\"move\");\n \n\tif (player.direction == MOVE_LEFT)\n\t{\n \tif(player.angle != -90)\n\t\t{\n\t\t\tplayer.angle = -90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y-1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y -=1;\n\t\t\tvar newX = player.position.x - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n \t}\n\tif (player.direction == MOVE_RIGHT)\n\t{\n \tif(player.angle != 90)\n\t\t{\n\t\t\tplayer.angle = 90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y+1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newX = player.position.x + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_UP)\n\t{\n\t if(player.angle != 0)\n\t\t{\n\t\t\tplayer.angle = 0;\n\t\t}\n\t\tif(map[playerPos.x-1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x-=1;\n\t\t\tvar newy = player.position.y - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({y: newy}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_DOWN)\n\t{\n\t if(player.angle != 180)\n\t\t{\n\t\t\tplayer.angle = 180;\n\t\t}\n\t\tif(map[playerPos.x+1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newy = player.position.y + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: player.position.x, y: newy}, 250).call(move);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n}", "move(direction) {\n // NOTE: West movement should -- and east should ++. Need to work on map orientation\n if (direction === \"north\" && this.currentCell.hasLink(this.currentCell.north) === true) {\n //alert(\"north\");\n this.y++;\n this.currentCell = this.currentCell.north;\n }\n if (direction === \"west\" && this.currentCell.hasLink(this.currentCell.west) === true) {\n //alert(\"west\");\n this.x--;\n this.currentCell = this.currentCell.west;\n }\n if (direction === \"south\" && this.currentCell.hasLink(this.currentCell.south) === true) {\n //alert(\"south\");\n this.y--;\n this.currentCell = this.currentCell.south;\n }\n if (direction === \"east\" && this.currentCell.hasLink(this.currentCell.east) === true) {\n //alert(\"east\");\n this.x++;\n this.currentCell = this.currentCell.east;\n }\n }", "change_move_status () {\r\n if(this.spaces_moved_hv > 0 || this.spaces_moved_d > 0){\r\n this.move_status =\r\n this.move_status == 0 ? 1 : 0;\r\n }\r\n }", "function startInteraction(ev) {\n app.ui.moveOutput.clear();\n ev.preventDefault();\n }", "_moveToStart() {\n // moveCount can disturb the method logic.\n const initialMoveCount = this._settings.moveCount;\n this._settings.moveCount = 1;\n\n for (let pos = 1; pos < this._settings.startPosition; pos++) {\n this._rightMoveHandler();\n }\n this._settings.moveCount = initialMoveCount;\n }", "function movestart(e) {\n if (e.defaultPrevented) { return; }\n if (!e.moveEnabled) { return; }\n\n var event = {\n startX: e.startX,\n startY: e.startY,\n pageX: e.pageX,\n pageY: e.pageY,\n distX: e.distX,\n distY: e.distY,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n velocityX: e.velocityX,\n velocityY: e.velocityY,\n identifier: e.identifier,\n targetTouches: e.targetTouches,\n finger: e.finger\n };\n\n var data = {\n target: e.target,\n event: event,\n timer: new Timer(update),\n touch: undefined,\n timeStamp: e.timeStamp\n };\n\n function update(time) {\n updateEvent(event, data.touch, data.timeStamp);\n trigger(data.target, 'move', event);\n }\n\n if (e.identifier === undefined) {\n // We're dealing with a mouse event.\n // Stop clicks from propagating during a move\n on(e.target, 'click', preventDefault);\n on(document, mouseevents.move, activeMousemove, data);\n on(document, mouseevents.end, activeMouseend, data);\n } else {\n // In order to unbind correct handlers they have to be unique\n data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n data.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n // We're dealing with a touch.\n on(document, touchevents.move, data.activeTouchmove, data);\n on(document, touchevents.end, data.activeTouchend, data);\n }\n }", "function movestart(e) {\n if (e.defaultPrevented) { return; }\n if (!e.moveEnabled) { return; }\n\n var event = {\n startX: e.startX,\n startY: e.startY,\n pageX: e.pageX,\n pageY: e.pageY,\n distX: e.distX,\n distY: e.distY,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n velocityX: e.velocityX,\n velocityY: e.velocityY,\n identifier: e.identifier,\n targetTouches: e.targetTouches,\n finger: e.finger\n };\n\n var data = {\n target: e.target,\n event: event,\n timer: new Timer(update),\n touch: undefined,\n timeStamp: e.timeStamp\n };\n\n function update(time) {\n updateEvent(event, data.touch, data.timeStamp);\n trigger(data.target, 'move', event);\n }\n\n if (e.identifier === undefined) {\n // We're dealing with a mouse event.\n // Stop clicks from propagating during a move\n on(e.target, 'click', preventDefault);\n on(document, mouseevents.move, activeMousemove, data);\n on(document, mouseevents.end, activeMouseend, data);\n } else {\n // In order to unbind correct handlers they have to be unique\n data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };\n data.activeTouchend = function(e, data) { activeTouchend(e, data); };\n\n // We're dealing with a touch.\n on(document, touchevents.move, data.activeTouchmove, data);\n on(document, touchevents.end, data.activeTouchend, data);\n }\n }", "function move(e) {\n var keynum;\n\n if (window.event) { // IE \n keynum = e.keyCode;\n } else if (e.which) { // Netscape/Firefox/Opera \n keynum = e.which;\n }\n\n\n if (!win) {\n if (keynum == 68) {\n updatePosition(2, \"right\"); //Moving right\n\n }\n //left\n if (keynum == 65) {\n updatePosition(2, \"left\"); //Moving left\n\n }\n //up\n if (keynum == 87) {\n updatePosition(2, \"up\"); //Moving up\n\n }\n //down\n if (keynum == 83) {\n updatePosition(2, \"down\"); //Moving down\n\n }\n }\n\n checkWin(); //Check if the player has won\n requestAnimationFrame(drawCanvas);\n}", "function _moved() {\n\t\t\t\t// move elements that are half in view\n\t\t\t\t_adjustContentPosition.call(this);\n\t\t\t\t// fire the change event if we should\n\t\t\t\t_fireChangeEvent.call(this);\n\t\t\t}", "move(){\n console.log('circle move')\n }", "move() { }", "move() { }", "onResponderTerminate() {\n this.resetMovingItem();\n // console.log(\"responder terminated\");\n }", "move(from, fromIx, fromCount, to, toIx) {\n let evdata = {\n success: false,\n from: from, \n fromIx: fromIx,\n fromCount: fromCount,\n to: to,\n toIx: toIx\n };\n if (!this.canMove(from, fromIx, fromCount, to, toIx)) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n let card = false;\n let dest = false;\n if (from == 'w') {\n card = this.waste.pop();\n } \n else if (from == 'f') {\n card = this.foundations[fromIx - 1].pop();\n }\n else if (from == 't') {\n let t = this.tableau[fromIx - 1];\n card = t.slice(t.length - fromCount);\n t.length = t.length - fromCount;\n }\n if (to == 't') {\n dest = this.tableau[toIx - 1];\n }\n else if (to == 'f') {\n dest = this.foundations[toIx - 1];\n }\n if (!card || !dest) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n if (Array.isArray(card)) {\n card.forEach((c) => { \n dest.push(c); \n });\n }\n else {\n dest.push(card);\n }\n evdata.success = true;\n this._event(Game.EV.MOVE, evdata); \n if (from == 't') {\n let last = this.tableau[fromIx - 1].last();\n this._event(Game.EV.REVEAL, {\n tableau: fromIx,\n card: last\n });\n }\n return true;\n }", "function eventMove(event, data) {\n // Fix #498\n // Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).\n // https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero\n // IE9 has .buttons and .which zero on mousemove.\n // Firefox breaks the spec MDN defines.\n if (navigator.appVersion.indexOf(\"MSIE 9\") === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {\n return eventEnd(event, data);\n }\n // Check if we are moving up or down\n var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);\n // Convert the movement into a percentage of the slider width/height\n var proposal = (movement * 100) / data.baseSize;\n moveHandles(movement > 0, proposal, data.locations, data.handleNumbers, data.connect);\n }", "function makeMove(e) {\n if(e.target.id >= 1 && e.target.id <= 9 && !e.target.classList.contains('selected')) {\n //Increment selected fields counter\n logic.incrementCount();\n //Save selected field to data array\n logic.addField(e.target.id-1);\n //Update UI\n e.target.classList.add('selected');\n e.target.removeEventListener('click', e); \n logic.getActivePlayer() === 1 ? e.target.innerText = 'O' : e.target.innerText = 'X';\n afterMove();\n } \n }" ]
[ "0.6817973", "0.67130524", "0.6543579", "0.651021", "0.64625555", "0.64032507", "0.63930976", "0.6391352", "0.63675624", "0.63491935", "0.6338625", "0.6311944", "0.6299001", "0.6279518", "0.62407154", "0.6232697", "0.622447", "0.62026554", "0.6194269", "0.6181375", "0.6160972", "0.6155212", "0.6133542", "0.6101529", "0.60556006", "0.6046795", "0.60401756", "0.60394037", "0.60309285", "0.60239214", "0.6023288", "0.6008604", "0.60003996", "0.5998473", "0.59956133", "0.59943277", "0.5992718", "0.59874856", "0.5978091", "0.59770834", "0.5976021", "0.59632325", "0.5962584", "0.5960784", "0.5957414", "0.59521985", "0.594972", "0.59486854", "0.5945931", "0.59451914", "0.59451914", "0.59451914", "0.59431845", "0.59414893", "0.5939336", "0.5928755", "0.5928395", "0.59279805", "0.5902859", "0.5893511", "0.58841306", "0.58774495", "0.58774215", "0.58769727", "0.5874406", "0.5869586", "0.58662283", "0.5862098", "0.584862", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.58423984", "0.5841722", "0.5837552", "0.58360225", "0.5831227", "0.58307666", "0.58307666", "0.5830402", "0.58257514", "0.5825653", "0.5820214", "0.5818833", "0.5805803", "0.5805803", "0.5804768", "0.5804683", "0.5803763", "0.5801852", "0.5801852", "0.5793843", "0.5793714", "0.5787566", "0.57857436" ]
0.0
-1
jQuery special event definition
function setup(data, namespaces, eventHandle) { // Stop the node from being dragged //add(this, 'dragstart.move drag.move', preventDefault); // Prevent text selection and touch interface scrolling //add(this, 'mousedown.move', preventIgnoreTags); // Tell movestart default handler that we've handled this add(this, 'movestart.move', flagAsHandled); // Don't bind to the DOM. For speed. return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_evtClick(event) { }", "function setEvent() {\n $('#plugin_submit').click(setConf);\n $('#plugin_cancel').click(browserBack);\n }", "_evtChange(event) { }", "function _eventHandler(data) {\n console.log(data);\n print2Console(\"EVENT\", data);\n\n\tdata = data.selected.firstChild.data;\n\tprint2Console(\"MYEVENT\", data);\n\t// try to get the callid\n var callid = $(data).find(\"id\");\n\tif (callid.text() !== \"\") {\n $(\"#field-call-control-callid\").val(callid.text());\n\t}\n callid = null;\n}", "function InternalEvent() {}", "onSelect(event) {}", "onEvent() {\n \n }", "function vB_AJAX_QuickEditor_Events()\n{\n}", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function bindEulaModalEvents(){\n\n\t$('#acceptAndDownloadCheckBox').click(function(event){\n\t\thandleEulaModalCheckBoxEvent();\n\t});\n\n\thandleEulaModalCheckBoxEvent();\t\n}", "function Event() { }", "function Event() { }", "function $e(el, e, cb) {\n\tel = (typeof el === 'string' ? $(el) : el);\n\tif (e.indexOf('on') === 0) {\n\t\tel[e] = cb;\n\t} else {\n\t\tel.addEventListener(e, cb);\n\t}\n}", "function triggerAndReturn(context,eventName,data){var event=$.Event(eventName);$(context).trigger(event,data);return!event.isDefaultPrevented();}// trigger an Ajax \"global\" event", "trigger(type, data) {\r\n const e = $.Event(type, data);\r\n\r\n this.$element.trigger(e);\r\n\r\n return e;\r\n }", "_handleClick(event) {\n var target = $(event.currentTarget);\n\n if (target.is('[data-edit]')) {\n this.$element.trigger('edit.zf.trigger');\n }\n\n if (target.is('[data-save]')) {\n this.$element.trigger('save.zf.trigger');\n }\n }", "function jQueryDispatchEvent(srcEvent,eventType,eventPointer){eventPointer=eventPointer||pointer;var eventObj=new angular.element.Event(eventType);eventObj.$material=true;eventObj.pointer=eventPointer;eventObj.srcEvent=srcEvent;angular.extend(eventObj,{clientX:eventPointer.x,clientY:eventPointer.y,screenX:eventPointer.x,screenY:eventPointer.y,pageX:eventPointer.x,pageY:eventPointer.y,ctrlKey:srcEvent.ctrlKey,altKey:srcEvent.altKey,shiftKey:srcEvent.shiftKey,metaKey:srcEvent.metaKey});angular.element(eventPointer.target).trigger(eventObj);}", "static set EVENT( value ) {\n overtakenAdaptEvent = value;\n }", "function new_handler(e,rect) {\n\t\t\t\t\tvar elem = $(this);\n\n\t\t\t\t\t// If called from the polling loop, w and h will be passed in as\n\t\t\t\t\t// arguments. If called manually, via .trigger( 'resize' ) or .resize(),\n\t\t\t\t\t// those values will need to be computed.\n\t\t\t\t\t!rect && (rect = dimension(elem.get(0)))\n\t\t\t\t\telem.data(str_data, rect);\n\n\t\t\t\t\told_handler.call(this,e,rect);\n\t\t\t\t}", "bindEvents() {\n }", "click_extra() {\r\n }", "function Eventable()\n{\n\n}", "function apply_card_event_handlers(){\n $('.card').click(card_selected($(this)));\n }", "actionEventHandler() {\n const selectorElement = document.getElementById(this.element.getAttribute(SELECTOR_ID));\n const event = {\n 'target': selectorElement\n };\n this.eventHandler(event);\n }", "function Events(){}//", "function Events(){}//", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}", "function Events() {}" ]
[ "0.6208069", "0.61712265", "0.6117725", "0.59664416", "0.59167016", "0.5903896", "0.58995515", "0.5869757", "0.58588725", "0.58588725", "0.58588725", "0.58588725", "0.58588725", "0.57951427", "0.5789245", "0.5789245", "0.57824004", "0.5751772", "0.5688772", "0.56794006", "0.5675452", "0.56635684", "0.5651494", "0.564049", "0.5633224", "0.5616039", "0.5605576", "0.5590877", "0.55900747", "0.55900747", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082", "0.5588082" ]
0.0
-1
by Diego Perini with modifications
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private internal function m185() {}", "static private protected internal function m118() {}", "static transient final private internal function m43() {}", "static transient final protected internal function m47() {}", "transient final protected internal function m174() {}", "transient final private protected internal function m167() {}", "obtain(){}", "transient private protected public internal function m181() {}", "transient final private internal function m170() {}", "static protected internal function m125() {}", "static transient final private protected internal function m40() {}", "static transient private protected internal function m55() {}", "static transient private internal function m58() {}", "static final private internal function m106() {}", "static private protected public internal function m117() {}", "__previnit(){}", "function kp() {\n $log.debug(\"TODO\");\n }", "function Pe(){}", "function SeleneseMapper() {\n}", "static transient private protected public internal function m54() {}", "static transient final protected public internal function m46() {}", "function comportement (){\n\t }", "transient private public function m183() {}", "function miFuncion (){}", "prepare() {}", "function GraFlicUtil(paramz){\n\t\n}", "function jessica() {\n $log.debug(\"TODO\");\n }", "transient final private protected public internal function m166() {}", "function undici () {}", "function pd(){}", "function sb(){this.pf=[]}", "function da(){}", "function da(){}", "function da(){}", "function _____SHARED_functions_____(){}", "function oi(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function ea(){}", "static final private protected internal function m103() {}", "function fm(){}", "function init() {\n\t \t\n\t }", "function wa(){}", "constructor () {\r\n\t\t\r\n\t}", "function pd(){this.Fc=void 0;this.group=x.j.Ml;this.Vb=x.j.Vb}", "get Prologic() {}", "static transient private public function m56() {}", "function AeUtil() {}", "function Komunalne() {}", "static transient final protected function m44() {}", "transient final private public function m168() {}", "function oi(a){this.Of=a;this.rg=\"\"}", "constructor (){}", "function Pythia() {}", "function _construct()\n\t\t{;\n\t\t}", "get PSP2() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "static private public function m119() {}" ]
[ "0.6601554", "0.65352565", "0.6248173", "0.59948987", "0.5959169", "0.5897094", "0.58391327", "0.57401186", "0.56591195", "0.5619805", "0.5592898", "0.5538822", "0.5532662", "0.54989", "0.5482116", "0.5448059", "0.54397273", "0.5438595", "0.5414127", "0.54138994", "0.5411371", "0.5345982", "0.53429884", "0.53081703", "0.52879345", "0.52826464", "0.5271323", "0.52062476", "0.5204453", "0.52015615", "0.5187743", "0.51869", "0.5152712", "0.51318085", "0.51299113", "0.5126215", "0.51250654", "0.5118804", "0.5118804", "0.5118804", "0.5109194", "0.5106291", "0.50800985", "0.50800985", "0.50800985", "0.50732046", "0.5068193", "0.50612485", "0.5054958", "0.5054409", "0.50511825", "0.50486284", "0.50461376", "0.50359946", "0.5031368", "0.50127834", "0.50079924", "0.5006214", "0.5000831", "0.4986242", "0.49856126", "0.49776092", "0.49470675", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49370706", "0.49334386" ]
0.0
-1
by Jed Schmidt with modifications
function selector(a){ a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]); var ret=[]; b!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]); return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "private public function m246() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "static final private internal function m106() {}", "static private protected internal function m118() {}", "transient final private internal function m170() {}", "static transient private protected internal function m55() {}", "static transient final private internal function m43() {}", "transient final private protected internal function m167() {}", "transient private protected public internal function m181() {}", "static transient final protected internal function m47() {}", "static transient private internal function m58() {}", "static transient final private protected internal function m40() {}", "__previnit(){}", "static protected internal function m125() {}", "static private protected public internal function m117() {}", "static transient private protected public internal function m54() {}", "transient private public function m183() {}", "function re(a,b){this.O=[];this.za=a;this.la=b||null;this.J=this.D=!1;this.H=void 0;this.ha=this.Fa=this.S=!1;this.R=0;this.Ef=null;this.N=0}", "static transient final protected public internal function m46() {}", "static final private protected internal function m103() {}", "function Hx(a){return a&&a.ic?a.Mb():a}", "function oi(a){this.Of=a;this.rg=\"\"}", "function wR(a,b){this.Fb=[];this.HF=a;this.YE=b||null;this.Pq=this.un=!1;this.ai=void 0;this.Gz=this.AK=this.ez=!1;this.uu=0;this.cb=null;this.az=0}", "function undici () {}", "obtain(){}", "function comportement (){\n\t }", "function sb(){this.pf=[]}", "transient final private protected public internal function m166() {}", "function Rn(){this.seq=[],this.map={}}// --- Utilities ---", "function e(){return [0,0,0,1]}", "static transient private public function m56() {}", "function o1084(o1)\n{\n try {\nfor (var o2 in o1)\n {\n try {\no3.o4(o2 + \" = \" + o1[o2]);\n}catch(e){}\n }\n}catch(e){}\n}", "function ff(a,b){this.Dl=[];this.Fu=a;this.us=b||null;this.ui=this.jb=!1;this.ac=void 0;this.Sq=this.Ur=this.wm=!1;this.Zl=0;this.S=null;this.Lj=0}", "static transient final protected function m44() {}", "static final private protected public internal function m102() {}", "static final private public function m104() {}", "function l$1(e,t,r,s){s[r]=[t.length,t.length+e.length],e.forEach((e=>{t.push(e.geometry);}));}", "function miFuncion (){}", "function hS(a,b){this.Me=[];this.jna=a;this.oma=b||null;this.cK=this.WC=!1;this.XC=void 0;this.b6=this.iNa=this.L5=!1;this.WT=0;this.$e=null;this.S5=0}", "static get elvl_info() {return 0;}", "getBone4cc(b) {\nreturn this.bone4cc[b];\n}", "static private public function m119() {}", "static transient final private protected public internal function m39() {}", "function l(){t={},u=\"\",w=\"\"}", "function binaryPlacement(pEn,pKay,set,pItemSet,writtenTo)\n{\n this.inPosition =[];\n this.itemSet=pItemSet;\n this.kay=pKay;\n this.en=pEn;\n var low = ((this.en-this.kay)>this.kay)?this.kay:this.en-this.kay;\n var top = en-low;\n var curPosCapt =writtenTo.slice();\n var lastStart=[0]\n var aftFirst = false;\n\nfor (var cA=0;cA<set.length;cA++)\n {\n if (cA<low)\n {\n curPosCapt[set[cA]]=this.itemSet[0];\n }\n else\n {\n curPosCapt[set[cA]]=this.itemSet[1];\n }\n }\n \n if (this.en==this.kay)\n {\n return curPosCapt.slice();\n }\n \nfunction BAForRep(start,pSet,aftFirst,leve,leveA,lastStart,curPosCapt)\n//function BAForRep(start,pSet,aftFirst,en,leve,leveA,lastStart,curPosCapt)\n{\n //if we are at last row\n if(leve==this.kay-1)\n {\n for (var cj=start;cj<(this.en-this.kay+leve+1);cj++)\n {\n if ((cj==(this.kay-1))&&(leve==(this.kay-1)))\n {\n aftFirst = false\n }\n else\n {\n aftFirst = true;\n }\n curPosCapt[pSet[cj]]=this.itemSet[0];\n \n// Logger.log(\"content: \"+apArray[apArray.length-1]+ \"ref : \"+(apArray.length-1)+\" dif : \"+(apArray[apArray.length-1]-(apArray.length-1))+\"boolean :\"+aftFirst)\n// if (apArray[apArray.length-1]>(apArray.length-1))\n if (aftFirst)\n {\n if (cj==start)\n {\n for (var cp=cj-leve-1;cp<(this.en-this.kay);cp++)\n if(cp==cj-leve-1)\n {\n curPosCapt[cp+(leve-1)-lastStart[0]]=this.itemSet[1];\n }\n else\n {\n curPosCapt[pSet[cp+this.kay]]=this.itemSet[1];\n }\n }\n else\n {\n curPosCapt[pSet[cj-1]]=this.itemSet[1];\n }\n }\n this.inPosition.push(curPosCapt.slice());\n }\n if (start==(this.en-1))\n {\n lastStart[0]=lastStart[0]+1;\n var int = 5;\n }\n else\n {\n lastStart[0]=0;\n }\n }\n else\n {\n //on any call the start value is the value at the current level\n start=leveA;\n //starting at that value go up to the en - length+leve +1\n for (var ck=start;ck<(this.en-this.kay+leve+1);ck++)\n {\n //write the counter value to this level position\n leveA++;\n curPosCapt[pSet[ck]]=this.itemSet[0];\n //call the next level with this one holding array that\n //has just been fed ck.\n //increase level by one and\n //make the value one higher\n BAForRep(ck+1,pSet,aftFirst,leve+1,leveA,lastStart,curPosCapt)\n// BAForRep(ck+1,pSet,aftFirst,en,leve+1,leveA,lastStart,curPosCapt)\n //after we have written arrays for the last level\n //we will snap back at each level\n //and we run the ascending sequence to the end\n for (var cm=leve+1;cm<this.kay-1;cm++)\n {\n curPosCapt[pSet[ck+(cm-leve)+1]]=this.itemSet[0];\n }\n }\n }\n}\n\n BAForRep(0,set,aftFirst,0,0,lastStart,curPosCapt.slice());\n// BAForRep(0,set,aftFirst,en,0,0,lastStart,curPosCapt.slice());\n// if (this.splitB)\n// {\n// return [this.captureF,this.captureS,this.inPosition];\n// }\n// else\n// {\n// return [capture,this.inPosition];\n return this.inPosition;\n\n// }\n}", "static final protected internal function m110() {}", "_firstRendered() { }", "static transient protected internal function m62() {}", "function o0(stdlib,o1,buffer) {\n try {\nthis.o559 = this.o560;\n}catch(e){}\n var o2 = o254 = [].fround;\n //views\n var charCodeAt =new Map.prototype.keys.call(buffer);\n\n function o4(){\n var o5 = 0.5\n var o35 = { writable: false, value: 1, configurable: false, enumerable: false };\n try {\no849 = o6;\n}catch(e){}\n try {\nreturn +(o0[o1])\n}catch(e){}\n }\n try {\nreturn o4;\n}catch(e){}\n}", "function pf(a,b){this.rb=[];this.sd=a;this.Tc=b||null}", "function co(a,b){this.Wd=[];this.uf=a;this.kf=b||null;this.jd=this.Lc=!1;this.Qb=void 0;this.Ne=this.If=this.he=!1;this.Zd=0;this.Ca=null;this.ie=0}", "function gv(a,b){this.oq=[];this.W3=a;this.TY=b||null;this.Uz=this.lh=!1;this.Ng=void 0;this.TU=this.J$=this.kL=!1;this.ZJ=0;this.Fb=null;this.bE=0}", "function ze(a){return a&&a.ae?a.ed():a}", "function zd(){this.$b=void 0;this.group=y.i.Sj;this.Kb=y.i.Kb}", "function _____SHARED_functions_____(){}", "function Scdr() {\r\n}", "function ld(a,b){this.Hf=[];this.ai=a;this.Gh=b||null;this.xe=this.hd=!1;this.Uc=void 0;this.Sg=this.Ki=this.Yf=!1;this.Mf=0;this.ub=null;this.Zf=0}", "transient final private public function m168() {}", "function ea(){}", "function jg(a,b){this.Lc=[];this.ue=a;this.Wd=b||null;this.Mb=this.lb=!1;this.ya=void 0;this.Gd=this.bf=this.bd=!1;this.Rc=0;this.o=null;this.dd=0}", "function o1109()\n{\n var o1 = {};\n var o2 = \"aabccddeeffaaggaabbaabaabaab\".e(/((aa))/);\n try {\nfor(var o3 in e)\n { \n try {\nif(o4.o11([7,8,9,10], o109, \"slice(-4) returns the last 4 elements - [7,8,9,10]\"))\n { \n try {\no4.o5(\"propertyFound\");\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n try {\nreturn o2;\n}catch(e){}\n}", "function zs(a,b){this.i=[];this.D=a;this.K=b||null;this.g=this.a=!1;this.c=void 0;this.s=this.w=this.j=!1;this.h=0;this.b=null;this.l=0}", "function nd(){}", "lowX() {return this.stringX()}", "setFromXML(boneel) {\nvar bname, brot, btrans, c, pel, rel, xyz, xyzw;\n//---------\nbtrans = null;\nbrot = null;\nbname = boneel.getAttribute(\"name\");\npel = (boneel.getElementsByTagName(\"position\")).item(0);\nrel = (boneel.getElementsByTagName(\"qRotation\")).item(0);\nif (pel) {\nxyz = [\"x\", \"y\", \"z\"];\nbtrans = (function() {\nvar j, len, results;\nresults = [];\nfor (j = 0, len = xyz.length; j < len; j++) {\nc = xyz[j];\nresults.push(Number(pel.getAttribute(c)));\n}\nreturn results;\n})();\n}\nif (rel) {\nxyzw = [\"x\", \"y\", \"z\", \"w\"];\nbrot = (function() {\nvar j, len, results;\nresults = [];\nfor (j = 0, len = xyzw.length; j < len; j++) {\nc = xyzw[j];\nresults.push(Number(rel.getAttribute(c)));\n}\nreturn results;\n})();\n}\nreturn this.setFromStr(bname, brot, btrans);\n}", "function ze(a,b){this.N=[];this.xa=a;this.ia=b||null;this.H=this.D=!1;this.F=void 0;this.ga=this.Da=this.R=!1;this.O=0;this.Of=null;this.J=0}", "function oi(){}", "function ed(a){a=a.tc();for(var b=[],c=[],d=0;d<a.length;d++){var e=a[d].cA;e&&(e=e.call(a[d]))&&(e[2]?b.push(e):c.push(e))}c.sort(fd);b.sort(fd);return[c,b]}", "function l(e){var n={};return me.each(e.match(Ae)||[],function(e,t){n[t]=!0}),n}", "constructor (){}", "function Hqb(){this.j=0;this.F=[];this.C=[];this.L=this.V=this.g=this.G=this.R=this.H=0;this.ia=[]}", "static transient final private public function m41() {}", "function Lqb(){this.j=0;this.F=[];this.C=[];this.L=this.V=this.g=this.G=this.O=this.H=0;this.ia=[]}", "function y(e){let t=R,n=D,r=j,s=v,i=M,o=B,a=_,u=new Uint8Array(x.slice(0,R)),d=E,c=E.slice(0,E.length),g=F,l=Y,p=e();return R=t,D=n,j=r,v=s,M=i,B=o,_=a,x=u,Y=l,E=d,E.splice(0,E.length,...c),F=g,P=new DataView(x.buffer,x.byteOffset,x.byteLength),p}", "stat() {\n var atts = [];\n var char = activeCharacter2();\n for (var key in char) {\n var obj = char[key];\n for (var prop in obj) {\n atts.push({key : prop, prop: obj[prop]});\n };\n };\n return atts;\n }", "function Zc(a){a=a.Xb();for(var b=[],c=[],d=0;d<a.length;d++){var e=a[d].Zg;e&&(e=e.call(a[d]))&&(e[2]?b.push(e):c.push(e))}c.sort($c);b.sort($c);return[c,b]}", "function yy(a,b){this.kd=[];this.ie=a;this.de=b||null;this.Pc=this.zc=!1;this.Mb=void 0;this.Ed=this.me=this.qd=!1;this.md=0;this.Ja=null;this.rd=0}", "function yd(a){var b;q&&(b=a.bh());var c=u(\"xml\");a=xc(a,!0);for(var d=0,e;e=a[d];d++){var h=zd(e);e=e.fb();h.setAttribute(\"x\",q?b-e.x:e.x);h.setAttribute(\"y\",e.y);c.appendChild(h)}return c}", "function bc(){for(var a=B.Za(),b=[],c=[],d=0;d<a.length;d++){var e=a[d].Hf;e&&(e=e.call(a[d]))&&(e[2]?b.push(e):c.push(e))}c.sort(cc);b.sort(cc);return[c,b]}", "function sprinkles() {\n\n\t}", "function vp(a,b){this.ee=[];this.wf=a;this.lf=b||null;this.sd=this.Uc=!1;this.Wb=void 0;this.Oe=this.Kf=this.ne=!1;this.he=0;this.Ua=null;this.oe=0}", "function MatchData() {}", "function Ob(){for(var a=J.vb(),b=[],c=[],d=0;d<a.length;d++){var e=a[d].Ak;e&&(e=e.call(a[d]))&&(e[2]?b.push(e):c.push(e))}c.sort(Pb);b.sort(Pb);return[c,b]}", "function Sread() {\r\n}", "static transient final private protected public function m38() {}", "function ie(){this.i=0,this.j=0,this.S=new Array}", "function Ca(e,t){for(var n in t)e[n]=t[n];return e}", "function gi(t,e){0}", "function ht(a,b){this.PW=[];this.Cva=a;this.Gja=b||null;this.qI=this.Oe=!1;this.Yi=void 0;this.Eda=this.HIa=this.l_=!1;this.EY=0;this.Xb=null;this.CN=0}", "function SeleneseMapper() {\n}", "function Transform$7() {}", "function fm(){}", "function Mr(t,e){for(var n in e)t[n]=e[n];return t}", "function Mr(t,e){for(var n in e)t[n]=e[n];return t}", "function Ha(){}" ]
[ "0.6518312", "0.6158009", "0.6157675", "0.58891916", "0.5859941", "0.58121234", "0.5739894", "0.5565203", "0.5461614", "0.542565", "0.5376566", "0.5360241", "0.5356987", "0.53195894", "0.52952313", "0.5234067", "0.5139211", "0.51173764", "0.5113671", "0.50827587", "0.5049621", "0.5037526", "0.5027537", "0.50045884", "0.50005126", "0.49934846", "0.49917442", "0.49625114", "0.4942965", "0.49122703", "0.48899525", "0.4879499", "0.48725832", "0.48502812", "0.4829206", "0.4810529", "0.47839963", "0.47836208", "0.47812784", "0.47791076", "0.47714475", "0.47670096", "0.47632375", "0.4761966", "0.47560638", "0.47432965", "0.47421435", "0.473832", "0.47335795", "0.47287717", "0.47230655", "0.47130796", "0.47034204", "0.4699795", "0.46978247", "0.46965656", "0.46963266", "0.46873793", "0.4687351", "0.4687062", "0.4679059", "0.4668479", "0.4657706", "0.46565238", "0.46535048", "0.46530184", "0.46509585", "0.46502322", "0.4649277", "0.46382314", "0.4632494", "0.46284756", "0.46282345", "0.46178225", "0.46172217", "0.46154758", "0.4611915", "0.46109387", "0.46086866", "0.46064353", "0.46016428", "0.45988286", "0.45969293", "0.45967245", "0.4590841", "0.45887607", "0.45874164", "0.4569778", "0.45664248", "0.4566138", "0.45604697", "0.45593527", "0.45586228", "0.45573822", "0.4551732", "0.4551264", "0.4549868", "0.4548602", "0.45460242", "0.45460242", "0.4545879" ]
0.0
-1
shallow object property extend
function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static iextend(obj) {\n // eslint-disable-next-line prefer-rest-params\n each(slice.call(arguments, 1), function (source) {\n for (let prop in source) {\n if ({}.hasOwnProperty.call(source, prop)) {\n obj[prop] = source[prop];\n }\n }\n });\n return obj;\n }", "static extend (obj, ...src) {\n const dest = obj\n for (let i in src) {\n let copy = src[i]\n for (let prop in copy) {\n if (copy.hasOwnProperty(prop)) {\n dest[prop] = copy[prop]\n }\n }\n }\n\n return dest\n }", "function deepExtend (destination, source) {\n for (var property in source) {\n if (source[property] && source[property].constructor &&\n source[property].constructor === Object) {\n destination[property] = destination[property] || {};\n arguments.callee(destination[property], source[property]);\n } else {\n destination[property] = source[property];\n }\n }\n return destination;\n }", "extend(props) {\r\n const clone = this.clone()\r\n\r\n Object.assign(clone.props, props)\r\n\r\n return clone\r\n }", "function extend (target, source) {\n for(prop in source) {\n target[prop] = source[prop];\n }\n return target;\n }", "function Extend(target, source){\r\n if((target) && (source) && (typeof source == 'object')) {\r\n for(var property in source) {\r\n if (source.hasOwnProperty(property)) {\r\n try { target[property] = source[property]; } catch (exception) { ; }\r\n }\r\n }\r\n }\r\n return target;\r\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n }", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n }", "function extend(a,b){for(var prop in b){a[prop]=b[prop];}return a;}", "function deepExtend(destination, source) {\n\t destination = destination || {};\n\t for (var property in source) {\n\t if (source[property] && source[property].constructor && source[property].constructor === Object) {\n\t destination[property] = destination[property] || {};\n\t deepExtend(destination[property], source[property]);\n\t } else {\n\t destination[property] = source[property];\n\t }\n\t }\n\t return destination;\n\t }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(obj) {\n slice.call(arguments, 1).forEach(function(source) {\n if (source) {\n for (var prop in source) {\n obj[prop] = source[prop]\n }\n }\n })\n return obj\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n }", "function extend(a, b) {\n for (var prop in b) {\n a[ prop ] = b[ prop ];\n }\n return a;\n }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(obj, props) {\n\t\tvar empty = {};\t\n\t\t\n\t\tif(!obj) {\n\t\t\tobj = {};\n\t\t}\n\t\tfor(var i = 1, l = arguments.length; i < l; i++) {\n\t\t\tmixin(obj, arguments[i]);\n\t\t}\n\t\treturn obj;\n\t\t\n\t\tfunction mixin(target, source) {\n\t\t\tvar name, s, i;\n\t\t\tfor(name in source) {\n\t\t\t\tif(source.hasOwnProperty(name)) {\n\t\t\t\t\ts = source[name];\n\t\t\t\t\tif(!( name in target) || (target[name] !== s && (!( name in empty) || empty[name] !== s))) {\n\t\t\t\t\t\ttarget[name] = s;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn target;\n\t\t\t// Object\n\t\t}\t\t\n\t}", "function deepExtend(destination, source) {\r\n destination = destination || {};\r\n for (var property in source) {\r\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\r\n destination[property] = destination[property] || {};\r\n deepExtend(destination[property], source[property]);\r\n } else {\r\n destination[property] = source[property];\r\n }\r\n }\r\n return destination;\r\n }", "function extend( a, b ) {\r\n for ( var prop in b ) {\r\n a[ prop ] = b[ prop ];\r\n }\r\n return a;\r\n }", "function deepExtend(destination, source) {\n destination = destination || {};\n for (var property in source) {\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\n destination[property] = destination[property] || {};\n deepExtend(destination[property], source[property]);\n } else {\n destination[property] = source[property];\n }\n }\n return destination;\n }", "function deepExtend(destination, source) {\n destination = destination || {};\n for (var property in source) {\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\n destination[property] = destination[property] || {};\n deepExtend(destination[property], source[property]);\n } else {\n destination[property] = source[property];\n }\n }\n return destination;\n }", "function deepExtend(destination, source) {\n destination = destination || {};\n for (var property in source) {\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\n destination[property] = destination[property] || {};\n deepExtend(destination[property], source[property]);\n } else {\n destination[property] = source[property];\n }\n }\n return destination;\n }", "function extend (base, extension) {\n if (isUndefined(base)) {\n return copy(extension);\n }\n if (isUndefined(extension)) {\n return copy(base);\n }\n if (isPureObject(base) && isPureObject(extension)) {\n return utils.extendDeep(base, extension);\n }\n return copy(extension);\n }", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n }", "function extend(a, b) {\r\n for (var prop in b) {\r\n a[prop] = b[prop];\r\n }\r\n return a;\r\n }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(obj) {\n if (!isObject(obj)) return obj;\n var source, prop;\n for (var i = 1, length = arguments.length; i < length; i++) {\n source = arguments[i];\n for (prop in source) {\n if (hasOwnProperty.call(source, prop)) {\n obj[prop] = source[prop];\n }\n }\n }\n return obj;\n }", "function extend(o, p) {\r\n\tfor (prop in p) { // For all props in p.\r\n\t\to[prop] = p[prop]; // Add the property to o.\r\n\t}\r\n\treturn o;\r\n}", "function extend(obj, source) {\n for (var prop in source) {\n obj[prop] = source[prop];\n }\n return obj;\n }", "function _extend(){\n\t \n\t\tvar out = {};\n\t\t\n\t\t//Itterate over all objects and copy each property\n\t\t// shallow copy only \n\t\tvar len = arguments.length;\n\t\tfor(var i=0; i < len;i++)\n\t\t for (var prop in arguments[i]) { out[prop] = arguments[i][prop]; }\n\t\t \n\t\treturn(out);\n\t}", "function extend() {\n // copy reference to target object\n var target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false,\n options,\n name,\n src,\n copy;\n\n // Handle a deep copy situation\n if (typeof target === \"boolean\") {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== \"object\" && !typeof target === 'function')\n target = {};\n\n var isPlainObject = function(obj) {\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor\n // property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if (!obj || toString.call(obj) !== \"[object Object]\" || obj.nodeType\n || obj.setInterval)\n return false;\n\n var has_own_constructor = hasOwnProperty.call(obj, \"constructor\");\n var has_is_prop_of_method = hasOwnProperty.call(obj.constructor.prototype,\n \"isPrototypeOf\");\n // Not own constructor property must be Object\n if (obj.constructor && !has_own_constructor && !has_is_prop_of_method)\n return false;\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n\n var last_key;\n for (var key in obj)\n last_key = key;\n\n return last_key === undefined || hasOwnProperty.call(obj, last_key);\n };\n\n\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) !== null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target === copy)\n continue;\n\n // Recurse if we're merging object literal values or arrays\n if (deep && copy && (isPlainObject(copy) || Array.isArray(copy))) {\n var clone = src && (isPlainObject(src) || Array.isArray(src)\n ? src : (Array.isArray(copy) ? [] : {}));\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (copy !== undefined)\n target[name] = copy;\n }\n }\n }\n\n // Return the modified object\n return target;\n}", "function extend() {\n // copy reference to target object\n var target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false,\n options,\n name,\n src,\n copy;\n\n // Handle a deep copy situation\n if (typeof target === \"boolean\") {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n }\n\n // Handle case when target is a string or something (possible in deep copy)\n if (typeof target !== \"object\" && !typeof target === 'function')\n target = {};\n\n var isPlainObject = function(obj) {\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor\n // property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if (!obj || toString.call(obj) !== \"[object Object]\" || obj.nodeType\n || obj.setInterval)\n return false;\n\n var has_own_constructor = hasOwnProperty.call(obj, \"constructor\");\n var has_is_prop_of_method = hasOwnProperty.call(obj.constructor.prototype,\n \"isPrototypeOf\");\n // Not own constructor property must be Object\n if (obj.constructor && !has_own_constructor && !has_is_prop_of_method)\n return false;\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n\n var last_key;\n for (var key in obj)\n last_key = key;\n\n return last_key === undefined || hasOwnProperty.call(obj, last_key);\n };\n\n\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) !== null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target === copy)\n continue;\n\n // Recurse if we're merging object literal values or arrays\n if (deep && copy && (isPlainObject(copy) || Array.isArray(copy))) {\n var clone = src && (isPlainObject(src) || Array.isArray(src)\n ? src : (Array.isArray(copy) ? [] : {}));\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (copy !== undefined)\n target[name] = copy;\n }\n }\n }\n\n // Return the modified object\n return target;\n}", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\n for ( var prop in b ) {\n a[ prop ] = b[ prop ];\n }\n return a;\n}", "function extend( a, b ) {\r\n for ( var prop in b ) {\r\n a[ prop ] = b[ prop ];\r\n }\r\n return a;\r\n}", "function extend(target, source) {\n for (var prop in source) {\n if (has(source, prop)) {\n target[prop] = source[prop];\n }\n }\n\n return target;\n }", "shallowCopy$() {\n const ret = super.shallowCopy$();\n return new ExtConfig(ret);\n }", "function extend( a, b ) {\n\t for ( var prop in b ) {\n\t a[ prop ] = b[ prop ];\n\t }\n\t return a;\n\t}", "function extend (base, extension) {\n\t if (isUndefined(base)) {\n\t return copy(extension);\n\t }\n\t if (isUndefined(extension)) {\n\t return copy(base);\n\t }\n\t if (isPureObject(base) && isPureObject(extension)) {\n\t return utils.extendDeep(base, extension);\n\t }\n\t return copy(extension);\n\t }" ]
[ "0.6932442", "0.69047314", "0.6878075", "0.6754211", "0.67336607", "0.6692845", "0.6692648", "0.6692648", "0.66892767", "0.66783905", "0.6675184", "0.6662802", "0.66591", "0.66442406", "0.66268665", "0.66268665", "0.66211367", "0.6619446", "0.66177124", "0.66173476", "0.66173476", "0.66173476", "0.6612927", "0.6593839", "0.6591193", "0.6583146", "0.65799", "0.6576082", "0.655901", "0.6557836", "0.65423495", "0.65423495", "0.6542075", "0.6542075", "0.6542075", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.6514153", "0.65105665", "0.6510265", "0.6502497", "0.64929646", "0.64762056" ]
0.0
-1
Helper Methods Unlock the modal for animation.
function unlockModal() { locked = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lockModal() {\n locked = true;\n }", "function lockModal() {\n locked = true;\n }", "function unlockForEdit() {\n\t$(modalTextTitle).prop(\"disabled\",false);\n\t$(modalTextTitle).css(\"border-bottom\", \"2px solid #7C8487\");\n\n\t$(modalTextareaDescription).prop(\"disabled\",false);\n\t$(modalTextareaDescription).css(\"border-bottom\", \"2px solid #7C8487\");\n\n\t$(modalLabelTitle).hide();\n\t$(modalLabelDescription).hide();\n\t$(modalLimitationLabelTitle).show();\n\t$(modalLimitationLabelDescription).show();\n\n\t$(modalIBedit).hide();\n\t$(modalIBdelete).hide();\n\t$(modalButtonEdit).show();\n}", "deactivateModal() {\n\t\tdocument.querySelector('#login-modal').style.display = 'none';\n\t}", "function modalAnimation() {}", "function hideShareModal() {\n // modal animation\n $( '.celebration-cards-share-modal' ).animate( {\n opacity: 0\n }, 500, function() {\n $( '.celebration-cards-share-modal' ).css( \"display\", \"none\" );\n $('.celebration-cards-share-modal__content__cancel').css('display', 'block');\n $('.celebration-cards-share-modal__content__input').css('display', 'none');\n $('.celebration-cards-share-modal__content__input').css('opacity', '0');\n });\n }", "hideModal() {\n // close the modal first\n this.modal.current.setTransition('exit', () => {\n Promise.resolve(\n // un-dim the page after modal slide animation completes\n setTimeout(() => {\n this.setState({\n dimClass: 'dimExit',\n });\n }, Number(Animation.modalSlideDuration)),\n )\n .then(() => {\n // reshow the button and hide modal/dim class\n setTimeout(() => {\n this.setState({\n showButton: true,\n showModal: false,\n dimClass: 'none',\n });\n }, Number(Animation.dimDuration));\n });\n });\n }", "function hideModal() {\r\n //The modal is currently closed\r\n modal.open = false;\r\n //Add class to hide modal\r\n modal.container.classList.add(\"hide-modal\");\r\n }", "function closeModal() {\n MODAL.removeAttribute(\"open\");\n resetGame();\n}", "function closeAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Clear the modal of the open class.\n //\n modal.removeClass( \"open\" );\n\n //\n // Are we using the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, okay, let's set the animation properties.\n //\n modal.animate( {\n //\n // Set the top property to the document scrollTop minus calculated topOffset.\n //\n \"top\": $doc.scrollTop() - topOffset + 'px',\n //\n // Fade the modal out, by using the opacity property.\n //\n \"opacity\": 0\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed / 2,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css hidden options.\n //\n modal.css( cssOpts.close );\n\n });\n //\n // Is the modal animation queued?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Fade out the modal background.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed property.\n //\n modal.trigger( 'reveal:closed' );\n\n });\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fadeAndPop'\n\n //\n // Are we using the 'fade' animation.\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, we're using the 'fade' animation.\n //\n modal.animate( { \"opacity\" : 0 },\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css close options.\n //\n modal.css( cssOpts.close );\n\n }); // end animate\n\n //\n // Are we mid animating the modal(s)?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Let's fade out the modal background element.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n }); // end fadeOut\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Set the modal close css options.\n //\n modal.css( cssOpts.close );\n //\n // Is the modal in the middle of an animation queue?\n //\n if ( !modalQueued ) {\n //\n // It's not mid queueu. Just hide it.\n //\n modalBg.css( { 'display': 'none' } );\n }\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if not animating\n //\n // Reset the modalQueued variable.\n //\n modalQueued = false;\n } // end if !locked\n\n }", "function closeAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Clear the modal of the open class.\n //\n modal.removeClass( \"open\" );\n\n //\n // Are we using the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, okay, let's set the animation properties.\n //\n modal.animate( {\n //\n // Set the top property to the document scrollTop minus calculated topOffset.\n //\n \"top\": $doc.scrollTop() - topOffset + 'px',\n //\n // Fade the modal out, by using the opacity property.\n //\n \"opacity\": 0\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed / 2,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css hidden options.\n //\n modal.css( cssOpts.close );\n\n });\n //\n // Is the modal animation queued?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Fade out the modal background.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed property.\n //\n modal.trigger( 'reveal:closed' );\n\n });\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fadeAndPop'\n\n //\n // Are we using the 'fade' animation.\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, we're using the 'fade' animation.\n //\n modal.animate( { \"opacity\" : 0 },\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css close options.\n //\n modal.css( cssOpts.close );\n\n }); // end animate\n\n //\n // Are we mid animating the modal(s)?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Let's fade out the modal background element.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n }); // end fadeOut\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Set the modal close css options.\n //\n modal.css( cssOpts.close );\n //\n // Is the modal in the middle of an animation queue?\n //\n if ( !modalQueued ) {\n //\n // It's not mid queueu. Just hide it.\n //\n modalBg.css( { 'display': 'none' } );\n }\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if not animating\n //\n // Reset the modalQueued variable.\n //\n modalQueued = false;\n } // end if !locked\n\n }", "function onHiddenBsModal() {\n isModalInTransitionToHide = false;\n isModalVisible = false;\n }", "modify () {\n\n // Hide modal\n this.modal.hide();\n }", "_dismiss() {\n\t\tthis.unbind();\n\t\tthis._isVisible = false;\n\t}", "function onHideBsModal() {\n isModalInTransitionToHide = true;\n }", "function unlock() {\n\tvar item = $(this).parents(\".irform-item:first\");\n\tmodal(\"<div class=\\\"alert alert-warning\\\" role=\\\"alert\\\"><strong>Warning!</strong> By unlocking this item, you will overwrite its value locally and hence any update will not be inherited from its parent values.</div>\", function() {\n\t\t$(item).find(\"fieldset.col-sm-9:first\").removeClass(\"col-sm-9\").addClass(\"col-sm-10\");\n\t\t$(item).find(\"div.col-sm-1\").remove();\n\t\tmainForm.options.disable.call(mainForm, false, item);\n\t\tmainForm.ignore(item, false);\n\t});\n}", "function closeModal33_openModal4()\n{\n modal3.style.display = \"none\";\n modal4.style.display = \"flex\";\n \n}", "modalHide(myModal) {\n myModal.style.display = \"none\";\n player.choosePlayer();\n }", "modalExit() {\n this.setState({showModal: false});\n }", "function cerrarModal() {\n capaModal.classList.remove(\"activa\");\n modal.style.animation = 'modalOut ' + tiempoAnimacion +'ms forwards ease';\n setTimeout(() => { seccionModal.style.transform = \"translateY(-2000px)\" }, tiempoAnimacion);\n}", "function closeModalBox() {\r\n\t\t$['mapsettings'].modal = false;\r\n\t\t$('#modal').slideUp(\"slow\", function(){\r\n\t\t\t$('#modal').remove();\r\n\t\t});\r\n\t\t$(\"#overlay\").fadeTo(\"slow\", 0, function() {\r\n\t\t\t$(\"#overlay\").remove();\r\n\t\t\tif($['mapsettings'].afterModal.length > 0) ($['mapsettings'].afterModal.shift())();\r\n\t\t});\r\n\t}", "hide(){\n\t\tthis.modalShadow.hide();\n\t\tthis.modalBody.hide();\n\t}", "handleCloseModal(){\n this.bShowModal = false;\n }", "function handleClosingModalBoxes(event){\n var targetModalBox = $(event.target).closest(\".modal-box\");\n targetModalBox.hide();\n targetModalBox.attr(\"aria-modal\", \"false\")\n //resume playing animation\n jssor_1_slider.$Play();\n //enable scrolling of body\n $(\"body\").css(\"overflow\", \"visible\");\n}", "function esconderModal() {\n\tmodal.style.display = 'none';\n}", "function modalHidden(){\n\t\trestoreTabindex();\n\t\ttdc.Grd.Modal.isVisible=false;\n\t}", "function dismissModal() {\n if (currentModal) {\n currentModal.dismiss().then(() => {\n currentModal = null;\n });\n }\n}", "function closeModal() {\n modal.style.opacity = \"0\";\n setTimeout(() => {\n modal.style.display = \"none\";\n }, 600);\n}", "function hideModal(modalElement)\r\n{\r\n var modalBackground = $(\"#modalBackground\");\r\n var modalTransitionTime = 250;\r\n\r\n modalBackground.unbind(\"click\");\r\n modalBackground.fadeOut(modalTransitionTime);\r\n modalElement.fadeOut(modalTransitionTime);\r\n}", "function toggle() {\r\n setModal(!modal)\r\n }", "startUnlocking()\n {\n // \"start\" CSS animation\n this.setState({transparent: true});\n // wait until CSS animation end\n Meteor.setTimeout(() => {\n this.unLock();\n }, this.props.transitionDuration);\n }", "function hideModal() {\n vm.modalVisible = false;\n }", "function hideModal() {\n vm.modalVisible = false;\n }", "function closeModalV() {\n modalV.style.display = \"none\";\n modalVbg.style.display = \"none\";\n}", "function hideModal(modal) {\n $(\"#flex-overlay\").css({\n 'display': 'none',\n opacity: 0\n });\n\n if (typeof modal == 'string')\n modal = $(modal);\n\n modal.css({\n \"display\": \"none\"\n })\n }", "endLoading() {\n this.modal.jQueryModalFade.removeClass('modal_fade_trick');\n this.modal.jQueryModalAwait.css('display', 'none');\n }", "function closeModal () {\n modal.style.display = 'none'\n modal.setAttribute('aria-hidden', 'true')\n wrapper[0].setAttribute('aria-hidden', 'false')\n cleanform()\n}", "function _shields_down() {\n if (compute_shield_modal) {\n compute_shield_modal.destroy();\n compute_shield_modal = null;\n }\n else {\n // None to begin with.\n }\n }", "function closeModal() {\n $(\".mask\").removeClass(\"active-modal\");\n}", "hideModal() {\r\n document.querySelector(\".glass\").classList.toggle(\"hidden\");\r\n document.querySelector(\".glass\").dataset.lat = null;\r\n document.querySelector(\".glass\").dataset.lng = null;\r\n app.resetModalFields();\r\n }", "closeModal() {\n this.closeModal();\n }", "function closeModal() {\n \tMODAL.style.display = 'none';\n \tRESET();\n }", "hideModal() {\n this.clearModal();\n $('.modal').modal('hide');\n }", "function closeModal() {\n modalEl.classList.add('hide');\n modalEl.classList.remove('show');\n document.body.style.overflow = 'visible';\n clearInterval(modalTimerId)\n }", "function closeModal() {\n const modal = $(\"#ytbsp-modal\");\n if (0 !== modal.length) {\n modal.css(\"display\", \"none\");\n modal.css(\"opacity\", \"0\");\n }\n}", "function hidePleaseWait () {\n $('#please-wait-modal').fadeOut(500, () => { })\n\n\n $('#please-wait-backdrop').fadeOut(500, () => { })\n}", "function hideWithTransition() {\n var that = this, timeout = setTimeout(function() {\n that.$element.off($.support.transition.end);\n hideModal.call(that);\n }, 500);\n this.$element.one($.support.transition.end, function() {\n clearTimeout(timeout);\n hideModal.call(that);\n });\n }", "function unmaskModal() {\n var $maskTarget = $(\".modal-body\");\n $maskTarget.closest('.modal-dialog').find('[type=\"submit\"]').removeAttr('disabled');\n $(\".modal-mask\").remove();\n }", "clearModal() {\n if ($(\"body\").hasClass(\"modal-open\")) {\n // Ensure animation has time to finish:\n Meteor.setTimeout(() => {\n $(\".modal\").each(() => {\n const modalId = $(this).attr(\"id\")\n UX.dismissModal(modalId)\n })\n $(\"body\").removeClass(\"modal-open\")\n $(\".modal-backdrop\").remove()\n }, 1000)\n }\n }", "function closeModal() {\n if(clickOut == false){\n return\n }\n $('.text_box').css('font-size','25px')\n $('.modal').css('display','none')\n $('.text_box').toggleClass('result')\n $('.text_box').empty()\n clickCounter++\n if(clickCounter == 25){\n endStage()\n }\n clickOut = false\n }", "function closePauseModal() {\n\t\tconsole.log(\"Closing modal\")\n\t\tmodal.style.display = \"none\";\n\t}", "function dismissExtraModal() {\n if (extraModal) {\n extraModal.dismiss().then(() => {\n extraModal = null;\n });\n }\n}", "function hide_bs_modal() {\n currentModal = this.previousModal;\n\n //Close elements\n this._bsModalCloseElements();\n\n //Never close pinned modals\n if (this.bsModal.isPinned)\n return false;\n\n //Remove all noty added on the modal and move down global backdrop\n $._bsNotyRemoveLayer();\n\n //Remove the modal from DOM\n if (this.removeOnClose)\n this.get(0).remove();\n }", "onModalDismiss() {\n this.setState({ showModal: false });\n }", "unlockUI() {\n this.$el.removeClass(classes.lockUI);\n return this;\n }", "function dismiss() {\n $.background.animate({\n opacity: 0,\n duration: animationSpeed\n }, () => {\n // Second parameter for the animation is the callback when it is done\n // In this case we're closing the window after menu has faded away\n $.getView().close();\n });\n\n menuWrapper.animate({\n left: -menuWidth,\n duration: animationSpeed\n });\n}", "function closeModal () {\n modal.style.display = 'none';\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "function closeModal() {\n const classModalOpen = $(\".modal-open\");\n classModalOpen.removeAttr(\"style\");\n classModalOpen.removeAttr(\"class\");\n $(\".modal-backdrop\").remove();\n }", "closeModal(){\n this.showModal = false\n }", "function skjulModal() {\n\n\n modal.classList.remove(\"vis\");\n }", "async closeVerificationModal() {\n await this.setState({ modalDisplay: false });\n this.renderActionButton();\n }", "closemodal() {\n this.modalCtr.dismiss();\n }", "function closeModal4(){\n modal4.style.display = 'none';\n}", "function closeModal4()\n{\n modal4.style.display = \"none\";\n}", "toggleModal () {\n\t\tthis.model.toggleModalState();\n\t\tthis.view.toggleModal( this.model.isModalOpen )\n\t}", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "unlock() {\n const that = this;\n\n that.locked = that.unfocusable = false;\n that._setFocusable();\n }", "unlockEditor() {\n this.lock = false;\n }", "function hidePleaseWait() {\r\n $(\"#pleaseWaitDialog\").modal(\"hide\");\r\n}", "function hidePleaseWait() {\r\n $(\"#pleaseWaitDialog\").modal(\"hide\");\r\n}", "function closeMenuModal() {\r\n menuModal.style.display = \"none\";\r\n}", "function closeModal4() {\n modal4.style.display = 'none';\n }", "function closeModal() {\n /* Get all modals */\n const modals = document.querySelectorAll(\".modal-bg\");\n\n /* Check if modal is active and deactivate it */\n for (let modal of modals) {\n if (modal.style.display === \"flex\") {\n modal.style.display = \"none\";\n resetFirstFormAfterHTMLTag(modal);\n }\n }\n resetTags();\n}", "dismissModal(){\n this._animate.linearIn('largeImageOpacity', 0/*end value*/, 500/*duration(ms)*/)\n setTimeout(()=>this.setState({showLargeImageModal:'none'}), 500)\n }", "function openModal2_CloseModal1()\n{\n Modal.style.display = \"none\";\n Modal2.style.display = \"flex\";\n\n}", "hideModal(){\n if(this.state.type === 'save'){\n this.__checkOscillators();\n $('#save-buttom').removeAttr(\"disabled\");\n document.getElementById(\"modal\").style.display = \"none\"\n document.getElementById('recipient-name').value = \"\";\n document.getElementById('recipient-description').value = \"\"\n document.getElementById('md-body').style.display = 'block';\n document.getElementById('success').style.display = 'none';\n document.getElementById('failure').style.display = 'none';\n document.getElementById('span-name').style.display= 'none';\n }else if(this.state.type === 'load'){\n this.__checkOscillators();\n $('#load-buttom').removeAttr(\"disabled\");\n document.getElementById('md-body-loader').style.display = 'block';\n document.getElementById(\"modalLoad\").style.display = \"none\"\n document.getElementById('success-loader').style.display = 'none';\n document.getElementById('failure-loader').style.display = 'none';\n }else if(this.state.type === 'password'){\n $('#password-buttom').removeAttr(\"disabled\");\n document.getElementById('md-body-password').style.display = 'block';\n document.getElementById(\"modalPassword\").style.display = \"none\"\n document.getElementById('success-password').style.display = 'none';\n this.__cleanPasswords();\n \n }else if(this.state.type === 'delete'){\n document.getElementById('md-body-delete').style.display = 'block';\n document.getElementById(\"modalDelete\").style.display = \"none\"\n document.getElementById('success-delete').style.display = 'none';\n document.getElementById('failure-delete').style.display = 'none';\n }\n \n \n document.getElementById(\"backdrop\").style.display = \"none\"\n \n //document.getElementById(\"save\").classNameName += document.getElementById(\"save\").classNameName.replace(\"show\", \"\")\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function closeModal(){\n modal.style.display = 'none';\n }", "function closeModal2_openModal3()\n{\n modal2.style.display = \"none\";\n modal3.style.display = \"flex\";\n}", "function onShownBsModal() {\n isModalInTransitionToShow = false;\n }", "function closeMe() {\n\t\t $('#' + settings.id).modal('hide');\n\t\t if (settings.isSubModal)\n\t\t $('body').addClass('modal-open');\n\t\t }", "function closeModal () {\n //chnge the display value to none\n modal.style.display = 'none';\n}", "modalClose(){\n\t\tthis.setState({modalAppear: false})\n\t}", "function hide() {\n $$invalidate('modalIsVisible', modalIsVisible = false); // Ensure we cleanup all event listeners when we hide the modal\n\n _cleanupStepEventListeners();\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\n}", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "hideModal(){\n if(document.getElementById('modal')){\n document.getElementById('modal').style.display = 'none';\n document.getElementById('caption').style.display = 'none';\n document.getElementById('modal').style.zIndex = 0;\n }\n \n }", "function closeModal() {\n $('#modal, #modal .wrap-modal').hide();\n $('.videomodal .videoresponsive, .imagemodal .label-imagemodal').empty();\n fechaMask();\n}", "function modalClose() {\t\t\n\t\tif($('mb_Title')) $('mb_Title').remove();\n\t\tif($('mb_Error')) $('mb_Error').remove();\n\t\tif($('mb_header')) $('mb_header').removeClass('yt-Panel-Primary');\n\n\t\t$('mb_center').style.display = 'none';\n\t\t\n\t\t$('mb_contents').getChildren()[0].remove();\n\t\t$('mb_overlay').setStyle('opacity',0);\n\t\t$('mb_frame').setStyle('opacity',0);\n\t\twindow.location.reload(true); \n}" ]
[ "0.72454244", "0.72454244", "0.6896535", "0.6820743", "0.67881566", "0.6694964", "0.66023105", "0.65635765", "0.6528138", "0.6525814", "0.6525814", "0.6509781", "0.6484871", "0.6479335", "0.646648", "0.6439817", "0.6433108", "0.6390839", "0.638449", "0.6374887", "0.63701576", "0.63546246", "0.63450307", "0.63377905", "0.63106793", "0.6298626", "0.62920123", "0.62865424", "0.6283876", "0.6273005", "0.6271748", "0.6264086", "0.6264086", "0.6259964", "0.62557614", "0.6246851", "0.62436754", "0.62412095", "0.6233439", "0.6227569", "0.6225042", "0.6216133", "0.6207629", "0.62063026", "0.62058", "0.6204948", "0.62017393", "0.61910266", "0.6186498", "0.61835295", "0.61786723", "0.61760813", "0.61736715", "0.6161921", "0.6161572", "0.61605376", "0.6154047", "0.6151483", "0.61410034", "0.61404425", "0.61398214", "0.6139632", "0.6126507", "0.6125875", "0.61170214", "0.61141485", "0.6113112", "0.6113112", "0.6113112", "0.6108552", "0.6103733", "0.6101768", "0.6101768", "0.6096491", "0.6096099", "0.60945404", "0.60846823", "0.60843825", "0.6077223", "0.6076996", "0.6076996", "0.6076996", "0.6076996", "0.6076996", "0.6076996", "0.6076996", "0.6076996", "0.60751945", "0.6063968", "0.6063529", "0.60628855", "0.6062141", "0.6058399", "0.60573083", "0.6056499", "0.60531175", "0.60488445", "0.6048477", "0.6047042" ]
0.8249799
1
Lock the modal to prevent further animation.
function lockModal() { locked = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unlockModal() {\n locked = false;\n }", "function unlockModal() {\n locked = false;\n }", "function lock() {\n $('button').attr(\"disabled\", \"true\");\n }", "function lockActions() {\n $('.modal').find('.actions-container')\n .children().first() // the save/submit button\n .addClass('disabled').prop('disabled', true);\n }", "lock() {\n const that = this;\n\n that.locked = that.unfocusable = true;\n\n if (that.showNearButton || that.showFarButton) {\n return;\n }\n\n that._setFocusable();\n }", "lockEditor() {\n this.lock = true;\n }", "startUnlocking()\n {\n // \"start\" CSS animation\n this.setState({transparent: true});\n // wait until CSS animation end\n Meteor.setTimeout(() => {\n this.unLock();\n }, this.props.transitionDuration);\n }", "loading() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalAwait.css('display', 'block');\n this.modal.jQueryModalWindow.css('display', 'none');\n }", "function unlockForEdit() {\n\t$(modalTextTitle).prop(\"disabled\",false);\n\t$(modalTextTitle).css(\"border-bottom\", \"2px solid #7C8487\");\n\n\t$(modalTextareaDescription).prop(\"disabled\",false);\n\t$(modalTextareaDescription).css(\"border-bottom\", \"2px solid #7C8487\");\n\n\t$(modalLabelTitle).hide();\n\t$(modalLabelDescription).hide();\n\t$(modalLimitationLabelTitle).show();\n\t$(modalLimitationLabelDescription).show();\n\n\t$(modalIBedit).hide();\n\t$(modalIBdelete).hide();\n\t$(modalButtonEdit).show();\n}", "function lock(el) {\n\tel.on('click.locked', function() {\n\t\treturn false;\n\t})\n}", "function lockForm(){\n\t\t\t$scope.isLoading = true;\n\t\t}", "lock() {\n _isLocked.set(this, true);\n }", "function lockUI() {\n Dom.$uiLocker.css( 'display', 'block' );\n }", "function attShowModal() {\n setShowModal(!showModal);\n }", "function disablePopUp() {\n setModalValue(!showModal); // toggling value of showModal and setting it in the state\n }", "unLock()\n {\n this.setState({shown: false});\n }", "lock() {\n this.close();\n this.isLocked = true;\n this.refreshState();\n }", "function modalAnimation() {}", "unlockEditor() {\n this.lock = false;\n }", "function lock() {\n clearAlertBox();\n // Lock the editors\n aceEditor.setReadOnly(true);\n\n // Disable the button and set checkCorrectness to true.\n $(\"#resetCode\").attr(\"disabled\", \"disabled\");\n correctnessChecking = true;\n}", "showLogin() {\n // Show the Lock modal\n this.lock.show();\n }", "unlock() {\n const that = this;\n\n that.locked = that.unfocusable = false;\n that._setFocusable();\n }", "function toggle() {\r\n setModal(!modal)\r\n }", "function showForgetModal() {\r\n $(\"#myModal\").modal(\"show\");\r\n}", "function _lockFunctionality() {\n lockUserActions = true;\n viewModel.set(\"lockUserActions\", lockUserActions);\n}", "_checkModal() {\n // TODO: Global modal\n if (this.parent) {\n if (this.attributes.modal) {\n this.on('render', () => this.parent.setState('loading', true));\n this.on('destroy', () => this.parent.setState('loading', false));\n }\n\n this.on('destroy', () => this.parent.focus());\n }\n }", "lock() {\n document.getElementById('instructions').style.display = 'none';\n document.getElementById('blocker').style.display = 'none';\n document.getElementById('draw-canvas').requestPointerLock();\n }", "handleShowModal() {\n this.showSpinner = true;\n this.template.querySelector(\"c-modal-component-template\").show();\n }", "function setModal() {\n $('.overlay').fadeIn('slow');\n $('.modal').slideDown('slow');\n }", "lockEditor() {\n //console.log('LOCK ON');\n this.setState({\n 'lockedEditor': true\n });\n }", "lock() {\n const that = this;\n\n that.locked = true;\n }", "function esconderModal() {\n\tmodal.style.display = 'none';\n}", "function showLoginModal(){\n $('#loginModal').modal({backdrop:'static'});\n}", "function openModal () {\n setVisablity(true)\n }", "lock() {\n this._locked = true;\n }", "function modalWindow() {\n $(\"#modal\").css('display', 'block');\n }", "function launchModal () {\n modal.style.display = 'block'\n modal.setAttribute('aria-hidden', 'false')\n wrapper[0].setAttribute('aria-hidden', 'true')\n}", "function openAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Close any opened modals.\n //\n closeOpenModals();\n //\n // Now, add the open class to this modal.\n //\n modal.addClass( \"open\" );\n\n //\n // Are we executing the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, we're doing the 'fadeAndPop' animation.\n // Okay, set the modal css properties.\n //\n //\n // Set the 'top' property to the document scroll minus the calculated top offset.\n //\n cssOpts.open.top = $doc.scrollTop() - topOffset;\n //\n // Flip the opacity to 0.\n //\n cssOpts.open.opacity = 0;\n //\n // Set the css options.\n //\n modal.css( cssOpts.open );\n //\n // Fade in the background element, at half the speed of the modal element.\n // So, faster than the modal element.\n //\n modalBg.fadeIn( options.animationSpeed / 2 );\n\n //\n // Let's delay the next animation queue.\n // We'll wait until the background element is faded in.\n //\n modal.delay( options.animationSpeed / 2 )\n //\n // Animate the following css properties.\n //\n .animate( {\n //\n // Set the 'top' property to the document scroll plus the calculated top measure.\n //\n \"top\": $doc.scrollTop() + topMeasure + 'px',\n //\n // Set it to full opacity.\n //\n \"opacity\": 1\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal reveal:opened event.\n // This should trigger the functions set in the options.opened property.\n //\n modal.trigger( 'reveal:opened' );\n\n }); // end of animate.\n\n } // end if 'fadeAndPop'\n\n //\n // Are executing the 'fade' animation?\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, were executing 'fade'.\n // Okay, let's set the modal properties.\n //\n cssOpts.open.top = $doc.scrollTop() + topMeasure;\n //\n // Flip the opacity to 0.\n //\n cssOpts.open.opacity = 0;\n //\n // Set the css options.\n //\n modal.css( cssOpts.open );\n //\n // Fade in the modal background at half the speed of the modal.\n // So, faster than modal.\n //\n modalBg.fadeIn( options.animationSpeed / 2 );\n\n //\n // Delay the modal animation.\n // Wait till the modal background is done animating.\n //\n modal.delay( options.animationSpeed / 2 )\n //\n // Now animate the modal.\n //\n .animate( {\n //\n // Set to full opacity.\n //\n \"opacity\": 1\n },\n\n /*\n * Animation speed.\n */\n options.animationSpeed,\n\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal reveal:opened event.\n // This should trigger the functions set in the options.opened property.\n //\n modal.trigger( 'reveal:opened' );\n\n });\n\n } // end if 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Okay, let's set the modal css properties.\n //\n //\n // Set the top property.\n //\n cssOpts.open.top = $doc.scrollTop() + topMeasure;\n //\n // Set the opacity property to full opacity, since we're not fading (animating).\n //\n cssOpts.open.opacity = 1;\n //\n // Set the css property.\n //\n modal.css( cssOpts.open );\n //\n // Show the modal Background.\n //\n modalBg.css( { \"display\": \"block\" } );\n //\n // Trigger the modal opened event.\n //\n modal.trigger( 'reveal:opened' );\n\n } // end if animating 'none'\n\n }// end if !locked\n\n }// end openAnimation", "function openAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Close any opened modals.\n //\n closeOpenModals();\n //\n // Now, add the open class to this modal.\n //\n modal.addClass( \"open\" );\n\n //\n // Are we executing the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, we're doing the 'fadeAndPop' animation.\n // Okay, set the modal css properties.\n //\n //\n // Set the 'top' property to the document scroll minus the calculated top offset.\n //\n cssOpts.open.top = $doc.scrollTop() - topOffset;\n //\n // Flip the opacity to 0.\n //\n cssOpts.open.opacity = 0;\n //\n // Set the css options.\n //\n modal.css( cssOpts.open );\n //\n // Fade in the background element, at half the speed of the modal element.\n // So, faster than the modal element.\n //\n modalBg.fadeIn( options.animationSpeed / 2 );\n\n //\n // Let's delay the next animation queue.\n // We'll wait until the background element is faded in.\n //\n modal.delay( options.animationSpeed / 2 )\n //\n // Animate the following css properties.\n //\n .animate( {\n //\n // Set the 'top' property to the document scroll plus the calculated top measure.\n //\n \"top\": $doc.scrollTop() + topMeasure + 'px',\n //\n // Set it to full opacity.\n //\n \"opacity\": 1\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal reveal:opened event.\n // This should trigger the functions set in the options.opened property.\n //\n modal.trigger( 'reveal:opened' );\n\n }); // end of animate.\n\n } // end if 'fadeAndPop'\n\n //\n // Are executing the 'fade' animation?\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, were executing 'fade'.\n // Okay, let's set the modal properties.\n //\n cssOpts.open.top = $doc.scrollTop() + topMeasure;\n //\n // Flip the opacity to 0.\n //\n cssOpts.open.opacity = 0;\n //\n // Set the css options.\n //\n modal.css( cssOpts.open );\n //\n // Fade in the modal background at half the speed of the modal.\n // So, faster than modal.\n //\n modalBg.fadeIn( options.animationSpeed / 2 );\n\n //\n // Delay the modal animation.\n // Wait till the modal background is done animating.\n //\n modal.delay( options.animationSpeed / 2 )\n //\n // Now animate the modal.\n //\n .animate( {\n //\n // Set to full opacity.\n //\n \"opacity\": 1\n },\n\n /*\n * Animation speed.\n */\n options.animationSpeed,\n\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal reveal:opened event.\n // This should trigger the functions set in the options.opened property.\n //\n modal.trigger( 'reveal:opened' );\n\n });\n\n } // end if 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Okay, let's set the modal css properties.\n //\n //\n // Set the top property.\n //\n cssOpts.open.top = $doc.scrollTop() + topMeasure;\n //\n // Set the opacity property to full opacity, since we're not fading (animating).\n //\n cssOpts.open.opacity = 1;\n //\n // Set the css property.\n //\n modal.css( cssOpts.open );\n //\n // Show the modal Background.\n //\n modalBg.css( { \"display\": \"block\" } );\n //\n // Trigger the modal opened event.\n //\n modal.trigger( 'reveal:opened' );\n\n } // end if animating 'none'\n\n }// end if !locked\n\n }// end openAnimation", "function loadingModal(){\n var $modal = $('.js-loading-bar'),\n $progress = $modal.find('.progress-bar');\n $modal.modal('show');\n $progress.addClass('animate');\n setTimeout(function() {\n $progress.removeClass('animate');\n $modal.modal('hide');\n }, 1000);\n }", "_initializeLock() {\n if(config.get(\"window.locked\")) {\n this.toggleLock();\n }\n }", "function warn() {\n modal.style.display = 'block';\n}", "show () {\n this._setLockout(true)\n }", "showLoader() {\n\t\t\tlet _loader = this.$( '.tvd-modal-preloader-wrapper' );\n\t\t\tif ( ! _loader.length ) {\n\t\t\t\t_loader = $( TVE_Dash.tpl( 'modal-loader', {} ) );\n\t\t\t\tthis.$el.append( _loader );\n\t\t\t}\n\n\t\t\t_loader.find( '.tvd-modal-preloader' ).css( {\n\t\t\t\ttop: ( this.$el.outerHeight() / 2 ) + 'px'\n\t\t\t} );\n\n\t\t\t/* we do this to avoid calling the loader multiple times */\n\t\t\trequestAnimationFrame( () => {\n\t\t\t\tif ( ! this.isLoading ) {\n\t\t\t\t\t_loader.fadeIn( 300 );\n\t\t\t\t\tthis.isLoading = true;\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tthis.$el.addClass( 'tvd-modal-disable' );\n\n\t\t\treturn this;\n\t\t}", "function openModal() {\n modal.style.display = 'block'; \n noscroll();\n}", "toggleLock() {\n $(\"[data-button='lock']\").find(\"i\").toggleClass(\"fa-unlock fa-lock\");\n $(\".container > .menu\").toggleClass(\"draggable\");\n\n var configLock = !config.get(\"window.locked\");\n\n config.set(\"window.locked\", configLock);\n }", "function unlock() {\n\tvar item = $(this).parents(\".irform-item:first\");\n\tmodal(\"<div class=\\\"alert alert-warning\\\" role=\\\"alert\\\"><strong>Warning!</strong> By unlocking this item, you will overwrite its value locally and hence any update will not be inherited from its parent values.</div>\", function() {\n\t\t$(item).find(\"fieldset.col-sm-9:first\").removeClass(\"col-sm-9\").addClass(\"col-sm-10\");\n\t\t$(item).find(\"div.col-sm-1\").remove();\n\t\tmainForm.options.disable.call(mainForm, false, item);\n\t\tmainForm.ignore(item, false);\n\t});\n}", "function openModal() {\n setQuesFlag(false);\n setIsModalVisible(true); \n }", "function openModal() {\n modal.style.display = \"flex\";\n setTimeout(() => {\n modal.style.opacity = \"1\";\n }, 200);\n}", "hide () {\n this._setLockout()\n }", "toggleModal () {\n\t\tthis.model.toggleModalState();\n\t\tthis.view.toggleModal( this.model.isModalOpen )\n\t}", "function formLock() {\r\n disableWidget('newButton');\r\n disableWidget('newButtonList');\r\n disableWidget('saveButton');\r\n disableWidget('printButton');\r\n disableWidget('printButtonPdf');\r\n disableWidget('copyButton');\r\n disableWidget('undoButton');\r\n hideWidget('undoButton');\r\n disableWidget('deleteButton');\r\n disableWidget('refreshButton');\r\n showWidget('refreshButton');\r\n disableWidget('mailButton');\r\n disableWidget('multiUpdateButton');\r\n disableWidget('indentDecreaseButton');\r\n disableWidget('changeStatusButton');\r\n disableWidget('subscribeButton');\r\n}", "function unmaskModal() {\n var $maskTarget = $(\".modal-body\");\n $maskTarget.closest('.modal-dialog').find('[type=\"submit\"]').removeAttr('disabled');\n $(\".modal-mask\").remove();\n }", "function openModal() {\r\n modalProject.style.visibility = \"visible\";\r\n modalProject.style.opacity = \"1\";\r\n modalProject.style.transform = \"translateY(-100%)\";\r\n setTimeout(() => {\r\n modalProject.style.pointerEvents = \"auto\";\r\n }, 500);\r\n}", "async lock() {\n\t\tif (this.lock_status_id === 3) {\n\t\t\treturn;\n\t\t}\n\t\tawait this.send_command(0);\n\t\tawait this.await_event('status:LOCKED');\n\t}", "function lockHelper(){\n\tvar lockButton = document.getElementById(\"lock\");\n\t\n\tif(lockButton.innerText === \"Unlock\")\n\t{\n\t\tselected_marker.dragging.enable();\n\t\tlockButton.innerText = \"Lock\";\n\t} \t\n\telse\n\t{\n\t\tselected_marker.dragging.disable();\n\t\tlockButton.innerText = \"Unlock\";\n\t}\n\tmymap.closePopup();\n}", "function maskModal($maskTarget) {\n var padding = $maskTarget.height() - 80;\n if (padding > 0) {\n padding = Math.floor(padding / 2);\n }\n $maskTarget.append(\"<div class='modal-mask'><div class='circle-loader'></div></div>\");\n //check scrollbar\n var height = $maskTarget.outerHeight();\n $('.modal-mask').css({\"width\": $maskTarget.width() + 30 + \"px\", \"height\": height + \"px\", \"padding-top\": padding + \"px\"});\n $maskTarget.closest('.modal-dialog').find('[type=\"submit\"]').attr('disabled', 'disabled');\n }", "pauseModalShow() {\n\t\tlet pModal = document.getElementById(\"pauseModal\");\n\n\t\t// show modal + pause scene\n\t\tpModal.style.display = \"block\";\n\t\tthis.scene.pause();\n\n\t\t// hide modal + resume scene after 3 seconds\n\t\tsetTimeout(() => {\n\t\t\tthis.scene.resume();\n\t\t\tpModal.style.display = \"none\";\n\t\t}, 3000);\n\t}", "function showModal() {\n setVisible(true);\n setSignUp(false);\n }", "function openModal() {\n setOpen(true);\n }", "modify () {\n\n // Hide modal\n this.modal.hide();\n }", "function MUP_Open(){\n //console.log(\" ----- MUP_Open ----\")\n\n // --- show modal\n $(\"#id_mod_upload_permits\").modal({backdrop: true});\n } // MUP_Open", "function showLoadingModal() {\n $(\"#LoadingModal\").modal(\"show\");\n}", "activateModal() {\n\t\tdocument.getElementById('logout').style.display = 'none';\n\t\tdocument.querySelector('#login-modal').style.display = 'block';\n\t}", "function lockdoor() {\n\t\t\t\tref.update({\n\t\t\t\tunlocked: false,\n\t\t\t})\t\t\t\n\t\t\t}", "openModal() {\n this.modal.addClass(\"modal--is-visible\");\n return false; // Because the Get in Touch button has an a href of #, on click it will scroll to the top of the screen, which we don't want. We want someone to open the modal wherever they are on the page. This return false stops that functionality.\n }", "function _unlockFunctionality() {\n lockUserActions = false;\n viewModel.set(\"lockUserActions\", lockUserActions);\n}", "function modalOpen() {\n modal.style.display = 'block';\n}", "setModalShowOrHide() {\r\n this.setState({\r\n showModal: !this.state.showModal\r\n })\r\n }", "unlock() {\n document.getElementById('blocker').style.display = 'block';\n document.getElementById('instructions').style.display = '';\n }", "function LockForService(title, message) {\n\t$('#service-wrapper').css(\"display\", \"block\");\n\t$('#service-wrapper').animate({opacity:1}, 200);\n}", "function openModal() { \n modal.style.display = 'block';\n }", "open() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalWindow.css('display', 'block');\n this.jQueryName.focus();\n }", "renderModal() {\n Promise.resolve(\n // hide button after click animation completes\n setTimeout(() => {\n this.setState({\n showButton: false\n });\n }, Number(Animation.clickDuration)),\n )\n .then(() => {\n // dim the page\n this.setState({\n dimClass: 'dimEnter',\n showModal: true,\n });\n })\n .then(() => {\n // modal animation\n this.modal.current.setTransition('enter');\n });\n }", "openModal() { \n this.bShowModal = true;\n }", "function openModal(){\r\n modal.style.display = 'block';\r\n }", "unlock() {\n this.isLocked = false;\n this.refreshState();\n }", "function openModal () {\n modal.style.display = 'block';\n }", "function loginOnClick()\n\t {\n\t // Ouverture d'une modale petite\n\t $('#modal-dialog').removeClass('LargeModal').addClass('SmallModal');\n\t var url = '/Login/Login';\n\t $('.modal-content').load(url);\n\t\t\t $('#modal-container').animate({\n\t scrollTop: 0\n\t }, 800);\n\t // alert('show modal');\n\t $('#modal-container').modal({ show: true });\n\t // alert('show modal after');\n\t return false;\n\t }", "function onShownBsModal() {\n isModalInTransitionToShow = false;\n }", "unlockEditor() {\n console.log('___________________')\n this.setState({\n 'lockedEditor': false\n });\n }", "function openModal() {\n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block';\n }", "unlock() {\n const that = this;\n\n that.locked = false;\n }", "onModalDismiss() {\n this.setState({ showModal: false });\n }", "function updateIsLocked(isLocked,oldValue){scope.isLockedOpen=isLocked;if(isLocked===oldValue){element.toggleClass('md-locked-open',!!isLocked);}else{$animate[isLocked?'addClass':'removeClass'](element,'md-locked-open');}if(backdrop){backdrop.toggleClass('md-locked-open',!!isLocked);}}", "eventToggleModal(event) {\n event.preventDefault();\n this.toggleModal();\n }", "function launchModal() {\n modalbg.style.display = \"block\";\n}", "function showModal() {\n\t\ttimer.className = 'modalTimer' ;\n\t\tmodal.className = 'modal-visible' ;\n\t}", "function lockScroll() {\n\t\t// lock scroll position, but retain settings for later\n\t\tvar scrollPosition = [\n\t\t self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,\n\t\t self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop\n\t\t];\n\t\tvar html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that\n\t\thtml.data('scroll-position', scrollPosition);\n\t\thtml.data('previous-overflow', html.css('overflow'));\n\t\thtml.css('overflow', 'hidden');\n\t\twindow.scrollTo(scrollPosition[0], scrollPosition[1]);\n\t}", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function lockChoice(){\r\n $(\"input\").attr(\"disabled\", true);\r\n}", "function showModal() {\n debug('showModal');\n if (!modal.ready) {\n initModal();\n modal.anim = true;\n currentSettings.showBackground(modal, currentSettings, endBackground);\n } else {\n modal.anim = true;\n modal.transition = true;\n currentSettings.showTransition(modal, currentSettings, function(){endHideContent();modal.anim=false;showContentOrLoading();});\n }\n }", "_dismiss() {\n\t\tthis.unbind();\n\t\tthis._isVisible = false;\n\t}", "function openModal(){\n modal.style.display = 'block';\n }", "deactivateModal() {\n\t\tdocument.querySelector('#login-modal').style.display = 'none';\n\t}", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function simpleLock() {\n // save scrolled Y position when locking\n scrolledClientY = document.body.getBoundingClientRect().top;\n // force the Y scrollbar to always appear to prevent jumping issues\n document.body.style.overflow = 'hidden scroll';\n // add scrolled Y position to body top before changing the position property\n document.body.style.top = `${scrolledClientY}px`;\n // limit the vertical height by fixing the position\n document.body.style.position = 'fixed';\n // force body to expand to its whole width\n document.body.style.width = '100%';\n}", "function openModal() {\r\n modal.style.display = \"block\";\r\n}" ]
[ "0.77020603", "0.77020603", "0.6724566", "0.66888505", "0.6680284", "0.6579386", "0.65182763", "0.6472608", "0.64131486", "0.639402", "0.6376364", "0.6302623", "0.62310976", "0.6218524", "0.619525", "0.6177555", "0.6141152", "0.6130219", "0.61241496", "0.6108205", "0.60983217", "0.60864687", "0.60833776", "0.60650176", "0.60614395", "0.60547864", "0.60475004", "0.6040619", "0.6002221", "0.60016763", "0.5985818", "0.5900236", "0.5899546", "0.58950895", "0.58896726", "0.5884072", "0.58671564", "0.5853915", "0.5853915", "0.58512795", "0.584517", "0.5839522", "0.58362705", "0.5835396", "0.583386", "0.5833347", "0.58253914", "0.5815525", "0.5813814", "0.5811698", "0.58090013", "0.57914585", "0.57590604", "0.5757784", "0.57397467", "0.5737688", "0.5729667", "0.57247406", "0.5724602", "0.5710292", "0.5704869", "0.57041365", "0.56958836", "0.5682638", "0.5682544", "0.5671615", "0.56570446", "0.56522214", "0.5647043", "0.5640301", "0.56381285", "0.56284887", "0.5626789", "0.562597", "0.5620924", "0.56191", "0.5603938", "0.5603454", "0.5602181", "0.55960846", "0.55739605", "0.55724967", "0.55724967", "0.5570697", "0.556708", "0.5557149", "0.5556398", "0.5551572", "0.55508816", "0.5547061", "0.5545526", "0.5545169", "0.55444264", "0.5542604", "0.5532633", "0.55321044", "0.553127", "0.55283487", "0.5523917" ]
0.8878073
1
Closes all open modals.
function closeOpenModals() { // // Get all reveal-modal elements with the .open class. // var $openModals = $( ".reveal-modal.open" ); // // Do we have modals to close? // if ( $openModals.length === 1 ) { // // Set the modals for animation queuing. // modalQueued = true; // // Trigger the modal close event. // $openModals.trigger( "reveal:close" ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "closeAll() {\n let i = this.openModals.length;\n while (i--) {\n this.openModals[i].close();\n }\n }", "function bs_close_all_modals() {\n $('.modal, [role=\"dialog\"]').modal('hide');\n $('.modal-backdrop').remove();\n $('body').removeClass('modal-open');\n}", "function closeOpenedModals() {\n\tvar openModals = document.getElementsByClassName('modal');\n\tfor (var i = 0; i < openModals.length; i++) {\n\t\tvar openModal = openModals[i];\n\t\tif (openModal.style.display == \"block\") {\n\t\t\topenModal.style.display = \"none\";\n\t\t}\n\t}\n}", "function closeModals() {\n if ($scope.warning) {\n $scope.warning.close();\n $scope.warning = null;\n }\n if ($scope.timedout) {\n $scope.timedout.close();\n $scope.timedout = null;\n }\n }", "closeAll() {\n for (const theModal of this.modals) {\n $(`#${theModal}`).modal('hide'); $(`#${theModal}`).unbind('hide.bs.modal').unbind('shown.bs.modal').unbind('hidden.bs.modal');\n delete this.tempObject[theModal]; // Delete the temporary cloned copy of object to be saved.\n }\n }", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "closeAll() {\n this.modalControl.closeAll();\n }", "function closeAllModals(event) {\n var modal = document.getElementsByClassName('friendModalDiv');\n if (event.target.classList.contains('friendModalDiv')) {\n } else {\n for (var i = 0; i < modal.length; i++) {\n let currModal = modal[i];\n currModal.classList.remove(\"openFriendModalDiv\");\n }\n }\n }", "function closeModal() {\n /* Get all modals */\n const modals = document.querySelectorAll(\".modal-bg\");\n\n /* Check if modal is active and deactivate it */\n for (let modal of modals) {\n if (modal.style.display === \"flex\") {\n modal.style.display = \"none\";\n resetFirstFormAfterHTMLTag(modal);\n }\n }\n resetTags();\n}", "close() {\n const modals = Array.from(document.querySelectorAll(\".modal\"));\n document.body.classList.remove(\"no-overflow\");\n\n this._element.classList.remove(\"active\");\n modals.forEach((modalNode) => {\n modalNode.classList.remove(\"modal-active\");\n });\n }", "function closeModals($scope) {\n if ($scope.warning) {\n $scope.warning.close();\n $scope.warning = null;\n }\n\n if ($scope.timedout) {\n $scope.timedout.close();\n $scope.timedout = null;\n }\n}", "function closeToolModals(){\n Quas.each(\".post-tool-modal\", function(el){\n el.visible(false);\n });\n\n Quas.each(\".toolbar-modal-btn\", function(el){\n el.active(false);\n });\n\n Quas.scrollable(true);\n}", "function closeAll() {\n\t\t\t$.each( menuItems, function( index ) {\n\t\t\t\tmenuItems[index].close();\n\t\t\t});\n\t\t}", "function close_modals(){\n\t\t$('.close').on('click', function(){\n\t\t\t$('.popup_msg').hide();\n\t\t});\n\t}", "closeAll() {\n this._openCloseAll(false);\n }", "function closeModal() {\n var modal = document.getElementsByClassName(\"modal\");\n Array.prototype.forEach.call(modal, function (element) {\n element.style.display = \"none\";\n })\n}", "function clearModals() {\n $('.modal.in').remove();\n $('.modal-backdrop').remove();\n this.next();\n}", "closeModal() {\n this.close();\n }", "closemodal() {\n this.modalCtr.dismiss(this.items);\n }", "function closeModal() {\n for(var i = 0; i < closeBtn.length; i++) {\n closeBtn[i].addEventListener('click', function(){\n for (var i = 0; i < modal.length; i++) {\n modal[i].classList.remove('open');\n }\n })\n }\n}", "function closeAllPopups() {\n setEditAvatarPopupOpen(false);\n setEditProfilePopupOpen(false);\n setAddPlacePopupOpen(false);\n setDeleteCardPopupOpen(false);\n setImagePopupOpen(false);\n setInfoToolTipOpen(false);\n setSelectedCard({});\n }", "closeModals() {\n this.setState({\n backgroundColor: 'white',\n logIsOpen: false,\n incrementIsOpen: false,\n decrementIsOpen: false\n })\n }", "function closeModal() {\n let closeBtns = document.querySelectorAll('.closeBtn')\n closeBtns.forEach(button => {\n button.addEventListener('click', event => {\n let modals = document.querySelectorAll('.modal')\n modals.forEach(modal => {\n if (event.target.getAttribute(\"data-type\") === modal.id) {\n modal.style.display = 'none'\n }\n })\n })\n })\n}", "closeModal() {\n this.closeModal();\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "function closeModals() {\n if (event.target == winModal) {\n winModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == dealerWinModal) {\n dealerWinModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == winTwentyOneModal) {\n winTwentyOneModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == dealerTwentyOneModal) {\n dealerTwentyOneModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == bustModal) {\n bustModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == dealerBustModal) {\n dealerBustModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == drawModal) {\n drawModal.style.display = \"none\";\n gameReset();\n }\n if (event.target == settingsModal) {\n settingsModal.style.display = \"none\";\n }\n if (event.target == rulesModal) {\n rulesModal.style.display = \"none\";\n }\n if (event.target == statsModal) {\n statsModal.style.display = \"none\";\n }\n}", "function closeDefaultModal() {\n default_modal.close();\n }", "function adminModalClose() {\n let i; \n for (i = 0; i < closeButton.length; i++) {\n closeButton[i].onclick = function() {\n modal.style.display = \"none\";\n modalEdit.style.display = 'none';\n modalDelete.style.display = 'none';\n }\n }\n}", "function closeModal() {\n return runGuardQueue(modalQueue.value.map(function (modalObject) {\n return function () {\n return modalObject.close();\n };\n }));\n}", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "function closeAllPopups()\n {\n if(infoPopupVisible)\n {\n $('#' + configuration.CSS.ids.infoPopupId).fadeOut();\n infoPopupVisible = false; \n }\n \n if(otherPopupVisible)\n {\n $('#' + configuration.CSS.ids.otherPopupId).fadeOut();\n otherPopupVisible = false;\n }\n \n if(economicalPopupVisible)\n {\n $('#' + configuration.CSS.ids.economicalPopupId).fadeOut();\n economicalPopupVisible = false; \n }\n \n if(politicalPopupVisible)\n {\n $('#' + configuration.CSS.ids.politicalPopupId).fadeOut();\n politicalPopupVisible = false; \n } \n }", "function closeModals(event) {\n if (event.target.classList.contains(\"closeModal\")) {\n let modal1 = document.querySelector(\".cart__modal\");\n modal1.style.display = \"none\";\n let modal2 = document.querySelector(\".cart__container\");\n modal2.style.display = \"none\";\n let modal3 = document.querySelector(\".checkout-page\");\n modal3.style.display = \"none\";\n let modal4 = document.querySelector(\".receipt-page\");\n modal4.style.display = \"none\";\n }\n}", "function closeModal()\r\n {\r\n windows.close($('#modalContainer .window').attr('id'));\r\n }", "function closeModal() {\n modal[0].style.display = \"none\";\n modal[1].style.display = \"none\";\n modal[2].style.display = \"none\";\n modal[3].style.display = \"none\";\n \n}", "function modalClose() {\n if (document.body.classList.contains('modal-open')) {\n document.body.classList.remove('modal-open')\n return\n }else {\n return\n }\n }", "function closeModal(){\r\n $('.close').click(function(){\r\n $('.item-details1, .item-details2, .item-details3').empty();\r\n $('.dark-background').fadeOut();\r\n })\r\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "closeAllViews() {\n // Raise ViewHiding events for open views in reverse order.\n while (this.openViews.length) {\n this._closeLatestView();\n }\n }", "function closeImages() {\n vm.modal.hide();\n screen.unlockOrientation();\n }", "function closeModal(modal) {\n modal.modal('hide');\n}", "function closeModal () {\n modal.style.display = 'none';\n }", "function clearModals(){\n $('#updateFailed').css('display', 'none');\n $('#updateComplete').css('display', 'none');\n $('#portWarningMessage').css('display', 'none');\n $('#configWarningMessage').css('display', 'none');\n $('#updateModalFooter [data-dismiss=\"modal\"]').css('display', 'none');\n $('#warningModalFooter [data-dismiss=\"modal\"]').css('display', 'none');\n $('#updateModalFooter .hideModal').css('display', 'none');\n $('#warningModalFooter .hideModal').css('display', 'none');\n $('#updateModal').modal('hide');\n $('#warningModal').modal('hide');\n}", "function closeAll() {\n $(\".tap-target\").tapTarget(\"close\");\n $(\".tap-target\").tapTarget(\"destroy\");\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "clearModal() {\n if ($(\"body\").hasClass(\"modal-open\")) {\n // Ensure animation has time to finish:\n Meteor.setTimeout(() => {\n $(\".modal\").each(() => {\n const modalId = $(this).attr(\"id\")\n UX.dismissModal(modalId)\n })\n $(\"body\").removeClass(\"modal-open\")\n $(\".modal-backdrop\").remove()\n }, 1000)\n }\n }", "close() {\n\t\tthis.$modal.removeClass(this.options.classes.open);\n\t\tthis.isOpen = false;\n\n // remove accessibility attr\n this.$body.attr('aria-hidden', false);\n\n\t\t// After starting fade-out transition, wait for it's end before setting hidden class\n\t\tthis.$modal.on(transitionEndEvent(), (e) => {\n\t\t\tif (e.originalEvent.propertyName === 'opacity') {\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tthis.$body.removeClass(this.options.classes.visible);\n\t\t\t\tthis.$modal\n\t\t\t\t\t.addClass(this.options.classes.hidden)\n\t\t\t\t\t.detach().insertAfter(this.$el)\n\t\t\t\t\t.off(transitionEndEvent());\n\t\t\t}\n\t\t});\n\n this.$closeBtn.off('click');\n this.$backdrop.off('click');\n this.$modal.off('keydown');\n this.$el.focus();\n\t}", "function closeModal() {\n var modal = document.querySelector(\".modal\");\n if( modal ) {\n modal.parentElement.removeChild(modal);\n var blocker = document.querySelector(\".blocker\");\n if( blocker ) blocker.parentElement.removeChild(blocker);\n }\n}", "close() {\n this.closeButton.on('click', null);\n this.modal(false);\n this.window.remove();\n }", "function close() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n modal.style.display = 'none';\n document.getElementById('play-modal').style.display = 'none';\n document.getElementById('edit-modal').style.display = 'none';\n document.getElementById('delete-modal').style.display = 'none';\n}", "function closeModal() {\n if (modalCloseHandler) {\n // This is for extra actions when closing the modal, for example cleanup\n modalCloseHandler();\n }\n\n setModalState({ show: false });\n }", "function close() {\n // Unbind the events\n $(window).unbind('resize', modalContentResize);\n $('body').unbind( 'focus', modalEventHandler);\n $('body').unbind( 'keypress', modalEventHandler );\n $('body').unbind( 'keydown', modalTabTrapHandler );\n $('.close').unbind('click', modalContentClose);\n $('body').unbind('keypress', modalEventEscapeCloseHandler);\n $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));\n\n // Set our animation parameters and use them\n if ( animation == 'fadeIn' ) animation = 'fadeOut';\n if ( animation == 'slideDown' ) animation = 'slideUp';\n if ( animation == 'show' ) animation = 'hide';\n\n // Close the content\n modalContent.hide()[animation](speed);\n\n // Remove the content\n $('#modalContent').remove();\n $('#modalBackdrop').remove();\n\n // Restore focus to where it was before opening the dialog\n $(oldFocus).focus();\n }", "function closeModal() {\n\t var modalElement = document.querySelector(\"div.modal[data-closed='0']\");\n\t if (modalElement) {\n\t modalElement.setAttribute(\"data-closed\", \"1\");\n\t modalElement.style.display = \"none\";\n\t }\n\t}", "function closeAllInfoWindows() {\n\tfor (var i=0;i<infoWindows.length;i++) {\n\t\tinfoWindows[i].close();\n\t}\n}", "function closeModal(modal) {\n let bodyOpen = modal.querySelector('.modal__body');\n modal.classList.remove('open');\n bodyOpen.classList.remove('open');\n }", "closemodal() {\n this.modalCtr.dismiss();\n }", "function clearModal() {\n if (!currentModal) {\n return;\n }\n\n document.body.classList.remove('modal-open');\n\n currentModal.parentNode.removeChild(currentModal);\n currentModal = null;\n }", "function hide_bs_modal() {\n currentModal = this.previousModal;\n\n //Close elements\n this._bsModalCloseElements();\n\n //Never close pinned modals\n if (this.bsModal.isPinned)\n return false;\n\n //Remove all noty added on the modal and move down global backdrop\n $._bsNotyRemoveLayer();\n\n //Remove the modal from DOM\n if (this.removeOnClose)\n this.get(0).remove();\n }", "closeModal() {\n removeClass(document.documentElement, MODAL_OPEN);\n hide(this.modal);\n\n if (this.videoWrapper) {\n const wrapperId = this.videoWrapper.getAttribute('id');\n if (window[wrapperId].pause) {\n window[wrapperId].pause();\n } else if (window[wrapperId].pauseVideo) {\n window[wrapperId].pauseVideo();\n }\n }\n\n const overlay = document.querySelector('.modal-overlay');\n if (overlay !== null) { document.body.removeChild(overlay); }\n }", "closeAll() {\n const that = this;\n\n for (var i = that._instances.length - 1; i > -1; i--) {\n that._close(that._instances[i]);\n }\n }", "closeAllEntries() {\n for(var entryIndex in entries) {\n var entry = entries[entryIndex];\n\n if(entry.isCloseable()) {\n entry.close();\n }\n }\n\n this.updateWindowHeight();\n }", "function closeModal() {\n const classModalOpen = $(\".modal-open\");\n classModalOpen.removeAttr(\"style\");\n classModalOpen.removeAttr(\"class\");\n $(\".modal-backdrop\").remove();\n }", "_closeAll() {\n this._closeItems();\n this._toggleShowMore(false);\n }", "function closeModalWindow(){$(\"#modal-window\").removeClass(\"show\"),$(\"#modal-window\").addClass(\"hide\"),$(\"#modal-window\").modal(\"hide\"),$(\"body\").removeClass(\"modal-open\"),$(\".modal-backdrop\").remove()}", "function closeAllVisibleControllers( ){\n try{\n for( var i in m_present_controllers ){\n if( m_content_container.contains( m_present_controllers[ i ].getDisplayNode() ) ){\n m_present_controllers[ i ].close();\n }\n }\n }catch( e ){\n Logger.logObj( e );\n Logger.log( '!!! EXCEPTION ON closeAllVisibleControllers()' );\n }\n }", "function closeModal() {\n modalEl.classList.add('hide');\n modalEl.classList.remove('show');\n document.body.style.overflow = 'visible';\n clearInterval(modalTimerId)\n }", "closeAll() {\n // Make a copy of all the widget in the dock panel (using `toArray()`)\n // before removing them because removing them while iterating through them\n // modifies the underlying data of the iterator.\n toArray(this._dockPanel.widgets()).forEach(widget => widget.close());\n this._downPanel.stackedPanel.widgets.forEach(widget => widget.close());\n }", "function closeModal() {\n\t$('.modal').css(\"display\", \"none\")\n\tconsole.log(\"Closed\")\n}", "function closeModal() {\n\t\n\tmodal.style.display = 'none';\n}", "function closeModal() {\n const modal = $(\"#ytbsp-modal\");\n if (0 !== modal.length) {\n modal.css(\"display\", \"none\");\n modal.css(\"opacity\", \"0\");\n }\n}", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "function killModal() {\n\t\t// Remove modal elements.\n\t\tconst classesToKill = [ 'tp-modal', 'tp-backdrop' ];\n\n\t\tfor ( let deadClass of classesToKill ) {\n\t\t\tconst deadNode = document.getElementsByClassName( deadClass );\n\n\t\t\tif ( deadNode && deadNode[0] ) {\n\t\t\t\tdeadNode[0].parentNode.removeChild( deadNode[0] );\n\t\t\t}\n\t\t}\n\n\t\t// Remove modal class from body.\n\t\tbodyNode.className = bodyNode.className.replace( 'tp-modal-open', '' );\n\n\t\t// Restore scrolling to body.\n\t\tbodyNode.style.overflowY = 'unset';\n\t}", "closeModal() {\n let self = this;\n\n self.set('youtubeModalService.showVideoModal', false);\n\n self.set('youtubeModalService.playerCounter', 0);\n\n self.set('youtubeModalService.isPlaylist', false);\n\n self.cleanUpScrub();\n\n self.turnOffAdaptiveVid();\n }", "function closeModal(){\n modal.style.display = 'none';\n }", "hideModal() {\n this.clearModal();\n $('.modal').modal('hide');\n }", "closeAll() {\n return Promise.all(this._contexts.map(context => this._widgetManager.closeWidgets(context))).then(() => undefined);\n }", "function closeUCAndNCModals() {\n $('#uncommitedChangesModal').modal('hide');\n $(\"#newCommandNameModal\").modal(\"hide\");\n}", "function closeModal(modal) {\n\tmodal.style.display = \"none\";\n}", "function closeModal(modal) {\n \n modal[0].style.display = \"none\";\n}", "_closeDialogs(dialogs) {\n let i = dialogs.length;\n while (i--) {\n // The `_openDialogs` property isn't updated after close until the rxjs subscription\n // runs on the next microtask, in addition to modifying the array as we're going\n // through it. We loop through all of them and call close without assuming that\n // they'll be removed from the list instantaneously.\n dialogs[i].close();\n }\n }", "_closeDialogs(dialogs) {\n let i = dialogs.length;\n while (i--) {\n // The `_openDialogs` property isn't updated after close until the rxjs subscription\n // runs on the next microtask, in addition to modifying the array as we're going\n // through it. We loop through all of them and call close without assuming that\n // they'll be removed from the list instantaneously.\n dialogs[i].close();\n }\n }", "function sellerModalClose() {\r\n document.getElementsByTagName('body')[0].classList.remove('ovh');\r\n document.querySelectorAll('.seller-registration-modal')[0].classList.remove('seller-registration-modal_opened');\r\n document.querySelectorAll('.seller-registration-window').forEach(function (win) {\r\n win.style.display = 'none';\r\n });\r\n }", "function closeModal() {\n MODAL.removeAttribute(\"open\");\n resetGame();\n}", "function closeModal(){\n let modal_container = document.querySelector(\".modal-container\");\n body.removeChild(modal_container);\n}", "function closePopups() {\n locations.forEach(location => {\n location.marker.getPopup().remove()\n })\n}", "function modalFadeOutOpened() {\n // get all modal that are currently shown\n var modalOpened = document.querySelectorAll(\".fade-in\");\n\n // loop through the founded elements\n for (var i = 0; i < modalOpened.length; i++) {\n // and remove the class \"fade-in\"\n modalOpened[i].classList.remove(\"fade-in\");\n }\n }", "function closeAllInfoWindows() {\n for (var i=0;i<infowins.length;i++) {\n infowins[i].close();\n infowins.splice(i, 1);\n }\n}", "function closeAllMenus() {\r\n hideOverlay();\r\n closeMobileCart();\r\n closeMobileCustomerMenu();\r\n closeMobileMainMenu();\r\n closeFilterMenu();\r\n}", "function closeModal() {\n \tMODAL.style.display = 'none';\n \tRESET();\n }", "function modalClose() {\t\t\n\t\tif($('mb_Title')) $('mb_Title').remove();\n\t\tif($('mb_Error')) $('mb_Error').remove();\n\t\tif($('mb_header')) $('mb_header').removeClass('yt-Panel-Primary');\n\n\t\t$('mb_center').style.display = 'none';\n\t\t\n\t\t$('mb_contents').getChildren()[0].remove();\n\t\t$('mb_overlay').setStyle('opacity',0);\n\t\t$('mb_frame').setStyle('opacity',0);\n\t\twindow.location.reload(true); \n}", "close() {\n this.modal.dismiss();\n }", "function closeAll() {\n $scope.closeMenu();\n document.activeElement.blur();\n $scope.ib.close();\n var listBox = document.getElementById(\"floating-panel\");\n while (listBox.firstChild) {\n listBox.removeChild(listBox.firstChild);\n }\n listBox.className = \"hidden\";\n $scope.closeWndr();\n }" ]
[ "0.84376395", "0.77613777", "0.7760164", "0.7690232", "0.76874083", "0.7605883", "0.7605883", "0.7605883", "0.74058515", "0.7212445", "0.71493334", "0.71299577", "0.7102482", "0.69917834", "0.6903182", "0.6827299", "0.6744225", "0.67415535", "0.6714342", "0.67139536", "0.6621212", "0.660137", "0.65975887", "0.6581863", "0.6554644", "0.65446234", "0.64556205", "0.64306587", "0.64306223", "0.6372382", "0.6370229", "0.6324901", "0.6311923", "0.62781835", "0.62769175", "0.6267448", "0.624567", "0.6245616", "0.6239389", "0.6239389", "0.6239389", "0.623922", "0.6236073", "0.6218788", "0.61994714", "0.6194821", "0.6194749", "0.61922544", "0.61922544", "0.61922544", "0.61922544", "0.6187222", "0.61806256", "0.617783", "0.6173916", "0.6162399", "0.6156249", "0.61534894", "0.6151331", "0.6149806", "0.6139506", "0.6136789", "0.61085117", "0.61000794", "0.609624", "0.6088993", "0.608752", "0.6081821", "0.60782146", "0.60605264", "0.6032426", "0.602812", "0.60233766", "0.6016271", "0.60145795", "0.60087186", "0.60040265", "0.60038745", "0.5999694", "0.59932876", "0.5986656", "0.59734446", "0.59704196", "0.5969462", "0.59692377", "0.5968333", "0.5965837", "0.5965837", "0.59604186", "0.5957319", "0.59550864", "0.5952335", "0.59503466", "0.59459823", "0.5944425", "0.59428495", "0.59381914", "0.5935448", "0.59345984" ]
0.7577199
9
Animates the modal opening. Handles the modal 'open' event.
function openAnimation() { // // First, determine if we're in the middle of animation. // if ( !locked ) { // // We're not animating, let's lock the modal for animation. // lockModal(); // // Close any opened modals. // closeOpenModals(); // // Now, add the open class to this modal. // modal.addClass( "open" ); // // Are we executing the 'fadeAndPop' animation? // if ( options.animation === "fadeAndPop" ) { // // Yes, we're doing the 'fadeAndPop' animation. // Okay, set the modal css properties. // // // Set the 'top' property to the document scroll minus the calculated top offset. // cssOpts.open.top = $doc.scrollTop() - topOffset; // // Flip the opacity to 0. // cssOpts.open.opacity = 0; // // Set the css options. // modal.css( cssOpts.open ); // // Fade in the background element, at half the speed of the modal element. // So, faster than the modal element. // modalBg.fadeIn( options.animationSpeed / 2 ); // // Let's delay the next animation queue. // We'll wait until the background element is faded in. // modal.delay( options.animationSpeed / 2 ) // // Animate the following css properties. // .animate( { // // Set the 'top' property to the document scroll plus the calculated top measure. // "top": $doc.scrollTop() + topMeasure + 'px', // // Set it to full opacity. // "opacity": 1 }, /* * Fade speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal reveal:opened event. // This should trigger the functions set in the options.opened property. // modal.trigger( 'reveal:opened' ); }); // end of animate. } // end if 'fadeAndPop' // // Are executing the 'fade' animation? // if ( options.animation === "fade" ) { // // Yes, were executing 'fade'. // Okay, let's set the modal properties. // cssOpts.open.top = $doc.scrollTop() + topMeasure; // // Flip the opacity to 0. // cssOpts.open.opacity = 0; // // Set the css options. // modal.css( cssOpts.open ); // // Fade in the modal background at half the speed of the modal. // So, faster than modal. // modalBg.fadeIn( options.animationSpeed / 2 ); // // Delay the modal animation. // Wait till the modal background is done animating. // modal.delay( options.animationSpeed / 2 ) // // Now animate the modal. // .animate( { // // Set to full opacity. // "opacity": 1 }, /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal reveal:opened event. // This should trigger the functions set in the options.opened property. // modal.trigger( 'reveal:opened' ); }); } // end if 'fade' // // Are we not animating? // if ( options.animation === "none" ) { // // We're not animating. // Okay, let's set the modal css properties. // // // Set the top property. // cssOpts.open.top = $doc.scrollTop() + topMeasure; // // Set the opacity property to full opacity, since we're not fading (animating). // cssOpts.open.opacity = 1; // // Set the css property. // modal.css( cssOpts.open ); // // Show the modal Background. // modalBg.css( { "display": "block" } ); // // Trigger the modal opened event. // modal.trigger( 'reveal:opened' ); } // end if animating 'none' }// end if !locked }// end openAnimation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "open() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalWindow.css('display', 'block');\n this.jQueryName.focus();\n }", "function modalAnimation() {}", "modalOpen(){\n\t\tthis.setState({modalAppear: true})\n\t}", "function openModal() {\n setOpen(true);\n }", "openModal() {\n\t\tthis.setState({\n\t\t\tisModalOpen: true\n\t\t});\n\t}", "function openModal() {\n modal.fadeIn();\n}", "function showModal() {\n debug('showModal');\n if (!modal.ready) {\n initModal();\n modal.anim = true;\n currentSettings.showBackground(modal, currentSettings, endBackground);\n } else {\n modal.anim = true;\n modal.transition = true;\n currentSettings.showTransition(modal, currentSettings, function(){endHideContent();modal.anim=false;showContentOrLoading();});\n }\n }", "displayModal() {\n $(\"#modal-sliding\").openModal();\n }", "function showModal() {\r\n\t\tdebug('showModal');\r\n\t\tif (!modal.ready) {\r\n\t\t\tinitModal();\r\n\t\t\tmodal.anim = true;\r\n\t\t\tcurrentSettings.showBackground(modal, currentSettings, endBackground);\r\n\t\t} else {\r\n\t\t\tmodal.anim = true;\r\n\t\t\tmodal.transition = true;\r\n\t\t\tcurrentSettings.showTransition(modal, currentSettings, function(){endHideContent();modal.anim=false;showContentOrLoading();});\r\n\t\t}\r\n\t}", "function openModal() {\n setIsOpen(true);\n }", "function openModal() {\n setIsModalOpen((isModalOpen) => !isModalOpen);\n }", "function setModal() {\n $('.overlay').fadeIn('slow');\n $('.modal').slideDown('slow');\n }", "function openModal () {\n modal.style.display = 'block';\n }", "function openModal () {\n setVisablity(true)\n }", "function openModal(modalToOpen) {\n //$(\".modal\").css(\"marginTop\", \"0\");\n $(modalToOpen).css(\"marginLeft\", ($(window).width() - $(modalToOpen).width())/2);\n $(modalToOpen+\"-bg\").fadeIn();\n $(modalToOpen).fadeIn();\n}", "function openModal() { \n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block';\n }", "function openModal() {\n modal.style.display = 'block';\n }", "handleOpenModal() { this.setState({ showModal: true }); }", "handleOpenModal () { this.setState({ showModal: true }) }", "handleModalOpen() {\n this.setState({ open: true });\n }", "function openModal(e) {\n\tmodal.style.display = 'block'\n}", "function openModal () {\n\t\tmodalMoves.innerHTML = moves;\n\t\tmodalSecs.innerHTML = pad(totalTime%60);\n\t\tmodalMins.innerHTML = pad(parseInt(totalTime/60));\n\t\tmodal.style.display = 'block';\n}", "function modalOpen() {\n modal.style.display = 'block';\n}", "openModal() {\n this.setState({\n modalOpen: true\n });\n }", "open() {\n this.visible = true;\n console.log(\"Modal opened\");\n }", "function onShowBsModal() {\n isModalInTransitionToShow = true;\n isModalVisible = true;\n }", "function openModal(){\r\n modal.style.display = 'block';\r\n }", "function open() {\n // Show the modal and overlay\n modal.style.display = 'block';\n modalOverlay.style.display = 'block';\n}", "function openModal() {\n modal.classList.add(\"is-active\");\n }", "handleOpenModal() {\n this.setState({ showModal: true });\n }", "openModal() {\r\n this.setState({\r\n modalIsOpen: true\r\n });\r\n }", "showModal() {\n this.isModalOpen = true;\n }", "openModal() {\n addClass(document.documentElement, MODAL_OPEN);\n show(this.modal);\n\n const overlay = document.createElement('div');\n overlay.className = 'modal-overlay';\n document.body.appendChild(overlay);\n }", "openModal () {\n this.setState({\n isModalOpen: true\n })\n }", "function modalOpen(evt) {\r\n let projectSelected = $(this).attr(\"ID\");\r\n let projectSelectedModal = \"#\" + $(this).attr(\"ID\") + \"Modal\";\r\n let projectTitle = $(this).find(\"h3\").text();\r\n let projectTitleModal = \"#\" + projectSelected + \"TitleModal\";\r\n let projectLinkId = projectSelected + \"Link\";\r\n let projectLink = $(\"#\" + projectLinkId).attr(\"href\");\r\n let projectLinkModal = \"#\" + projectLinkId + \"Modal\";\r\n\r\n evt.stopPropagation();\r\n menuClose()\r\n $(projectSelectedModal).removeClass(\"remElement\");\r\n $(projectSelectedModal).addClass(\"temp\");\r\n $(projectSelectedModal).scrollTop(0);\r\n $(projectTitleModal).text(projectTitle);\r\n $(projectLinkModal).attr(\"href\", projectLink);\r\n $(\"body\").addClass(\"bgFreeze\");\r\n $(\"main\").addClass(\"bgDarken\");\r\n $(\"main\").on(\"click\", modalClose);\r\n}", "showModal() {\n this.open = true;\n }", "function openModal() {\r\n // console.log(142);\r\n modal.style.display = 'block';\r\n}", "function openModal () {\n modal.style.display = 'block'\n}", "openModal () {\n this.setState({ newModalIsOpen: true });\n }", "function openModal(){\n modal.style.display = 'block';\n }", "openModal() {\n this.setState({ open: true });\n }", "openModal() {\n this.setState({ isModalOpen: true });\n }", "handleOpenModal() {\n this.stateUpdate({showModal: true});\n }", "function openModal() {\r\n\tmodal.style.display = 'block';\r\n}", "openModal() {\n if (this.estimationData.data.length < 1) {\n this.getEstimationData();\n }\n this.isModalOpen = true;\n }", "openModal() {\n this.setState({ modalIsOpen: true });\n }", "function openModal() {\n console.log('Open sesame!')\n modal.classList.add('open');\n}", "function openModal() {\r\n modal.style.display = 'block';\r\n}", "openModal() {\n this.setState({ isModalOpen: true });\n }", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\n modal.style.display = 'block';\n}", "function openModal() {\nelModal.style.display = 'block';\n}", "openModal(){\n\n }", "function openModal() {\r\n modalProject.style.visibility = \"visible\";\r\n modalProject.style.opacity = \"1\";\r\n modalProject.style.transform = \"translateY(-100%)\";\r\n setTimeout(() => {\r\n modalProject.style.pointerEvents = \"auto\";\r\n }, 500);\r\n}", "toggleModal () {\n\t\tthis.model.toggleModalState();\n\t\tthis.view.toggleModal( this.model.isModalOpen )\n\t}", "open(){\n this.setState({ showModal: true }) \n }", "function openModal(){\r\n modal.style.display = 'block';\r\n}", "function openModal(){\n\t\n\tmodal.style.display = 'block';\n\t\n}", "function openModal() {\r\n modal.style.display = \"block\";\r\n}", "function openModal() {\n modal.style.display = \"block\";\n}", "modalDisplayAnimation() {\n let modal = document.getElementById(\"nomadModal\"); // target modal to open it\n\n let btn = document.getElementById(\"modalButton\"); // Get the <span> element that closes the modal\n\n let span = document.getElementsByClassName(\"close\")[0]; // When the user clicks the button, open the modal\n\n btn.onclick = function () {\n modal.style.display = \"block\";\n }; // When the user clicks on <span> (x), close the modal\n\n\n span.onclick = function () {\n modal.style.display = \"none\";\n }; // When the user clicks anywhere outside of the modal, close it\n\n\n window.onclick = function (event) {\n if (event.target == modal) {\n modal.style.display = \"none\";\n }\n };\n\n $(\".message a\").click(function () {\n $(\"form\").animate({\n height: \"toggle\",\n opacity: \"toggle\"\n }, \"slow\");\n });\n }", "function handleOpen() {\n $.background.animate({\n opacity: 0.5,\n duration: animationSpeed\n });\n menuWrapper.animate({\n left: 0,\n duration: animationSpeed\n });\n}", "openModal(message) {\n this.setState({ modalIsOpen: true });\n }", "openModal() { \n this.bShowModal = true;\n }", "function show() {\n $$invalidate('modalIsVisible', modalIsVisible = true);\n }", "function openModal(myModal) {\n myModal.style.display = \"block\";\n }", "function openModal() {\n modal.style.display = \"block\";\n}", "function openModal(){\n modal.style.display = 'block';\n}", "function openModal(){\n modal.style.display = 'block';\n}", "modalShow() {\n\t\tlet modal = document.getElementById(\"myModal\");\n\t\tlet restartBtn = document.getElementsByClassName(\"close\")[0];\n\n\t\tthis.scene.pause(); // pause timer & game When colliding with a bomb\n\t\tmodal.style.display = \"block\"; // show modal\n\n\t\trestartBtn.addEventListener(\"click\", (e) => {\n\t\t\te.preventDefault();\n\t\t\tmodal.style.display = \"none\"; // hide modal on clicking 'RESTART' button\n\n\t\t\t// restart after clicking 'restart' - clear all events & set game in initial point\n\t\t\tthis.restartGame();\n\t\t});\n\t}", "openModal() {\n this.props.setSuccessMessage('');\n this.props.getPositions();\n this.props.getTags();\n this.props.setCompanyId(this.props.companyId);\n this.setState({isModalOpen: true});\n }", "function openModal(e) {\n var index = Array.from(triggers).indexOf(e.currentTarget);\n var modal = Array.from(modals)[index];\n modal.classList.add(\"active\");\n}", "function openModal(modal) {\n \n modal[0].style.display = \"block\";\n}", "function showModal() {\n\t\ttimer.className = 'modalTimer' ;\n\t\tmodal.className = 'modal-visible' ;\n\t}", "function openMoadal(e){\n console.log(e);\n modal.style.display = 'block';\n \n}", "function openModal() {\n setIsModalOpen((isModalOpen) => !isModalOpen);\n dispatch(getObsQuestionnaireResponseDetail(id));\n }", "function attShowModal() {\n setShowModal(!showModal);\n }", "openModal() {\n this.modalbuy.open(this.event);\n }", "openModal() {\n this.modal.addClass(\"modal--is-visible\");\n return false; // Because the Get in Touch button has an a href of #, on click it will scroll to the top of the screen, which we don't want. We want someone to open the modal wherever they are on the page. This return false stops that functionality.\n }", "function openModal() {\r\n\t\t\tdocument.getElementById('myModal').style.display = \"block\";\r\n\t\t}", "function openModal(){\n modal.style.display = 'block'; \n}", "function openModal() {\n getRecipeDetails();\n handleShow();\n }", "openModal() {\n this.setState({\n visible: true\n });\n }", "open() {\n if (this.options.deepLink) {\n var hash = `#${this.id}`;\n\n if (window.history.pushState) {\n window.history.pushState(null, null, hash);\n } else {\n window.location.hash = hash;\n }\n }\n\n this.isActive = true;\n\n // Make elements invisible, but remove display: none so we can get size and positioning\n this.$element\n .css({ 'visibility': 'hidden' })\n .show()\n .scrollTop(0);\n if (this.options.overlay) {\n this.$overlay.css({'visibility': 'hidden'}).show();\n }\n\n this._updatePosition();\n\n this.$element\n .hide()\n .css({ 'visibility': '' });\n\n if(this.$overlay) {\n this.$overlay.css({'visibility': ''}).hide();\n if(this.$element.hasClass('fast')) {\n this.$overlay.addClass('fast');\n } else if (this.$element.hasClass('slow')) {\n this.$overlay.addClass('slow');\n }\n }\n\n\n if (!this.options.multipleOpened) {\n /**\n * Fires immediately before the modal opens.\n * Closes any other modals that are currently open\n * @event Reveal#closeme\n */\n this.$element.trigger('closeme.zf.reveal', this.id);\n }\n\n var _this = this;\n\n function addRevealOpenClasses() {\n if (_this.isMobile) {\n if(!_this.originalScrollPos) {\n _this.originalScrollPos = window.pageYOffset;\n }\n $('html, body').addClass('is-reveal-open');\n }\n else {\n $('body').addClass('is-reveal-open');\n }\n }\n // Motion UI method of reveal\n if (this.options.animationIn) {\n function afterAnimation(){\n _this.$element\n .attr({\n 'aria-hidden': false,\n 'tabindex': -1\n })\n .focus();\n addRevealOpenClasses();\n Foundation.Keyboard.trapFocus(_this.$element);\n }\n if (this.options.overlay) {\n Foundation.Motion.animateIn(this.$overlay, 'fade-in');\n }\n Foundation.Motion.animateIn(this.$element, this.options.animationIn, () => {\n if(this.$element) { // protect against object having been removed\n this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);\n afterAnimation();\n }\n });\n }\n // jQuery method of reveal\n else {\n if (this.options.overlay) {\n this.$overlay.show(0);\n }\n this.$element.show(this.options.showDelay);\n }\n\n // handle accessibility\n this.$element\n .attr({\n 'aria-hidden': false,\n 'tabindex': -1\n })\n .focus();\n Foundation.Keyboard.trapFocus(this.$element);\n\n /**\n * Fires when the modal has successfully opened.\n * @event Reveal#open\n */\n this.$element.trigger('open.zf.reveal');\n\n addRevealOpenClasses();\n\n setTimeout(() => {\n this._extraHandlers();\n }, 0);\n }", "loading() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalAwait.css('display', 'block');\n this.modal.jQueryModalWindow.css('display', 'none');\n }", "function openModal() {\n modal.style.display = \"flex\";\n setTimeout(() => {\n modal.style.opacity = \"1\";\n }, 200);\n}", "function MUP_Open(){\n //console.log(\" ----- MUP_Open ----\")\n\n // --- show modal\n $(\"#id_mod_upload_permits\").modal({backdrop: true});\n } // MUP_Open", "show(){\n\t\tthis.modalShadow.show();\n\t\tthis.modalBody.show();\n\t}", "function openModal(){\n var modal = document.getElementById('thanksModal');\n modal.style.display = \"flex\";\n function fadeIn() {\n modal.style.opacity = \"1\";\n }\n setTimeout(fadeIn, 125);\n }", "function setModal() {\n if ($('#modal').iziModal('getState') == 'closed') {\n $('#modal').iziModal('open');\n }\n}", "showModal() {\n $('.modal').modal('show');\n }", "function start() {\n $('#myModal').modal('show');\n }" ]
[ "0.72274184", "0.71450293", "0.7141732", "0.7109374", "0.7081208", "0.70157766", "0.6918489", "0.68839055", "0.6869721", "0.68123823", "0.67818654", "0.67528653", "0.67508465", "0.6713749", "0.6665212", "0.6662611", "0.6645355", "0.6645355", "0.6643038", "0.66234994", "0.66217816", "0.6583968", "0.6550459", "0.65475696", "0.6534219", "0.65304744", "0.65147305", "0.6514214", "0.64682424", "0.64658165", "0.6459005", "0.6453678", "0.6453213", "0.6447543", "0.6446661", "0.64401925", "0.6439012", "0.6433919", "0.64191586", "0.64175034", "0.6413477", "0.6408557", "0.6406699", "0.6392458", "0.6377483", "0.6374953", "0.63715804", "0.6369898", "0.63515013", "0.63493156", "0.63281476", "0.63281476", "0.63281476", "0.63281476", "0.63281476", "0.6311853", "0.6306827", "0.6306827", "0.6300293", "0.6291063", "0.62885135", "0.6286223", "0.6281106", "0.62807345", "0.6275937", "0.62542826", "0.625218", "0.6251688", "0.6244093", "0.624216", "0.6236162", "0.6231042", "0.6226451", "0.62139183", "0.6211097", "0.6206908", "0.620661", "0.62056863", "0.6202993", "0.62003225", "0.6195607", "0.619074", "0.61889917", "0.61815697", "0.61794883", "0.61774707", "0.6175777", "0.61656505", "0.6156821", "0.61561024", "0.6149634", "0.61463326", "0.6145083", "0.613887", "0.6123564", "0.61226827", "0.6117478", "0.611483", "0.60992306" ]
0.7665859
1
Closes the modal element(s) Handles the modal 'close' event.
function closeAnimation() { // // First, determine if we're in the middle of animation. // if ( !locked ) { // // We're not animating, let's lock the modal for animation. // lockModal(); // // Clear the modal of the open class. // modal.removeClass( "open" ); // // Are we using the 'fadeAndPop' animation? // if ( options.animation === "fadeAndPop" ) { // // Yes, okay, let's set the animation properties. // modal.animate( { // // Set the top property to the document scrollTop minus calculated topOffset. // "top": $doc.scrollTop() - topOffset + 'px', // // Fade the modal out, by using the opacity property. // "opacity": 0 }, /* * Fade speed. */ options.animationSpeed / 2, /* * End of animation callback. */ function () { // // Set the css hidden options. // modal.css( cssOpts.close ); }); // // Is the modal animation queued? // if ( !modalQueued ) { // // Oh, the modal(s) are mid animating. // Let's delay the animation queue. // modalBg.delay( options.animationSpeed ) // // Fade out the modal background. // .fadeOut( /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed property. // modal.trigger( 'reveal:closed' ); }); } else { // // We're not mid queue. // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if !modalQueued } // end if animation 'fadeAndPop' // // Are we using the 'fade' animation. // if ( options.animation === "fade" ) { // // Yes, we're using the 'fade' animation. // modal.animate( { "opacity" : 0 }, /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Set the css close options. // modal.css( cssOpts.close ); }); // end animate // // Are we mid animating the modal(s)? // if ( !modalQueued ) { // // Oh, the modal(s) are mid animating. // Let's delay the animation queue. // modalBg.delay( options.animationSpeed ) // // Let's fade out the modal background element. // .fadeOut( /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); }); // end fadeOut } else { // // We're not mid queue. // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if !modalQueued } // end if animation 'fade' // // Are we not animating? // if ( options.animation === "none" ) { // // We're not animating. // Set the modal close css options. // modal.css( cssOpts.close ); // // Is the modal in the middle of an animation queue? // if ( !modalQueued ) { // // It's not mid queueu. Just hide it. // modalBg.css( { 'display': 'none' } ); } // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if not animating // // Reset the modalQueued variable. // modalQueued = false; } // end if !locked }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "'click .close' (event) {\n console.log(\"MODAL CLOSED VIA X\");\n modal.hide();\n }", "closeModal() {\n this.close();\n }", "function close() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "closemodal() {\n this.modalCtr.dismiss(this.items);\n }", "close() {\n \n // The close function will hide the modal...\n this.visible = false;\n\n // ...and dispatch an event on the modal that the view model can listen for.\n this.el.dispatchEvent(\n new CustomEvent('closed', { bubbles: true })\n );\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "closeModal() {\n this.closeModal();\n }", "function closeModal () {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeCreatePollModal() {\n \n var backdropElem = document.getElementById('modal-backdrop');\n var createPollElem = document.getElementById('create-poll-modal');\n\n // Hide the modal and its backdrop.\n backdropElem.classList.add('hidden');\n createPollElem.classList.add('hidden');\n \n //clearInputValues();\n}", "function close_modals(){\n\t\t$('.close').on('click', function(){\n\t\t\t$('.popup_msg').hide();\n\t\t});\n\t}", "close() {\n\t\tthis.$modal.removeClass(this.options.classes.open);\n\t\tthis.isOpen = false;\n\n // remove accessibility attr\n this.$body.attr('aria-hidden', false);\n\n\t\t// After starting fade-out transition, wait for it's end before setting hidden class\n\t\tthis.$modal.on(transitionEndEvent(), (e) => {\n\t\t\tif (e.originalEvent.propertyName === 'opacity') {\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tthis.$body.removeClass(this.options.classes.visible);\n\t\t\t\tthis.$modal\n\t\t\t\t\t.addClass(this.options.classes.hidden)\n\t\t\t\t\t.detach().insertAfter(this.$el)\n\t\t\t\t\t.off(transitionEndEvent());\n\t\t\t}\n\t\t});\n\n this.$closeBtn.off('click');\n this.$backdrop.off('click');\n this.$modal.off('keydown');\n this.$el.focus();\n\t}", "close() {\n const modals = Array.from(document.querySelectorAll(\".modal\"));\n document.body.classList.remove(\"no-overflow\");\n\n this._element.classList.remove(\"active\");\n modals.forEach((modalNode) => {\n modalNode.classList.remove(\"modal-active\");\n });\n }", "closemodal() {\n this.modalCtr.dismiss();\n }", "function closeModal() {\n\t var modalElement = document.querySelector(\"div.modal[data-closed='0']\");\n\t if (modalElement) {\n\t modalElement.setAttribute(\"data-closed\", \"1\");\n\t modalElement.style.display = \"none\";\n\t }\n\t}", "close() {\n this.modal.dismiss();\n }", "function closeModal() {\n /* Get all modals */\n const modals = document.querySelectorAll(\".modal-bg\");\n\n /* Check if modal is active and deactivate it */\n for (let modal of modals) {\n if (modal.style.display === \"flex\") {\n modal.style.display = \"none\";\n resetFirstFormAfterHTMLTag(modal);\n }\n }\n resetTags();\n}", "function closeModal()\r\n {\r\n windows.close($('#modalContainer .window').attr('id'));\r\n }", "function closeModal() {\n const modal = $(\"#ytbsp-modal\");\n if (0 !== modal.length) {\n modal.css(\"display\", \"none\");\n modal.css(\"opacity\", \"0\");\n }\n}", "function closeModal() {\n\t$('.modal').css(\"display\", \"none\")\n\tconsole.log(\"Closed\")\n}", "function closeModal(modal) {\n modal.modal('hide');\n}", "close() {\n this.closeButton.on('click', null);\n this.modal(false);\n this.window.remove();\n }", "function closeModal() {\n clearForm();\n props.onChangeModalState();\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "closeContactModal() {\n //get element references\n const modal = document.getElementById(\"contact-success-modal\");\n const modalOverlay = document.getElementById(\"contact-modal-overlay\");\n \n //Fade out the modal\n this.fadeOutModal(modal, modalOverlay);\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function modalClose() {\t\t\n\t\tif($('mb_Title')) $('mb_Title').remove();\n\t\tif($('mb_Error')) $('mb_Error').remove();\n\t\tif($('mb_header')) $('mb_header').removeClass('yt-Panel-Primary');\n\n\t\t$('mb_center').style.display = 'none';\n\t\t\n\t\t$('mb_contents').getChildren()[0].remove();\n\t\t$('mb_overlay').setStyle('opacity',0);\n\t\t$('mb_frame').setStyle('opacity',0);\n\t\twindow.location.reload(true); \n}", "function closeModal() {\n\t\n\tmodal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = 'none';\n }", "function closeModal() {\n\tmodal.style.display = 'none'\n}", "function closeAddPhotoModal() {\n\n var backdropElem = document.getElementById('modal-backdrop');\n var addPhotoModalElem = document.getElementById('create-item-modal');\n\n // Hide the modal and its backdrop.\n backdropElem.classList.add('hidden');\n addPhotoModalElem.classList.add('hidden');\n\n clearPhotoInputValues();\n\n}", "handleModalClose() {\n const closeModal = document.querySelector('.modal-close');\n\n closeModal.addEventListener('click', () => {\n document.querySelector('.modal-content').remove();\n document.querySelector('.employee-modal').style.display = \"none\";\n });\n }", "function closeModal(){\r\n $('.close').click(function(){\r\n $('.item-details1, .item-details2, .item-details3').empty();\r\n $('.dark-background').fadeOut();\r\n })\r\n }", "function closeModal(){\n\t$(\"#myModal\").hide();\n\tcurrPokeID = null;\n}", "function closeModal () {\n modal.style.display = 'none'\n modal.setAttribute('aria-hidden', 'true')\n wrapper[0].setAttribute('aria-hidden', 'false')\n cleanform()\n}", "function closeModal () {\n modal.style.display = 'none'\n}", "function modelClose() {\n $( \".btn-close\" ).click(function() {\n $('#disclaimerModal').hide();\n $('body').removeClass('modal-open');\n });\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeAddPhotoModal() {\n\n var backdropElem = document.getElementById('modal-backdrop');\n var addPhotoModalElem = document.getElementById('add-photo-modal');\n\n // Hide the modal and its backdrop.\n backdropElem.classList.add('hidden');\n addPhotoModalElem.classList.add('hidden');\n\n clearPhotoInputValues();\n\n}", "function closeModal() {\n modal.style.display = 'none';\n document.getElementById('play-modal').style.display = 'none';\n document.getElementById('edit-modal').style.display = 'none';\n document.getElementById('delete-modal').style.display = 'none';\n}", "function closeModal() {\n if (modalCloseHandler) {\n // This is for extra actions when closing the modal, for example cleanup\n modalCloseHandler();\n }\n\n setModalState({ show: false });\n }", "function closeModal() {\r\n modal.style.display = 'none';\r\n}", "handleCloseClick()\n {\n invokeCloseModal() \n this.close()\n }", "function closeModal() {\n var modal = document.querySelector(\".modal\");\n if( modal ) {\n modal.parentElement.removeChild(modal);\n var blocker = document.querySelector(\".blocker\");\n if( blocker ) blocker.parentElement.removeChild(blocker);\n }\n}", "function closeModal() {\n let closeBtns = document.querySelectorAll('.closeBtn')\n closeBtns.forEach(button => {\n button.addEventListener('click', event => {\n let modals = document.querySelectorAll('.modal')\n modals.forEach(modal => {\n if (event.target.getAttribute(\"data-type\") === modal.id) {\n modal.style.display = 'none'\n }\n })\n })\n })\n}", "function closeModal(modal) {\n\tmodal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModalDialog () {\n mainView.send('close-modal-dialog');\n}", "closeModal() {\n removeClass(document.documentElement, MODAL_OPEN);\n hide(this.modal);\n\n if (this.videoWrapper) {\n const wrapperId = this.videoWrapper.getAttribute('id');\n if (window[wrapperId].pause) {\n window[wrapperId].pause();\n } else if (window[wrapperId].pauseVideo) {\n window[wrapperId].pauseVideo();\n }\n }\n\n const overlay = document.querySelector('.modal-overlay');\n if (overlay !== null) { document.body.removeChild(overlay); }\n }", "function closeModal(modalID) {\n\t$(\"#\"+modalID).modal ('hide'); \n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal(e) {\n e.stopPropagation();\n if (e.target.id === 'close') document.querySelector('.modal-container').remove();\n else if (e.target.classList.contains('modal-container')) document.querySelector('.modal-container').remove();\n}", "function close() {\n // Unbind the events\n $(window).unbind('resize', modalContentResize);\n $('body').unbind( 'focus', modalEventHandler);\n $('body').unbind( 'keypress', modalEventHandler );\n $('body').unbind( 'keydown', modalTabTrapHandler );\n $('.close').unbind('click', modalContentClose);\n $('body').unbind('keypress', modalEventEscapeCloseHandler);\n $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));\n\n // Set our animation parameters and use them\n if ( animation == 'fadeIn' ) animation = 'fadeOut';\n if ( animation == 'slideDown' ) animation = 'slideUp';\n if ( animation == 'show' ) animation = 'hide';\n\n // Close the content\n modalContent.hide()[animation](speed);\n\n // Remove the content\n $('#modalContent').remove();\n $('#modalBackdrop').remove();\n\n // Restore focus to where it was before opening the dialog\n $(oldFocus).focus();\n }", "function closeModal(evt) {\n const el = evt.target;\n\n if (el.classList.contains('modal')) {\n el.classList.remove(SELECTORS.modalOpen);\n Analytics.updateStatWeightings(pullWeights(el));\n if (Analytics.isReady()) TeamCtrl.runHeadToHead();\n }\n}", "function closeModals(event) {\n if (event.target.classList.contains(\"closeModal\")) {\n let modal1 = document.querySelector(\".cart__modal\");\n modal1.style.display = \"none\";\n let modal2 = document.querySelector(\".cart__container\");\n modal2.style.display = \"none\";\n let modal3 = document.querySelector(\".checkout-page\");\n modal3.style.display = \"none\";\n let modal4 = document.querySelector(\".receipt-page\");\n modal4.style.display = \"none\";\n }\n}", "function closeModal(){\r\n modal.style.display = 'none';\r\n}", "function closeModal() {\r\n modal.style.display = \"none\";\r\n}", "function closeModal() {\r\n // console.log(142);\r\n modal.style.display = 'none';\r\n}", "function handleClose() {\n setOpenModalId(0);\n }", "function closeModal(modal) {\n \n modal[0].style.display = \"none\";\n}", "function closeModal() {\n modal3.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "closeInteliUiModal() {\n $(this.target.boxContainer).parents().find('.modal-content').find('#btnClose').click();\n }", "function closePopup() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n const modalInfoContainer = document.querySelector(\".modal-info-container\");\n modalInfoContainer.remove();\n modalContainer.style.display = \"none\";\n}", "function closeModal() {\n document.getElementById(\"backdrop\").style.display = \"none\";\n document.getElementById(\"createFeedModal\").style.display = \"none\";\n document.getElementById(\"createFeedModal\").classList.remove(\"show\");\n}", "function closeRuleModal () {\n rulesModalContainer.style.display = 'none'\n welcomeDiv.style.display = 'block'\n}", "function closeTheModal(e){\r\n\r\n if(document.querySelector(\".modal\")){\r\n document.querySelector(\".modal\").remove();\r\n}\r\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal() {\r\n modal.style.display = 'none';\r\n resetInfo();\r\n}", "function closeModal(){\n modal.style.display = 'none';\n}", "function closeModal() {\n\t//reset all the input text\n\tdocument.getElementById(\"post-text-input\").value = \"\";\n\tdocument.getElementById(\"post-photo-input\").value = \"\";\n\tdocument.getElementById(\"post-price-input\").value = \"\";\n\tdocument.getElementById(\"post-city-input\").value = \"\";\n\tdocument.getElementById(\"post-condition-new\").checked = true;\n\t//add div to hidden\n\tdocument.getElementById(\"sell-something-modal\").classList.add('hidden');\n\tdocument.getElementById(\"modal-backdrop\").classList.add('hidden');\n}", "function closeModal(event) {\r\n if (event.target !== this) return;\r\n modal.classList.add('inactive');\r\n document.documentElement.removeAttribute('style');\r\n setTimeout(function () { modal.remove() }, 300);\r\n }", "function closeModal() {\n var modal = document.getElementsByClassName(\"modal\");\n Array.prototype.forEach.call(modal, function (element) {\n element.style.display = \"none\";\n })\n}", "function closeModal() {\n \tMODAL.style.display = 'none';\n \tRESET();\n }", "function closeImageModal() {\n image_modal.close();\n }", "function closeModalWindow(){$(\"#modal-window\").removeClass(\"show\"),$(\"#modal-window\").addClass(\"hide\"),$(\"#modal-window\").modal(\"hide\"),$(\"body\").removeClass(\"modal-open\"),$(\".modal-backdrop\").remove()}", "function closeIt() {\n\tdocument.getElementById('modal').style.display = \"none\";\n}", "function modalClose() {\n if (document.body.classList.contains('modal-open')) {\n document.body.classList.remove('modal-open')\n return\n }else {\n return\n }\n }", "function closeModal(){\n modal.style.display = 'none'; \n}", "function closeDefaultModal() {\n default_modal.close();\n }", "function CloseModal(){\n var modal = document.querySelector(\"#create-twit-modal\");\n var modalbackdrop = document.querySelector(\"#modal-backdrop\");\n //console.log(\"close [x] element clicked\");\n modal.style.display = \"none\";\n modalbackdrop.style.display = \"none\";\n document.querySelector(\"#twit-text-input\").value = \"\";\n document.querySelector(\"#twit-attribution-input\").value = \"\";\n}", "close(element) {\n const currentModal = this.elements.body.querySelector(this.state.modal);\n\n if (currentModal.classList.contains('is-active')) {\n currentModal.classList.remove('is-active');\n this.elements.body.style.overflow = 'visible';\n }\n }", "function closeModal() {\n\tdocument.getElementById('modal').style.display ='none';\n}", "function closeModal() {\n\tdocument.getElementById('myModal').style.display = \"none\";\n }", "function closeModal() {\n\tdocument.getElementById('myModal').style.display = \"none\";\n }", "function closeModal(){\n modal.style.display = \"none\";\n}" ]
[ "0.77563965", "0.7622132", "0.7581933", "0.75813425", "0.75560737", "0.75253475", "0.7521087", "0.7492387", "0.7418996", "0.7387039", "0.7387039", "0.7387039", "0.73749846", "0.73536456", "0.73076594", "0.7279166", "0.7277782", "0.72513795", "0.72486603", "0.72446233", "0.7239184", "0.7238027", "0.7227768", "0.7215669", "0.7202526", "0.7200825", "0.71763563", "0.7172572", "0.71503335", "0.71503335", "0.71503335", "0.71461034", "0.7142929", "0.71353465", "0.7128136", "0.7115909", "0.71134305", "0.7111093", "0.7100494", "0.7097745", "0.70847183", "0.7081436", "0.7078309", "0.7078309", "0.7078309", "0.7078309", "0.70593804", "0.70571953", "0.7043485", "0.7042493", "0.70413077", "0.70239955", "0.70223355", "0.7016574", "0.70153594", "0.70153594", "0.70113575", "0.7010613", "0.70084643", "0.700597", "0.700597", "0.70017296", "0.6993235", "0.69832194", "0.69700295", "0.6961256", "0.6961015", "0.6954555", "0.69377756", "0.6936357", "0.69332767", "0.69320357", "0.69320357", "0.69320357", "0.69299483", "0.69257784", "0.69232774", "0.69187766", "0.69068885", "0.6905279", "0.6903351", "0.6903351", "0.6903351", "0.68889254", "0.6877008", "0.6873807", "0.68683815", "0.68683237", "0.6856247", "0.68560064", "0.6854034", "0.6851829", "0.68512315", "0.6848301", "0.6846319", "0.6838857", "0.6836059", "0.6831748", "0.6822686", "0.6822686", "0.6817665" ]
0.0
-1
end closeAnimation Destroys the modal and it's events.
function destroy() { // // Unbind all .reveal events from the modal. // modal.unbind( '.reveal' ); // // Unbind all .reveal events from the modal background. // modalBg.unbind( '.reveal' ); // // Unbind all .reveal events from the modal 'close' button. // $closeButton.unbind( '.reveal' ); // // Unbind all .reveal events from the body. // $( 'body' ).unbind( '.reveal' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeModal() {\n close.click(function(e) {\n gameEnd.removeClass('show');\n start();\n });\n}", "function closeAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Clear the modal of the open class.\n //\n modal.removeClass( \"open\" );\n\n //\n // Are we using the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, okay, let's set the animation properties.\n //\n modal.animate( {\n //\n // Set the top property to the document scrollTop minus calculated topOffset.\n //\n \"top\": $doc.scrollTop() - topOffset + 'px',\n //\n // Fade the modal out, by using the opacity property.\n //\n \"opacity\": 0\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed / 2,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css hidden options.\n //\n modal.css( cssOpts.close );\n\n });\n //\n // Is the modal animation queued?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Fade out the modal background.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed property.\n //\n modal.trigger( 'reveal:closed' );\n\n });\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fadeAndPop'\n\n //\n // Are we using the 'fade' animation.\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, we're using the 'fade' animation.\n //\n modal.animate( { \"opacity\" : 0 },\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css close options.\n //\n modal.css( cssOpts.close );\n\n }); // end animate\n\n //\n // Are we mid animating the modal(s)?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Let's fade out the modal background element.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n }); // end fadeOut\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Set the modal close css options.\n //\n modal.css( cssOpts.close );\n //\n // Is the modal in the middle of an animation queue?\n //\n if ( !modalQueued ) {\n //\n // It's not mid queueu. Just hide it.\n //\n modalBg.css( { 'display': 'none' } );\n }\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if not animating\n //\n // Reset the modalQueued variable.\n //\n modalQueued = false;\n } // end if !locked\n\n }", "function closeAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's lock the modal for animation.\n //\n lockModal();\n //\n // Clear the modal of the open class.\n //\n modal.removeClass( \"open\" );\n\n //\n // Are we using the 'fadeAndPop' animation?\n //\n if ( options.animation === \"fadeAndPop\" ) {\n //\n // Yes, okay, let's set the animation properties.\n //\n modal.animate( {\n //\n // Set the top property to the document scrollTop minus calculated topOffset.\n //\n \"top\": $doc.scrollTop() - topOffset + 'px',\n //\n // Fade the modal out, by using the opacity property.\n //\n \"opacity\": 0\n\n },\n /*\n * Fade speed.\n */\n options.animationSpeed / 2,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css hidden options.\n //\n modal.css( cssOpts.close );\n\n });\n //\n // Is the modal animation queued?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Fade out the modal background.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed property.\n //\n modal.trigger( 'reveal:closed' );\n\n });\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fadeAndPop'\n\n //\n // Are we using the 'fade' animation.\n //\n if ( options.animation === \"fade\" ) {\n //\n // Yes, we're using the 'fade' animation.\n //\n modal.animate( { \"opacity\" : 0 },\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Set the css close options.\n //\n modal.css( cssOpts.close );\n\n }); // end animate\n\n //\n // Are we mid animating the modal(s)?\n //\n if ( !modalQueued ) {\n //\n // Oh, the modal(s) are mid animating.\n // Let's delay the animation queue.\n //\n modalBg.delay( options.animationSpeed )\n //\n // Let's fade out the modal background element.\n //\n .fadeOut(\n /*\n * Animation speed.\n */\n options.animationSpeed,\n /*\n * End of animation callback.\n */\n function () {\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n }); // end fadeOut\n\n } else {\n //\n // We're not mid queue.\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if !modalQueued\n\n } // end if animation 'fade'\n\n //\n // Are we not animating?\n //\n if ( options.animation === \"none\" ) {\n //\n // We're not animating.\n // Set the modal close css options.\n //\n modal.css( cssOpts.close );\n //\n // Is the modal in the middle of an animation queue?\n //\n if ( !modalQueued ) {\n //\n // It's not mid queueu. Just hide it.\n //\n modalBg.css( { 'display': 'none' } );\n }\n //\n // Trigger the modal 'closed' event.\n // This should trigger any method set in the options.closed propety.\n //\n modal.trigger( 'reveal:closed' );\n\n } // end if not animating\n //\n // Reset the modalQueued variable.\n //\n modalQueued = false;\n } // end if !locked\n\n }", "close() {\n\t\tthis.$modal.removeClass(this.options.classes.open);\n\t\tthis.isOpen = false;\n\n // remove accessibility attr\n this.$body.attr('aria-hidden', false);\n\n\t\t// After starting fade-out transition, wait for it's end before setting hidden class\n\t\tthis.$modal.on(transitionEndEvent(), (e) => {\n\t\t\tif (e.originalEvent.propertyName === 'opacity') {\n\t\t\t\te.stopPropagation();\n\n\t\t\t\tthis.$body.removeClass(this.options.classes.visible);\n\t\t\t\tthis.$modal\n\t\t\t\t\t.addClass(this.options.classes.hidden)\n\t\t\t\t\t.detach().insertAfter(this.$el)\n\t\t\t\t\t.off(transitionEndEvent());\n\t\t\t}\n\t\t});\n\n this.$closeBtn.off('click');\n this.$backdrop.off('click');\n this.$modal.off('keydown');\n this.$el.focus();\n\t}", "function closeModal() {\n if(clickOut == false){\n return\n }\n $('.text_box').css('font-size','25px')\n $('.modal').css('display','none')\n $('.text_box').toggleClass('result')\n $('.text_box').empty()\n clickCounter++\n if(clickCounter == 25){\n endStage()\n }\n clickOut = false\n }", "closeModal() {\n this.close();\n }", "function close() {\n // Unbind the events\n $(window).unbind('resize', modalContentResize);\n $('body').unbind( 'focus', modalEventHandler);\n $('body').unbind( 'keypress', modalEventHandler );\n $('body').unbind( 'keydown', modalTabTrapHandler );\n $('.close').unbind('click', modalContentClose);\n $('body').unbind('keypress', modalEventEscapeCloseHandler);\n $(document).trigger('CToolsDetachBehaviors', $('#modalContent'));\n\n // Set our animation parameters and use them\n if ( animation == 'fadeIn' ) animation = 'fadeOut';\n if ( animation == 'slideDown' ) animation = 'slideUp';\n if ( animation == 'show' ) animation = 'hide';\n\n // Close the content\n modalContent.hide()[animation](speed);\n\n // Remove the content\n $('#modalContent').remove();\n $('#modalBackdrop').remove();\n\n // Restore focus to where it was before opening the dialog\n $(oldFocus).focus();\n }", "closeModal() {\n this.closeModal();\n }", "function closeModal() {\n $('#modal, #modal .wrap-modal').hide();\n $('.videomodal .videoresponsive, .imagemodal .label-imagemodal').empty();\n fechaMask();\n}", "_close(dispose = true) {\n this._animateOut();\n if (dispose) {\n this.modalObj.close();\n this._dispose();\n }\n }", "function close() {\n $modalInstance.dismiss();\n }", "close() {\n this.closeButton.on('click', null);\n this.modal(false);\n this.window.remove();\n }", "'click .close' (event) {\n console.log(\"MODAL CLOSED VIA X\");\n modal.hide();\n }", "closemodal() {\n this.modalCtr.dismiss(this.items);\n }", "closemodal() {\n this.modalCtr.dismiss();\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "function closeModal() {\n if (modalController) {\n modalController.close();\n }\n }", "function modalClose() {\t\t\n\t\tif($('mb_Title')) $('mb_Title').remove();\n\t\tif($('mb_Error')) $('mb_Error').remove();\n\t\tif($('mb_header')) $('mb_header').removeClass('yt-Panel-Primary');\n\n\t\t$('mb_center').style.display = 'none';\n\t\t\n\t\t$('mb_contents').getChildren()[0].remove();\n\t\t$('mb_overlay').setStyle('opacity',0);\n\t\t$('mb_frame').setStyle('opacity',0);\n\t\twindow.location.reload(true); \n}", "function closeModal() {\n \tMODAL.style.display = 'none';\n \tRESET();\n }", "function cerrarModal() {\n capaModal.classList.remove(\"activa\");\n modal.style.animation = 'modalOut ' + tiempoAnimacion +'ms forwards ease';\n setTimeout(() => { seccionModal.style.transform = \"translateY(-2000px)\" }, tiempoAnimacion);\n}", "function closeModal(){\r\n $('.close').click(function(){\r\n $('.item-details1, .item-details2, .item-details3').empty();\r\n $('.dark-background').fadeOut();\r\n })\r\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "close() {\n // start animation => look at the css\n this.show = false;\n setTimeout(() => {\n // end animation\n this.start = false;\n // deactivate the backdrop visibility\n this.contentSource.displayHandle.classList.toggle('_active');\n\n // notify furo-backdrop that it is closed now\n this.contentSource.dispatchEvent(new Event('closed', { composed: true, bubbles: true }));\n }, this.toDuration);\n }", "function closeModal() \r\n{\r\n\t$(\".modal\").fadeOut('fast', function() {\r\n\t\t$(\".modal_bg\").fadeOut('fast');\r\n\t\t$(\".modal\").removeClass(\"modalsmall\"); // TODO: PUT THESE CLASSES IN SETTINGS AS AN ARRAY\r\n\t\t$(\".modal\").removeClass(\"modallarge\"); // TODO: PUT THESE CLASSES IN SETTINGS AS AN ARRAY\r\n\t});\t\r\n}", "function close()\n\t{\n\t\tthat.fadeOut(200, 0, fadeComplete);\n\t}", "function closeModal() {\n modalEl.classList.add('hide');\n modalEl.classList.remove('show');\n document.body.style.overflow = 'visible';\n clearInterval(modalTimerId)\n }", "function closeModal(evt) {\n bScreen.className = 'hidden';\n modal.className = 'hidden';\n}", "function closeImageModal() {\n image_modal.close();\n }", "function onCloseClick() {\n modalEL.classList.remove(\"is-open\");\n imagePlacer(\"\");\n window.removeEventListener(\"keydown\", onEsc);\n window.removeEventListener(\"keydown\", horizontalSlider);\n}", "destroy()\n\t{\n\t\tthis.element.remove();\n\t\tthis.modalPanel.destroy();\n\t}", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "hide(){\n\t\tthis.modalShadow.hide();\n\t\tthis.modalBody.hide();\n\t}", "function modalClose() {\r\n\r\n $(\"body\").removeClass(\"bgFreeze\");\r\n $(\"main\").removeClass(\"bgDarken\");\r\n $(\".temp\").addClass(\"remElement\");\r\n $(\".remElement\").removeClass(\"temp\");\r\n $(\"main\").off(\"click\", modalClose);\r\n}", "destroy() {\n this.modalPanel.destroy();\n this.fields = null;\n this.classes = null;\n }", "function modalEnd() {\n\tconst href = \"#modal-end\";\n\twindow.open(href, \"_self\");\n}", "endLoading() {\n this.modal.jQueryModalFade.removeClass('modal_fade_trick');\n this.modal.jQueryModalAwait.css('display', 'none');\n }", "function handleClosingModalBoxes(event){\n var targetModalBox = $(event.target).closest(\".modal-box\");\n targetModalBox.hide();\n targetModalBox.attr(\"aria-modal\", \"false\")\n //resume playing animation\n jssor_1_slider.$Play();\n //enable scrolling of body\n $(\"body\").css(\"overflow\", \"visible\");\n}", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "function closeModal() {\n modal.style.display = 'none';\n }", "hideModal() {\n this.clearModal();\n $('.modal').modal('hide');\n }", "function onEnd() {\n\t\t\t\t\t\t\telement.off(css3AnimationEvents, onAnimationProgress);\n\t\t\t\t\t\t\t$$jqLite.removeClass(element, activeClassName);\n\t\t\t\t\t\t\t$$jqLite.removeClass(element, pendingClassName);\n\t\t\t\t\t\t\tif (staggerTimeout) {\n\t\t\t\t\t\t\t\t$timeout.cancel(staggerTimeout);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimateClose(element, className);\n\t\t\t\t\t\t\tvar node = extractElementNode(element);\n\t\t\t\t\t\t\tfor (var i in appliedStyles) {\n\t\t\t\t\t\t\t\tnode.style.removeProperty(appliedStyles[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "function closeModal () {\n modal.style.display = 'none';\n }", "close() {\n this.modal.dismiss();\n }", "function closeModal() {\n\t$('.modal').css(\"display\", \"none\")\n\tconsole.log(\"Closed\")\n}", "function closeAlertIframe(){\n\n $('#modal').fadeOut('fast');\n}", "function closeModal(event) {\r\n if (event.target !== this) return;\r\n modal.classList.add('inactive');\r\n document.documentElement.removeAttribute('style');\r\n setTimeout(function () { modal.remove() }, 300);\r\n }", "function closeModal(modalToClose) {\n $(modalToClose+\"-bg\").fadeOut();\n $(modalToClose).fadeOut();\n}", "closeModal(){\n this.showModal = false\n }", "close() {\n \n // The close function will hide the modal...\n this.visible = false;\n\n // ...and dispatch an event on the modal that the view model can listen for.\n this.el.dispatchEvent(\n new CustomEvent('closed', { bubbles: true })\n );\n }", "function modalClose(event) {\n const isModalOpen = modal.classList.contains(\"is-open\");//проверка открыто ли модальное окно\n if (!isModalOpen) {\n return;\n }\n modal.classList.remove(\"is-open\");\n bodyEl.classList.remove('is-open');//добавляет скролл при закрытой модалке\n modalImg.src = \"\";\n modalImg.alt = \"\";\n window.removeEventListener('keydown', onLeftRightArrow);\n window.removeEventListener('keydown', modalCloseByEscape);\n modalBtnClose.removeEventListener(\"click\", modalClose);\n overlay.removeEventListener('click', modalClose);\n \n \n }", "closeCleanup() {\n this.hide();\n this.addPopUpListener();\n }", "animationReadyToClose() {\n if (this.animationEnabled()) {\n // set default view visible before content transition for close runs\n if (this.getDefaultTabElement()) {\n const eleC = this.getDefaultTabElement() ? this.getDefaultTabElement().querySelector(ANIMATION_CLASS) :\n this.getDefaultTabElement().querySelector(ANIMATION_CLASS);\n if (eleC) {\n eleC.style.position = 'unset';\n eleC.classList.remove('hide');\n }\n }\n }\n }", "exit() {\n if (!this._destroyed) {\n this._animationState = 'hidden';\n this._changeDetectorRef.markForCheck();\n }\n }", "closeModal(body, modal){\n body.removeChild(modal);\n }", "handleModalClose() {}", "close() {\n const modals = Array.from(document.querySelectorAll(\".modal\"));\n document.body.classList.remove(\"no-overflow\");\n\n this._element.classList.remove(\"active\");\n modals.forEach((modalNode) => {\n modalNode.classList.remove(\"modal-active\");\n });\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function close() {\n $uibModalInstance.dismiss('exit');\n }", "function setEndAnimation() {\r\n\t\t\tinAnimation = false;\r\n\t\t}", "function endScreen(){\n toggleModalOn();\n var newGameSelector = document.getElementById('modal-new-game');\n var modalCancel = document.getElementById('modal-cancel');\n \n newGameSelector.addEventListener('click', event=>{\n toggleModalOff();\n newGame();\n })\n \n modalCancel.addEventListener('click', event =>{\n toggleModalOff();\n })\n \n}", "function hideWithTransition() {\n var that = this, timeout = setTimeout(function() {\n that.$element.off($.support.transition.end);\n hideModal.call(that);\n }, 500);\n this.$element.one($.support.transition.end, function() {\n clearTimeout(timeout);\n hideModal.call(that);\n });\n }", "function closePauseModal() {\n\t\tconsole.log(\"Closing modal\")\n\t\tmodal.style.display = \"none\";\n\t}", "function closeModal() {\n var modal = $('#modal');\n if (modal.hasClass('in'))\n modal.modal('hide');\n\n grafo('map', typeGraph);\n}", "function closeModal() {\n MODAL.removeAttribute(\"open\");\n resetGame();\n}", "function closeModal() {\n $scope.oModal.hide();\n vm.directionsDisplay.setDirections({\n routes: []\n });\n }", "function closeModal() {\n if (modalCloseHandler) {\n // This is for extra actions when closing the modal, for example cleanup\n modalCloseHandler();\n }\n\n setModalState({ show: false });\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "closeContactModal() {\n //get element references\n const modal = document.getElementById(\"contact-success-modal\");\n const modalOverlay = document.getElementById(\"contact-modal-overlay\");\n \n //Fade out the modal\n this.fadeOutModal(modal, modalOverlay);\n }", "destroy() {\n const self = this;\n const canDestroy = this.element.trigger('beforedestroy');\n\n if (!canDestroy) {\n return;\n }\n\n function destroyCallback() {\n if (self.modalButtons) {\n self.element.find('button').off('click.modal');\n }\n\n if (self.element.find('.detailed-message').length === 1) {\n $('body').off(`resize.modal-${this.id}`);\n }\n\n if (self.settings.trigger === 'click') {\n self.trigger.off('click.modal');\n }\n\n self.element.closest('.modal-page-container').remove();\n $.removeData(self.element[0], 'modal');\n\n $(window).off('popstate.modal');\n }\n\n if (!this.isOpen()) {\n destroyCallback();\n return;\n }\n\n this.element.one('afterclose.modal', () => {\n destroyCallback();\n });\n\n this.close(true);\n }", "function hide() {\n $$invalidate('modalIsVisible', modalIsVisible = false); // Ensure we cleanup all event listeners when we hide the modal\n\n _cleanupStepEventListeners();\n }", "function closeModal() {\n clearForm();\n props.onChangeModalState();\n }", "popModal() {\n\t\tthis._popLastComponent(TransitionConstants.MODAL_OUT);\n\t}", "clearModal() {\n if ($(\"body\").hasClass(\"modal-open\")) {\n // Ensure animation has time to finish:\n Meteor.setTimeout(() => {\n $(\".modal\").each(() => {\n const modalId = $(this).attr(\"id\")\n UX.dismissModal(modalId)\n })\n $(\"body\").removeClass(\"modal-open\")\n $(\".modal-backdrop\").remove()\n }, 1000)\n }\n }", "function closeModal() {\n const modal = $(\"#ytbsp-modal\");\n if (0 !== modal.length) {\n modal.css(\"display\", \"none\");\n modal.css(\"opacity\", \"0\");\n }\n}", "function closeModal() {\r\n modal.style.display = 'none';\r\n resetInfo();\r\n}", "function close() {\n\t\t// Put the tick to an unreachable value to invalidate timers.\n\t\ttick = -1;\n\t\telm.style.left = \"210px\";\n\t\telm.style.pointerEvents = \"none\"; // Ignore mouse events.\n\n\t\t// Wait out the animation before destroying the element.\n\t\tsetTimeout(() => div.message.removeChild(elm), 200);\n\t}", "function closeModal() {\n modal3.style.display = 'none';\n}", "function closeModal() {\n resetGame();\n modal = document.querySelector('.overlay');\n modal.classList.remove(\"show\");\n}", "function closeModalV() {\n modalV.style.display = \"none\";\n modalVbg.style.display = \"none\";\n}", "function closeModalWindow(){$(\"#modal-window\").removeClass(\"show\"),$(\"#modal-window\").addClass(\"hide\"),$(\"#modal-window\").modal(\"hide\"),$(\"body\").removeClass(\"modal-open\"),$(\".modal-backdrop\").remove()}", "hideModal() {\n // close the modal first\n this.modal.current.setTransition('exit', () => {\n Promise.resolve(\n // un-dim the page after modal slide animation completes\n setTimeout(() => {\n this.setState({\n dimClass: 'dimExit',\n });\n }, Number(Animation.modalSlideDuration)),\n )\n .then(() => {\n // reshow the button and hide modal/dim class\n setTimeout(() => {\n this.setState({\n showButton: true,\n showModal: false,\n dimClass: 'none',\n });\n }, Number(Animation.dimDuration));\n });\n });\n }", "_onEndAnim() {\n if (this._overlay) {\n this._peer.getChart().getPlotArea().removeChild(this._overlay);\n this._overlay = null;\n }\n }", "function closeModal() {\n $(\".mask\").removeClass(\"active-modal\");\n}", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function hideWithTransition() {\n var that = this\n , timeout = setTimeout(function () {\n that.$element.off($.support.transition.end)\n hideModal.call(that)\n }, 500)\n\n this.$element.one($.support.transition.end, function () {\n clearTimeout(timeout)\n hideModal.call(that)\n })\n }", "function closeModal(modal) {\n modal.modal('hide');\n}", "function closeToolModals(){\n Quas.each(\".post-tool-modal\", function(el){\n el.visible(false);\n });\n\n Quas.each(\".toolbar-modal-btn\", function(el){\n el.active(false);\n });\n\n Quas.scrollable(true);\n}", "function closeModal() {\n modal.classList.remove(\"show\");\n restartGame();\n}", "_onAnimationEnd() {\n // Clean up the old container. This is done after the animation to avoid garbage\n // collection during the animation and because the black box updates need it.\n if (this._oldContainer) {\n this._oldContainer.removeFromParent();\n this._oldContainer.destroy();\n this._oldContainer = null;\n }\n\n if (this._delContainer) {\n this._delContainer.removeFromParent();\n this._delContainer.destroy();\n this._delContainer = null;\n }\n\n // Fire ready event saying animation is finished.\n if (!this.AnimationStopped) this.RenderComplete();\n\n // Restore event listeners\n this.EventManager.addListeners(this);\n\n // Reset animation flags\n this.Animation = null;\n this.AnimationStopped = false;\n }" ]
[ "0.74375325", "0.73502976", "0.73502976", "0.7322071", "0.7182829", "0.7116376", "0.70620614", "0.7037047", "0.69913936", "0.69836074", "0.6978616", "0.6906821", "0.6898675", "0.6836635", "0.68324727", "0.6832158", "0.68224967", "0.6791035", "0.67685413", "0.6745313", "0.6744577", "0.6716114", "0.6701351", "0.66959506", "0.66950524", "0.6690956", "0.6690642", "0.66882604", "0.66854715", "0.6681905", "0.66792756", "0.66792756", "0.66792756", "0.66684407", "0.66608506", "0.6654337", "0.66392624", "0.6637643", "0.66259", "0.66250503", "0.66250503", "0.66250503", "0.66206324", "0.66176873", "0.6614189", "0.6602325", "0.6586691", "0.6572854", "0.657151", "0.6559215", "0.6557147", "0.65558946", "0.65520537", "0.6548865", "0.6540688", "0.65389913", "0.6538092", "0.65343803", "0.6525401", "0.65197366", "0.65197366", "0.65197366", "0.65197116", "0.6511791", "0.6508589", "0.6507176", "0.65051574", "0.65046257", "0.64994264", "0.64989865", "0.6497989", "0.64950716", "0.64897263", "0.64865726", "0.6485701", "0.64828587", "0.6480494", "0.6468964", "0.6458854", "0.64472765", "0.6446168", "0.6442886", "0.6441375", "0.64379895", "0.64312834", "0.6429316", "0.64284855", "0.6426433", "0.6426433", "0.6426433", "0.6426433", "0.6426433", "0.6426433", "0.6426433", "0.6426433", "0.64252144", "0.6415251", "0.6412039", "0.6407046" ]
0.6657155
36
Converts JSON to HTML table
function convertToTable(json){ var table = '<table>'; for (x in json){ table += '<tr>'; for (y in json[x]){ table = table + '<td>' + json[x][y] + '</td>'; } table += '</tr>'; } table += '</table>'; return table; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTable(json) {\n var obj = JSON.parse(json),\n table = $(\"<table>\"),\n row, value, i;\n\n for (i = 0; i < obj.rows.length; i++) {\n row = $(\"<tr>\");\n row.append(\"<td>\" + obj.rows[i].key + \"</td>\");\n value = obj.rows[i].value;\n if (value instanceof Array) {\n value.forEach(function (element) {\n row.append(\"<td>\" + element + \"</td>\"); \n });\n }\n else {\n row.append(\"<td>\" + value + \"</td>\"); \n }\n table.append(row); \n }\n\n return table;\n }", "function JSONToHTML(json) {\n let html=\"<table>\\n\";\n let arr=JSON.parse(json);\n html+=\" <tr>\";\n for(let key of Object.keys(arr[0])) {\n html+='<th>${htmlEscape(key)}</th>>';\n }\n html+='</tr>\\n';\n\n for(let obj of arr) {\n for(let keys of Object.keys(arr[0])) {\n html += '<td>${htmlEscape(obj[keys])}</td>'\n }\n } html+='</tr>\\n';\n return html+\"</table>\";\n function htmlEscape(text) {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#039;\");}\n\n\n}", "function createTable(json){\n var table = document.getElementById('user-results')\n\n for (var i = 0; i < json.data.length; i++){\n var row = `<tr>\n <td>${json.data[i].first_name}</td>\n <td>${json.data[i].last_name}</td>\n <td>${json.data[i].email}</td>\n </tr>`\n table.innerHTML += row\n\n\n }\n}", "function makeTableFromJSON() {\n\tvar div = document.getElementById('table');\n\tmakeTableStyle(div);\n\t\n\tif(div)\n\t{\n\t\tdiv.innerHTML = \"\";\n\t}\n\tvar displayTable = \"<table id='dataTable' class='table table-striped table-bordered' cellspacing='0' width='100%'><thead><tr>\";\n\tvar data = JSON.parse(datasetToDisplay);\n\tvar headers = [];\n\tfor (var key in data[0]) {\n\t\talert(key);\n\t\tdisplayTable+= \"<th>\" +key+ \"</th>\";\n\t\theaders.push(key);\n\t}\n\tdisplayTable+= \"</tr></thead>\";\n\tdisplayTable+= \"<tbody>\";\n\t\n\t\n\tfor (var i = 1; i < data.length; i++) {\n\t\tdisplayTable+= \"<tr>\";\n\t\tfor(var j=0;j<headers.length;j++){\n\t\tdisplayTable+= \"<td>\" +data[i].headers[j]+\" </td>\";\n\t\t}\n\t\tdisplayTable+=\"</tr>\"\n\t}\n\t\n\tdisplayTable+=\"</table>\";\n\tvar Columns = makeColumnHeaderForTable(colData);\n\tmakeFilterElements();\n makeObjects(colData);\n\t\t\t\n\n\t\n\tdiv.innerHTML = displayTable;\n\t\n\t\t\t$('#dataTable').DataTable({\n\t\t\t\t\"paging\": true,\n\t\t\t\t\"ordering\": true,\n\t\t\t\t\"info\": false,\n\t\t\t\t\"lengthMenu\": [[10, 25, 50, -1], [10, 25, 50, \"All\"]]\n\t\t\t\t\n\t\t\t});\n}", "function displayJsonToHtmlTable(jsonData) {\n var table = document.getElementById(\"display_csv_data\");\n if (jsonData.length > 0) {\n var headers = Object.keys(jsonData[0]);\n var htmlHeader = \"<thead><tr>\";\n\n for (var i = 0; i < headers.length; i++) {\n htmlHeader += \"<th>\" + headers[i] + \"</th>\";\n }\n htmlHeader += \"<tr></thead>\";\n\n var htmlBody = \"<tbody>\";\n for (var i = 0; i < jsonData.length; i++) {\n var row = jsonData[i];\n htmlBody += \"<tr>\";\n for (var j = 0; j < headers.length; j++) {\n var key = headers[j];\n htmlBody += \"<td>\" + row[key] + \"</td>\";\n }\n htmlBody += \"</tr>\";\n }\n htmlBody += \"</tbody>\";\n table.innerHTML = htmlHeader + htmlBody;\n } else {\n table.innerHTML = \"There is no data in CSV\";\n }\n}", "function ConvertJsonToTable(jsonData, keys, containerId, tableClassName) {\n //Patterns for table thead & tbody\n var tbl = \"<table border='1' cellpadding='1' cellspacing='1' id='\" + containerId + \"' class='\" + tableClassName + \"'>{0}{1}</table>\";\n var th = \"<thead>{0}</thead>\";\n var tb = \"<tbody>{0}</tbody>\";\n var tr = '<tr class=\"{0}\">{1}</tr>';\n var thRow = \"<th>{0}</th>\";\n var tdRow = '<td>{0}</td>';\n var thCon = \"\";\n var tbCon = \"\";\n var trCon = \"\";\n\n function getRowClass(isOdd) {\n return isOdd ? 'odd' : 'even';\n }\n\n if (keys && jsonData) {\n\n //Creating all table headers\n if(isArray(keys)) {\n for (i = 0; i < keys.length; i++) {\n thCon += thRow.format(keys[i]);\n }\n } else {\n for(var key in keys) {\n if(keys.hasOwnProperty(key)) {\n if(keys[key].hasOwnProperty('name')) {\n thCon += thRow.format(keys[key].name);\n } else {\n thCon += thRow.format(keys[key]);\n }\n }\n }\n }\n\n th = th.format(tr.format('header', thCon));\n\n //Creating all table rows from Json data\n if (typeof(jsonData[0]) == \"object\") {\n var isOdd = false;\n for (i = 0; i < jsonData.length; i++) {\n if(isArray(keys)) {\n for (j = 0; j < keys.length; j++) {\n tbCon += tdRow.format(jsonData[i][keys[j]]);\n }\n } else {\n for(var key in keys) {\n if(keys.hasOwnProperty(key)) {\n if(keys[key].hasOwnProperty('onRender')) {\n tbCon += tdRow.format(keys[key].onRender(jsonData[i][key]));\n } else {\n tbCon += tdRow.format(jsonData[i][key]);\n }\n }\n }\n }\n trCon += tr.format(getRowClass(isOdd), tbCon);\n tbCon = \"\";\n isOdd = !isOdd;\n }\n }\n tb = tb.format(trCon);\n\n tbl = tbl.format(th, tb);\n return tbl;\n }\n\n return null;\n}", "function scoreToHTML(json) {\n let html = '<table>\\n';\n html += ' <tr><th>name</th><th>score</th></tr>\\n';\n\n let scores = JSON.parse(json);\n\n for (let score of scores) {\n html += ' <tr>';\n html += `<td>${score.name}</td>`;\n html += `<td>${score.score}</td>`;\n\n html += '</tr>\\n';\n }\n\n html += '</table>';\n console.log(html);\n}", "function data_to_table(object) {\n var row = tbody.append(\"tr\");\n Object.values(object).forEach(function(value) {\n row.append(\"td\").text(value)\n })\n}", "function renderTable(data) {\n var tHead = \"\";\n var tBody = \"\";\n var header = true;\n\n // adds data to array\n if (!Array.isArray(data)) {\n var dataTmp = data;\n data = [dataTmp];\n }\n\n // iterate through json objects in array\n for (var index in data) {\n tBody += \"<tr>\";\n // iterate through values in json object\n for (var key in data[index]) {\n // adds table header from key values\n if (header) tHead += \"<th>\" + key + \"</th>\";\n tBody += \"<td id = '\" + index + \"'>\" + data[index][key] + \"</td>\";\n }\n // stops adding table headers\n header = false;\n tBody += \"</tr>\";\n }\n tableHead.innerHTML = tHead;\n tableBody.innerHTML = tBody;\n}", "function makeTableFromJSON(json_obj) {\n // grab the table display element and set up for the table\n var table_display = document.getElementById('dynamic_table');\n var table = document.createElement('table');\n var table_body = table.createTBody();\n var table_header = table.createTHead();\n\n // cleaning the old table is part of setup\n while(table_display.firstChild) {\n table_display.removeChild(table_display.firstChild);\n }\n\n // get the number of rows and columns we have\n var rows = json_obj.length;\n if (rows < 1) {\n alert('Retrieved an empty JSON object! :(');\n }\n var cols = Object.keys(json_obj[0]).length;\n // console.log('DEBUG -> ROWS: ' + rows + ', COLS: ' + cols);\n\n // start some variables outside the loops and reuse them\n var table_row = table_header.insertRow(0); \n var table_col;\n var json_keys = Object.keys(json_obj[0]);\n // console.log(json_keys);\n\n // build the header row\n var i = 0;\n json_keys.forEach(function(key) {\n table_col = table_row.insertCell(i);\n table_col.innerHTML = '<b>' + key + '</b>';\n i++;\n })\n \n for (var i=0; i<rows; i++) {\n table_row = table_body.insertRow(i);\n for (var j=0; j<cols; j++) {\n table_col = table_row.insertCell(j);\n table_col.innerHTML = json_obj[i][json_keys[j]];\n }\n }\n\n table_display.appendChild(table);\n}", "function buildTable(data){\n \n tbody.html(\"\");\n\n data.forEach((element) => {\n var row = tbody.append(\"tr\");\n Object.entries(element).forEach(([key,value]) => {\n row.append(\"td\").text(value);\n })\n });\n\n}", "function createTable(jsonObject) {\n let tableArray =[]; //empty array to start\n jsonObject.degrees.forEach(function(property){ //iterate through json object (which is called degrees)\n tableArray.push( //and push that data into an array\n `<tr>\n <td>${property.School}</td>\n <td>${property.Program}</td>\n <td>${property.Type}</td>\n <td>${property.Year}</td></tr>`); //telling my function to display each key/value pair\n });\n return tableArray; //return the complete table\n}", "function displaytable(data){\n tbody.html(\"\");\n data.forEach(function(Table) {\n console.log(Table);\n var row = tbody.append(\"tr\");\n Object.entries(Table).forEach(function([key, value]) {\n console.log(key, value);\n // Append a cell to the row for each value\n // in the weather report object\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function renderJson(json) {\n\t\ttable.setData([]);\n\t\tvar curheader = '0';\n\t\tvar index = [];\n\t\tvar rows = [];\n\n\t\tfor (var i = 0,\n\t\t j = json.horses.length; i < j; i++) {\n\n\t\t\tvar item1,\n\t\t\t item2;\n\n\t\t\titem1 = json.horses[i].id;\n\t\t\titem2 = json.horses[i].name.toString().trim();\n\n\t\t\tvar row = Ti.UI.createTableViewRow({\n\t\t\t\tid : item1,\n\t\t\t\ttitle : item2\n\t\t\t});\n\n\t\t\tif (item2.substring(0, 1) != curheader) {\n\t\t\t\tcurheader = item2.substring(0, 1);\n\t\t\t\trow.header = curheader;\n\t\t\t\tindex.push({\n\t\t\t\t\tindex : i,\n\t\t\t\t\ttitle : curheader\n\t\t\t\t});\n\t\t\t}\n\t\t\trow.className = 'horseList';\n\t\t\trows.push(row);\n\t\t}\n\n\t\t//Tweak to the table set\n\t\ttable.setData(rows);\n\t\ttable.setIndex(index);\n\t}", "function table(json) {\n var table = json.table,\n\trows = table.length,\n\tcols = table[0].length,\n\trowlabels = json.rowlabels,\n\tcollabels = json.collabels,\n\trowperm = reorder.permutation(rows),\n\tcolperm = reorder.permutation(cols);\n\n \n}", "function getTableDataFromJSON() {\n\n }", "function formatJsonString(d){\n var tableFlow = '';\n var taskStringFlow = [];\n var JsonStringFlow = $.parseJSON(d);\n for(var n in JsonStringFlow){\n taskStringFlow.push(JsonStringFlow[n]);\n }\n\n tableFlow = '<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" class=\"table table-condensed\" style=\"padding-left:50px; font-size:13px;\">';\n\n for(var i in taskStringFlow){\n tableFlow += '<tr style=\"border:none !important;\">'+\n '<td style=\"border:none !important;\">'+taskStringFlow[i].name+'</td>'+\n '<td style=\"border:none !important;\"><img src=\"'+taskStringFlow[i].image+'\" class=\"img img-responsive\" style=\"width:10%;\" /></td>'+\n '<td style=\"border:none !important;\">'+taskStringFlow[i].qty+'</td>'+\n '<td style=\"border:none !important;\">'+taskStringFlow[i].price+'</td>'+\n '<td style=\"border:none !important;\">'+parseInt(taskStringFlow[i].qty) * parseInt(taskStringFlow[i].price)+'</td>'+\n '</tr>'\n }\n tableFlow += '</table>';\n return tableFlow;\n}", "function buildTable(data){\n tbody.html(\"\");\n data.forEach(function(ufoData) {\n console.log(ufoData);\n var row = tbody.append(\"tr\");\n Object.entries(ufoData).forEach(function([key, value]) {\n // Append a cell to the row for each value\n var cell = row.append(\"td\");\n cell.text(value);\n });\n })\n}", "function buildTable(data){\n tbody.html(\"\");\n data.forEach(function(ufoData) {\n console.log(ufoData);\n var row = tbody.append(\"tr\");\n Object.entries(ufoData).forEach(function([key, value]) {\n // Append a cell to the row for each value\n var cell = row.append(\"td\");\n cell.text(value);\n });\n })\n}", "function create_table(data){\n data.forEach(function(d){\n\n //create row\n var row = tbody.append(\"tr\");\n \n //unpack each row element into table\n Object.entries(d).forEach(function([key,value]){\n //append a cell to the row for each value\n var cell = tbody.append(\"td\");\n //set cell value\n cell.text(value);\n });\n \n });\n}", "function view(json) {\n var targetElement = $(config.elements.data);\n targetElement.html(makeTable(json));\n }", "function display(json) {\n //create a html string\n html = '<table cellspacing =5 cellpadding=5 >';\n\t\n \n\t// for each object in json\n for(var i in json) {\n\t \n\t\t//html += '<th>Path'\n\t\thtml += '<b>****Path ****</b>'\n\t\t//html += j\n\t\thtml += ''\n\t\t//html += '</th>'\n\t\titem = json[i];\n\t\thtml += '<br/>'\n\t\tfor (k in item) {\n\t\t// item2 = item[j];\n\t\t \n\t\t html += item[k]\n\t\t html += '<br/>'\n\t\t \n\t\t }\n\t\t html += '<p/>'\n // html += toRow(item);\n\t //}\n\t\t\n }\n html += '</table>';\n\t//add it to the 'search-results' div\n $('#search-results').html(html);\n}", "function createTable(data) {\n // Parse the json string into the object\n data_obj = JSON.parse(data);\n\n document.getElementById(\"table_container\").innerHTML = '';\n\n // Creation of the table\n var table = document.createElement(\"table\"), rowH, headerA,\n headerB, row, cellA, cellB;\n\n rowH = document.createElement(\"tr\");\n headerA = document.createElement(\"th\");\n headerB = document.createElement(\"th\");\n\n headerA.innerHTML = \"nome\";\n headerB.innerHTML = \"data\";\n\n table.appendChild(rowH);\n rowH.appendChild(headerA);\n rowH.appendChild(headerB);\n\n // Append the table inside parent container\n document.getElementById(\"table_container\").appendChild(table);\n\n for (let key in data_obj) {\n // Create rows and cells with For loop\n row = document.createElement(\"tr\");\n cellA = document.createElement(\"td\");\n cellB = document.createElement(\"td\");\n\n dataTime = new Date(data_obj[key].data);\n\n // Fill with data\n cellA.innerHTML = data_obj[key].nome;\n // Setting european format date\n cellB.innerHTML = dataTime.toLocaleDateString();\n\n // Append rows and cells\n table.appendChild(row);\n row.appendChild(cellA);\n row.appendChild(cellB);\n }\n}", "function displayData(data){ \n tbody.text(\"\")\n data.forEach(function(sighting){\n new_tr = tbody.append(\"tr\")\n Object.entries(sighting).forEach(function([key, value]){\n new_td = new_tr.append(\"td\").text(value)\t\n })\n})}", "function buildTable(table){\n\n // loop through data\n table.forEach((item) => {\n\n // append rows\n let row = tbody.append(\"tr\");\n\n // iterate through keys and values\n Object.entries(item).forEach(([key, value]) => {\n\n // append cells \n let cell = row.append(\"td\");\n\n // add text value to each cell\n cell.text(value);\n });\n });\n}", "function structureJSON(){\n \n $('#result_wrapper').remove();\n $('body').append('<table id=\"result\" class=\"width100\"><table/>');\n \n // Convert text into JSON\n data = JSON.parse($('#input').val());\n \n // If data has been parsed correctly and it is an array\n if (data && typeof(data) == 'object' ){\n \n parseToTable(data, function(aaData, aoColumns){\n \n // Create table\n $('#result').dataTable({\n\t\"aaData\" : aaData,\n\t\"aoColumns\" : aoColumns,\n\t\"bLengthChange\": true,\n\t\"bDestroy\": true\n });\n \n });\n }\n}", "function jsonToHTML (data) {\n \n var html;\n \n \n \n return html;\n}", "function data2table(data) {\r\n let keys = Object.keys(data[0]);\r\n let html = '<p>Age breakdown for the population of output area ' + data[0]['GEOGRAPHY_CODE'] + ' in ' + data[0]['DATE_NAME'] + '.</p>';\r\n html += '<table class=\"table table-sm\">';\r\n html += '<thead><tr><th scope=\"col\">Age group</th><th scope=\"col\">%</th></tr></thead><tbody>'\r\n for (object in data) {\r\n html += '<tr>';\r\n html += '<td>' + data[object][keys[2]] + '</td>';\r\n html += '<td><img src=\"./img/pixel.png\" style=\"height: 18px; width: ' + (data[object][keys[3]] * 4) + 'px;\"> ' + data[object][keys[3]] + '%</td>';\r\n html += '</tr>';\r\n }\r\n html += '</tbody></table>';\r\n results.innerHTML = html;\r\n}", "function renderTsStatTable(data) {\n html = \"<table><tbody>\";\n /* identify rownames to put in first columns */\n var rownames = [];\n for ( var rowname in data ) {\n if (data.hasOwnProperty(rowname)) {\n rownames.push(rowname);\n }\n }\n /* build up table row by row */\n var colnames = [];\n rownames.forEach(function(rowname) {\n if (colnames.length == 0) {\n /* only true for first row, build header */\n Object.keys(data[rowname]).forEach(function(colname) {\n colnames.push(colname)\n });\n html += \"<tr><th>\" + \"key</th><th>\" + colnames.join(\"</th><th>\") + \"</th></tr>\";\n }\n /* build value rows */\n var values = [rowname, ];\n colnames.forEach(function(colname) {\n values.push(data[rowname][colname])\n });\n html += \"<tr><td>\" + values.join(\"</td><td>\") + \"</td></tr>\";\n });\n return html + \"<tbody></table>\";\n}", "function buildList(json) {\n var html = '<table><thead>' + buildHeader(json[0]) + '</thead><tbody>';\n\n for (var i = 0; i < json.length; i++) {\n html += buildRow(json[i], null, (i % 2 == 1));\n }\n html += '</tbody></table>';\n\n return html;\n}", "function populateTable (data){\r\n\r\n tbody.html (\"\")\r\n\r\ndata.forEach((weatherReport) => {\r\n\r\n var row = tbody.append(\"tr\");\r\n\r\n Object.entries(weatherReport).forEach(([key, value]) => {\r\n\r\n var cell = row.append(\"td\");\r\n\r\n cell.text(value);\r\n\r\n });\r\n\r\n});\r\n\r\n}", "function formatToHTML(data) {\n var i = 0;\n if (isDict(data)) {\n html = \"<table border=0 width=992>\";\n for (var key in data) {\n var color = (i % 2 == 0) ? '#eee' : '#fff';\n i += 1;\n html += \"<tr bgcolor='\" + color + \"'>\";\n html += \"<td><b><p>\" + key + \":</p></b></td>\";\n html += \"<td><p>\" + formatIfURL(data[key]) + \"</p></td>\";\n html += \"</tr>\";\n }\n html += \"</table>\";\n return html;\n }\n if (Array.isArray(data)) {\n html = \"<table border=0 style='width: 100%>\";\n for (var i = 0; i < data.length; i++) {\n var color = (i % 2 == 0) ? '#eee' : '#fff';\n html += \"<tr bgcolor='\" + color + \"'>\";\n html += \"<td><b><p>\" + i + \":</p></b></td>\";\n html += \"<td><p>\" + formatIfURL(data[i]) + \"</p></td>\";\n html += \"</tr>\";\n }\n html += \"</table>\";\n return html;\n }\n return formatIfURL(data);\n}", "function displayData(tableData){\r\n tableData.forEach(function(record){\r\n // console.log(record);\r\n var row = tbody.append(\"tr\");\r\n \r\n Object.entries(record).forEach(function([key, value]){\r\n var cell = row.append(\"td\");\r\n cell.text(value);\r\n });\r\n })}", "function create_table(data, id) {\r\n var e = \"\";\r\n var headers = data[0];\r\n var k = Object.keys(headers);\r\n e += \"<tr>\"\r\n $.each(k, function (h, j) {\r\n e += \"<th>\" + j + \"</th>\";\r\n })\r\n e += \"</tr>\";\r\n $.each(data, function (i, d) {\r\n e += \"<tr>\";\r\n var v = Object.values(d);\r\n $.each(v, function (h, j) {\r\n e += \"<td>\" + j + \"</td>\";\r\n })\r\n e += \"</tr>\";\r\n })\r\n $(\"#\" + id).html(e);\r\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredDataSet.length; i++) {\n\n // Get the current object and its fields\n var data = filteredDataSet[i];\n var fields = Object.keys(data);\n\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n\n // For every field in the table object, create a new cell at set its inner text to be the current value at the current field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "function table(r){\n r.forEach(sighting => {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(([key,value]) => {\n var entries = row.append(\"td\").text(value);\n });\n });\n}", "function buildTable(data) {\r\n tbody.html(\"\");\r\n//next loop through each object in data and append a row and cells for each value in the row\r\ndata.forEach((dataRow)) => {\r\n //append a row to table body\r\n let row=tbody.append(\"tr\");\r\n //Loop through each field in dataRow and add each value as a table cell (td)\r\n Object.values(dataRow).forEach((val)=> {\r\n let cell = row.append(\"td\");\r\n cell.text(val);\r\n }\r\n );\r\n}", "function displayData(data){ \r\n tbody.text(\"\")\r\n data.forEach(function(sighting){\r\n new_tr = tbody.append(\"tr\")\r\n Object.entries(sighting).forEach(function([key, value]){\r\n new_td = new_tr.append(\"td\").text(value)\t\r\n })\r\n})}", "function rendtable(jsons, screen){\n\t\n\tconst tableItem = document.querySelector('table tbody');\t//css selector not for IE8-\n\t//let tableItem = document.getElementsByTagName('table')[0];\n\tlet elem;\t\t\n\t\n\tfor(elem in jsons){\n\t\t//篩選資料\n\t\tif(screen(jsons[elem])){\t\t\t\n\t\t\n\t\t//產生資料列元素\n\t\tlet row = document.createElement('tr');\n\t\tlet sno = document.createElement('td');\n\t\tlet sna = document.createElement('td');\n\t\tlet sbi = document.createElement('td');\n\t\tlet bemp = document.createElement('td');\t\t\n\t\tlet sarea = document.createElement('td');\n\t\tlet ar = document.createElement('td');\t\t\t\t\n\t\tlet mday = document.createElement('td');\n\t\t//填入資料\n\t\tsno.innerHTML = jsons[elem].sno;\t\t\n\t\tsna.innerHTML = jsons[elem].sna;\n\t\tsbi.innerHTML = jsons[elem].sbi;\n\t\tbemp.innerHTML = jsons[elem].bemp;\n\t\tsarea.innerHTML = jsons[elem].sarea;\n\t\tar.innerHTML = jsons[elem].ar;\n\t\tmday.innerHTML = jsons[elem].mday;\n\t\t//排版\n\t\trow.classList.add('dynamic');\t\n\t\trow.appendChild(sno);\n\t\trow.appendChild(sna);\n\t\trow.appendChild(sbi);\n\t\trow.appendChild(bemp);\n\t\trow.appendChild(sarea);\n\t\trow.appendChild(ar);\n\t\trow.appendChild(mday);\n\t\t\n\t\t\ttableItem.appendChild(row);\n\t\t}\n\t}\n}", "function displayData(data){ \n body.text(\"\")\n data.forEach(function(sight){\n newtr = body.append(\"tr\")\n Object.entries(sight).forEach(function([key, value]){\n newtd = newtr.append(\"td\").text(value)\t\n })\n})}", "function makeTable(array_json){\r\n\t\tvar array = jsonpickle.decode(array_json);\t// convert array json back to array\r\n\t\tvar div = document.getElementById('block');\r\n\t\tvar table = document.createElement(\"table\");\r\n\t\ttable.setAttribute(\"id\", \"table\");\r\n\t\ttable.setAttribute(\"class\", \"table table-hover tablesorter\");\r\n\t\tdiv.appendChild(table);\r\n\t\ttable.innerHTML = \"<thead><tr><th>Hash</th><th>Error Message</th><th>First Occurrence</th><th>Most Recent Occurrence</th><th>Count</th></tr></thead>\";\r\n\t\tvar tablebody = table.appendChild(document.createElement('tbody'));\r\n\t\t\r\n\t\tfor(var i=0;i<array.length;i++){\r\n\t\t\tvar tr = document.createElement('tr'); \r\n\r\n\t\t\tvar td1 = document.createElement('td');\r\n\t\t\tvar td2 = document.createElement('td');\r\n\t\t\tvar td3 = document.createElement('td');\r\n\t\t\tvar td4 = document.createElement('td');\r\n\t\t\tvar td5 = document.createElement('td');\r\n\t\t\t\r\n\t\t\terror_obj_json = array[i]\r\n\t\t\terror_obj = jsonpickle.decode(error_obj_json)\r\n\t\t\t\r\n\t\t\tvar text1 = document.createTextNode(error_obj.hash);\r\n\t\t\tvar text2 = document.createTextNode(error_obj.message_string);\r\n\t\t\tvar text3 = document.createTextNode(error_obj.first_occurrence);\r\n\t\t\tvar text4 = document.createTextNode(error_obj.last_occurrence);\r\n\t\t\tvar text5 = document.createTextNode(error_obj.count);\r\n\r\n\t\t\ttd1.appendChild(text1);\r\n\t\t\ttd2.appendChild(text2);\r\n\t\t\ttd3.appendChild(text3);\r\n\t\t\ttd4.appendChild(text4);\r\n\t\t\ttd5.appendChild(text5);\t\r\n\t\t\t\r\n\t\t\ttr.appendChild(td1);\r\n\t\t\ttr.appendChild(td2);\r\n\t\t\ttr.appendChild(td3);\r\n\t\t\ttr.appendChild(td4);\r\n\t\t\ttr.appendChild(td5);\r\n\r\n\t\t\ttablebody.appendChild(tr);\r\n\t\t}\r\n\t\t\r\n\t\tdocument.close();\r\n\t}", "function jsonObjektEinfuegen(tabelleId, jsonobjekt) {\n var tabelle = document.getElementById(tabelleId);\n //eine neues rowTag erstellen und mit dem uebergebenen JSON Objekt fuellen\n // rowTag erstellen\n var rowTag = document.createElement('tr');\n for (var i in jsonobjekt){\n var cellTag = document.createElement('td');\n var textNode;\n textNode = document.createTextNode(jsonobjekt[i]);\n cellTag.appendChild(textNode);\n rowTag.appendChild(cellTag);\n }\n tabelle.appendChild(rowTag);\n}", "function buildTable(data) {\n var headers = Object.keys(data[0]);\n var table = document.createElement(\"TABLE\");\n var row = document.createElement(\"TR\");\n headers.forEach(function(column){\n var cellH = document.createElement(\"TH\");\n var textItem = document.createTextNode(column);\n cellH.appendChild(textItem);\n row.appendChild(cellH);\n });\n table.appendChild(row); \n \n data.forEach(function(item){\n var row = document.createElement(\"TR\");\n headers.forEach(function(header){\n var cell = document.createElement(\"TD\");\n var textItem = document.createTextNode(item[header]);\n cell.appendChild(textItem); //to right align numeric values\n if(!isNaN(item[header]))\n cell.style.textAlign = \"right\";\n row.appendChild(cell);\n });\n table.appendChild(row);\n }); \n return table;\n }", "function table(data){\n tbody.html(\"\");\n\n\t//append the rows(tr) and cells(td) for returned values\n data.forEach((dataRow) => {\n let row = tbody.append(\"tr\");\n \n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n });\n })\n}", "function tabulate(data) {\n data.forEach((entry) => {\n var tr = tbody.append('tr');\n tr.append('td').attr(\"class\", \"Date\").text(entry.datetime);\n tr.append('td').attr(\"class\", \"City\").text(entry.city);\n tr.append('td').attr(\"class\", \"State\").text(entry.state);\n tr.append('td').attr(\"class\", \"Country\").text(entry.country);\n tr.append('td').attr(\"class\", \"Shape\").text(entry.shape);\n tr.append('td').attr(\"class\", \"Duration\").text(entry.durationMinutes);\n tr.append('td').attr(\"class\", \"Comments\").text(entry.comments);\n });\n}", "function populateTable(tableData) {\n tbody.innerHTML = (\"\");\n tableData.forEach((datum) => {\n var row = tbody.append(\"tr\");\n console.log(datum);\n\n Object.entries(datum).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n});\n}", "function buildTable(data){\n\n // clear the current data from the table\n tbody.html(\"\");\n\n // create a forEach loop to loop through the data array\n data.forEach((dataRow)=>{\n\n // add row to body as table row\n let row = tbody.append(\"tr\");\n\n //loop through each object in the data set\n Object.values(dataRow).forEach((val)=>{\n\n // add each object to it's row in table data\n let cell = row.append(\"td\");\n\n // add the values of the key:value pair for each object to the cell\n cell.text(val);\n }\n );\n });\n}", "function results(items) {\n // Iterate through each item object\n items.forEach((item) => {\n\n // Append one table row `tr` to the table body\n var row = tbody.append(\"tr\");\n\n // Iterate through each key and value\n Object.entries(item).forEach(([key, value]) => { \n \n // Use the key to determine which array to push the value to\n if (key === \"datetime\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"city\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"state\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"country\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"shape\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"durationMinutes\") {\n row.append(\"td\").text(value);\n }\n else if (key === \"comments\") {\n row.append(\"td\").text(value);\n }\n });\n });\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get the current object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "function buildTable(data) {\n //clear any existing data\n tbody.html(\"\");\n //create a forEach function to loop through the array 'data'\n data.forEach((dataRow) => {\n //find the tbody tag and add a table row\n let row = tbody.append(\"tr\");\n //reference one object from the array, put the values into dataRow, one object per row\n Object.values(dataRow).forEach((val) => {\n //append data into a <td> tag\n let cell = row.append(\"td\");\n //extract only the text of the value from the key:value pair\n cell.text(val);\n });\n });\n}", "function tableFormat(res){\n for(i=0; i<res.length; i++){\n table.push(\n [res[i].item_id, res[i].product_name, res[i].department_name, res[i].price, res[i].stock_quantity]\n )\n }\n console.log(table.toString());\n console.log(\"\\n \");\n}", "function buildTable(data) {\n // First, clear out any existing data\n tbody.html(\"\");\n \n // Next, loop through each object in the data\n // and append a row and cells for each value in the row\n data.forEach((dataRow) => {\n // Append a row to the table body\n let row = tbody.append(\"tr\");\n \n // Loop through each field in the dataRow and add\n // each value as a table cell (td)\n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n });\n });\n }", "function buildTable(data) {\n //clear data\n tbody.html(\"\");\n\n //loop through each data object & append rows & values in each row\n data.forEach((dataRow) => {\n const row = tbody.append(\"tr\");\n\n //loop through each cell in every row to append\n Object.values(dataRow).forEach((val) => {\n let cell = row.append(\"td\");\n cell.text(val);\n }\n );\n });\n\n}", "function generateTable(data) {\n var html = '<table class=\"table table-striped\"><caption>Preview Data</caption>';\n var row_count = 10;\n if(typeof(data[0]) === 'undefined') {\n return null;\n }\n\n if(data[0].constructor === String) {\n html += '<tr>\\r\\n';\n for(var item in data) {\n html += '<td>' + data[item] + '</td>\\r\\n';\n }\n html += '</tr>\\r\\n';\n }\n\n if(data[0].constructor === Array) {\n\tvar i = 0; \n for(var row in data) {\n if(i < row_count) {\n\t html += '<tr>\\r\\n';\n\t for(var item in data[row]) {\n\t html += '<td>' + data[row][item] + '</td>\\r\\n';\n\t }\n\t html += '</tr>\\r\\n';\n } else {\n \t break;\n }\n i++;\n }\n \n }\n\n if(data[0].constructor === Object) {\n for(var row in data) {\n html += '<tr>\\r\\n';\n for(var item in data[row]) {\n html += '<td>' + item + ':' + data[row][item] + '</td>\\r\\n';\n }\n html += '</tr>\\r\\n';\n }\n }\n html += \"</table>\";\n return html;\n}", "function jsonToHTMLBody(json) {\n return `<div id=\"json\">${valueToHTML(json, '<root>')}</div>`;\n }", "function generateTable(data){ \n var tbody = d3.select(\"tbody\");\n $(\"#tablebody tr\").remove();\n data.forEach(function(results){\n var row = tbody.append(\"tr\"); \n Object.entries(results).forEach(function([key,value]){\n var cell = row.append(\"td\"); \n cell.text(value);\n });\n });\n\n}", "function tableValues(data) {\n data.forEach(ufoSightings => {\n console.log(ufoSightings);\n let row = tableBody.append(\"tr\");\n Object.entries(ufoSightings).forEach(([key, value]) => {\n let cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < sightingData.length; i++) { // Loop through the data object items\n var sighting = sightingData[i]; // Get each data item object\n var fields = Object.keys(sighting); // Get the fields in each data item\n var $row = $tbody.insertRow(i); // Insert a row in the table object\n for (var j = 0; j < fields.length; j++) { // Add a cell for each field in the data item object and populate its content\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "function renderTable() {\n tbody.innerHTML = \"\";\n for (var i = 0; i < filterData.length; i++) {\n // Get the current objects and its fields. Calling each dictionary object 'ovni'. This comes from the data.js database where\n //the object dataSet holds an array (list) of dictionaries. Each dictionary is an object and I'm calling it ovni. This will\n // loop through each dictionary/object from the variable dataSet and store their keys in the variable fields. \n\n var ovni = filterData[i];\n var fields = Object.keys(ovni);\n \n // Create a new row in the tbody, set the index to be i + startingIndex\n // fields are the columns\n var row = tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell and set its inner text to be the current value at the current address's field\n // the variable field will gather the columns names. It will loop through the fields(columns). Example, fields index 0 is datetime.\n var field = fields[j];\n var cell = row.insertCell(j);\n // now i will pass to the cell the ovni object, field values.\n cell.innerText = ovni[field];\n }\n }\n}", "function displayData(data){\n tbody.text(\"\")\n data.forEach(function(ufo_sighting){\n new_table_row = tbody.append(\"tr\")\n Object.entries(ufo_sighting).forEach(function([key, value]){\n new_table_cell = new_table_row.append(\"td\").text(value)\n }) \n })}", "function displayData(data){\n tbody.text(\"\")\n data.forEach(function(ufo_sighting){\n new_table_row = tbody.append(\"tr\")\n Object.entries(ufo_sighting).forEach(function([key, value]){\n new_table_cell = new_table_row.append(\"td\").text(value)\n }) \n })}", "function createTable (data) {\n tbody.html(\"\");\n data.forEach(function(UFO) {\n var datarow = tbody.append(\"tr\");\n Object.entries(UFO).forEach(([key, value]) => {\n var cell = datarow.append(\"td\");\n cell.text(value)\n })\n })\n}", "function createTable(formattedJSONData2Darray) {\n let headerArr = [\"Date\", \"Location\", \"Type\", \"Value\", \"Unit\"];\n // var table = $('<table>');\n var thead = $('<thead>');\n $('table').append(thead);\n let trHead = $('<tr>')\n\n\n //append head with names\n for (var i = 0; i < headerArr.length; i++) {\n var tr = $('<tr>');\n let th = $('<th>')\n th.appendTo(trHead);\n th.text(headerArr[i]);\n }\n trHead.appendTo($(thead));\n //append table with values to head\n for (var i = 0; i < formattedJSONData2Darray.length; i++) {\n let tr = $('<tr>');\n $('#insertLocation').append($(tr)); //apends 1 value\n for (var ii = 0; ii < formattedJSONData2Darray[i].length; ii++) {\n var td = $('<td>');\n $(tr).append(td.text(formattedJSONData2Darray[i][ii]));\n }\n // formattedJSONData2Darray[i].forEach(columnElemText =>\n // $(tr).append(td.text(columnElemText))\n // );\n }\n console.log(formattedJSONData2Darray.length);\n\n\n}", "function generateRowsTableEstablecimientos(object){\r\n\tdataSet = null;\r\n\tvar output = \"[\";\r\n\t$.each(object, function(i) {\r\n\t\tif (i != 0){\r\n\t\t\toutput += ','\r\n\t\t}\r\n\t\toutput += \"[\";\r\n\t\toutput += '\"<a href=\\'javascript:GotoEstablecimiento(' + object[i].idEstablecimiento + ')\\'>' + object[i].nombre + '</a>\"';\r\n\t\toutput += ',\"' + object[i].codigoEstablecimiento + '\"';\r\n\t\toutput += \"]\";\r\n\t});\r\n\toutput += \"]\";\r\n\tconsole.log(output);\r\n\tdataSet = JSON.parse(output);\r\n}", "function displayInventoryTable(res) {\r\n\r\n const table = new Table({\r\n head: ['Product #', 'Department', 'Product', 'Price', 'Qty In Stock'],\r\n colWidths: [15, 20, 30, 15, 15]\r\n });\r\n\r\n for (let i = 0;\r\n (i < res.length); i++) {\r\n var row = [];\r\n row.push(res[i].item_id);\r\n row.push(res[i].department_name);\r\n row.push(res[i].product_name);\r\n row.push(res[i].price);\r\n row.push(res[i].stock_quantity);\r\n table.push(row);\r\n }\r\n\r\n console.log(table.toString());\r\n}", "function format(d, indice) {\n // `d` is the original data object for the row\n var texto = d[indice]; //indice donde esta el input hidden\n var resultado = $(texto).val();\n var json = JSON.parse(resultado);\n var len = Object.keys(json).length;\n console.log(json);\n var childTable = '<table style=\"padding-left:20px;border-collapse: separate;border-spacing: 10px 3px;\">' +\n '<tr><td style=\"font-weight: bold\">' + $('#text_response').val() + '</td><td style=\"font-weight: bold\">' + $('#text_value').val() + '</td><td style=\"font-weight: bold\">' + $('#text_date').val() + '</td></tr>';\n for (var i = 1; i <= len; i++) {\n childTable = childTable +\n '<tr></tr><tr><td>' + json[i].respuesta + '</td><td>' + json[i].valor + '</td><td>' + json[i].fechaResultado + '</td></tr>';\n }\n childTable = childTable + '</table>';\n return childTable;\n }", "function dataDisplay(item){\n tbody.text(\"\");\n item.forEach(ufo_sighting => {\n console.table(ufo_sighting);\n add_tr = tbody.append(\"tr\");\n\n Object.entries(ufo_sighting).forEach(function([key,value]){\n add_td = add_tr.append(\"td\").text(value);\n });\n });\n}", "function buildTable(ufoInfo) {\n // First, clear out any existing data\n tbody.html(\"\");\n\n // Next, loop through each object in the data\n // and append a row and cells for each value in the row\n ufoInfo.forEach((ufoSighting) => {\n let row = tbody.append('tr');\n\n // Loop through each field in the dataRow and add\n // each value as a table cell (td)\n Object.entries(ufoSighting).forEach(([key, value]) => { \n let tableBody = row.append('td');\n tableBody.text(value);\n });\n });\n}", "function buildTable(localTableDataJson, tagId) {\n console.log('building table for ' + tagId);\n var content = \"\";\n var header = \"<thead><tr>\";\n console.log(localTableDataJson.headers)\n for (var index in localTableDataJson.headers) {\n console.log('added header');\n header += \"<th>\" + localTableDataJson.headers[index] + \"</th>\";\n }\n header += \"</tr></thead>\";\n content += header + \"<tbody>\";\n\n for (var index in localTableDataJson.data) {\n\n content += \"<tr>\";\n jQuery.each(localTableDataJson.data[index], function(index2, dataColumn) {\n content += \"<td>\" + dataColumn + \"</td>\";\n });\n content += \"</tr>\";\n\n }\n\n content += \"</tbody>\"\n\n $('#' + tagId).empty();\n $('#' + tagId).append(content);\n}", "function buildTable(d) {\n var row = tbody.append('tr');\n Object.entries(d).forEach(([key, value]) => {\n var column = row.append('td').text(value);\n\n\t});\n}", "function displayData(something){ \n tbody.text(\"\")\n something.forEach(function(et_sighting){\n new_tr = tbody.append(\"tr\")\n Object.entries(et_sighting).forEach(function([key, value]){\n new_td = new_tr.append(\"td\").text(value)\t\n })\n})}", "function allData() {\n tbody.html(\"\");\n tableData.forEach((report) => {\n var row = tbody.append(\"tr\");\n Object.entries(report).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n numberEvents.text(objectLength(tableData));\n}", "function tableInfo(ufoInfo) {\n tbody.html(\"\");\n ufoInfo.forEach((ufoSighting) => {\n let row = tbody.append('tr');\n Object.entries(ufoSighting).forEach(([key, value]) => { \n let tableBody = row.append('td');\n tableBody.text(value);\n }); \n });\n}", "function makeTable(data){\n var tbody = d3.select(\"#ufo-table\").select(\"tbody\");\n tbody.html(\"\");\n data.forEach((x) => {\n var row = tbody.append(\"tr\");\n Object.entries(x).forEach(([key, value]) => {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n}", "function table_Build(data) {\n tableBody.html(\"\");\n data.forEach((row) => {\n const new_row = tableBody.append(\"tr\");\n \n Object.values(row).forEach((value) => {\n let dp = new_row.append(\"td\");\n dp.text(value);\n }\n );\n });\n}", "function add_to_table(output_json) //get JSON from google sheet via load_and_reformat_sheet_json\n \t\t\t{\n \t\t\n \t\t//table header displayer\n \t\ttable_output = \"<table id=\\\"table\\\" class=\\\"ui table\\\"><thead><tr>\";\n \t\t$.each(output_json.object[0],function(i,item)// table item header\n\t\t \t\t\t\t{\n\t\t \t\t\t\t \ttable_output = table_output + \"<th>\" + i + \"</th>\";\n\t\t \t\t\t\t});\n\t\t \t\t\t\t\ttable_output = table_output + \"</tr></thead>\";\n\n\n\t\t\t\t\t//content displayer \n\t\t\t\t\tfor (i = 0; i< output_json.object.length; i++)\n \t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar count = 1; //count \n\t\t\t\t\t\t\t\t\t\tvar num_parameter = Object.keys(output_json.object[0]).length;\t\t\t\t\t\t\t\t\t\t\n\t\t \t\t\t\t \t\t\t\t$.each(output_json.object[i],function(x,row_data)// loop through each array\n\t\t \t\t\t\t\t\t\t\t\t{\n\t\t \t\t\t\t\t\t\t\t\t\n\t\t \t\t\t\t\t\t\t\t\tif (count == 1)// check if this is the beginning of the table\n\t\t \t\t\t\t\t\t\t\t\t\t{\n\t\t \t\t\t\t\t\t\t\t\t\t\ttable_output = table_output +\"<tr>\";\n\t\t \t\t\t\t\t\t\t\t\t\t}\n\t\t \t\t\t\t\t\t\t\t\ttable_output = table_output + \"<td>\"+row_data+\"</td>\";\n\t\t \t\t\t\t\t\t\t\t\t\n\t\t \t\t\t\t\t\t\t\t\tif (count == num_parameter)// check if this is the ending of the cell\n\t\t \t\t\t\t\t\t\t\t\t\t{\n\t\t \t\t\t\t\t\t\t\t\t\t\ttable_output = table_output +\"</tr>\";\n\t\t \t\t\t\t\t\t\t\t\t\t}\n\t\t \t\t\t\t\t\t\t\t\t\n\t\t \t\t\t\t\t\t\t\t\tcount++;\n\n\t\t \t\t\t\t\t\t\t\t\t});\n \t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t\t\t//export table to html\n \t\t\t\t\t\t\t\t$(\".table\").remove();\n \t\t\t\t\t\t\t\ttable_output = table_output + \"</table>\";\n \t\t\t\t\t\t\t\t$('#table_div').append(table_output);\t\n\t\t\t\t\t\t\t\t\t\n\n \t\t\t}", "function renderTable() {\n $tbody.innerHTML = '';\n for (var i = 0; i < filteredData.length; i++) {\n // Get get the current UFOData object and its fields\n var UFOData = filteredData[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "function createTable(jsonE, str) {\n $('body').append('<table id=\"tb' + str + '\"><tr class=\"trh\"></tr></table>');\n // $('body').append('<table id=\"tb' + str + '\"><tr class=\"trh' + str + '\"></tr></table>');\n // $('body').append('<table id=\"tb\"><tr class=\"trh\"></tr></table>');\n\n for (x in jsonE[0]) {\n // $('.trh' + str).append('<th>' + x + '</th>');\n $('#tb' + str + ' .trh').append('<th>' + x + '</th>');\n }\n\n // debugger;\n\n let i = 0;\n jsonE.forEach(arr => {\n $('#tb' + str).append('<tr class=\"tr' + i + '\"></tr>');\n for (x in arr) {\n if (x === 'nextSalary') {\n $('#tb' + str + ' .tr' + i).append('<td><ol class=\"ol' + i + '\"></ol></td>');\n for (j = 0; j < 3; j++) {\n $('.ol' + i).append('<li>' + arr[x][j] + '</li>');\n }\n } else {\n $('#tb' + str + ' .tr' + i).append('<td>' + arr[x] + '</td>');\n }\n }\n i++;\n });\n}", "function parseToTable(da, callback){\n \n // Iterate through all elements properties to get the headers names\n var aoC = [];\n var keys = [];\n var data = da;\n \n for (var e in da){\n for(var key in da[e]){\n\t\n\tif (keys.indexOf(key) < 0){\n\t aoC.push({\"sTitle\": key});\n\t keys.push(key);\n\t}\n }\n }\n \n // Get all the elements data\n var aaD = [];\n \n for (var e in data){\n \n var row = [];\n \n // Get the properties in the same order as the first element\n for(var k in keys){\n\t\n\t// If it is an object\n\tif( typeof(data[e][keys[k]]) == 'object' ){\n\t \n\t parseToTable(data[e][keys[k]], function(d, c){\n\t row.push( tableToHtml(d,c) );\n\t });\n\t}\n\telse if (data[e][keys[k]]){\n\t row.push( data[e][keys[k]] );\n\t}\n\telse {\n\t row.push( \"\" );\n\t}\n }\n aaD.push(row);\n }\n callback(aaD, aoC);\n }", "function buildTable(data) {\n\n var table = document.createElement(\"TABLE\");\n\n var keyList = Object.keys(data[0]);\n\n \n\n var row = document.createElement(\"TR\");\n\n table.appendChild(row);\n\n for(var i in keyList) {\n\n var tableHeadingName = document.createTextNode(keyList[i]);\n\n var tableHeading = document.createElement(\"TH\");\n\n row.appendChild(tableHeading);\n\n tableHeading.appendChild(tableHeadingName);\n\n }\n\n \n\n for(var i in data) {\n\n var mountainInfo = data[i];\n\n var row = document.createElement(\"TR\");\n\n table.appendChild(row);\n\n for(var j in mountainInfo) {\n\n var info = document.createTextNode(mountainInfo[j]);\n\n var col = document.createElement(\"TD\");\n\n row.appendChild(col);\n\n col.appendChild(info);\n\n }\n\n } \n\n return table; \n\n }", "function buildTable(data){\n // Start By Clearing Existing Data\n tbody.html(\"\");\n // Loop Through `data` \n data.forEach((dataRow) => {\n // Append Table Row to the Table Body \n let row = tbody.append(\"tr\");\n // Iterate Through Values\n Object.values(dataRow).forEach((val) => {\n // add a row\n let cell = row.append(\"td\");\n cell.text(val);\n });\n })\n}", "function viewArrayAsTable(myArray) {\n var result;\n //var result = \"<table border=1>\";\n\n // make head row with titles\n// result += \"<tr>\";\n// if (myArray.length>0){\n// \tvar x = myArray[0];\n// \tvar y = Object.keys(x);\n// \tfor(var j=0; j<y.length; j++){\n// \tresult += \"<td><b>\" + y[j] + \"</b></td>\";\n// \t}\n//\t}\n\n // make table\n //result += \"</tr>\";\n\n if ( myArray == null || myArray.length == 0) {\n return result = '';\n }\n\n for (var i = 0; i < myArray.length; i++) {\n result += \"<tr>\";\n result += \"<td class='cargo-name'>\" + myArray[i].name + \"</td>\";\n result += \"<td class='cargo-weight'>\" + myArray[i].weight + \"</td>\";\n result += \"</tr>\";\n }\n //result += \"</table>\";\n return result;\n}", "function displayTable(){\n var stringData = \"\";\n for (var i=0; i<data.length; i++ ){\n \n \n stringData = stringData + \"<tr><td>\"+(i+1)+\"</td><td>\" + data[i].FullName + \"</td><td>\" + data[i].Email + \"</td><td>\" + data[i].Phone + \"</td><td>\" + data[i].Description + \"</td></tr>\";\n \n }\n \n var tableData = document.getElementById('tableData');\n tableData.innerHTML = stingData;\n \n}", "function _jsToTable(objectBlob) {\n var rowData = _flattenData(objectBlob);\n var headers = _extractHeaders(rowData);\n return {\"headers\":headers, \"rowData\":rowData};\n }", "function tableToJson(table) {\n var data = [];\n\n // first row needs to be headers\n var headers = [];\n for (var i=0; i<table.rows[0].cells.length; i++) {\n headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi,'');\n }\n\n // go through cells\n for (var i=1; i<table.rows.length; i++) {\n\n var tableRow = table.rows[i];\n var rowData = {};\n\n for (var j=0; j<tableRow.cells.length; j++) {\n\n var string = (tableRow.cells[j].innerHTML).replace(\"<br>\",\"\");\n rowData[ headers[j] ] = string;\n\n }\n\n data.push(rowData);\n } \n\n return data;\n}", "function createTable(data){\n\n resetTable();\n data.forEach((sighting)=>{\n console.log(sighting);\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(([key, value])=> {\n console.log(key, value);\n var cell = row.append(\"td\");\n cell.text(value);\n});\n});\n}", "function makeTable(data) {\n var tableData = data.map(person => \"<tr><td>\" + person.id + \"</td><td>\" + person.age + \"</td><td>\" + person.name + \"</td><td>\" + person.gender + \"</td><td>\" + person.email + \"</td></tr>\");\n tableData.unshift('<table class=\"table\"><tr><th scope=\"col\">id</th><th scope=\"col\">age</th><th scope=\"col\">name</th><th scope=\"col\">gender</th><th scope=\"col\">email</th></tr>');\n tableData.push(\"</table>\");\n return tableData.join(\"\");\n}", "function displayData(dd) {\n \n tableBody.innerHTML = \"\";\n\n dd.forEach((ufoSightings) => {\n console.log(ufoSightings);\n var row = tbody.insert(\"tr\");\n Object.entries(ufoSightings).forEach(([key, value]) => {\n row.insert(\"td\").text(value);\n });\n });\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < ufoSightings.length; i++) {\n // Get get the current sightings object and its fields\n var sightings = ufoSightings[i];\n var fields = Object.keys(sightings);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the sightings object, create a new cell at set its inner text to be the current value at the current sightings field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sightings[field];\n }\n }\n}", "function displayResults(scrapedData) {\n // First, empty the table\n $(\"tbody\").empty();\n\n // Then, for each entry of that json...\n scrapedData.forEach(function(scrapedData) {\n // Append each of the article's properties to the table\n $(\"tbody\").append(\n \"<tr><td>\" +\n scrapedData.title +\n \"</td>\" +\n \"<td>\" +\n scrapedData.link +\n \"</td>\" +\n \"</tr>\" \n )\n });\n}", "function fromJSONtoActionsTable(actions_array){\n var str = \"\"\n var empty = '\\\n <tr id=\"no_actions_tr\">\\\n <td colspan=\"6\">' + tr(\"No actions to show\") + '</td>\\\n </tr>';\n\n if (!actions_array){\n return empty;\n }\n\n if (!$.isArray(actions_array))\n {\n var tmp_array = new Array();\n tmp_array[0] = actions_array;\n actions_array = tmp_array;\n }\n\n if (!actions_array.length){\n return empty;\n }\n\n $.each(actions_array, function(index, scheduling_action){\n str += fromJSONtoActionRow(scheduling_action);\n });\n\n return str;\n}", "function buildTable(data) {\n tbody.html(\"\");\n\n data.forEach((dataRow) => {\n let row = tbody.append(\"tr\");\n // Create list of table values \n Object.values(dataRow).forEach((val) => {\n let cell = row.append('td');\n cell.text(val);\n });\n })\n}", "function buildTable(taObj) {\n let table = $('#applicants-table');\n let parent = table.children();\n for (let j = 0; j < taObj.length; j++) {\n var td = $('td');\n var data = [taObj[j].givenname, taObj[j].familyname, taObj[j].status, taObj[j].year];\n\n parent.append($('<tr>'));\n for (let i = 0; i < data.length; i++) {\n var html = $('<td>').text(data[i]);\n parent.append(html);\n }\n }\n table.show();\n}", "function buildHtmlTable(el, data) {\n var columns = [];\n var header = el.createTHead();\n var row = header.insertRow(0);\n var dataRow = data[0];\n for (var column in dataRow) {\n row.appendChild(document.createElement('th'));\n row.lastChild.innerHTML = column;\n columns.push(column);\n }\n header.append(row);\n el.append(header);\n \n var body = document.createElement(\"tbody\");\n for (var i = 0; i < data.length; i++) {\n row = body.insertRow(-1);\n for (var colIndex = 0; colIndex < columns.length; colIndex++) {\n var cellValue = data[i][columns[colIndex]];\n if (cellValue === null)\n cellValue = \"\";\n var cell = row.insertCell(-1);\n cell.innerHTML = cellValue;\n }\n body.append(row);\n }\n el.append(body);\n}", "function ultimosTransitos() {\n $.getJSON('/admin/transitos/ver/ultimos-transitos', function (data) {\n data.forEach(ultimosTransitos => {\n html += '<tr><td>' + ultimosTransitos.condutor_nome + ' - ' + ultimosTransitos.tipo_transito + '</td></tr>';\n });\n $(\"#table_condutor_nome\").html(html);\n });\n var html = \"\";\n}", "function default_table(){\n tableData.forEach((sightings) => {\n var record = tbody.append(\"tr\");\n Object.entries(sightings).forEach(([key, value]) => {\n var data_value = record.append(\"td\");\n data_value.text(value);\n });\n });\n}", "function init(){\r\n data.forEach(function(ufosightings) {\r\n console.log(ufosightings);\r\n var row = tbody.append(\"tr\");\r\n \r\n Object.entries(ufosightings).forEach(function([key, value]) {\r\n console.log(key, value);\r\n var cell = tbody.append(\"td\");\r\n cell.text(value);\r\n });\r\n \r\n});\r\n\r\n}", "function bindJSONtoTable(table, url, data, callback) {\n\tif(table.is('table')) {\n\t\t$.getJSON(url, data, function(mydata){\n\t\t\tvar data_header = null;\n\t\t\tvar data_series = null;\n\t\t\t\n\t\t\tvar $thead = $(\"<thead></thead>\");\n\t\t\ttable.append($thead);\n\t\t\tvar $tbody = $(\"<tbody></tbody>\");\n\t\t\ttable.append($tbody);\n\t\t\t\n\t\t\tfor(var one in mydata) { // init for the table data\n\t\t\t\tvar item = mydata[one];\n\t\t\t\t\n\t\t\t\tif(item[\"categories\"] != null && item[\"categories\"] != undefined) {\n\t\t\t\t\tdata_header = item[\"categories\"];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(one == \"series\") {\n\t\t\t\t\tdata_series = item;\n\t\t\t\t}\n\t\t\t} // end for\n\t\t\t\n\t\t\tvar hasName = false;\n\t\t\t\n\t\t\tif(data_header != null) { // add title for the table\n\t\t\t\tvar $tr = $(\"<tr></tr>\");\n\t\t\t\t$thead.append($tr);\n\t\t\t\t$tr.append(\"<th></th>\");\n\t\t\t\t\n\t\t\t\tfor(var i = 0; i < data_header.length; i++) {\n\t\t\t\t\tvar value = data_header[i];\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tvar $th = $(\"<th></th>\");\n\t\t\t\t\t$th.html(value);\n\t\t\t\t\t$tr.append($th);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(data_series != null) { // add data into tbody\n\t\t\t\tfor(var i = 0 ; i < data_series.length ; i++) {\n\t\t\t\t\tvar divItem = data_series[i];\n\t\t\t\t\tvar $tr = $(\"<tr></tr>\");\n\t\t\t\t\t$tbody.append($tr);\n\t\t\t\t\t\n\t\t\t\t\tvar $title = $(\"<td></td>\");\n\t\t\t\t\t$tr.append($title);\n\t\t\t\t\tif(divItem[\"name\"] != undefined) {\n\t\t\t\t\t\t$title.html(divItem[\"name\"]);\n\t\t\t\t\t\thasName = true;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor(var j = 0 ; j < divItem[\"data\"].length ; j++) {\n\t\t\t\t\t\tvar value = divItem[\"data\"][j];\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar $td = $(\"<td></td>\");\n\t\t\t\t\t\t$td.html(value);\n\t\t\t\t\t\t$tr.append($td);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(!hasName) { // rm title cell if not exist\n\t\t\t\t$thead.find(\"tr\").find(\"th:first\").remove();\n\t\t\t\t$tbody.find(\"tr\").find(\"td:first\").remove();\n\t\t\t}\n\t\t\t\n\t\t\tif(callback != undefined) callback(table);\n\t\t});\n\t}\n}", "function dataTable(data) {\n tbody.html('');\n data.forEach(function(sightings) {\n console.log(sightings);\n var row = tbody.append('tr');\n \n Object.entries(sightings).forEach(function([key, value]) {\n console.log(key, value);\n var cell = row.append('td');\n cell.text(value);\n });\n });\n \n console.log('You have begun your search for the truth!');\n}", "function displayTable(results) {\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Department', 'Price', 'Stock']\n , colWidths: [10, 30, 15, 10, 10]\n });\n for (i = 0; i < results.length; i++) {\n table.push(\n [results[i].item_id, results[i].product_name, results[i].department_name, results[i].price, results[i].stock_quantity]\n );\n }\n console.log(table.toString());\n}" ]
[ "0.8157815", "0.794002", "0.72810906", "0.72794", "0.72413075", "0.72397435", "0.7226649", "0.7022742", "0.7007057", "0.699789", "0.6955359", "0.6935765", "0.681017", "0.6798629", "0.67899024", "0.67751575", "0.67607105", "0.6730741", "0.6730741", "0.6716402", "0.66984075", "0.6696851", "0.66805327", "0.66435164", "0.66335255", "0.6630139", "0.66133595", "0.65897524", "0.65738565", "0.6555808", "0.6551505", "0.65414834", "0.6533619", "0.652358", "0.6521895", "0.64927834", "0.64886135", "0.64870167", "0.6475587", "0.6464336", "0.6460124", "0.64398557", "0.64311755", "0.6420425", "0.6410105", "0.63894194", "0.6386589", "0.63859165", "0.6375779", "0.63746744", "0.63732773", "0.6360431", "0.635764", "0.63476235", "0.6347272", "0.63396025", "0.6338979", "0.6334216", "0.6328496", "0.63184845", "0.63184845", "0.63173866", "0.6313609", "0.6307302", "0.630502", "0.6300487", "0.63002944", "0.6297761", "0.6274297", "0.6269207", "0.62574244", "0.62504977", "0.624626", "0.6241987", "0.6241588", "0.6241048", "0.62368786", "0.6232878", "0.6229382", "0.6214235", "0.62137073", "0.6208427", "0.6207111", "0.62031573", "0.61844444", "0.6180066", "0.61771613", "0.6171355", "0.6168136", "0.61552477", "0.61550283", "0.61462516", "0.6146124", "0.61453354", "0.6144855", "0.6143598", "0.6143096", "0.6141056", "0.6135264", "0.6124738" ]
0.80924743
1
Abort the api call
abort() { source.cancel() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abort () {\n this.request.abort();\n }", "function abortRequest(){\n this.aborted = true;\n this.clearTimeout();\n this.emit('abort');\n}", "abort () {\n this.requests.forEach(req => req.abort())\n super.abort()\n }", "cancel() {\n if (this._requestTask && typeof this._requestTask.abort === 'function') {\n this._requestTask.abort();\n }\n\n this._requestTask = null;\n }", "abort () {\n // ...\n }", "abort() {\n }", "abort() {\n if ( this.xhr ) {\n this.xhr.abort();\n }\n }", "async abort() {\n return;\n }", "abort() {\n if (this.xhr) {\n this.xhr.abort();\n }\n }", "downloadingCanceled() {\n if (this.request !== null) {\n this.request.abort();\n }\n }", "abort () {\n // Reject the promise returned from the upload() method.\n console.log('upload cancel')\n }", "abort() {\n this.aborted = true;\n requestErrorSteps(this);\n updateReadyState(this, FakeXMLHttpRequest.UNSENT);\n }", "async abort() {\n if (this.client) {\n this.client.close();\n } \n }", "function abort() {\n retryRequests.forEach(function (t) {\n clearTimeout(t.timeout); // abort request in order to trigger LOADING_ABANDONED event\n\n if (t.config.request && t.config.abort) {\n t.config.abort(t.config.request);\n }\n });\n retryRequests = [];\n delayedRequests.forEach(function (x) {\n return clearTimeout(x.delayTimeout);\n });\n delayedRequests = [];\n requests.forEach(function (x) {\n // MSS patch: ignore FragmentInfo requests\n if (x.request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__[\"HTTPRequest\"].MSS_FRAGMENT_INFO_SEGMENT_TYPE) {\n return;\n } // abort will trigger onloadend which we don't want\n // when deliberately aborting inflight requests -\n // set them to undefined so they are not called\n\n\n x.onloadend = x.onerror = x.onprogress = undefined;\n x.loader.abort(x);\n });\n requests = [];\n }", "abort() {\n while (this.length > 0) {\n let dial = this._queue.shift();\n\n dial.callback(DIAL_ABORTED());\n }\n\n this.stop();\n }", "abort() {\n this.emit('abort');\n }", "cancel() {\n if (this._abortController != null) {\n this._abortController.abort();\n\n this._abortController = null;\n }\n }", "function abort() {\n retryTimers.forEach(function (t) {\n return clearTimeout(t);\n });\n retryTimers = [];\n\n delayedXhrs.forEach(function (x) {\n return clearTimeout(x.delayTimeout);\n });\n delayedXhrs = [];\n\n xhrs.forEach(function (x) {\n // abort will trigger onloadend which we don't want\n // when deliberately aborting inflight requests -\n // set them to undefined so they are not called\n x.onloadend = x.onerror = x.onprogress = undefined;\n x.abort();\n });\n xhrs = [];\n }", "abort() {\n this.transaction_.abort();\n }", "abortRequest() {\n if (this.layer.request) {\n if (this.layer.request.readyState !== 4) {\n // Abort the request && reset the layer\n this.layer.request.abort();\n this.layer = {};\n }\n }\n }", "cancel() {}", "abort() {\n abortSignal(getSignal(this));\n }", "abort() {\n abortSignal(getSignal(this));\n }", "abort() {\n // Abort is not supported for this uploader\n }", "async abort() {\n await this.conn.end();\n }", "abort() {\n if (this._objectWriter) {\n this._objectWriter.abort();\n } else {\n throw(createError(ErrorCode.ABORTED, 'Abort was triggered.'));\n this.destroy();\n }\n }", "_xhrOnAbort() {\n var xhr = this.xhr;\n this.abort(ResourceLoader.reqType(xhr) + ' Request was aborted by the user.');\n }", "cancel() {\n cancel();\n }", "stop() {\n this.isRunning = true;\n window.http.xmlHtpRequest.abort();\n }", "cancelFetch() {\n const xhr = this._fetchXHR;\n if (xhr && xhr.readyState !== XMLHttpRequest.DONE) {\n xhr.abort();\n }\n delete this._fetchXHR;\n }", "cancelFetch() {\n const xhr = this._fetchXHR;\n if (xhr && xhr.readyState !== XMLHttpRequest.DONE) {\n xhr.abort();\n }\n delete this._fetchXHR;\n }", "abort () {\n if (this._disabled) return this\n while (this._requestControllers.length) {\n const controller = this._requestControllers.shift()\n if (controller && controller.abort) {\n this._aborted = true\n controller.abort()\n }\n }\n return this\n }", "function abortPendingRequestsForApiCall(apiCallName) {\n var pendingRequest = _.find(_pendingRequests, (pending) => {\n return pending._apiCallName === apiCallName;\n });\n\n if (pendingRequest) {\n pendingRequest._callback = () => {\n };\n pendingRequest.abort();\n removeValue(_pendingRequests, pendingRequest);\n }\n}", "cancel() {\n throw new Error(\"Not implemented.\")\n }", "close() {\n window.http.xmlHtpRequest.abort();\n }", "canceled() {}", "function onButtonAbort() {\n try {\n authenticationContext.abortAuthentication(\n configuration.markAsManualConnect);\n WinJS.log && WinJS.log(\"Authentication aborted\", \"sample\", \"status\");\n }\n catch (ex) {\n WinJS.log && WinJS.log(ex.description, \"sample\", \"error\");\n }\n clearAuthenticationToken();\n }", "onabort() {}", "cancel() {\n\n }", "async cancel() {\n throw new Error(this.cancelMessage);\n }", "async abort() {\n if (this.pgClient !== undefined) {\n await this.pgClient.end();\n }\n }", "stop () {\n this.continue = false\n if (this.abortController) {\n this.abortController.abort()\n }\n }", "cancel() {\n\n if (this.requestRunning === false) return;\n\n this.requestRunning = false;\n\n this._resetAdsLoader();\n\n // Hide the advertisement.\n this._hide(\"cancel\");\n\n // Send event to tell that the whole advertisement thing is finished.\n let eventName = \"AD_SDK_CANCELED\";\n let eventMessage = \"Advertisement has been canceled.\";\n this.eventBus.broadcast(eventName, {\n name: eventName,\n message: eventMessage,\n status: \"warning\",\n analytics: {\n category: this.eventCategory,\n action: eventName,\n label: this.gameId\n }\n });\n }", "componentWillUnmount() {\n request.abort();\n }", "async abort() {\n try {\n await this.connection.destroy();\n } catch (e) {\n }\n this.connection = undefined;\n }", "function Cancellation() { }", "function abortXHR(xhr) {\n if (xhr && xhr.readyState < 4) {\n xhr.onreadystatechange = $.noop;\n xhr.abort();\n }\n }", "function abortXHR(xhr) {\n if (xhr && xhr.readyState < 4) {\n xhr.onreadystatechange = $.noop\n xhr.abort()\n }\n }", "function abortXHR(xhr) {\n if ( xhr && xhr.readyState < 4) {\n xhr.onreadystatechange = $.noop\n xhr.abort()\n }\n}", "function abortXHR(xhr) {\n if ( xhr && xhr.readyState < 4) {\n xhr.onreadystatechange = $.noop\n xhr.abort()\n }\n}", "_abortAllRequests() {\n while (this._requests.length > 0) {\n const req = this._requests.pop();\n req.abort = true;\n req.xhr.abort();\n req.xhr.onreadystatechange = function () {};\n }\n }", "function cancelViaAPI(params) {\n return new Promise((resolve, reject) => {\n reject(new Error(`Not Yet implemented`));\n });\n}", "stop() {\n // TODO: set error code based on error type\n this.configs.HTTPRequest\n .response.status(501)\n .json({\n data: this.data,\n error: this.error,\n model: this.model,\n });\n }", "_onDisconnectTimeout() {\n this._abortAllRequests();\n }", "stopRequesting() {\n this.data = [];\n clearInterval(this.data_request);\n }", "function aborter(){\n\t\t\t// cleanup\n\t\t\teventTarget.removeEventListener( eventType, handler)\n\t\t\tsignal.removeEventListener( \"abort\", aborter)\n\n\t\t\t// done\n\t\t\treject( new _AbortError(\"Aborted\"))\n\t\t}", "terminate() {\n if (this.state.status === 'new') {\n // An empty/new call; just delete the Call object without noise.\n this.plugin.deleteCall(this)\n return\n } else if (this.state.status === 'create') {\n // A fresh outgoing Call; not yet started. There may or may not\n // be a session object. End the session if there is one.\n if (this.session) this.session.terminate()\n this.setState({status: 'request_terminated'})\n // The session's closing events will not be called, so manually\n // trigger the Call to stop here.\n this._stop()\n } else {\n // Calls with other statuses need some more work to end.\n try {\n if (this.state.status === 'invite') {\n this.setState({status: 'request_terminated'})\n this.session.reject() // Decline an incoming call.\n } else if (['accepted'].includes(this.state.status)) {\n // Hangup a running call.\n this.session.bye()\n // Set the status here manually, because the bye event on the\n // session is not triggered.\n this.setState({status: 'bye'})\n }\n } catch (err) {\n this.app.logger.warn(`${this}unable to close the session properly. (${err})`)\n // Get rid of the Call anyway.\n this._stop()\n }\n }\n }", "componentWillUnmount() {\n this.source.cancel('cancel request');\n }", "function cancel() {\n history.goBack();\n }", "_abort(commandId) {\n // if the operation is aborted, then on next poll we get the correct state\n return this.$.nx.request().then((request) =>\n request\n .path(`bulk/${commandId}/abort`)\n .execute({ method: 'put' })\n .then((status) => {\n if (this._isAborted(status)) {\n this.dispatchEvent(\n new CustomEvent('poll-aborted', {\n bubbles: true,\n composed: true,\n detail: status,\n }),\n );\n } else {\n console.warn(`Incorrect abort status on bulk action: ${status}`);\n }\n return status;\n })\n .catch((error) => {\n this.dispatchEvent(\n new CustomEvent('poll-error', {\n bubbles: true,\n composed: true,\n detail: error,\n }),\n );\n console.warn(`Bulk action abort failed: ${error}`);\n throw error;\n }),\n );\n }", "function abort(err) {\n reader.abort(ended = err || true, cb)\n }", "function abort(err) {\n reader.abort(ended = err || true, cb)\n }", "function cancel() {\n transition(DELETE, true);\n\n props.cancelInterview(props.id)\n .then(response => {\n transition(EMPTY);\n })\n .catch(error => {\n transition(ERROR, true);\n })\n }", "_xhrOnTimeout() {\n var xhr = this.xhr;\n this.abort(ResourceLoader.reqType(xhr) + ' Request timed out.');\n }", "componentWillUnmount() {\n this.serverRequest.abort();\n }", "componentWillUnmount() {\r\n this.abortController.abort();\r\n }", "cancel () {\n this._fetching = false\n }", "cancel () {\n this._fetching = false\n }", "cancel() {\n this.cancelled = true;\n }", "abortErrorReason() {\n throw new Error('Not implemented');\n }", "cancel() {\n // Call underlying googleyolo API if supported and previously initialized.\n // There is also a current issue with One-Tap. It will always fail with\n // noCredentialsAvailable error if cancelLastOperation is called before\n // rendering.\n // If googleyolo is not yet loaded, there is no need to run cancel even\n // after loading since there is nothing to cancel.\n if (this.googleyolo_ && this.initialized_) {\n this.lastCancel_ =\n this.googleyolo_.cancelLastOperation().catch(function(error) {\n // Suppress error.\n });\n }\n }", "function abortTimer() {\n clearInterval(tid);\n}", "cancel() {\n if (this.token) {\n this.token.cancel();\n this.token = null;\n }\n this.stopPipe(this.canceledError());\n }", "__onNativeAbort() {\n // When the abort that triggered this method was not a result from\n // calling abort()\n if (!this.__abort) {\n this.abort();\n }\n }", "_xhrOnError() {\n var xhr = this.xhr;\n this.abort(ResourceLoader.reqType(xhr) + ' Request failed. Status: ' + xhr.status + ', text: \"' + xhr.statusText + '\"');\n }", "function endCurrentCall() {\n\n}", "function neutralize_current_environment() {\n if (current_request != null && current_request.abort) {\n current_request.abort();\n }\n\n if (current_more_request != null && current_more_request.abort) {\n current_more_request.abort();\n }\n }", "cancel() {\n delete activityById[id];\n }", "async abort() {\n transactionalGuard()\n stateMachine.transitionTo(STATES.ABORTING)\n\n if (!isOngoing()) {\n logger.debug('No partitions or offsets registered, not sending EndTxn')\n\n stateMachine.transitionTo(STATES.READY)\n return\n }\n\n const broker = await findTransactionCoordinator()\n await broker.endTxn({\n producerId,\n producerEpoch,\n transactionalId,\n transactionResult: false,\n })\n\n stateMachine.transitionTo(STATES.READY)\n }", "function aborts(thing) {\n return thing && thing.aborts();\n }", "function xhrOnUnloadAbort() {\n\tjQuery( window ).unload(function() {\n\t\t// Abort all pending requests\n\t\tfor ( var key in xhrCallbacks ) {\n\t\t\txhrCallbacks[ key ]( 0, 1 );\n\t\t}\n\t});\n}", "function xhrOnUnloadAbort() {\n\tjQuery( window ).unload(function() {\n\t\t// Abort all pending requests\n\t\tfor ( var key in xhrCallbacks ) {\n\t\t\txhrCallbacks[ key ]( 0, 1 );\n\t\t}\n\t});\n}", "function abortMission() {\n console.log(\"Exiting Manager Mode\");\n connection.end();\n}", "function cancel() {\n gotoReturnState();\n }", "abortTest () {\n\t\tif (this.runningQueue) {\n\t\t\tthis.runningQueue.cancel()\n\t\t}\n\t}", "cancelForm() {\n const { id } = this.state;\n const body = { id, abort: true };\n this.submitForm(body);\n }", "function cancel() {\n window.history.back();\n}", "cancel() {\n this.logout();\n this.isCancelled = true;\n }", "cancel() {\n clearTimeout(this.timeoutID);\n delete this.timeoutID;\n }", "function cancel() {\n offset = -1;\n phase = 0;\n }", "cancelBatch() {\n this.batching = null;\n this.meta.batchChanges = null;\n }", "cancelBatch() {\n this.batching = null;\n this.meta.batchChanges = null;\n }", "get aborted() {\n var _a, _b, _c;\n return ((_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroyed) !== null && _b !== void 0 ? _b : this.destroyed) && !((_c = this[kOriginalResponse]) === null || _c === void 0 ? void 0 : _c.complete);\n }", "clientAborted(id) {\n log(id + \": Stream client aborted\");\n this.abortClient(id);\n this.startAStream();\n }", "function creditsAbort() {\n \tmusic_rasero.stop();\t\t\t\t\t// Stop music\n \tdefDemo.next();\t\t\t\t\t\t\t// Go to next part (End \"crash\")\n }", "cancel() {\n console.log('[cancel]');\n // now request that Journey Builder closes the inspector/drawer\n connection.trigger('requestInspectorClose');\n }", "function cancelOrder(symbol, orderId, OrderAPI, binanceSecret, binanceAPI) {\n //console.log(\n // \"cancelOrder\",\n // symbol,\n // orderId,\n // OrderAPI,\n // binanceSecret,\n // binanceAPI\n //);\n const params = { symbol, orderId, timestamp: new Date().getTime() };\n let res = makeSignature(params, binanceSecret);\n params.signature = res;\n let qs = res.qs + \"signature=\" + res.signature;\n\n return fetch(OrderAPI + \"/fapi/v1/order\" + \"?\" + qs, {\n method: \"DELETE\",\n headers: {\n \"X-MBX-APIKEY\": binanceAPI,\n // \"Content-Type\": \"application/json\"\n },\n })\n .then((res) => {\n return res.json();\n })\n .then((r) => {\n console.log(\"result\", r);\n return r;\n })\n .catch((err) => console.log(err.message));\n}", "aborted() {\n this.emit('aborted');\n }", "cancel() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n if (this.intervalId) {\n clearInterval(this.intervalId);\n }\n this.timeoutId = undefined;\n this.intervalId = undefined;\n this.sequence = 0;\n this.isActive = false;\n this.times = [];\n if (this.rejectCallback) {\n this.rejectCallback(new Error('cancel'));\n }\n this.rejectCallback = undefined;\n }", "function cancel() {\r\n const wrapper = document.querySelector(\".afhalen-wrapper\");\r\n wrapper.style.display = \"none\";\r\n resetState();\r\n // just to clear the error box\r\n sendErrorMessage(\"\");\r\n\r\n }" ]
[ "0.81136954", "0.76359", "0.7565169", "0.73976916", "0.7347391", "0.7263224", "0.72632205", "0.719874", "0.7179605", "0.69478905", "0.69353133", "0.68929744", "0.6869565", "0.68594706", "0.68445784", "0.684434", "0.68271357", "0.68074214", "0.67733204", "0.67709816", "0.67704403", "0.6745807", "0.6745807", "0.6703759", "0.6671944", "0.6630295", "0.659178", "0.6577496", "0.65663403", "0.65580237", "0.65580237", "0.6551837", "0.65481704", "0.64721745", "0.6464687", "0.6463705", "0.64231443", "0.6400338", "0.6395899", "0.63895315", "0.6388552", "0.63883275", "0.6385132", "0.6334855", "0.6330109", "0.63096714", "0.6302167", "0.6263414", "0.62392384", "0.62392384", "0.62314135", "0.6224177", "0.6222297", "0.62101483", "0.6204575", "0.61668754", "0.6165711", "0.61581147", "0.61532784", "0.61458415", "0.61281794", "0.61281794", "0.60867584", "0.6073657", "0.6067892", "0.6051964", "0.6039394", "0.6039394", "0.6004659", "0.5998489", "0.59770054", "0.59662503", "0.596307", "0.5942771", "0.5911424", "0.59097725", "0.5899735", "0.58953047", "0.58902997", "0.5879256", "0.58745813", "0.58745813", "0.5861973", "0.5860713", "0.5836383", "0.58239734", "0.5822928", "0.58138996", "0.581157", "0.57954675", "0.57725364", "0.57725364", "0.5741866", "0.57256085", "0.5720232", "0.57112104", "0.57006943", "0.56969213", "0.5695566", "0.56920075" ]
0.66733384
24
Attach 'g' tag to svg reference
getSvgNode() { const { config, className } = this.props; const node = this.svgNode; return d3.select(node) .select(`.${className}__group`) .attr('transform', `translate(${config.marginLeft}, ${config.marginTop})`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gCreate(tag) { return document.createElementNS('http://www.w3.org/2000/svg', tag); }", "function SVGWrap() {}", "getSvgRef() {\n return this.svggroup;\n }", "function g(id = null, classList) {\n let g = document.createElementNS(Svg.svgNS, \"g\");\n if (id != null)\n g.id = id;\n if (classList != undefined) {\n g.classList.add(...classList);\n }\n return g;\n }", "function SVGParent() {}", "drawSvg() {\n \n\t}", "drawSvgWrapper() {\n //Construct Body\n var body = d3.select(\"#root\")\n\n //Construct SVG\n var svg = body\n .append(\"div\")\n .append(\"svg\")\n .attr(\"class\", \"svg\")\n .attr(\"id\", \"content\")\n .attr(\"width\", this.width)\n .attr(\"height\", this.height)\n .attr(\"viewBox\", this.viewBox)\n .attr(\n \"transform\",\n \"translate(\" +\n this.width / 2 +\n \",\" +\n this.height / 2 +\n \")\"\n )\n ;\n //Draw G for map\n return svg;\n }", "function SVGElement() {}", "function SVGElement() {}", "function SVGElement() {}", "function SVGElement() {}", "function SVGElement() {}", "function SVGElement() {}", "_createSVG() {\n\t\t\treturn d3.select(this._container)\n\t\t\t\t.append('svg');\n\t\t}", "function SVGWrapper(svg, container) {\r\n\tthis._svg = svg; // The SVG root node\r\n\tthis._container = container; // The containing div\r\n\tfor (var i = 0; i < jQuery.svg._extensions.length; i++) {\r\n\t var extension = jQuery.svg._extensions[i];\r\n\t this[extension[0]] = new extension[1](this);\r\n\t}\r\n }", "function getSvgElement() {\n\n let svg = getSvg('svg');\n svg.setAttribute('width', '100%');\n svg.setAttribute('height', '100%');\n \n // Set up SVG defs\n \n const rectDef = getSvg('rect'),\n defs = getSvg('defs');\n \n rectDef.setAttribute('class', 'note');\n rectDef.setAttribute('id', rectId);\n rectDef.setAttribute('height', PIANO_ROLL_OPTIONS.barHeight);\n defs.appendChild(rectDef);\n svg.appendChild(defs);\n\n return svg;\n }", "function addSvgg(dParent, gid, { w = '100%', h = '100%', bg, fg, originInCenter = false } = {}) {\n\t//div dParent gets an svg and inside a g, returns g\n\t//dParent must have its bounds width and height set\n\tlet svg1 = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\n\tif (!dParent.style.width || !dParent.style.height) {\n\t\tlet pBounds = getBounds(dParent);\n\t\tw = pBounds.width + 'px';\n\t\th = pBounds.height + 'px';\n\t\tif (pBounds.width == 0){\n\t\t\tw='100%';\n\t\t\th='100%';\n\t\t}\n\t\t//console.log('--- addSvgg: CORRECTING MISSING WIDTH AND HEIGHT ON PARENT ---', dParent.id,w,h);\n\n\t\t// svg1.setAttribute('width', pBounds.width + 'px');\n\t\t// svg1.setAttribute('height', pBounds.height + 'px');\n\t\t// dParent.style.setProperty('width', pBounds.width + 'px');\n\t\t// dParent.style.setProperty('height', pBounds.height + 'px');\n\t}\n\tif (!dParent.style.position) dParent.style.position = 'relative';\n\n\tsvg1.setAttribute('width', w);\n\tsvg1.setAttribute('height', h);\n\tlet style = 'margin:0;padding:0;position:absolute;top:0px;left:0px;';\n\tif (bg) style += 'background-color:' + bg;\n\tsvg1.setAttribute('style', style);\n\tdParent.appendChild(svg1);\n\n\tlet g1 = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n\tif (gid) g1.id = gid;\n\tsvg1.appendChild(g1);\n\t// if (originInCenter) { g1.style='transform:translate(50%, 50%)'; } //works!\n\t// if (originInCenter) { g1.setAttribute('class', 'gCentered'); } //works! but: relies on class gCentered\n\t// console.log('____________________________')\n\t// console.log(getBounds(svg1))\n\t// console.log(getBounds(dParent))\n\tif (originInCenter) { g1.style.transform = \"translate(50%, 50%)\"; } //works!\n\n\treturn g1;\n}", "function SVGWrapper(svg, container) {\n\tthis._svg = svg; // The SVG root node\n\tthis._container = container; // The containing div\n\tfor (var i = 0; i < $.svg._extensions.length; i++) {\n\t\tvar extension = $.svg._extensions[i];\n\t\tthis[extension[0]] = new extension[1](this);\n\t}\n}", "function createSvg() {\n svg = d3Service.select(parentElement).append(\"svg\");\n }", "_setGraphContent () {\n const bb = this._boundingBox;\n const height = bb.offsetHeight;\n const width = bb.offsetWidth;\n\n let svg = d3.select(bb).append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .append(\"g\")\n .attr(\"transform\", \"translate(50,0)\");\n\n this._setSVG(svg);\n }", "_renderSvg() {\n this._svg = d3\n .select(this.parent)\n .append(\"svg\")\n .attr(\"class\", \"chart-svg\")\n .append(\"g\")\n .attr(\"class\", \"data-container\")\n .append(\"g\")\n .attr(\"class\", \"markers-container\");\n }", "function createSVG(svg) {\n var content = create(FRAGMENT);\n var template = create('div');\n template.innerHTML = '<svg xmlns=\"http://www.w3.org/2000/svg\">' + svg + '</svg>';\n append(content, template.firstChild.childNodes);\n return content;\n }", "function createSVG(svg) {\n var content = create(FRAGMENT);\n var template = create('div');\n template.innerHTML = '<svg xmlns=\"http://www.w3.org/2000/svg\">' + svg + '</svg>';\n append(content, template.firstChild.childNodes);\n return content;\n }", "function setupSVG(svg, width, height) {\n //Remove children of svg to eventually tiles from the previous image\n svg.innerHTML = '';\n\n //Give to svg the same size as the image\n svg.setAttribute('viewBox', '0 0 '+width+' '+height);\n svg.setAttribute('width', '100%');\n svg.setAttribute('height', '100%');\n}", "function createSvgReference(id, viewbox) {\n\t\tvar svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n\t\tvar use = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n\t\tviewbox = viewbox || \"0 0 24 24\";\n\t\tuse.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"href\", \"#\" + id);\n\t\tsvg.setAttribute(\"role\", \"icon\");\n\t\tsvg.setAttribute(\"viewBox\", viewbox);\n\t\tsvg.appendChild(use);\n\t\treturn svg;\n\t}", "function addSVG(svgs) {\n $j.each(svgs, function(svg,opt){\n var svg = svg,\n selector = $j(opt.selector);\n\n if($j('#'+svg).length){\n if(selector.length > 0 && selector.find('.'+svg).length == 0){\n var mode = (typeof opt.mode != 'undefined' ) ? opt.mode : 'append',\n ratio = (typeof opt.ratio != 'undefined' ) ? opt.ratio : true,\n aspect = '';\n\n if(ratio === false){\n aspect = ' preserveAspectRatio=\"none\"';\n }\n\n var ready_svg = '<svg class=\"ico '+svg+'\"'+aspect+'><use xlink:href=\"#'+svg+'\" /></svg>';\n\n selector.each(function(i,el){\n if(mode === 'prepend'){\n $j(el).prepend(ready_svg);\n }else if(mode === 'html'){\n $j(el).html(ready_svg);\n }else{\n $j(el).append(ready_svg);\n }\n });\n }\n }else{\n console.error('Interface - o SVG sprite #'+svg+' não existe.');\n }\n });\n}", "init() {\n var me = this,\n svg = document.createElementNS(this.xmlns, 'svg');\n svg.setAttribute('id', this.id);\n svg.setAttribute('width', this.coorWidth);\n svg.setAttribute('height', this.coorHeight);\n svg.setAttribute('zoomAndPan', this.zoomAndPan);\n if (this.style) {\n svg.setAttribute('style', this.style);\n }\n if (this.onload) {\n svg.setAttribute('onload', this.onLoad);\n }\n me._docElementNS = svg;\n if (this.children.length > 0) {\n for (var i = 0; i < this.children.length; i++) {\n var child = this.children[i];\n child.parent = this;\n if (child.docElementNS) {\n this.docElementNS.appendChild(child.docElementNS);\n }\n }\n }\n if (me.autoBind) {\n me.bind();\n }\n }", "function appendSVG() {\n // append svg element to body\n return d3.select(\".chart\").append(\"svg\")\n .attr(\"id\", \"svg\")\n .attr(\"width\", w + margins.left + margins.right)\n .attr(\"height\", h + margins.top + margins.bottom)\n .append(\"g\")\n .attr(\"id\", \"scatterplot\")\n .attr(\"transform\", \"translate(\" + margins.left + \",\" + margins.top + \")\");\n }", "getSVG () {\n if (this._svg) {\n return this._svg;\n }\n }", "function newSVG(name) {\n\treturn (document.createElementNS(\"http://www.w3.org/2000/svg\", name));\n}", "function initSVG() {\n \t\tsvg = d3.select('body')\n \t\t.append('svg')\n \t\t.attr('viewBox', '0 0 600 600')\n \t\t.attr('style', 'width: 300px; height: 300px;');\n \t}", "function setSVG(nom) {\r\n var elementHtmlARemplir = window.document.getElementById(\"id_image\");\r\n elementHtmlARemplir.innerHTML = nom;\r\n}", "function SVGShape() {}", "drawSVGSpace() {\n const svgGroup = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n const svgSpace = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n\n svgGroup.setAttributeNS(null, \"transform\", `translate(${this.y * 100}, ${this.x * 100})`);\n\n svgSpace.setAttributeNS(null, \"id\", this.id);\n svgSpace.setAttributeNS(null, \"height\", 100);\n svgSpace.setAttributeNS(null, \"width\", 100);\n svgSpace.setAttributeNS(null, \"fill\", \"transparent\");\n\n svgGroup.appendChild(svgSpace);\n document.querySelector('svg > g').appendChild(svgGroup);\n }", "function addEltToSVG(svg, name, attrs)\n{\n var element = document.createElementNS(\"http://www.w3.org/2000/svg\", name);\n if (attrs === undefined) attrs = {};\n for (var key in attrs) {\n element.setAttributeNS(null, key, attrs[key]);\n }\n svg.appendChild(element);\n\n}", "function svg(tag, attr) {\r\n\t\tvar el = document.createElementNS(\"http://www.w3.org/2000/svg\", tag || 'svg');\r\n\t\tif (attr) {\r\n\t\t\t$.each(attr, function(k, v) {\r\n\t\t\t\tel.setAttributeNS(null, k, v);\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn $(el);\r\n\t}", "function svg(tag, attr) {\r\n\t\tvar el = document.createElementNS(\"http://www.w3.org/2000/svg\", tag || 'svg');\r\n\t\tif (attr) {\r\n\t\t\t$.each(attr, function(k, v) {\r\n\t\t\t\tel.setAttributeNS(null, k, v);\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn $(el);\r\n\t}", "function addNewSVG(bounds) {\n d3.select('svg').remove();\n let body = d3.select('body');\n let svg = body.append('svg');\n\n svg\n .attr(\"width\", bounds.width + bounds.margin.left + bounds.margin.right)\n .attr(\"height\", bounds.height + bounds.margin.top + bounds.margin.bottom);\n\n return svg.append('g')\n .attr(\"transform\", \"translate(\" + bounds.margin.left + \",\" + bounds.margin.top + \")\");\n}", "function cloneSVG(){\n return this.element.cloneNode(true);\n }", "function putSvg(next) {\n if (next == VIEWS.DOT.hash) {\n goToDot(next + \"/\" + dot_top);\n return;\n }\n if (!next) next = dot_top;\n var root = d3.select(\"#svg_container\");\n d3.xml(\"lib/dot_svg/\" + next + \".svg\", function(error, documentFragment) {\n if (error) {console.log(error); return;}\n var svgNode = documentFragment.getElementsByTagName(\"svg\")[0];\n\n var w = $(root.node()).width();\n var h = $(root.node()).height();\n\n svgNode.setAttribute(\"viewBox\", \"0 0 \" + w + ' ' + h);\n svgNode.setAttribute(\"style\", \"width: \" + w + 'px;height:' + h + \"px;\");\n\n var d = d3.select(svgNode);\n\n if (root.node().childNodes.length > 0) {\n root.node().replaceChild(svgNode, root.node().childNodes[0]);\n } else {\n root.node().appendChild(svgNode);\n }\n var matrix = d.select(\"g\").node().transform.baseVal.consolidate().matrix;\n var X = matrix.e;\n var Y = matrix.f;\n var width = parseInt(svgNode.getAttribute(\"width\"), 10);\n var height = parseInt(svgNode.getAttribute(\"height\"), 10);\n var x_scale = w / width;\n var y_scale = h / height;\n var initial_scale = Math.min(x_scale, y_scale);\n initial_scale = Math.min(initial_scale, 1);\n\n var translate_x = ((w - width*initial_scale) / 2);\n var translate_y = ((h - height*initial_scale) / 2);\n\n // Setup event listeners for model nodes.\n root.selectAll(\"polygon\").each(function() {\n if (this.hasAttribute(\"fill\")) {\n // All model nodes should show the corresponding HDL, or the\n // corresponding DOT graph when clicked. dsdk::A_MODEL_NODEs\n // are magenta, dsdk::A_SCHEDULED_MODEL_NODEs are white, and\n // are not a direct descendant of the \"graph\" (the background\n // is also white, but is a direct descendant of the \"graph\".\n if (this.getAttribute(\"fill\") == \"magenta\" ||\n (this.getAttribute(\"fill\") == \"white\" && !this.parentNode.classList.contains(\"graph\"))) {\n var g = this.parentNode;\n var title = g.getElementsByTagName(\"title\")[0].innerHTML;\n g.addEventListener(\"click\", function(e){\n // Ctrl+Click opens source, plain click opens graph.\n var evt = window.event || e;\n if (evt.ctrlKey) {\n // TODO Eventually the filename will probably need\n // to include a kernel/component subdirectory.\n var filename = title.replace(/^\\d+_/, \"\")+\".vhd\";\n addHdlFileToEditor(\"lib/hdl/\" + filename);\n if (sideCollapsed) {\n collapseAceEditor();\n refreshAreaVisibility();\n adjustToWindowEvent();\n }\n } else {\n var new_hash = window.location.hash + \"/\" + title;\n VIEWS.DOT.hash = new_hash;\n goToDot(new_hash);\n }\n });\n }\n }\n });\n\n // Clickdown for edge highlighting.\n root.selectAll(\"g.edge path\")\n .on('click', function () {\n // TODO use parent\n if (dot_clickdown == this) {\n dot_clickdown = null;\n } else {\n dot_clickdown = this;\n }\n });\n\n // Edge/arrowhead highlighting.\n var highlightColor = \"#1d99c1\";\n root.selectAll(\"g.edge path\")\n .on('mouseover', function () {\n $(this).attr({\"stroke-width\":5, \"stroke\":highlightColor});\n $(this).siblings(\"polygon\").attr({\"fill\":highlightColor, \"stroke\":highlightColor, \"stroke-width\":3});\n })\n .on('mouseout', function () {\n if (dot_clickdown == this) return;\n $(this).attr({\"stroke-width\":1, \"stroke\":\"black\"});\n $(this).siblings(\"polygon\").attr({\"fill\":\"black\", \"stroke\":\"black\", \"stroke-width\":1});\n });\n root.selectAll(\"g.edge polygon\")\n .on('mouseover', function () {\n $(this).siblings(\"path\").attr({\"stroke-width\":5, \"stroke\":highlightColor});\n $(this).attr({\"fill\":highlightColor, \"stroke\":highlightColor, \"stroke-width\":3});\n })\n .on('mouseout', function () {\n if (dot_clickdown == this) return;\n $(this).siblings(\"path\").attr({\"stroke-width\":1, \"stroke\":\"black\"});\n $(this).attr({\"fill\":\"black\", \"stroke\":\"black\", \"stroke-width\":1});\n });\n\n\n // TODO use translateExtent() to prevent translating out of frame?\n //.translateExtent([10 - X, 10 - Y, 2 * X - 10, 2 * Y - 10])\n //.translateExtent([[0, 0], [2 * Y - 10]])\n\n var scaled_x = initial_scale * X;\n var scaled_y = initial_scale * Y;\n scaled_x += translate_x;\n scaled_y += translate_y;\n var zoom = d3.behavior.zoom()\n .scaleExtent([0, 1.5])\n .scale(initial_scale)\n .translate([scaled_x, scaled_y])\n .on(\"zoom\", zoomed);\n d.select(\"g\").attr(\"transform\",\"translate(\" + scaled_x + \",\" + scaled_y +\")scale(\" + initial_scale + \",\" + initial_scale + \")\");\n d.call(zoom);\n if (!$('#dot_edges_toggle').is(':checked')) {\n $(\"#svg_container\").find(\"g.edge\").toggle();\n }\n });\n updateDotHierarchy();\n}", "render() {\n return (\n <svg id=\"mini-map\" ref=\"svg\">\n </svg>\n );\n }", "function injectSVG() {\n\n\t\tvar ajax = new XMLHttpRequest();\n\n\t\tajax.open('GET', 'assets/img/svg.svg?v=4', true);\n\t\tajax.send();\n\t\tajax.onload = function(e) {\n\n\t\t\tvar div = document.createElement('div');\n\t\t\tdiv.id = 'svgInject';\n\t\t\tdiv.innerHTML = ajax.responseText;\n\t\t\tdocument.body.insertBefore(div, document.body.childNodes[0]);\n\n\t\t}\n\n\t}", "function drawSvg() {\n\t\t// selector can be #residential, or #commercial which should be in graph.html\n\t\tvar dataSources = [{selector: '#commercial', data: data.commGraphData}, \n\t\t\t{selector: '#residential', data: data.residGraphData}];\n\n\t\tdataSources.forEach(function(item) {\n\t\t\tvar canvas = createCanvas(item.selector, item.data);\n\t\t\tdrawHorizontalLabel(canvas);\n\t\t\tdrawVerticalLable(canvas, item.data);\n\t\t\tdrawHeatMap(canvas, item.data);\n\t\t});\n\t}", "function drawSVG(svg){\n \"use strict\";\n var svgs = Array.prototype.slice.call( svg.find('svg') ),\n svgArr = [],\n resizeTimeout;\n // the svgs already shown...\n svgs.forEach( function( el, i ) {\n var svg = new SVGEl( el );\n svgArr[i] = svg;\n setTimeout(function( el ) {\n return function() {\n svg.render();\n };\n }( el ), 0 );//0ms pause before drawing\n } );\n}", "function insertSVGWeb() {\n document.write('<script type=\"text/javascript\" '\n + 'src=\"' + svgSrcURL + '\" '\n + 'data-path=\"' + svgDataPath + '\" '\n + 'data-debug=\"' + svgDebug + '\"></script>');\n}", "createSmallSVG(initDiv) {\n return initDiv.append('svg')\n .attr('width', 20)\n .attr('height', 40)\n .style(\"margin\", \"5px\")\n .style(\"display\",\"table-row\")\n .style(\"background-color\", \"Blue\");\n }", "function createSVG() {\n svg = d3.select(\"#bubble-chart\")\n .append(\"svg\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n }", "function insertSVG() {\t\r\n\tjQuery(document).ready(function() {\r\n\t\tjQuery('img.svg').each(function(){\r\n\t\t\tvar $img = jQuery(this);\r\n\t\t\tvar imgID = $img.attr('id');\r\n\t\t\tvar imgClass = $img.attr('class');\r\n\t\t\tvar imgURL = $img.attr('src');\r\n\t\t\t\r\n\t\t\tjQuery.get(imgURL, function(data) {\r\n\t\t\t\t// Get the SVG tag, ignore the rest\r\n\t\t\t\tvar $svg = jQuery(data).find('svg');\r\n\t\t\t\t\r\n\t\t\t\t// Add replaced image's ID to the new SVG\r\n\t\t\t\tif(typeof imgID !== 'undefined') {\r\n\t\t\t\t\t$svg = $svg.attr('id', imgID);\r\n\t\t\t\t}\r\n\t\t\t\t// Add replaced image's classes to the new SVG\r\n\t\t\t\tif(typeof imgClass !== 'undefined') {\r\n\t\t\t\t\t$svg = $svg.attr('class', imgClass + ' replaced-svg');\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// Remove any invalid XML tags as per http://validator.w3.org\r\n\t\t\t\t$svg = $svg.removeAttr('xmlns:a');\r\n\t\t\t\t\r\n\t\t\t\t// Replace image with new SVG\r\n\t\t\t\t$img.replaceWith($svg);\r\n\t\t\t}, 'xml');\r\n\t\t});\t\t\r\n\t});\t\r\n\t\r\n\t$(window).load(function() {\r\n\t\t// Update the css for the github_logo class (path)\r\n\t\tjQuery('.github_logo path').css('fill', colorSentenceBorder);\r\n\t});\r\n}", "function onSVGLoaded( data ){\n var rectID= \"#\"+(ctrl.room.number).toLowerCase();\n var rect = data.select(rectID);\n rect.attr(\"fill\", \"#42A5F5\");\n s.append( data );\n }", "function createSvg(text, kind){\n return d3.select(text)\n .attr(\"width\", viewWidth + margin.left + margin.right)\n .attr(\"height\", viewHeight + margin.top + margin.bottom)\n .append(\"g\")\n .attr(\"id\", kind)\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n}", "function SVGElement(type, options) {\n this.create = function(type) {\n this.elem = document.createElementNS('http://www.w3.org/2000/svg', type);\n };\n this.get = function(key) {\n return this.elem.getAttributeNS(null, key);\n };\n this.set = function(key, val) {\n this.elem.setAttributeNS(null, key, val);\n };\n this.setBulk = function(options) {\n for (let key in options) {\n if (options.hasOwnProperty(key)) {\n this.set(key, options[key]);\n }\n }\n };\n this.addClass = function(cls) {\n this.elem.classList.add(cls);\n };\n this.removeClass = function(cls) {\n this.elem.classList.remove(cls);\n };\n this.addEventListener = function(type, func) {\n this.elem.addEventListener(type, func);\n };\n this.removeEventListener = function(type, func) {\n this.elem.removeEventListener(type, func);\n };\n this.appendChild = function(child) {\n this.elem.appendChild(child);\n };\n this.removeChild = function(child) {\n this.elem.removeChild(child);\n };\n this.element = function() {\n return this.elem;\n };\n\n this.create(type);\n if (options !== null) {\n this.setBulk(options);\n }\n}", "render () {\n return (\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col-8 offset-2\">\n <svg id=\"treestruct\" ref={node => this.node = node}\n width={500} height={500}>\n </svg>\n </div>\n </div>\n </div>\n )\n }", "function getSvg() {\n return d3.select(this.selector).node();\n}", "init() {\n let svg = '<path' +\n ' id=\"' + this.id +'\"';\n\n if (this.stroke) {\n svg += ' stroke=\"' + this.stroke + '\"';\n }\n if (this.strokeWidth) {\n svg += ' stroke-width=\"' + this.strokeWidth + '\"';\n }\n if (this.opacity) {\n svg += ' opacity=\"' + this.opacity + '\"';\n }\n if (this.data) {\n svg += ' d=\"' + this.data + '\"';\n }\n svg+= '></path>'\n this.innerHTML = svg;\n }", "function createSVGElement(tag,attributes,appendTo) {\n\t\tvar element = document.createElementNS('http://www.w3.org/2000/svg',tag);\n\t\tattr(element,attributes);\n\t\tif (appendTo) {\n\t\t\tappendTo.appendChild(element);\n\t\t}\n\t\treturn element;\n\t}", "_saveContextSVG(){\n this.getGraphicsContext().saveSVG();\n }", "function applyStyleToSVG() {\n page.evaluate(function (css) {\n //We need to apply the style to the SVG\n var defs = document.createElement(\"defs\"),\n style = document.createElement(\"style\");\n style.innerHTML = css;\n\n defs.appendChild(style);\n document.querySelector(\"svg\").appendChild(defs);\n }, css);\n }", "function handleSVGClick(event) {\n // Figure out what was clicked\n var clickedNode = event.target;\n if (clickedNode.correspondingUseElement) {\n // If it's an instantiation of a <defs> item, let's target the <use> (aka the instance)\n // (TODO: option to target the node inside <defs> instead, via correspondingElement)\n clickedNode = clickedNode.correspondingUseElement;\n }\n \n // Generate ancestor chain of the clicked node\n var nodeChain = [];\n var svgRoot = event.currentTarget;\n var node = clickedNode;\n while (node && node !== svgRoot) {\n nodeChain.unshift(node);\n node = node.parentElement;\n }\n// console.log(\"CLICK on\", event.target);\n// console.log(\"nodeChain =\", nodeChain);\n \n // Generate nth-child lookup info\n var chain = [];\n nodeChain.forEach(function (node) {\n var childIndex = $(node).index();\n chain.push({ childIndex: childIndex, tagName: node.tagName });\n \n// console.log(node.tagName + \", child #\" + childIndex);\n });\n \n // Find that same tag in the code\n var startOfOpenTag = XMLPathFinder.findTag(currentEditor, chain);\n if (startOfOpenTag) {\n // Select it\n var lineNum = startOfOpenTag.pos.line;\n var token = startOfOpenTag.token;\n currentEditor.setSelection({line: lineNum, ch: token.start}, {line: lineNum, ch: token.end}, true);\n }\n }", "function makeSVG(tag, attrs) {\n\t\tvar el = document.createElementNS('http://www.w3.org/2000/svg', tag);\n\t\tfor (var k in attrs)\n\t\t\tel.setAttribute(k, attrs[k]);\n\t\treturn el;\n\t}", "set G(value) {\n this._g = value;\n }", "function SVGBaseElement() {\n }", "function makeSVG () {\n \n //Create SVG element\n NS.svg = d3.select(\".donut\")\n .append(\"svg\")\n .attr(\"width\", NS.width)\n .attr(\"height\", NS.height);\n}", "function createSvg () {\r\n // Remove the existing one\r\n d3\r\n .select(canvasId)\r\n .selectAll('svg')\r\n .remove();\r\n // Create a new svg node\r\n svg = d3\r\n .select(canvasId)\r\n .append('svg:svg')\r\n .attr('width', 500)\r\n .attr('height', 500)\r\n .append('g') // Group all element to make alignment easier\r\n .attr('transform', function () { // Place in center of the page\r\n return 'translate(' + (500 / 2) + ', ' + (500 / 2) + ')';\r\n });\r\n }", "function N(t){return t.ownerSVGElement||(\"svg\"===(t.tagName+\"\").toLowerCase()?t:null)}", "render() {\n return (\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n <svg xmlns='http://www.w3.org/2000/svg' width={100} height={100}>\n <rect width={100} height={100} fill='#269' />\n <g fill='#6494b7'>\n <rect width={100} height={1} y={20} />\n <rect width={100} height={1} y={40} />\n <rect width={100} height={1} y={60} />\n <rect width={100} height={1} y={80} />\n <rect width={1} height={100} x={20} />\n <rect width={1} height={100} x={40} />\n <rect width={1} height={100} x={60} />\n <rect width={1} height={100} x={80} />\n </g>\n <rect\n width={100}\n height={100}\n fill='none'\n strokeWidth={2}\n stroke='#fff'\n />\n </svg>\n );\n }", "function set$1(element, svg) {\n\n var parsed = parse$2(svg);\n\n // clear element contents\n clear$1(element);\n\n if (!svg) {\n return;\n }\n\n if (!isFragment(parsed)) {\n // extract <svg> from parsed document\n parsed = parsed.documentElement;\n }\n\n var nodes = slice$1(parsed.childNodes);\n\n // import + append each node\n for (var i = 0; i < nodes.length; i++) {\n appendTo(nodes[i], element);\n }\n\n}", "function bind(item, el, sibling, tag, svg) {\n var node = item._svg, doc;\n\n // create a new dom node if needed\n if (!node) {\n doc = el.ownerDocument;\n node = (0,_util_dom__WEBPACK_IMPORTED_MODULE_2__.domCreate)(doc, tag, ns);\n item._svg = node;\n\n if (item.mark) {\n node.__data__ = item;\n node.__values__ = {fill: 'default'};\n\n // if group, create background and foreground elements\n if (tag === 'g') {\n var bg = (0,_util_dom__WEBPACK_IMPORTED_MODULE_2__.domCreate)(doc, 'path', ns);\n bg.setAttribute('class', 'background');\n node.appendChild(bg);\n bg.__data__ = item;\n\n var fg = (0,_util_dom__WEBPACK_IMPORTED_MODULE_2__.domCreate)(doc, 'g', ns);\n node.appendChild(fg);\n fg.__data__ = item;\n }\n }\n }\n\n // (re-)insert if (a) not contained in SVG or (b) sibling order has changed\n if (node.ownerSVGElement !== svg || hasSiblings(item) && node.previousSibling !== sibling) {\n el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);\n }\n\n return node;\n}", "render(svg, events) {\n let prevSvg = document.querySelector(`${this.eCfg.selector} svg`);\n if (prevSvg) prevSvg.remove();\n\n svg._visualization = this.drawableElement._visualization;\n this.drawableElement = svg;\n d3.select(svg).selectAll('path').attr('vector-effect', 'non-scaling-stroke'); // for zoom\n\n svg.style.top = '0px';\n svg.style.left = '0px';\n svg.style.position = 'absolute';\n this.element.append(svg) // this.v.element.selector\n\n return this.attachEvents(svg, events);;\n }", "initializeVizSpace() {\n this.svg = d3.select(this.node)\n .attrs({\n viewBox: `0 0 ${this.getSvgOuterWidth()} ${this.getSvgOuterHeight()}`,\n preserveAspectRatio: `xMidYMid meet`\n })\n ;\n\n this.svg = this.svg.append(\"g\")\n .attrs({\n \"transform\": `translate(${this.props.svgSize.margin.left}, ${this.props.svgSize.margin.top})`,\n })\n ;\n }", "function bind(item, el, sibling, tag, svg) {\n var node = item._svg, doc;\n\n // create a new dom node if needed\n if (!node) {\n doc = el.ownerDocument;\n node = domCreate(doc, tag, ns);\n item._svg = node;\n\n if (item.mark) {\n node.__data__ = item;\n node.__values__ = {fill: 'default'};\n\n // if group, create background and foreground elements\n if (tag === 'g') {\n var bg = domCreate(doc, 'path', ns);\n bg.setAttribute('class', 'background');\n node.appendChild(bg);\n bg.__data__ = item;\n\n var fg = domCreate(doc, 'g', ns);\n node.appendChild(fg);\n fg.__data__ = item;\n }\n }\n }\n\n // (re-)insert if (a) not contained in SVG or (b) sibling order has changed\n if (node.ownerSVGElement !== svg || hasSiblings(item) && node.previousSibling !== sibling) {\n el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);\n }\n\n return node;\n }", "serialize() {\n var svg = document.getElementsByTagName(\"svg\")\n var editor = atom.workspace.getActiveTextEditor()\n if(editor && (svg.length == 0)){\n this.createGraph(editor);\n }\n }", "function bind(item, el, sibling, tag) {\n var node = item._svg, doc;\n\n // create a new dom node if needed\n if (!node) {\n doc = el.ownerDocument;\n node = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__[\"d\" /* domCreate */])(doc, tag, ns);\n item._svg = node;\n\n if (item.mark) {\n node.__data__ = item;\n node.__values__ = {fill: 'default'};\n\n // if group, create background and foreground elements\n if (tag === 'g') {\n var bg = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__[\"d\" /* domCreate */])(doc, 'path', ns);\n bg.setAttribute('class', 'background');\n node.appendChild(bg);\n bg.__data__ = item;\n\n var fg = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__[\"d\" /* domCreate */])(doc, 'g', ns);\n node.appendChild(fg);\n fg.__data__ = item;\n }\n }\n }\n\n if (doc || node.previousSibling !== sibling || !sibling) {\n el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild);\n }\n\n return node;\n}", "render() {\n return (\n <g ref={(gNode) => this.gNode = gNode} transform={this.transform}>\n {this.paths}\n {this.props.labels && this.createLabels()}\n </g>\n );\n }", "function SvgComponent(props) {\n return (\n <Svg width={84} height={84} viewBox=\"0 0 84 84\" {...props}>\n <Defs></Defs>\n <G data-name=\"Group 10\">\n <G filter=\"url(#prefix__a)\">\n <Circle\n data-name=\"Ellipse 4\"\n cx={33}\n cy={33}\n r={33}\n transform=\"translate(9 9)\"\n fill=\"#9b9b7a\"\n />\n </G>\n <G\n data-name=\"Icon feather-plus\"\n fill=\"none\"\n stroke=\"#fff\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={3}\n >\n <Path data-name=\"Path 20\" d=\"M42.217 27.823v30.434\" />\n <Path data-name=\"Path 21\" d=\"M27 43.04h30.434\" />\n </G>\n </G>\n </Svg>\n )\n}", "function makeSvg(tag, attrs) {\n\tvar el= document.createElementNS('http://www.w3.org/2000/svg', tag);\n\tfor (var k in attrs) {\n\t\tel.setAttribute(k, attrs[k]);\n\t}\n\treturn el;\n}", "function embed(parent, svg, target) {\r\n // if the target exists\r\n if (target) {\r\n // create a document fragment to hold the contents of the target\r\n var fragment = document.createDocumentFragment(),\r\n viewBox = !svg.hasAttribute(\"viewBox\") && target.getAttribute(\"viewBox\"); // conditionally set the viewBox on the svg\r\n\r\n viewBox && svg.setAttribute(\"viewBox\", viewBox); // copy the contents of the clone into the fragment\r\n\r\n for ( // clone the target\r\n var clone = target.cloneNode(!0); clone.childNodes.length;) {\r\n fragment.appendChild(clone.firstChild);\r\n } // append the fragment into the svg\r\n\r\n\r\n parent.appendChild(fragment);\r\n }\r\n }", "function post_graph(target, g, options) {\n var elem = document.getElementById(target)\n var no_dims = options && options.no_dims;\n // elem.innerHTML += \"<code>\" + g + \"</code>\"\n var rendered = Viz(g, \"svg\");\n if (no_dims) {\n // ugh what a hack\n // console.log(\"pre-replace \" + rendered);\n rendered = rendered.replace(/width=\"[^\"]*\"/, '');\n // console.log(\"mid-replace \" + rendered);\n rendered = rendered.replace(/height=\"[^\"]*\"/, '');\n // console.log(\"postreplace \" + rendered);\n }\n elem.innerHTML += rendered;\n}", "function isRegSVG ( el ) {\n const inner = el.innerHTML\n if ( inner.includes( '<use' ) ) {\n addSrcType( el, 'useTag' )\n return el\n } else {\n addSrcType( el, 'svgTag' )\n return el\n }\n}", "function loadSVG() {\n\tvar xmlhttp = new XMLHttpRequest();\n\txmlhttp.onreadystatechange = function() {\n\t if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n\t\t// loading the document with drawsvg\n\t\tchan.call({\n\t\t\tmethod: \"loadStringSVG\",\n\t\t\tparams: {\n\t\t\t\t// string svg contents\n\t\t\t\t'stringSVG' : xmlhttp.responseText,\n\t\t\t\t// svg name\n\t\t\t\t'nameSVG' : 'your svg name',\n\t\t\t\t// The name of the service which to be called \n\t\t\t\t// when user clicks on the save button of drawsvg\n\t\t\t\t'saveService' : 'onSaveSVG',\n\t\t\t\t// don't show save dialog\n\t\t\t\t'showSaveDialog' : false,\n\t\t\t\t// Change the dimensions of the document to the full window (100%)\n\t\t\t\t'fullWindow' : true,\n\t\t\t\t// svg loading callbacks\n\t\t\t\t'onLoad' : function() {log(\"got svg1 onLoad notification\");},\n\t\t\t\t'onError': function(err) {log(\"ERROR while loading svg1: \"+err);}\n\t\t\t},\n\t\t\t// jsChannel callbacks\n\t\t\terror: function(error, message) { log( \"ERROR: \" + error + \" (\" + message + \")\"); },\n\t\t\tsuccess: function(v) {}\n\t\t});\n\t }\n\t};\n\txmlhttp.open(\"GET\", svgURL, true);\n\txmlhttp.send();\n}", "function ɵɵnamespaceSVG() {\n instructionState.lFrame.currentNamespace = SVG_NAMESPACE;\n }", "appendToSVG(val) {\n //Parabola.svg_context = val;\n this.svg_element = this.toSVG(this.fx, this.fy).appendTo(Parabola.svg_context);\n\n $(\"#parab-list\").append($(document.createElement(\"p\")).attr(\"id\", \"par\" + this._ID));\n this.updateSVG();\n }", "function bind(el, mdef, item, index, insert) {\n\t // create svg element, bind item data for D3 compatibility\n\t var node = DOM.child(el, index, mdef.tag, ns, null, insert);\n\t node.__data__ = item;\n\t node.__values__ = {fill: 'default'};\n\n\t // create background rect\n\t if (mdef.tag === 'g') {\n\t var bg = DOM.child(node, 0, 'rect', ns, 'background');\n\t bg.__data__ = item;\n\t }\n\n\t // add pointer from scenegraph item to svg element\n\t return (item._svg = node);\n\t}", "function svg(id = null, classList) {\n let svg = document.createElementNS(Svg.svgNS, \"svg\");\n if (id != null)\n svg.id = id;\n if (classList != undefined) {\n svg.classList.add(...classList);\n }\n return svg;\n }", "function createMonster(x, y) {\n var monster = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n monster.setAttribute(\"x\", x);\n monster.setAttribute(\"y\", y);\n monster.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#monster\");\n document.getElementById(\"monsters\").appendChild(monster);\n}", "function SVGComic(evt, opts) {\n /// <summary>The main SVGComic object</summary>\n /// <param name=\"evt\">The calling event</param>\n /// <param name=\"opts\">The desired options</param>\n /// <option name=\"author\">The author's name (defaults to A. N. Onymous)</option>\n /// <option name=\"copyright\">The preferred copyright statement (defaults to \"&copy YEAR AUTHOR. All rights \n /// reserved\")</option>\n /// <option name=\"fill\">Preferred gutter color (defaults to black)</option>\n /// <option name=\"fontSize\">Preferred font size for title/author/subtitle/copyright (defaults to 12)</option>\n /// <option name=\"height\">Preferred comic height (defaults to 300)</option>\n /// <option name=\"subtitle\">Preferred secondary/episode title (defaults to blank)</option>\n /// <option name=\"textColor\">Preferred color for title/etc. text (defaults to white)</option>\n /// <option name=\"title\">Preferred title (defaults to \"untitled\")</option>\n /// <option name=\"width\">Preferred comic width (defaults to 800)</option>\n /// <option name=\"xGutter\">Preferred horizontal gutter (defaults to 10)</option>\n \n if (window.svgDocument == null) {\n svgDocument = evt.target.ownerDocument;\n }\n\n this.document = svgDocument;\n this.svg = this.document.rootElement;\n this.ns = 'http://www.w3.org/2000/svg';\n\n if (opts == null) {\n opts = new Array();\n }\n\n var date = new Date();\n\n this.author = opts['author'] || 'A. N. Onymous';\n\n this.copyright = opts['copyright'] || \"© \" + date.getFullYear() + \" \" + this.author + \". All rights reserved.\";\n this.fill = opts['fill'] || 'black';\n this.fontSize = opts['fontSize'] || 12;\n this.height = opts['height'] || 300;\n this.subtitle = opts['subtitle'] || '';\n this.textColor = opts['textColor'] || 'white';\n this.title = opts['title'] || 'Untitled';\n this.width = opts['width'] || 800;\n this.xGutter = opts['xGutter'] || 10;\n\n// this.x = opts['x'] || window.innerWidth / 2 - this.width / 2;\n// this.y = opts['y'] || window.innerHeight / 2 - this.height / 2;\n\n this.panels = new Array();\n\n this.initialize();\n}", "function makeSvg(tag, attrs) {\n var el = document.createElementNS('http://www.w3.org/2000/svg', tag);\n for(var k in attrs) {\n el.setAttribute(k, attrs[k]);\n }\n return el;\n}", "function createGComponent(letter) {\n\n var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n if (/^\\s+$/.test(letter)) {\n g.setAttribute('class', 'space');\n } else {\n g.setAttribute('class', letter);\n }\n //Returns an array of rects\n var pixels = findLetter(letter);\n\n //Append the rects to the group element to form a letter\n for (var i = 0; i < pixels.length; i++) {\n g.appendChild(pixels[i]);\n }\n return g;\n}", "function RenderedSVG(options) {\n var _this = _super.call(this) || this;\n _this._urlResolved = null;\n var source = Private.getSource(options);\n _this.node.innerHTML = source;\n var svgElement = _this.node.getElementsByTagName('svg')[0];\n if (!svgElement) {\n throw new Error('SVGRender: Error: Failed to create <svg> element');\n }\n if (options.resolver) {\n _this._urlResolved = Private.handleUrls(_this.node, options.resolver, options.linkHandler);\n }\n _this.addClass(SVG_CLASS);\n return _this;\n }", "function svg_elem(name, attrs) {\n var attr,\n elem = document.createElementNS(\"http://www.w3.org/2000/svg\", name);\n if (typeof attrs === \"object\") {\n for (attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n elem.setAttribute(attr, attrs[attr]);\n }\n }\n }\n return elem;\n }", "function SvgComponent(props) {\n return (\n <Svg\n width={42}\n height={42}\n viewBox=\"0 0 42 42\"\n {...props}\n >\n <Defs>\n <LinearGradient\n id=\"prefix__b\"\n x1={0.067}\n y1={0.1}\n x2={0.748}\n y2={0.918}\n gradientUnits=\"objectBoundingBox\"\n >\n <Stop offset={0} stopColor={Colors.primaryColor} />\n <Stop offset={1} stopColor=\"#f10\" stopOpacity={0.929} />\n </LinearGradient>\n </Defs>\n <G data-name=\"Componente 18 \\u2013 1\">\n <G>\n <Circle\n data-name=\"Elipse 13\"\n cx={12}\n cy={12}\n r={12}\n transform=\"translate(9 6)\"\n fill=\"url(#prefix__b)\"\n />\n </G>\n <Path\n data-name=\"Caminho 5\"\n d=\"M15.791 16.991l10.647.07c.552 0 .808.572.808 1.124s-.256 1.107-.808 1.107H15.721c-.552 0-.949-.387-.966-1.107a1.089 1.089 0 011.036-1.194z\"\n fill=\"#fff\"\n />\n </G>\n </Svg>\n )\n}", "get ownerSVGElement() {\n return null;\n }", "function createSvg(tagName) {\n return document.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n}", "function bind(el, mdef, item, index, insert) {\n // create svg element, bind item data for D3 compatibility\n var node = DOM.child(el, index, mdef.tag, ns, null, insert);\n node.__data__ = item;\n node.__values__ = {fill: 'default'};\n\n // create background rect\n if (mdef.tag === 'g') {\n var bg = DOM.child(node, 0, 'rect', ns, 'background');\n bg.__data__ = item;\n }\n\n // add pointer from scenegraph item to svg element\n return (item._svg = node);\n}", "function bind(el, mdef, item, index, insert) {\n // create svg element, bind item data for D3 compatibility\n var node = DOM.child(el, index, mdef.tag, ns, null, insert);\n node.__data__ = item;\n node.__values__ = {fill: 'default'};\n\n // create background rect\n if (mdef.tag === 'g') {\n var bg = DOM.child(node, 0, 'rect', ns, 'background');\n bg.__data__ = item;\n }\n\n // add pointer from scenegraph item to svg element\n return (item._svg = node);\n}", "function carregar_svg(){\r\n $('img.svg').each(function(){\r\n var $img = $(this);\r\n var imgID = $img.attr('id');\r\n var imgClass = $img.attr('class');\r\n var imgURL = $img.attr('src');\r\n\r\n $.get(imgURL, function(data) {\r\n var $svg = $(data).find('svg');\r\n if (typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); }\r\n if (typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass+' replaced-svg'); }\r\n $svg = $svg.removeAttr('xmlns:a');\r\n $img.replaceWith($svg);\r\n });\r\n });\r\n}", "function ɵɵnamespaceSVG() {\n _currentNamespace = 'http://www.w3.org/2000/svg';\n}", "function set(element, svg) {\n\n var parsed = parse(svg);\n\n // clear element contents\n clear(element);\n\n if (!svg) {\n return;\n }\n\n if (!isFragment(parsed)) {\n // extract <svg> from parsed document\n parsed = parsed.documentElement;\n }\n\n var nodes = slice(parsed.childNodes);\n\n // import + append each node\n for (var i = 0; i < nodes.length; i++) {\n appendTo(nodes[i], element);\n }\n\n}", "function getNode(n, v) {\n n = document.createElementNS(\"http://www.w3.org/2000/svg\", n);\n for (var p in v)\n n.setAttributeNS(null, p, v[p]);\n return n\n}", "function embed(svg, target) {\n // if the target exists\n if (target) {\n // create a document fragment to hold the contents of the target\n var fragment = document.createDocumentFragment(), viewBox = !svg.getAttribute(\"viewBox\") && target.getAttribute(\"viewBox\");\n // conditionally set the viewBox on the svg\n viewBox && svg.setAttribute(\"viewBox\", viewBox);\n // copy the contents of the clone into the fragment\n for (// clone the target\n var clone = target.cloneNode(!0); clone.childNodes.length; ) {\n fragment.appendChild(clone.firstChild);\n }\n // append the fragment into the svg\n svg.appendChild(fragment);\n }\n }", "get svgIcon() { return this._svgIcon; }", "get svgIcon() { return this._svgIcon; }" ]
[ "0.70142496", "0.67238516", "0.6707693", "0.66033876", "0.6601479", "0.6581008", "0.65510505", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.64681643", "0.64557517", "0.64357746", "0.64344984", "0.64332086", "0.64280814", "0.6377617", "0.6371969", "0.63560927", "0.63560927", "0.63541406", "0.63528425", "0.6317219", "0.62364906", "0.62314224", "0.6216915", "0.6214785", "0.6154291", "0.61459523", "0.6113069", "0.61095405", "0.610397", "0.60858905", "0.60858905", "0.6061337", "0.60466677", "0.60218173", "0.60167325", "0.6007296", "0.59884316", "0.59867585", "0.59856135", "0.59685606", "0.59666085", "0.59644437", "0.5963138", "0.5958706", "0.5948959", "0.5943616", "0.59263015", "0.59179246", "0.5913754", "0.59076685", "0.5903849", "0.58979565", "0.5897729", "0.58824116", "0.5881163", "0.5871063", "0.586293", "0.585821", "0.5847519", "0.58431405", "0.58400166", "0.58347344", "0.5829771", "0.58280635", "0.58127", "0.5801983", "0.57995504", "0.5797485", "0.57930773", "0.5789729", "0.5787606", "0.5787358", "0.57789296", "0.5772567", "0.5768803", "0.57598835", "0.5759327", "0.5754925", "0.5753567", "0.57532233", "0.5738536", "0.5736555", "0.5719552", "0.5719144", "0.5718513", "0.5713848", "0.57125556", "0.57125556", "0.5709659", "0.57089335", "0.5705505", "0.57040197", "0.5698888", "0.56969756", "0.56969756" ]
0.0
-1
counts adjacent cells of type
function countAdjacent(val, row, column) { var ret = 0; //Iterate over adjacent for(var i = row-1; i <=row+1; ++i){ for(var j = column-1; j <=column+1; ++j){ if(i < 0 || i >=rows) continue if(j < 0 || j >= columns) continue if(i == row && j == column) continue //Increment in dictionary var index = (i*rows) + j; if(curGeneration[index] == val) { ++ret; } } } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_countNeighbours (cellX, cellY) {\n let neighbours = 0\n for (let x = -1; x < 2; x++) {\n for (let y = -1; y < 2; y++) {\n if (this.matrix[(cellX + x + this.sizeX) % this.sizeX][(cellY + y + this.sizeY) % this.sizeY] === 1) {\n neighbours++\n }\n }\n }\n neighbours -= (this.matrix[cellX][cellY] === 1 ? 1 : 0)\n return neighbours\n }", "function countNeighbors( cells, i, j )\n{\n var n = 0;\n\n n += countCell( cells, i - 1, j - 1 );\n n += countCell( cells, i - 1, j );\n n += countCell( cells, i - 1, j + 1 );\n\n n += countCell( cells, i, j - 1 );\n n += countCell( cells, i, j + 1 );\n\n n += countCell( cells, i + 1, j - 1 );\n n += countCell( cells, i + 1, j );\n n += countCell( cells, i + 1, j + 1 );\n\n return n;\n}", "countLiveNeighbors(x, y, grid) {\n const height = grid.length;\n const width = grid[0].length;\n const size = { width, height };\n let count = 0;\n let row;\n \n let prevY = y - 1;\n let nextY = y + 1;\n let prevX = x - 1;\n let nextX = x + 1;\n \n if (prevY < 0) {\n prevY = size.height -1;\n }\n if (nextY >= size.height) {\n nextY = 0; \n } \n if (prevX < 0) {\n prevX = size.width - 1;\n }\n if (nextX >= size.width) {\n nextX = 0;\n }\n\n // count cells in previous row\n row = grid[prevY];\n if (row) {\n if (row[prevX] && row[prevX] === \"live\") {\n count++;\n }\n if (row[x] && row[x] === \"live\") {\n count++;\n }\n if (row[nextX] && row[nextX] === \"live\") {\n count++;\n }\n }\n // count cells in current row\n row = grid[y];\n if (row[prevX] && row[prevX] === \"live\") {\n count++;\n }\n if (row[nextX] && row[nextX] === \"live\") {\n count++;\n }\n // count cells in next row\n row = grid[nextY];\n if (row) {\n if (row[prevX] && row[prevX] === \"live\") {\n count++;\n }\n if (row[x] && row[x] === \"live\") {\n count++;\n }\n if (row[nextX] && row[nextX] === \"live\") {\n count++;\n }\n }\n return count;\n }", "function countNeighbors(i) {\n\tvar neighbors = 0;\n\tvar cell = Cells[i];\n\tif(!isNaN(cell.top) && Cells[cell.top].state == true)\n\t\tneighbors++;\n\t\n\tif(!isNaN(cell.bottom) && Cells[cell.bottom].state == true)\n\t\tneighbors++;\t\n\t\n\tif(!isNaN(cell.left) && Cells[cell.left].state == true)\n\t\tneighbors++;\n\t\n\tif(!isNaN(cell.right) && Cells[cell.right].state == true)\n\t\tneighbors++;\n\treturn neighbors;\n}", "function countNeighbours(data, row, col) {\n var r = 0;\n\n for (var i = row - 1; i <= row + 1; ++i) {\n for (var j = col - 1; j <= col + 1; ++j) {\n r += (data[i] && data[i][j] ? data[i][j] : 0);\n }\n }\n \n return r - data[row][col];\n}", "function neighborCount(row, col) {\n var count = 0, smallRow = row - 1, bigRow = row + 1, smallCol = col - 1, bigCol = col + 1;\n\n if (smallRow >= 0 && boardTable[smallRow][col] == 1) {\n count++;\n }\n if (smallRow >= 0 && smallCol >= 0 && boardTable[smallRow][smallCol] == 1) {\n count++;\n }\n if (smallRow >= 0 && bigCol < columns && boardTable[smallRow][bigCol] == 1) {\n count++;\n }\n if (smallCol >= 0 && boardTable[row][smallCol] == 1) {\n count++;\n }\n if (bigCol < columns && boardTable[row][bigCol] == 1) {\n count++;\n }\n if (bigRow < rows && boardTable[bigRow][col] == 1) {\n count++;\n }\n if (bigRow < rows && smallCol >= 0 && boardTable[bigRow][smallCol] == 1) {\n count++;\n }\n if (bigRow < rows && bigCol < columns && boardTable[bigRow][bigCol] == 1) {\n count++;\n }\n return count;\n}", "function getSurroundingXCount(x, y, type){\n\t\tvar count =0;\n\t\t\tfor(var i =x-1; i <= x+1 ; i++){\n\t\t\t\tfor(var j = y-1; j<= y+1; j++){\n\t\t\t\t\tif( i >= 0 && i < tileWidth && j >= 0 && j < tileHeight){\n\t\t\t\t\t\tif( i != x || j != y){\n\t\t\t\t\t\t\tif(tiles[i][j] == type){\n\t\t\t\t\t\t\t\tcount ++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\treturn count;\n}", "function countCell( cells, i, j )\n{\n if ( i < 0 || i > dimen - 1 ) {\n return 0;\n }\n\n if ( j < 0 || j > dimen - 1 ) {\n return 0;\n }\n\n return isAlive( cells, i, j ) ? 1 : 0;\n}", "function liveCount(row,col) {\n\tvar c = 0\n\tfor (var i=-1; i <= 1; ++i) {\n\t\tfor (var j=-1; j <= 1; ++j) {\n\t\t\tif (i==0 && j==0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tif (getCell(i+row,j+col).on.value)\n\t\t\t\tc++\n\t\t}\n\t}\n\t\n\treturn c\n}", "adjacentFaceCounts() {\n return _.countBy(this.adjacentFaces(), 'numSides');\n }", "function countNeighbours(x, y) {\n var aliveNeighbors = 0\n\n // If the cell is alive, it will have a value of 1 or 2. Otherwise it will be 0.\n // This may be improved to wrap around the board, but currently the edges are the end\n // of the universe\n function alive(x, y) {\n return cells[x] && cells[x][y]\n }\n\n // Checking 8 surrounding cells\n if (alive(x, y + 1)) aliveNeighbors++ // N cell\n if (alive(x + 1, y + 1)) aliveNeighbors++ // NE cell\n if (alive(x + 1, y)) aliveNeighbors++ // E cell\n if (alive(x + 1, y - 1)) aliveNeighbors++ // SE cell\n if (alive(x, y - 1)) aliveNeighbors++ // S cell\n if (alive(x - 1, y - 1)) aliveNeighbors++ // SW cell\n if (alive(x - 1, y)) aliveNeighbors++ // W cell\n if (alive(x - 1, y + 1)) aliveNeighbors++ // NW cell\n\n return aliveNeighbors\n }", "function count_islands(emap) {\n \n const len = array_length(emap);\n const height = array_length(emap[0]);\n \n let visited = [];\n\n // Generate the visited 2D array -> This is to check whether the cell \n // has already been checked\n for (let i = 0; i < len; i = i + 1) {\n visited[i] = [];\n for (let j = 0; j < height; j = j + 1) {\n visited[i][j] = false;\n }\n }\n \n // Check whether the neighboring cells are valid \n function isSafe(emap, row, col, visited) {\n // Check there is no negative / overflow index\n return row >= 0 && row < len && col >= 0 && col < height \n && emap[row][col] > 0 && !visited[row][col];\n }\n \n\n // Apply Depth-First search and treat the 2D array as a graph\n function dfs(emap, row, col, visited) {\n // Mark this cell as visited\n visited[row][col] = true;\n for (let i = -1; i <= 1; i = i + 1) {\n for (let j = -1; j <= 1; j = j + 1) {\n if ((i === -1 && j === 0) ||\n (i === 0 && j === -1) ||\n (i === 0 && j === 1) ||\n (i === 1 && j === 0)) {\n if(isSafe(emap, row + i, col + j, visited)) {\n dfs(emap, row + i, col + j, visited);\n } else {\n \n }\n } else {\n \n }\n }\n }\n \n }\n\n \n let counter = 0;\n \n // Trying to check the number of connected graphs\n for (let i = 0; i < len; i = i + 1) {\n for (let j = 0; j < len; j = j + 1) {\n if (emap[i][j] > 0 && !visited[i][j]) {\n // Check\n dfs(emap, i, j, visited);\n counter = counter + 1;\n } else {\n \n }\n }\n }\n\n return counter;\n}", "function countNeighbours(data, row, col) {\n\tlet neighborCount = 0; // number of neighbors of the given cell\n\tconst rowLen = data[0].length; // max row size\n\tconst colLen = data.length; // max col size\n\tconst neighbors = []; // holds all valid neighbors of the given cell\n\n\t// define the immediate neighbors for the given cell\n\tlet topLeft;\n\tlet topCenter;\n\tlet topRight;\n\tlet midLeft;\n\tlet midRight;\n\tlet bottomLeft;\n\tlet bottomCenter;\n\tlet bottomRight;\n\n\t// find valid neighbors in the row above the current cell\n\tif (row - 1 >= 0) {\n\t\ttopCenter = data[row - 1][col];\n\t\tneighbors.push(topCenter);\n\t\tif (col - 1 >= 0) {\n\t\t\ttopLeft = data[row - 1][col - 1];\n\t\t\tneighbors.push(topLeft);\n\t\t}\n\n\t\tif (col + 1 < colLen) {\n\t\t\ttopRight = data[row - 1][col + 1];\n\t\t\tneighbors.push(topRight);\n\t\t}\n\t}\n\t// find valid neigbors in the same row of the current cell\n\tif (col - 1 >= 0) {\n\t\tmidLeft = data[row][col - 1];\n\t\tneighbors.push(midLeft);\n\t}\n\n\tif (col + 1 < colLen) {\n\t\tmidRight = data[row][col + 1];\n\t\tneighbors.push(midRight);\n\t}\n\t// find valid neighbors in the row below the current cell\n\tif (row + 1 < rowLen) {\n\t\tbottomCenter = data[row + 1][col];\n\t\tneighbors.push(bottomCenter);\n\t\tif (col - 1 >= 0) {\n\t\t\tbottomLeft = data[row + 1][col - 1];\n\t\t\tneighbors.push(bottomLeft);\n\t\t}\n\n\t\tif (col + 1 < colLen) {\n\t\t\tbottomRight = data[row + 1][col + 1];\n\t\t\tneighbors.push(bottomRight);\n\t\t}\n\t}\n\n\t// loop over list of neighbors and validate each neighbor\n\tfor (let n of neighbors) {\n\t\tif (n === 1) {\n\t\t\t// neighboring cell is not empty\n\t\t\tneighborCount++;\n\t\t}\n\t}\n\treturn neighborCount;\n}", "function getNeighbourCount(x, y) {\n\tlet count = 0;\n\tfor (let yy = -1; yy < 2; yy++) {\n\t\tfor (let xx = -1; xx < 2; xx++) {\n\t\t\tif (xx === 0 && yy === 0) continue;\n\t\t\tif (x + xx < 0 || x + xx > resolution - 1) continue;\n\t\t\tif (y + yy < 0 || y + yy > resolution - 1) continue;\n\t\t\tif (cells[x + xx][y + yy]) count++;\n\t\t}\n\t}\n\treturn count;\n}", "getLiveNeighborCount(h, w) {\n const currentCells = this.cells[this.activeBuffer];\n let c = 0;\n\n if (currentCells[h - 1] && currentCells[h - 1][w - 1]) ++c;\n if (currentCells[h - 1] && currentCells[h - 1][w - 0]) ++c;\n if (currentCells[h - 1] && currentCells[h - 1][w + 1]) ++c;\n\n if (currentCells[h - 0] && currentCells[h + 0][w - 1]) ++c;\n if (currentCells[h - 0] && currentCells[h + 0][w + 1]) ++c;\n\n if (currentCells[h + 1] && currentCells[h + 1][w - 1]) ++c;\n if (currentCells[h + 1] && currentCells[h + 1][w - 0]) ++c;\n if (currentCells[h + 1] && currentCells[h + 1][w + 1]) ++c;\n\n return c;\n }", "function equalNeighbours (input) {\n let counter = 0;\n\n // Check horizontal pairs\n for (let row = 0; row < input.length; row++) {\n for (let col = 0; col < input[row].length - 1; col++) {\n if (input[row][col] === input[row][col + 1]) {\n counter++;\n }\n }\n }\n\n // Check vertical pairs\n for (let row = 0; row < input.length - 1; row++) {\n for (let col = 0; col < input[row].length; col++) {\n if (input[row][col] === input[row + 1][col]) {\n counter++;\n }\n }\n }\n\n console.log(counter);\n}", "neighborCount(mtx, x, y) {\n var count = 0;\n for (var i = -1 ; i <= 1 ; i++) {\n for (var j = -1 ; j <= 1 ; j++) {\n if ((0 < (x+i)) && ((x+i) < this.width)\n && (0 < (y+j)) && ((y+j) < this.height)) {\n if (0 != mtx[y+j][x+i]) {\n count += 1;\n }\n }\n }\n }\n if (0 < count) {\n console.log(\"neighborCount(\", x, y, \") = \", count);\n }\n return count;\n }", "countNeighbours() {\n\t\tlet c = 0;\n\t\tfor(let x =- 1; x <= 1; x++) {\n\t\t\tfor(let y =- 1; y <= 1; y++) {\n\t\t\t\tlet neighbour = { x: this.x + x, y: this.y + y };\n\t\t\t\tif( this.world.isInside(neighbour.x, neighbour.y) &&\n\t\t\t\t (( neighbour.x !== this.x ) || ( neighbour.y !== this.y )) ) {\n\t\t\t\t\tif(this.world.grid[neighbour.y][neighbour.x].state) c += 1;\n\t\t\t\t\tif(c > 3) return c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}", "cellAdjMineCount(row, col) {\n const cells = this.cells;\n return cells[ this.to_1d(row, col) * this.cellBytes + 2];\n }", "function countNeighboring (thing, i, j) {\n var cnt = 0;\n // count adjacent \"thing\"\n if (A.world[i-1]) {\n // the row above\n if (A.world[i-1][j-1] && A.world[i-1][j-1] === thing) { cnt += 1 };\n if (A.world[i-1][j] === thing) { cnt += 1 };\n if (A.world[i-1][j+1] && A.world[i-1][j+1] === thing) { cnt += 1 };\n }\n if (A.world[i][j-1] && A.world[i][j-1] === thing) { cnt += 1 }; // the 'current' row\n if (A.world[i][j+1] && A.world[i][j+1] === thing) { cnt += 1 };\n if (A.world[i+1]) {\n // the row below\n if (A.world[i+1][j-1] && A.world[i+1][j-1] === thing) { cnt += 1 };\n if (A.world[i+1][j] === thing) { cnt += 1 };\n if (A.world[i+1][j+1] && A.world[i+1][j+1] === thing) { cnt += 1 };\n }\n return cnt;\n}", "getNeighborsCount( x, y ){\n\n let neighborsCnt = 0;\n for (let neighborX = x - 1; neighborX <= x + 1; neighborX++){\n for (let neighborY = y - 1; neighborY <= y + 1; neighborY++){\n\n if ((neighborX === x && neighborY === y) ||\n neighborX < 0 || neighborY < 0 ||\n neighborX >= this.boardWidth || neighborY >= this.boardHeight){\n\n continue\n\n }\n\n if (this.board[neighborX][neighborY] === ALIVE){\n neighborsCnt += 1;\n }\n\n }\n }\n\n return neighborsCnt\n }", "function cellsALiveCount(){\n let newCells = createCells();\n let cellsAlive = 0\n for (let y = 0; y < resolution; y++){\n for (let x = 0; x < resolution; x++){\n const neighbours = getNeightbourCount(x,y);\n if (cells[x][y] && neighbours >= 2 && neighbours <= 3) \n newCells[x][y] = true;\n else if (!cells[x][y] && neighbours === 3) \n newCells[x][y] = true;\n cellsAlive += cells[x][y] ? 1 : 0 \n }\n }\n return cellsAlive;\n}", "function count_live_neighbors(grid, row, col) {\n let count = 0;\n\n for (let r = -1; r < 2; r++) {\n for (let c = -1; c < 2; c++) {\n count += grid[(row + r + gridRows) % gridRows][(col + c + gridCols) % gridCols];\n }\n }\n count -= grid[row][col];\n return count;\n}", "function numIslands(grid) {\n //? Treat matrix as graph, recursive DFS on grid with row, column if land seen \n let count = 0;\n \n function dfs(grid, row, col) {\n if (row < 0 || col < 0 || row >= grid.length || col >= grid.length) return;\n\n let value = grid[row][col];\n if (value === '1') {\n grid[row][col] = '#';\n dfs(grid, row+1, col);\n dfs(grid, row-1, col);\n dfs(grid, row, col-1);\n dfs(grid, row, col+1);\n }\n }\n\n for (let i = 0; i < grid.length; i++) {\n for (let j = 0; j < grid[0].length; j++) {\n if (grid[i][j] === '1') {\n count++;\n dfs(grid, i, j);\n }\n }\n }\n return count;\n}", "livingNeighbors(row, col) {\n // TODO: Return the count of living neighbors.\n //given cells position, return number of living neighbors\n\n // get cell then go to living neighbors\n\n return (\n //row above\n this.getCell(row - 1, col - 1) +\n this.getCell(row - 1, col) +\n this.getCell(row - 1, col + 1) +\n //left and right\n this.getCell(row, col - 1) +\n this.getCell(row, col + 1) +\n //row below\n this.getCell(row + 1, col - 1) +\n this.getCell(row + 1, col) +\n this.getCell(row + 1, col + 1)\n );\n }", "function countLiveNeighbor() {\n for (let i = 0; i < allCell.length; i++) {\n allCell[i].liveNeighbor = 0;\n for (let j = 0; j < allCell[i].neighbor.length; j++) {\n\n if (allCell[allCell[i].neighbor[j]].isLife === true) {\n allCell[i].liveNeighbor++;\n }\n }\n }\n}", "function getneighcount(arr, x, y){\n var nc = 0;\n for (var nn = 0; nn < neighbourhood.length; nn++){\n var dx = neighbourhood[nn][0];\n var dy = neighbourhood[nn][1];\n if (arr[pbcz(x + dx, arr.length)][pbcz(y + dy, arr[x].length)] === ALIVE){\n nc++;\n }\n }\n return nc;\n }", "countNeighbours() {\n const countedGame = Game.duplicate(this);\n\n // for every live cell\n for (let y in this.cells) {\n for (let x in this.cells[y]) {\n \n //for its eight neighbours\n for (let dy = -1; dy <= 1; dy++) {\n for (let dx = -1; dx <= 1; dx++) {\n if (dy === 0 && dx === 0) continue;\n\n // neighbour's coordinates\n const nx = +x + dx;\n const ny = +y + dy;\n\n // if there is no Cell object for neighbour, add one\n if (!countedGame.cells[ny] || !countedGame.cells[ny][nx])\n countedGame.addCell(nx, ny, false);\n\n // increment neighbour's neighbour count\n countedGame.cells[ny][nx].neighbours++;\n }\n }\n }\n }\n return countedGame;\n }", "function countNeighbors(row, col) {\n let count = 0;\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n let r = (row + i + rows) % rows;\n let c = (col + j + cols) % cols;\n if (grid[r][c] === 1) {\n count++;\n }\n }\n }\n if (grid[row][col] === 1) {\n count--;\n }\n return count;\n}", "function countLiveNeighbors(grid, row, col) {\r\n var count = 0;\r\n var countInf = 0;\r\n //go through neighbors\r\n for (var i = row - 1; i <= row + 1; i += 1) {\r\n for (var j = col - 1; j <= col + 1; j += 1) {\r\n //check boundary\r\n if (validPosition(i, j)) {\r\n //count\r\n if (!grid[i][j].dead) {\r\n count = count + 1;\r\n } \r\n }\r\n }\r\n }\r\n //avoid the points that are being checked to be count \r\n if (!grid[row][col].dead) {\r\n count = count - 1;\r\n }\r\n \r\n \r\n return count;\r\n \r\n }", "_getPartOfCount() {\n\n // 8-neighborhood around\n const n = [\n Point.val(this.x - 1, this.y - 1),\n Point.val(this.x - 1, this.y),\n Point.val(this.x - 1, this.y + 1),\n Point.val(this.x, this.y - 1),\n Point.val(this.x, this.y + 1),\n Point.val(this.x + 1, this.y - 1),\n Point.val(this.x + 1, this.y),\n Point.val(this.x + 1, this.y + 1),\n ];\n\n const edges = n.filter(p => p === '-' || p === '|').length;\n const ind = [];\n for (let i = 0; i < 8; i++) {\n if (n[i] === '-' || n[i] === '|') ind.push(i);\n }\n\n switch (edges) {\n\n case 2:\n switch (ind[0]) {\n case 1: \n return ind[1] === 3 ? (n[0] === n[7] ? 2 : 1) : (n[2] === n[5] ? 2 : 1);\n case 3: \n return n[2] === n[5] ? 2 : 1;\n case 4: \n return n[0] === n[7] ? 2 : 1;\n }\n\n case 3: \n return n.filter(p => p === ' ').length === 5 ? 3 : 2;\n\n case 4:\n return n.filter(p => p === ' ').length;\n }\n }", "function countAliveNeighbours(map, x, y)\n{\n var count = 0;\n for (var i = -1; i < 2; i++)\n {\n for (var j = -1; j < 2; j++)\n {\n var nb_x = i + x;\n var nb_y = j + y;\n if (i === 0 && j === 0)\n {\n }\n //If it's at the edges, consider it to be solid (you can try removing the count = count + 1)\n else if (nb_x <= 0 || nb_y <= 0 || nb_x >= map[0].length - 2 || nb_y >= map.length - 2)\n count = count + 1;\n else if (map[nb_y][nb_x] === 1)\n count = count + 1;\n }\n }\n return count;\n}", "function islandCounter(M){\n islands = 0\n if (M == null OR M.length == 0){\n return 0\n }\n row = M.length\n col = M[0].length\n\n for(i=0;i<row-1;i++){\n for(j=0;j<col-1;j++){\n if (M[i][j] == 1):\n markIsland(M, row, col, i, j)\n islands++\n }\n }\n return islands\n}", "livingNeighbors(row, col) {\n // TODO: Return the count of living neighbors.\n\n let livingCount = 0;\n\n\n for (let i = row-1; i < row+2; i++) {\n for (let j = col-1; j< col+2; j++) {\n\n //if this cell exists\n if (!(this.getCell(i,j) === null)) {\n //if neighbor is alive\n if (this.board[i][j] === 1) {\n livingCount++;\n }\n }\n // console.log('current coordinates of neighbors: ', `[${i}][${j}]`)\n }\n }\n\n //if current cell is ME and alive\n\n if (this.board[row][col] === 1) {\n livingCount--;\n }\n\n console.log('current coordinates: ', `[${row}][${col}]`)\n\n console.log(`living count ${livingCount}`);\n return livingCount;\n\n }", "function countNeighbors(x, y){\n\t\n\t// Init counter with value = 0\n\tvar counter = 0;\n\t\n\t// Get the left coordinate modulo size\n\tminX = (x > 0) ? (x - 1) : (size - 1);\n\t\n\t// Get the top coordinate modulo size\n\tminY = (y > 0) ? (y - 1) : (size - 1);\n\t\n\t// Get the right coordinate modulo size\n\tmaxX = (x < size - 2) ? (x + 1) : 0;\n\t\n\t// Get the bottom coordinate modulo size\n\tmaxY = (y < size - 2) ? (y + 1) : 0;\n\t\n\t// Check if left top neighbor is alive\n\tif(field[minX][minY].status === 'alive'){\n\t\tcounter++;\n\t}\n\t\n\t// Check if left neighbor is alive\n\tif(field[minX][y].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if left right neighbor is alive\n\tif(field[minX][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if top neighbor is alive\n\tif(field[x][minY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if bottom neighbor is alive\n\tif(field[x][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right top neighbor is alive\n\tif(field[maxX][minY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right neighbor is alive\n\tif(field[maxX][y].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right bottom neighbor is alive\n\tif(field[maxX][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Return number of counter\n\treturn counter;\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function countVertices(cells) {\n var vc = -1\n , max = Math.max\n for(var i=0, il=cells.length; i<il; ++i) {\n var c = cells[i]\n for(var j=0, jl=c.length; j<jl; ++j) {\n vc = max(vc, c[j])\n }\n }\n return vc+1\n}", "function arrayMarkCount(iRows, iCols, iStartRow, iStartCol) {\n var i;\n var j;\n\n iMarkCount = 0;\n\n for (i = iStartRow; i < iStartRow + iRows; i++) {\n for (j = iStartCol; j < iStartCol + iCols; j++) {\n if (iMarkedCells[i % iMapRows][j % iMapCols] == 1) {\n iMarkCount++;\n } \n }\n } \n\n return iMarkCount;\n}", "countTreasures () {\n // Initially set the total number of treasures surrounding the cell to 0:\n let total = 0;\n \n // If the cell clicked is a coin itself, do not count the number of treasures surrounding the cell:\n if (this.coins) {\n total = -1;\n }\n // If the cell clicked is not a coin (or turtle by default), then check the identity of all the cells in its perimeter:\n else {\n for (let xP = -1; xP <= 1; xP++) {\n for (let yP = -1; yP <= 1; yP++) {\n let i = this.i + xP;\n let j = this.j + yP;\n \n // As long as the neighboring cell is within the area of the grid:\n if (i > -1 && i < gridColumns && j > -1 && j < gridRows) {\n // Treat each neighbor as an individual cell in the grid ...\n let neighbor = grid[i][j];\n // And using the Cell class, add 1 to total if neighbors' identity is coin:\n if (neighbor.coins) {\n total++;\n }\n }\n }\n }\n // The total nunber of coin-cells found is the numberOfTreasures for this particular cell.\n this.numberOfTreasures = total;\n }\n }", "function findNeighbours(matrix){\r\n let count = 0;\r\n\r\n let rows = matrix.length;\r\n let cols = matrix[0].length;\r\n\r\n //check verticals\r\n for(let r = 0; r<rows-1; r++){\r\n for(let c = 0; c<cols; c++){\r\n if(matrix[r][c] == matrix[r+1][c]){\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n //check horizonals\r\n for(let r = 0; r<rows; r++){\r\n for(let c = 0; c<cols-1; c++){\r\n if(matrix[r][c] == matrix[r][c+1]){\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n return count;\r\n}", "function calcNegsCount(board, cellI, cellJ) {\n var negs = 0;\n for (var i = cellI - 1; i <= cellI + 1; i++) {\n for (var j = cellJ - 1; j <= cellJ + 1; j++) {\n //if non-valid index (in case the cell is in the frame), continue\n if (!(board[i] && board[i][j])) continue;\n //if this is the cell itself, continue;\n if (cellI === i && cellJ === j) continue;\n //index is valid: check and count\n if (board[i][j].val === '*') negs++;\n }\n }\n if (negs === 0) return '';\n return negs + '';\n}", "getNeighboursCount(cell) {\n\n\t\tlet aliveNeighbours = 0;\n\t\tlet deadNeighbours = [];\n\n\t\t// iterate 3 X 3 grid around cell\n\t\tfor (let x = -1; x <= 1; x++) {\n\t\t\tfor (let y = -1; y <= 1; y++) {\n\t\t\t\tif (x === 0 && y === 0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// if grid is active cell\n\t\t\t\tif (this.findAliveCell(this.mod(cell.x + x, this.state.cols), this.mod((cell.y + y), this.state.rows)) !== undefined) {\n\t\t\t\t\taliveNeighbours++;\n\t\t\t\t} else {\n\t\t\t\t\tdeadNeighbours.push({ x: this.mod(cell.x + x, this.state.cols), y: this.mod((cell.y + y), this.state.rows) });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { count: aliveNeighbours, deadNeighbours: deadNeighbours };\n\t}", "function neighborSum(cell, i, j) {\r\n this.cell = cell;\r\n this.i = i;\r\n this.j = j;\r\n var sum = 0;\r\n if(cellArray[i - 1][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i - 1][j].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i - 1][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n return sum;\r\n}", "function getNeightbourCount(x, y){\n let count = 0;\n for (let yy = -1; yy < 2; yy++){\n for (let xx = -1; xx < 2; xx++){\n if (xx === 0 && yy === 0) \n continue;\n if (x + xx < 0 || x + xx > resolution - 1) \n continue;\n if (y + yy < 0 || y + yy > resolution - 1) \n continue;\n if (cells[x + xx][y + yy]) \n count++;\n }\n }\n return count;\n}", "function countSurroundingMines (cell) {\n\tvar surroundingCells = lib.getSurroundingCells(cell.row, cell.col)\nvar count = 0;\nfor(var j=0; j<surroundingCells.length; j++){\n\tif(surroundingCells[j].isMine === true){\n\t\tcount++\n\t}\n\t//console.log (\"count is: \"+count)\n}return count\n\n}", "function numberOfBoardEntries() {\n var count = 0\n for(i=0; i<TicTacToePage.boardCells.length; i++){\n if(TicTacToePage.boardCells[i].getText() == \"O\" || TicTacToePage.boardCells[i].getText() == \"X\"){\n count+=1\n }\n }\n return count\n }", "function incrementNeigbours(cells, x, y) {\n x = parseInt(x);\n y = parseInt(y);\n for (var j = (x - 1); j <= (x + 1); j++) {\n if (typeof cells[j] !== 'undefined') {\n for (var k = (y - 1); k <= (y + 1); k++) {\n if (typeof cells[j][k] !== 'undefined'\n && cells[j][k] instanceof Cell) {\n cells[j][k].neighbourMines++;\n\n }\n }\n }\n }\n }", "livingNeighbors(row, col) {\n let counter = 0;\n let board = this.board;\n if(board[row][col+1] === 1 && board[row][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row][col+1] === 1 || board[row][col-1] === 1){\n counter += 1;\n }\n }\n if(board[row-1] !== undefined){\n if(board[row-1][col] === 1){\n counter += 1;\n }\n if(board[row-1][col+1] === 1 && board[row-1][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row-1][col+1] === 1 || board[row-1][col-1] === 1){\n counter += 1;\n }\n }\n }\n if(board[row+1] !== undefined){\n if(board[row+1][col] === 1){\n counter += 1;\n }\n if(board[row+1][col+1] === 1 && board[row+1][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row+1][col+1] === 1 || board[row+1][col-1] === 1){\n counter += 1;\n }\n }\n };\n return counter;\n }", "function countNegs(cellI,cellJ) {\n var negs = 0;\n for (var i =cellI-1; i <= cellI+1; i++) {\n for (var j =cellJ-1; j <= cellJ+1; j++) {\n if ( i === cellI && j === cellJ ) continue;\n if ( i < 0 || i > board.length-1) continue;\n if ( j < 0 || j > board[0].length-1) continue;\n if (board[i][j].contain === 'mine') {negs++;}\n }\n }\n if (negs === 0) {negs = 'empty';}\n return negs;\n }", "function check_horizontal(row, col, color) {\n let count = 1\n let temp = col\n while (col > 0) {\n let $left_cell = get_cell(row, --col)\n console.log(col, color, 'left count')\n console.log($left_cell)\n if ($left_cell.css('backgroundColor') == color) {\n count += 1\n console.log('count +++ left')\n }\n else {\n break\n }\n }\n col = temp\n while (col < that.col) {\n let $right_cell = get_cell(row, ++col)\n console.log(col, color, 'right count')\n console.log($right_cell)\n if ($right_cell.css('backgroundColor') == color) {\n count += 1\n console.log('count +++ right')\n }\n else {\n break\n }\n }\n if (count >= 4) {\n return true\n }\n return false\n }", "function countSurroundingMines(cell) {\n var count = 0;\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n for (let index =0; index < surrounding.length; index++) {\n if (surrounding[index].isMine === true){\n count++;\n }\n }\n return count;\n}", "function numIslands(grid) {\n if (!grid.length) return 0;\n\n const maxCols = grid[0].length;\n const maxRows = grid.length;\n let islands = 0;\n\n function traverseIsland(row, col) {\n if (\n row > -1 &&\n row < maxRows &&\n col > -1 &&\n col < maxCols &&\n grid[row][col] === '1'\n ) {\n grid[row][col] = '0';\n\n // up\n traverseIsland(row - 1, col);\n // down\n traverseIsland(row + 1, col);\n // left\n traverseIsland(row, col - 1);\n // right\n traverseIsland(row, col + 1);\n }\n }\n\n for (let row = 0; row < maxRows; row++) {\n for (let col = 0; col < maxCols; col++) {\n if (grid[row][col] === '1') {\n islands++;\n traverseIsland(row, col);\n }\n }\n }\n\n return islands;\n}", "function NumberOfIsland(grid) {\n let n, m, count = 0;\n n = grid.length;\n if (n <= 0) return 0;\n m = grid[0].length;\n for (let i = 0; i < n; i++){\n for (let j = 0; j < m; j++) {\n if(grid[i][j] === \"1\"){\n DFSMark(grid, i, j);\n count++;\n }\n }\n }\n return count;\n}", "function countActiveNeighbours(game, cell) {\n var total = 0;\n iterateArray(neighbouringCells(cell), function countActiveNeighboursIterator(cell) {\n var id = cellId(cell);\n if (game.hasOwnProperty(id) && isActive(game[id])) {\n total += 1;\n }\n });\n return total;\n }", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function countVertices(cells) {\n\t var vc = -1\n\t , max = Math.max\n\t for(var i=0, il=cells.length; i<il; ++i) {\n\t var c = cells[i]\n\t for(var j=0, jl=c.length; j<jl; ++j) {\n\t vc = max(vc, c[j])\n\t }\n\t }\n\t return vc+1\n\t}", "function numOffices(grid) {\n let result = 0;\n\n for (let x = 0; x < grid[0].length; x++) {\n if (grid[0][x] === 1 && grid[0][x - 1] !== 1) {\n result = result + 1;\n }\n }\n\n\n for (let y = 1; y < grid.length; y++) {\n for (let x = 0; x < grid[0].length; x++) {\n if (grid[y][x] === 1 && grid[y][x - 1] !== 1 && grid[y - 1][x] !== 1) {\n result = result + 1;\n }\n }\n }\n return result;\n}", "function numIslands(grid) {\n const rowCount = grid.length;\n const colCount = grid[0].length;\n let islandCount = 0;\n\n for (let r = 0; r < rowCount; r++) {\n for (let c = 0; c < colCount; c++) {\n const isLand = grid[r][c] === '1';\n \n if (isLand) {\n islandCount++;\n _markIslandVisited(grid, r, c);\n }\n }\n } \n\n return islandCount;\n}", "function countNeighbours(centerX, centerY, searchSize) {\n\n var numCellsCounted = 0;\n var numNeighbours = 0;\n\n for (let xOffset = -searchSize; xOffset <= searchSize; xOffset++) {\n for (let yOffset = -searchSize; yOffset <= searchSize; yOffset++) {\n if (xOffset != 0 || yOffset != 0) { \n var xSamp = centerX + xOffset;\n var ySamp = centerY + yOffset;\n\n if (xSamp >= 0 && xSamp < cols && ySamp > 0 && ySamp < rows) {\n if (pPuffs[xSamp][ySamp]){\n numNeighbours += 1;\n }\n numCellsCounted += 1;\n }\n }\n }\n }\n\n return numNeighbours / numCellsCounted;\n}", "function getLinkCount(cell) {\n var parent = graph.getDefaultParent();\n var childCount = graph.getModel().getChildCount(parent);\n var sourceCount = 0;\n var targetCount = 0;\n for (var i = 0; i < childCount; i++) {\n var child = graph.getModel().getChildAt(parent, i);\n if (child.isEdge()) {\n //增加连线的判断 20100105 by MeiKefu\n if (!child.getSource() || !child.getTarget()) {\n alert(\"连接线 [\" + child.id + \" \" + child.value + \"] 没有连接正确\");\n return {\n source: 0,\n target: 0\n };\n }\n if (child.getSource().getId() == cell.getId()) sourceCount++;\n if (child.getTarget().getId() == cell.getId()) targetCount++;\n }\n }\n return {\n source: sourceCount,\n target: targetCount\n };\n }", "function countIslands(arr = []) {\n function throwError(errString) {\n throw new Error(errString);\n }\n if(arr.length === 0) throwError('input col array is empty');\n if(arr[0].length === 0) throwError('input row array is empty');\n const rowLength = arr[0].length;\n const colLength = arr.length;\n var islandCount = 0;\n for(let i = 0; i < colLength; i++) {\n for(let j = 0; j < rowLength; j++) {\n if(arr[i][j] === 1) {\n islandCount = islandCount + 1\n DFS(i,j);\n }\n }\n }\n \n function DFS(i, j) {\n arr[i][j] = 2;\n const top = arr[i-1] && arr[i-1][j]\n const left= arr[i] && arr[i][j-1]\n const bottom = arr[i+1] && arr[i+1][j]\n const right = arr[i] && arr[i][j+1]\n if(top === 1) DFS(i-1, j);\n if(left === 1) DFS(i, j-1);\n if(right === 1) DFS(i, j+1);\n if(bottom == 1) DFS(i+1, j);\n }\n return islandCount;\n}", "function countNeighbors(column, row, countMiddle) {\n let sum = 0;\n if (column !== 0 && column < gameState.numberOfColumns - 1) {\n sum += gameState.oldcanvas[column - 1][row]\n sum += gameState.oldcanvas[column + 1][row]\n } else if (column == 0) {\n sum += gameState.oldcanvas[column + 1][row]\n }\n else if (column == gameState.numberOfColumns - 1) {\n sum += gameState.oldcanvas[column - 1][row]\n }\n if (countMiddle) {\n sum += gameState.oldcanvas[column][row]\n }\n return sum;\n}", "function countLiveCells(coords, grid) {\n let sum = 0;\n for (let coord of coords) { // `for..of` loop is much faster than `reduce()`\n sum += grid[coord[0]][coord[1]];\n }\n return sum;\n}", "function countCoordinate (val){\n return (val * side ) + (side / 2);\n}", "_calcCellState(pos){\n var cell=pos.split(':');\n var x=Number (cell[0]);\n var y=Number (cell[1]);\n var currState=this._getCellState(x, y);\n // Get adjacent cells\n var sum=0;\n sum+=this._getCellState(x-1, y-1);\n sum+=this._getCellState(x, y-1);\n sum+=this._getCellState(x+1, y-1);\n sum+=this._getCellState(x-1, y);\n sum+=this._getCellState(x+1, y);\n sum+=this._getCellState(x-1, y+1);\n sum+=this._getCellState(x, y+1);\n sum+=this._getCellState(x+1, y+1);\n\n // Living cell\n if(currState===1){\n // < 2 live neighbors\n if(sum<2){return false;}\n // 2 or 3\n if(sum===2 || sum===3){return true;}\n // > 3\n if(sum>3){return false;}\n }else{\n if(sum===3){return true;}\n }\n return false\n }", "function countSurroundingMines(cell) {\n var count = 0\n\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n\n for (let i = 0; i < surrounding.length; i++) {\n var cell = surrounding[i]\n\n if (cell.isMine == true) {\n count++\n }\n }\n return count\n}", "function countSurroundingMines (cell) {\n\n var surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n\n var count = 0;\n\n for (var i = 0; i < surroundingCells.length; i++){\n if (surroundingCells[i].isMine){\n count ++;\n }\n }\n return count;\n}", "countNeighbours (x, y) {\n\n // the total sum of living neighbours\n let alive = 0;\n\n // loop over the x neighbours\n for (let i = -1; i < 2; ++i) {\n\n // loop over the y neighbours\n for (let j = -1; j < 2; ++j) {\n\n // calculate the x coordinate\n let xPos = (x + i + this.config.get(colsKey)) % this.config.get(colsKey);\n\n // calculate the y pos\n let yPos = (y + j + this.config.get(rowsKey)) % this.config.get(rowsKey);\n\n // count lives\n alive += this.grid.get((xPos + yPos * this.config.get(colsKey)));\n } \n }\n\n // exclude ourselves\n alive -= this.grid.get((x + y * this.config.get(colsKey)));\n\n // return the sum\n return alive;\n }", "calculateAtDesiredPos() {\n let counter = 0;\n for (let i = 0; i < this.num_rows; i++) {\n for (let j = 0; j < this.num_cols; j++) {\n if (this.isAtDesiredPos([i, j], this.board[i][j])) counter++;\n }\n }\n return counter;\n }", "function treesCount(rowCount,colCount,input){\n console.log(rowCount,colCount);\n let treeCount = 0,row = 0,col = 0;\n while(row < input.length){\n if(input[row][col]===\"#\"){\n console.log(row,col,input[row][col]);\n treeCount++;\n }\n col = (col+colCount)%input[0].length;\n row += rowCount;\n }\n console.log(\"treeCount is : \",treeCount);\n return treeCount;\n}", "countMines() {\n if (this.mine) {\n this.neighborCount = 1;\n return;\n }\n \n var total = 0;\n for (var xoff = -1; xoff <= 1;xoff++ ) {\n var i = this.i + xoff;\n if (i < 0 || i >= this.cols) continue;\n \n for (var yoff = -1; yoff <= 1; yoff++) {\n var j = this.j + yoff;\n if (j < 0 || j >= this.rows) continue;\n // \n var neighbor = this.grid[i][j];\n this.neighbourCells.push(neighbor)\n if (neighbor.mine) {\n total++;\n }\n }\n }\n this.neighborCount = total;\n }", "function countInDirection(row, col, delRow, delCol, animString, winString) {\n\t// get the new co-ordinates\n\tvar newRow = row*1 + delRow*1;\n\tvar newCol = col*1 + delCol*1;\n\t\n\t// check bounds\n\tif (row >= max_row + header_rows || row < header_rows+1 || col < 0 || col >= max_col) {\n\t\treturn 0;\n\t}\n\t\n\t// check if this cell is the correct colour\n\tif (map[col][row].currentAnimation == animString) {\n\t\tif (winString != null) map[col][row].gotoAndPlay(winString);\n\t\treturn ret = countInDirection(newRow, newCol, delRow, delCol, animString, winString) + 1;\n\t} else {\n\t\treturn 0;\n\t}\n}", "function countSurroundingMines (cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n var count = 0;\n\n for (let a = 0; a < surrounding.length; a++) {\n if (surrounding[a].isMine == true) {\n count++\n } \n } return count\n}", "function countSurroundingMines(cell) {\n var count = 0\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (let i = 0; i < surrounding.length; i++) {\n var cell = surrounding[i]\n if (cell.isMine) {\n count++\n }\n }\n return count\n}", "function countPixels(grid) {\n\tvar total = 0;\n\tgrid.forEach(function(arrElem) {\n\t\tarrElem.forEach(function(elem){\n\t\t\tif (!elem) {\n\t\t\t\ttotal++;\n\t\t\t}\n\t\t});\n\t});\n\treturn total;\n}", "function getIndex(cell) {\n var index = 0;\n $(cell).prevAll(\".MainCell\").each(function () {\n if (ifCellEmpty(this) == false) {\n index++;\n }\n });\n return index;\n}", "function countWayTab(width, height) {\n\n // const widthOfArry = Array(width + 1).fill(0);\n // const _2dArry = [];\n // for(let i = 0; i < (height + 1); i++) {\n // _2dArry[i] = widthOfArry;\n // }\n const _2dArry = [];\n for(let i = 0; i < height+1; i++){\n _2dArry.push(Array(width+1));\n for(let j = 0; j < width+1; j++) {\n if(i===1 && j===1) {\n _2dArry[i][j] = 1;\n continue;\n }\n _2dArry[i][j] = 0;\n }\n }\n \n for(let i = 0; i < _2dArry.length; i++) {\n for(let j = 0; j < _2dArry[i].length; j++) {\n if(_2dArry[i][j + 1] !== undefined) _2dArry[i][j + 1] += _2dArry[i][j];\n if(_2dArry[i + 1] !== undefined) _2dArry[i + 1][j] += _2dArry[i][j];\n }\n }\n\n return _2dArry[height][width];\n}", "function count_peaks(emap) {\n\n let counter = 0;\n for (let i = 0; i < array_length(emap); i = i + 1) {\n for (let j = 0; j < array_length(emap[0]); j = j + 1) {\n if (count_lower_neighbors(emap, i, j) === 8) {\n counter = counter + 1;\n } else {\n \n }\n }\n }\n \n return counter;\n}", "function countSurroundingMines (cell) {\n\tvar surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n\tlet count = 0;\n\tfor (let i=0;i<surroundingCells.length; i++){\n\t\tif(surroundingCells[i].isMine)\n\t\t\tcount+=1;\n\t}\n\treturn count;\n}", "amountCellsInSnake(cell) {\n return this.snake.filter(({x, y}) => x === cell.x && y === cell.y)\n .length;\n }", "bitCount(mtx) {\n var count = 0;\n for (var y = 0 ; y < this.height ; y++) {\n for (var x = 0 ; x < this.width ; x++) {\n if (0 < mtx[y][x]) {\n count += 1;\n }\n }\n }\n // console.log(\"bitCount: count = \", count);\n return count;\n }", "checkOpenNeighbors(grid, width, cellPos) {\n // we know there is at least one open cell next to the wall\n let numOpenCells = 0;\n\n // Check right\n if ((cellPos + 1) < grid.length && ((cellPos + 1) % width) > 0 &&\n grid[cellPos + 1] === OPENING_CHAR) {\n numOpenCells++;\n }\n // Check left\n if ((cellPos - 1) >= 0 && (cellPos % width) > 0 &&\n grid[cellPos - 1] === OPENING_CHAR) {\n numOpenCells++;\n }\n // Check above\n if ((cellPos - width) >= 0 && grid[cellPos - width] === OPENING_CHAR) {\n numOpenCells++;\n }\n // Check below\n if ((cellPos + width) < grid.length && grid[cellPos + width] === OPENING_CHAR) {\n numOpenCells++;\n }\n\n return numOpenCells;\n }", "livingNeighbors(row, col) {\n const neighbors = [\n [row - 1, col - 1],\n [row - 1, col],\n [row - 1, col + 1],\n [row, col - 1],\n [row, col + 1],\n [row + 1, col - 1],\n [row + 1, col],\n [row + 1, col + 1]\n ];\n\n return neighbors.reduce((living, neigh) => {\n let row1 = neigh[0];\n let col1 = neigh[1];\n if (this.board[row1] && this.board[row1][col1]) {\n living++;\n }\n return living;\n }, 0);\n }", "function countSurroundingMines (cell) {\n var cnt = 0\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n for (var i = 0; i < surrounding.length; i++){\n if (surrounding[i].isMine){\n cnt++\n }\n }\n return cnt\n}", "function num_of_live_neighbours(game, n, r, c){\n const x = [-1,0,1];\n const y = [-1,0,1];\n let ans = 0;\n for(let i = 0; i < 3; i = i + 1){\n for(let j = 0; j < 3; j = j + 1){\n if(!(i === 1 && j === 1) \n && game[(r+x[i]+n)%n][(c+y[j]+n)%n] === 1){\n ans = ans + 1;\n } else {}\n }\n }\n return ans;\n}", "function getMineCount(i, j) {\n let count = 0;\n for (let di = -1; di <= 1; di++) {\n for (let dj = -1; dj <= 1; dj++) {\n const ni = i + di;\n const nj = j + dj;\n if (ni >= board.getRows() || nj >= board.getCols() || nj < 0 || ni < 0) continue;\n const $cell = $(`.field.hidden[data-row=${ni}][data-col=${nj}]`);\n if ($cell.hasClass('mine')) count++;\n }\n }\n return count;\n}", "getNeighbors(currentCells) {\n this.numNeighbors = 0;\n if (inGrid(currentCells, this.y - 1, this.x - 1)) {\n if (currentCells[this.y - 1][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x)) {\n if (currentCells[this.y - 1][this.x].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x + 1)) {\n if (currentCells[this.y - 1][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y, this.x - 1)) {\n if (currentCells[this.y][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y, this.x + 1)) {\n if (currentCells[this.y][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x - 1)) {\n if (currentCells[this.y + 1][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x)) {\n if (currentCells[this.y + 1][this.x].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x + 1)) {\n if (currentCells[this.y + 1][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n }", "function showCellCount() {\n\tvar rows = TABLE.rows\n\tvar n = rows.length;\n\tvar found = false;\n\tvar cellCount = 1;\n\tfor (var i=0; i<n; i++) {\n\t\tvar cells = rows[i].cells;\n\t\tvar k = cells.length;\n\t\tfor (var j=0; j<k; j++) {\n\t\t\tif (cells[j] == CELL) {\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcellCount ++;\n\t\t}\n\t\tif (found) break;\n\t}\n\tCELL_IDX = cellCount;\n\tdocument.getElementById('cellNumber').innerHTML = strCellNumber.replace('##number##', cellCount);\n}", "getNumOfConnectedComponents() {\n let numOfConnectedComponents = 0;\n\n const notVisited = new Set(this.nodes);\n while (notVisited.size) {\n const notVisitedArr = Array.from(notVisited);\n const source = notVisitedArr[0];\n const toVisitStack = [source];\n notVisited.delete(source);\n while (toVisitStack.length) {\n const currNode = toVisitStack.pop();\n for (let neighbor of currNode.adjacent) {\n if (notVisited.has(neighbor)) {\n toVisitStack.push(neighbor);\n notVisited.delete(neighbor);\n }\n }\n }\n numOfConnectedComponents++;\n }\n return numOfConnectedComponents;\n }", "function countPosition(count, i, j, ...rest) {\n\tif (rest.indexOf(1) !== -1) {\n\t\tif (data[i - 1][j - 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(2) !== -1) {\n\t\tif (data[i - 1][j] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(3) !== -1) {\n\t\tif (data[i - 1][j + 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(4) !== -1) {\n\t\tif (data[i][j - 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(6) !== -1) {\n\t\tif (data[i][j + 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(7) !== -1) {\n\t\tif (data[i + 1][j - 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(8) !== -1) {\n\t\tif (data[i + 1][j] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\tif (rest.indexOf(9) !== -1) {\n\t\tif (data[i + 1][j + 1] === 1) {\n\t\t\tcount++;\n\t\t}\n\t}\n\t\n\treturn count;\n}", "countNumbersInColumn(j){\r\n let count = 0;\r\n for(let i=1; i<=9; i++){\r\n if(this.getNumber(i, j)>0){\r\n count ++;\r\n }\r\n }\r\n return count;\r\n }", "function headerCountLiveNeighbors(board, location){\n var liveNeighbors = 0;\n //check above\n if(board[location - HEADERBOARDWIDTH] === HEADERALIVE && !headerInTopRow(location)){\n liveNeighbors++;\n }\n //check below\n if(board[location + HEADERBOARDWIDTH] === HEADERALIVE && !headerInBottomRow(location)){\n liveNeighbors++;\n }\n //check right\n if(board[location + 1] === HEADERALIVE && !headerInRightColumn(location)){\n liveNeighbors++;\n }\n //check left\n if(board[location - 1] === HEADERALIVE && !headerInLeftColumn(location)){\n liveNeighbors++;\n }\n //check aboveright\n if(board[location - HEADERBOARDWIDTH + 1] === HEADERALIVE && !headerInTopRow(location) && !headerInRightColumn(location)){\n liveNeighbors++;\n }\n //check aboveleft\n if(board[location - HEADERBOARDWIDTH - 1] === HEADERALIVE && !headerInTopRow(location) && !headerInLeftColumn(location)){\n liveNeighbors++;\n }\n //check belowright\n if(board[location + HEADERBOARDWIDTH + 1] === HEADERALIVE && !headerInBottomRow(location) && !headerInRightColumn(location)){\n liveNeighbors++;\n }\n //check belowleft\n if(board[location + HEADERBOARDWIDTH - 1] === HEADERALIVE && !headerInBottomRow(location) && !headerInLeftColumn(location)){\n liveNeighbors++;\n }\n return liveNeighbors;\n}", "function countNeighboursAlive(board, row, column, rules) {\n var neighbour = 0;\n let tempRow = 0;\n let tempCol = 0;\n let aliveCount = 0;\n\n // check each neighbour\n while (neighbour < NEIGHBOURSCOUNT) {\n tempRow = row + NeighboursCord[neighbour][0];\n tempCol = column + NeighboursCord[neighbour][1];\n // check if current neighbour's row is valid\n if (tempRow > -1 && tempRow < rules.ROW) {\n // check if current neighbour's column is valid\n if (tempCol > -1 && tempCol < rules.COLUMN) {\n if (board[tempRow][tempCol] == rules.ALIVE) aliveCount++;\n }\n }\n neighbour++;\n }\n return aliveCount;\n}" ]
[ "0.6740658", "0.6686302", "0.6622562", "0.66177654", "0.6582243", "0.65606385", "0.6558473", "0.652471", "0.63512546", "0.6331398", "0.6325522", "0.6306116", "0.6291829", "0.62904614", "0.6272278", "0.6240216", "0.6173889", "0.6167412", "0.6133891", "0.613344", "0.61299247", "0.61206883", "0.609936", "0.6097042", "0.60928756", "0.6048771", "0.6042417", "0.6039532", "0.60231704", "0.6014871", "0.6013176", "0.601241", "0.59899443", "0.59867054", "0.5954385", "0.5943468", "0.5943468", "0.5943468", "0.5943468", "0.5943468", "0.5943468", "0.5943468", "0.5943468", "0.5934053", "0.5916749", "0.5905537", "0.59005874", "0.5888376", "0.5882371", "0.5881109", "0.58784384", "0.58705246", "0.58189875", "0.581854", "0.58121186", "0.57838327", "0.5768917", "0.5759441", "0.57578063", "0.5756601", "0.5744043", "0.5744043", "0.5744043", "0.57400453", "0.5725678", "0.57059634", "0.57044697", "0.5704397", "0.570355", "0.5702981", "0.5663729", "0.5638181", "0.56350315", "0.56319904", "0.5631824", "0.5627568", "0.5611308", "0.55974084", "0.5583583", "0.55791116", "0.55778027", "0.5568504", "0.55625844", "0.55601394", "0.55593723", "0.554962", "0.55490154", "0.55375373", "0.55218923", "0.5520786", "0.5517837", "0.5517432", "0.55170417", "0.551582", "0.5511615", "0.5504299", "0.55040646", "0.548692", "0.54826176", "0.54813564" ]
0.66390324
2
indexOf keep and return the first index of every theme Parameters : self : array, value : what we want
onlyUnique(value, index, self) { return self.indexOf(value) === index; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getThemeBelow(){\r\n //get the current theme url string\r\n var curr = $themeMenu.val();\r\n \r\n //find the index in the array\r\n var index = -1;\r\n for(var i = 1 ; i < themes.length ; i+=1){\r\n if(themes[i] === curr){\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n var index = (index+1)%themes.length;\r\n if(index == 0){\r\n return 1;\r\n }\r\n return index;\r\n}", "function allIndexesOf (array, value) {\n return ;\n}", "indexOfValue(value) {\n for (let i = 0; i < this.length; i++) {\n if (this.data[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function isFirstOccurrence(value, i, array) {\n return (array.indexOf(value) === i);\n }", "function indexOf(list, value) {\n\n}", "indexOf(elemento){}", "indexOf(val) {}", "function firstIndexFunction(value, index, array) {\n return value >18;\n}", "triTheme(arr) {\n for (let i = 0; i < arr.length; i++) {\n for (let j = 1; j < arr.length; j++) {\n if (arr[i].theme === arr[j].theme) {\n arr.splice(i, 1)\n }\n }\n }\n }", "getCurrentIndex() {\n const index = this.filteredAppButtonList.indexOf(\n this.currentButtonFocused\n );\n if (index < 0 || index > this.maxIndex) {\n this.highlightInitialButton();\n }\n return index;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function searchValue(value) {\n let index = -1;\n for(let i=0; i<myArray.length; i++) {\n if(value === myArray[i]) {\n index = i;\n break;\n }\n }\n return index;\n}", "getFirstIndex() {\n // index of the top item\n return (this.maxIndex - Math.floor(this.index)) % this.maxIndex; \n }", "function adjustColorIndex(index) {\n if (index>0) {\n return (index-1)\n }\n else {\n return (iconList.length-1)\n }\n}", "function getFlavorByIndex(arr, i){\n return arr[i];\n}", "function _indexOf(value) {\n var i = 0,\n length = this.length;\n while (i < length) {\n if (this[i] === value) {\n return i;\n }\n i++;\n }\n return -1;\n }", "function funcGetIndex(arr, selected) {\n var arrIndex = jQuery.map(arr, function(e, i) {\n if (e.code == selected.code) return i;\n })\n return arrIndex.length ? arrIndex[0] : 0;\n }", "function funcGetIndex(arr, selected) {\n var arrIndex = jQuery.map(arr, function(e, i) {\n if (e.code == selected.code) return i;\n })\n return arrIndex.length ? arrIndex[0] : 0;\n }", "function _indexOf(value) {\n var i = 0,\n length = this.length;\n while (i < length) {\n if (this[i] === value) {\n return i;\n }\n i++;\n }\n return -1;\n }", "IndexOf() {\n\n }", "function findIndex(arr, val) {\n\n}", "function getFirstUniqueIndex() {\n for(var i = 1; i < Number.MAX_VALUE; i++) {\n if(!document.querySelector('.image_wrap .image_con > .image_pin[data-pin-index=\"' + i + '\"]')) {\n return i;\n }\n }\n }", "function findIndex(array, value) {\n\n\tfor(var i = 0; i < array.length; i++) {\n\t\t\n\t\tvar index = Object.values(array[i]).indexOf(value);\n\t\t\n\t\tif(index > -1) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}", "function findIndexNo(array, value) {\n\tfor(var i = 0; i < array.length; i++) {\n \tif (array[i].index === value) {\n \treturn i;\n } \n }\n return -1\n}", "function findIndexes(array,value){\r\n\tvar tempindexes=[];\r\n\tfor(var i=0; i<array.length; i++){\r\n\t\tif (array[i]===value) tempindexes.push(i);\r\n\t}\r\n\treturn tempindexes;\r\n}", "function index() {\n if ( Array.isArray( arr ) ) {\n return arr.indexOf( selected ); // set var for the current index value\n }\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n }", "indexOf(value) {\n let node = this.head, i = 0;\n while (node) {\n if (node.value === value) return i;\n node = node.next;\n i++;\n }\n return -1;\n }", "indexOf() {\n return this.choices.indexOf.apply(this.choices, arguments);\n }", "indexOf() {\n return this.choices.indexOf.apply(this.choices, arguments);\n }", "_getSelectedPersonaIndex(persona) {\n let selectedInitials = persona.text.toLowerCase().trim();\n\n var i;\n for (i = 0; i < this.state.personaList.length; i++) {\n let initials = this.state.personaList[i].text.toLowerCase().trim();\n if (initials === selectedInitials)\n return i + 1; //Use a 1-based index\n }\n }", "function indexOf(array, value) {\n\t\t\tfor (var i = 0, len = array.length; i < len; i++) {\n\t\t\t\tif (array[i] === value) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn -1;\n\t\t}", "getIndexOf(value) {\n let current = this.head;\n let index = 0;\n\n while (current) {\n if (current.value === value) {\n return index;\n }\n\n current = current.next;\n index ++;\n }\n\n return -1;\n }", "find(value) {\n const matches = [];\n this._viewCells.forEach(cell => {\n const cellMatches = cell.startFind(value);\n if (cellMatches) {\n matches.push(cellMatches);\n }\n });\n return matches;\n }", "function indexOf(array, value) {\n\t\t\t\tfor (var i = 0, len = array.length; i < len; i++) {\n\t\t\t\t\tif (array[i] === value) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn -1;\n\t\t\t}", "function indexOf(array, value) {\n //loop through array - checking each value until you find value that matches \n for(let i = 0; i < array.length; i++) {\n if (array[i] == value) {\n //you return i => index you're current on \n return i; \n }\n }\n //if you reach the end of loop w.o finding item return -1 => indicates item wasn't found\n return -1; \n}", "function indexOf(array, value) {\n for(let i = 0, len = array.length; i < len; i++) {\n if(array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "getBackgroundColor(index) {\n const colors = [\"#FF5154\", \"#50C9CE\", \"#8093F1\", \"292F36\", \"CB48B7\"];\n return colors[index];\n }", "function index(value) {\n var match = this.detect(function(pair) { \n return pair.value === value; \n });\n return match && match.key;\n }", "function indexOf(array, value) {\n\t\t for (var i = 0, len = array.length; i < len; i++) {\n\t\t if (array[i] === value) {\n\t\t return i;\n\t\t }\n\t\t }\n\t\t return -1;\n\t\t}", "function indexOfEl(listPast, el) {\n let current = listPast\n let index = 0\n const idxArr = []\n while (current) {\n if (current.value === el) idxArr.push(index)\n current = current.next\n index++\n }\n console.log(`idxArr ${idxArr}`)\n return idxArr\n }", "function value(element){\r\n var $selectionContainer = $(element).closest('.selection'),\r\n $selectables = $selectionContainer.find(settings.filter);\r\n return $selectables.index(element);\r\n }", "function indexOf(val) {\n return this.indexOf(val);\n}", "onlyUnique(value, index, self) {\n return self.indexOf(value) === index;\n }", "function firstValueFunction(value, index, array) {\n return value >18;\n}", "function _indexOf( array, value ) {\n\t\tfor( var i=array.length-1; i>=0; i-- ) {\n\t\t\tif( array[i] === value )\n\t\t\t\treturn i;\n\t\t}\n\t\treturn -1;\n\t}", "function index(value) {\n var match = this.detect(function(pair) {\n return pair.value === value;\n });\n return match && match.key;\n }", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function indexOf(array, value) {\n\t for (var i = 0, len = array.length; i < len; i++) {\n\t if (array[i] === value) {\n\t return i;\n\t }\n\t }\n\t return -1;\n\t}", "function find() {\n return function (arr, value) {\n var len = arr.length,\n i;\n for (i = 0; i < len; i += 1) {\n if (arr[i] === value) {\n return i;\n }\n }\n return -1;\n };\n }", "function looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n }", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function indexOf(array, value) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n return -1;\n}", "function detectChangedIndex(value){\n if(scroll_value[0]!=value[0]){\n scroll_value[0]=value[0];\n index=0;\n }\n else if(scroll_value[1]!=value[1]){\n scroll_value[1]=value[1];\n index=1;\n }\n}", "uniqueElement (value, index, self) {\n return self.indexOf(value) === index\n }", "idx(element, array) {\n let cont=0;\n for (let i of array) {\n if (i === element) {\n return cont;\n }\n cont += 1;\n }\n return cont;\n }", "function looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n }", "function looseIndexOf (arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) { return i }\n }\n return -1\n }" ]
[ "0.6691184", "0.58646584", "0.5816226", "0.55927277", "0.5585501", "0.55358964", "0.5447397", "0.5438506", "0.54280365", "0.5406039", "0.54002887", "0.5366569", "0.5339307", "0.53385544", "0.5323902", "0.5315461", "0.5310467", "0.52950364", "0.52950364", "0.52674", "0.5262792", "0.52614695", "0.5247357", "0.5236714", "0.52287924", "0.5225926", "0.52242744", "0.52194494", "0.52194494", "0.52194494", "0.52194494", "0.52194494", "0.52194494", "0.52194494", "0.52194494", "0.5203155", "0.5193193", "0.5193193", "0.5184979", "0.5178148", "0.51759297", "0.5167706", "0.5153251", "0.51506853", "0.5148918", "0.5140406", "0.51400775", "0.5097951", "0.50942606", "0.5068488", "0.5062817", "0.50606203", "0.50561565", "0.5055749", "0.5041698", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.50409794", "0.5033321", "0.5021114", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.5015926", "0.50117755", "0.50093824", "0.50083", "0.5007956", "0.5007956" ]
0.51310813
47
method to return a random number
random(min, max) { //Math.random value is between 0 and 1. We use Math.floor in order to get an integer between min and max. return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomNumber () {}", "function getNumber() {\n return Math.random();\n}", "function randomNumber() {\r\n return Math.random;\r\n}", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNumber(){\n return (Math.round(1 * Math.random()) + 1);\n }", "function randomNumber(){\n return Math.random\n}", "function randomNumber(){\r\n return Math.random();\r\n}", "function getNumber(){\n return (1 + Math.floor(48 * Math.random()));\n}", "function generateRandomNumber(){\n return Math.random();\n}", "function returnRandomNumber(){\n return Math.floor(Math.random() * 1084);\n}", "function randomNumber() {\n return (Math.round(Math.random()*100)+1);\n }", "random(): number {\n let u: number = (prng.random(): any);\n return this._random(u);\n }", "function randomNum() {\n var randomNumber = Math.round(999999999 * Math.random());\n\n return randomNumber;\n }", "function getRandomNum() {\n return Math.floor(1 + Math.random() * 10);\n}", "function randomNumber(){\n let rand = Math.floor(Math.random()*10);\n return(rand); \n}", "function randomNumber() {\n return Math.floor(Math.random() * 10 + 1);\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n }", "function returnRandomNumber() {\n return 'Look at this great number: ' + Math.random();\n}", "function randomNumberGenerator() {\n\treturn (Math.floor(((Math.random() * 9) + 1)));\n}", "function randomNumber(num){\r\n return Math.floor( Math.random() * num)\r\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "function randomNumber() {\n return Math.floor((Math.random() * 10) + 1)\n}", "generateRandomNumber() {\n return this.generateRandom(0, 10);\n }", "function randomint(){\n\tvar x = Math.floor(Math.random()*9);\n\treturn x;\n}", "function generateRandomlyNumber(){\n\treturn Math.floor(Math.random()*10)\n}", "function getRandNum() {\n var outRandom = Math.round(Math.random() * 900) + 100;\n return outRandom;\n}", "function randomNumber() {\n return Math.random() * 10;\n}", "function randomNumber() {\n return Math.random() * 10; \n}", "function randomNumber() {\n return Math.floor(Math.random() * 10) + 1;\n\n}", "function randomNumber() {\n return (1 + Math.round(Math.random() * 4));\n}", "function getRandomNumber(){\n /**\n * Math.random returns a number between 0 and 1,\n * and that's why we multiply it by 100\n */\n return Math.floor((Math.random() * 100) + 1);\n}", "function randomNumber(num) {\r\n\treturn Math.floor(Math.random() * num);\r\n}", "function generateRandomNumber(num){\r\n return Math.floor(Math.random() * num)\r\n}", "function generateNum() {\n\treturn Math.floor(Math.random()*100)\n}", "function randNum(){\n\tvar num = Math.floor(Math.random() * 9) +1 ;\n\treturn num;\n\n}", "function generateNumber() {\n return Math.floor(Math.random() * 256);\n }", "function getRandomNum(){\n var number = Math.floor(Math.random() * 9) + 1;\n return number;\n}", "function randomNumber() {\n return Math.floor(Math.random() * 256);\n}", "function getRandomNumber(){\r\n /**\r\n * Math.random returns a number between 0 and 1,\r\n * and that's why we multiply it by 100\r\n */\r\n return Math.floor((Math.random() * 100) + 1);\r\n}", "function getRandomNumber(num){\n\treturn Math.floor(Math.random() * num);\n}", "function randomNumber() {\n rndNumber = Math.floor((Math.random()*100)+1);\n }", "function getRandom(){\r\n\treturn Math.floor(Math.random() * 10);\r\n}", "getRandom() {\n return Math.floor((Math.random() * 10) + 1);\n }", "function randomNumberGenerator(){\n return Math.floor(Math.random()*1000);\n }", "function getRandomNumber() {\n return String.fromCharCode(Math.floor(Math.random() * 10) + 48)\n}", "function generateRandomNumber(){\n return Math.floor((Math.random()*100)+1);\n }", "function rand(num) {\n //Returns a random integer between 0 and num\n var randomNum = num * Math.random();\n var result = Math.floor(randomNum);\n return result; \n}", "function randomNum(num){\n return Math.floor(Math.random()*num);\n}", "function getRandomNumber() {\n return String.fromCharCode(Math.floor(Math.random() * 10) + 48);\n}", "function getRandomNum() {\n\treturn Math.floor(Math.random() * -999 + 2250);\n}", "rNum() {\n return Math.floor(Math.random() * (61) + 15) / 100;\n }", "function random(num){\n return Math.floor(num*Math.random());\n}", "function random(num){\r\n randomNumber = Math.floor(Math.random()*num);\r\n}", "function generateNumber() {\n result = Math.floor(Math.random() * 4) + 1\n return result\n}", "function Random_getNumber () {\n if ( !_isaac_weak_seeded || _isaac_counter >= 0x10000000000 )\n Random_weak_seed();\n\n var n = ( 0x100000 * _isaac_rand() + ( _isaac_rand() >>> 12 ) ) / 0x10000000000000;\n _isaac_counter += 2;\n\n return n;\n}", "function getRandomNumber(){\n return String.fromCharCode(Math.floor(Math.random()*10)+48);\n}", "function getRandomNumber () {\n return Math.floor(Math.random() * 256);\n}", "function getRandom() {\n\treturn Math.random();\n}", "function randomNumber(hi,lo){\n return random(hi,lo)\n}", "function randomNumber() {\n return Math.floor(Math.random() * MAX_NUMBER) + 1;\n}", "function getRandomNr() {\n return Math.floor(Math.random() * 10) + 300\n}", "static random () {\n return getRandomNumberFromZeroTo(500);\n }", "function getRandomInt(){\n return Math.floor(Math.random() * 10);\n}", "randomNum() {\n return Math.floor(Math.random() * 600);\n }", "function getRandomNumber(num) {\n return Math.floor(Math.random() * num);\n }", "function randomNum(){\n return Math.floor(Math.random() * 256)\n}", "function getRandomNumber(){\n number = Math.floor(Math.random() * 100) + 1\n return number\n}", "function init() {\n const randomNumber = genRandom();\n return number;\n}", "function Rand(num){\n //returns randon number between 0- num\nvar randnum = Math.random()*num;\nvar result Math.floor(randnum);\nreturn = result;\n\n}", "function random(number) {\n return Math.floor(Math.random()*number);\n}", "function randomness(number) {\n var randomNo = Math.floor(Math.random() * number);\n\n return randomNo;\n}", "function randomNum(){\n return Math.floor(Math.random() * 14);\n}", "generateRandomNumber (){\n let number = Math.floor((Math.random() * 10) + 1);\n return number;\n }", "function randomNumber() {\n return Math.floor(Math.random() * (4 - 0) + 0);\n}", "function randomNumGen(num){\n return Math.floor(Math.random() * num );\n}", "function randomNumber()\r\n{\r\n return Math.floor(Math.random()*12);\r\n}", "function getRandomNumber() {\n return numeral[Math.floor(Math.random() * numeral.length)];\n}", "function getRand() {\n return (Math.floor((Math.random() * 100) + 1));\n}", "function getRandomNum(){\n return Math.floor(Math.random()*4 + 1);\n}", "function randomNumberGenerator(){\n return Math.floor(Math.random()*1000);\n}", "function randomNumGen() {\n return Math.floor(Math.random() * 102) + 19;\n }", "randomNumber() {\n\t\treturn random([1, 2, 3, 4, 5, 6]);\n\t}", "function randomNum() {\nreturn Math.floor(Math.random() * 100)\n\n}", "function randomNumber() {\r\n return console.log(Math.random());\r\n}", "function getRandNum(x) { \r\n return Math.floor(Math.random() * x);\r\n}", "function random() {\n\treturn ((Math.random()*99)+1).toFixed();\n}", "function rand(number)\n{\n\tvar rand = Math.floor(Math.random() * number);\n\treturn rand;\n}", "function randomNum(num) {\n return Math.floor(Math.random() * num);\n}", "function random() {\n randomNum = Math.random();\n}", "function randomNr() {\n return Math.floor(Math.random() * 9999);\n}", "function newNumber(){\n var numero=Math.floor(Math.random()*highestNumber)+1;\n console.log(numero);\n return numero;\n}", "function randomNumberGenerator(){\n return (10+ Math.floor(Math.random()*(99-10+1)));\n}", "function randomNumGen(){\n return Math.floor(Math.random() * 100 + 1);\n}", "RandomInt(num) {\n\t\treturn Math.floor(Math.random() * num);\n\t}", "function generateNum() {\n return Math.round(Math.random() * 100);\n}", "function random(number) {\n return Math.floor(Math.random() * number);\n}" ]
[ "0.87659764", "0.8616641", "0.8549165", "0.84647435", "0.8441976", "0.8410082", "0.839208", "0.8376876", "0.83558387", "0.8351933", "0.82477206", "0.8238194", "0.8233361", "0.8217425", "0.8214662", "0.8199311", "0.81913215", "0.81840783", "0.8176416", "0.8168229", "0.8131849", "0.8131849", "0.8131849", "0.8131849", "0.8131849", "0.8131849", "0.8131849", "0.81168574", "0.8108718", "0.81078607", "0.81054527", "0.8101136", "0.80970186", "0.8084834", "0.80687195", "0.80593365", "0.8054604", "0.80488175", "0.80445075", "0.80434924", "0.80434376", "0.80366623", "0.8035994", "0.8035587", "0.8034742", "0.8031441", "0.8024239", "0.8013957", "0.8004914", "0.80022675", "0.7997363", "0.7993499", "0.7992748", "0.7982564", "0.7975228", "0.79718316", "0.7969788", "0.79673356", "0.79570657", "0.79340076", "0.7919456", "0.79182935", "0.7914826", "0.7895205", "0.7893701", "0.78894", "0.7878694", "0.78771394", "0.7876538", "0.7874778", "0.7871599", "0.7870405", "0.7867459", "0.78610337", "0.78600836", "0.78592616", "0.7847092", "0.78446615", "0.7841615", "0.7841168", "0.7838581", "0.7837495", "0.78314143", "0.78264374", "0.78248984", "0.7824513", "0.78237593", "0.7822858", "0.78195995", "0.78157014", "0.7814359", "0.7814052", "0.781305", "0.7812979", "0.7811869", "0.7809239", "0.77936524", "0.7784369", "0.7782532", "0.7782093", "0.7779295" ]
0.0
-1
method to return a random non themed part of sentence
readRandomPart() { let randomPartIndex = this.random(0, this.addPart.length-1); return this.addPart[randomPartIndex].toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomizeSentence(sentence) {\n\n}", "function getword(partOfSpeech) {\n return partOfSpeech[Math.floor(Math.random() * partOfSpeech.length)];\n}", "function randomStartingPhrase() {\n if (Math.random() < 0.33) {\n return phrases[Math.floor(Math.random() * phrases.length)]\n }\n return ''\n}", "function random_word(){\n var n = 4 + Math.floor(Math.random() * 6);\n return random_text(n);\n }", "randomText(positive) {\n const posPhrases = [\n 'Goed gedaan!',\n 'Netjes!',\n 'Je doet het súper!',\n 'Helemaal goed!',\n 'Je bent een topper!'\n ]\n const negPhrases = [\n 'Ik weet dat je het kunt!',\n 'Jammer, probeer het nog eens!',\n 'Bijna goed!',\n 'Helaas pindakaas'\n ]\n\n const phrases = positive ? posPhrases : negPhrases\n const maximumNumber = phrases.length\n const randomNumber = Math.floor(Math.random() * maximumNumber)\n \n return phrases[randomNumber]\n }", "function randomSentence() {\n var sentenceIndex = Math.floor(Math.random()*self.sentences.length)\n\n if (self.currentSentence !== sentenceIndex) {\n self.currentSentence = sentenceIndex\n } else {\n randomSentence()\n }\n }", "function nonsenseWord() {\n var word = chance.word({syllables: 3});\n return word;\n}", "randomSentence () {\n let sentenceArray = []\n let sentence1 = this.randomSentenceHelper();\n //sentence Array tracks each relative clause generated\n sentenceArray.push(sentence1);\n let num = Math.random();\n //loop continues to generate relative clauses until it fails to meet\n //the random check.\n while(num < Math.min(.85, this.complexity)) {\n let conj = this.randomWord(this.conjunctions);\n sentenceArray.push(conj);\n tempSentence = this.randomSentenceHelper();\n sentenceArray.push(tempSentence);\n num = Math.random();\n }\n joinedSentence = sentenceArray.join(' ');\n //change the first letter to uppercase and replace the last ',' with a '.'\n fullSentence = joinedSentence[0].toUpperCase() + joinedSentence.slice(1, joinedSentence.length -1) + '.';\n return fullSentence;\n }", "function getRandomNormalWord() {\n theWord = wordsNormal[Math.floor(Math.random() * wordsNormal.length)];\n console.log(theWord);\n return theWord\n}", "text(nChars){\n let text = \"\";\n while(text.length < nChars){\n let index = Math.floor((Math.random() * words.length));\n text += words[index] + \" \";\n }\n\n //If the text is longer cut it \n if(text.length > nChars){\n let difference = text.length - nChars;//lorem 3 \n text = text.substring(0,text.length - difference);\n }\n\n return text + \".\";\n }", "makeText(numWords = 100) {\n let randNum = Math.floor(Math.random() * this.words.length)\n let word = this.words[randNum]\n let str = ''\n\n for (let i = 0; i < numWords; i++) {\n str += `${word} `\n let randIdx = Math.floor(Math.random() * this.wordsObj[word].length)\n const nextWord = this.wordsObj[word][randIdx]\n if (nextWord === null) {\n // Remove the trailing space at the end of the sentence.\n str.replace(/\\s+$/, '')\n break\n }\n word = nextWord\n }\n\n return str\n }", "function getRandomPhrase() {\n const phrase = phrases[Math.floor(Math.random() * phrases.length)];\n return phrase;\n}", "function getRandom() {\n return Math.floor(Math.random() * words.length);\n}", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n\n}", "makeText(numWords = 100) {\n const startWordIndex = Math.floor(Math.random() * Object.keys(this.startChains).length);\n let prevWord = Object.keys(this.startChains)[startWordIndex];\n let randomText = prevWord;\n\n for (let i = 1; i < numWords; i++) {\n const nextRandom = Math.floor(Math.random() * this.chains[prevWord].length);\n const nextWord = this.chains[prevWord][nextRandom];\n randomText += ' ';\n if (nextWord) {\n randomText += nextWord.toLowerCase();\n prevWord = nextWord;\n } else {\n randomText += this.makeText(numWords - i);\n break;\n }\n }\n if (prevWord.charAt(prevWord.length - 1) === ',') {\n randomText = randomText.slice(0, randomText.length - 1)\n }\n if (!END_PUNCTUATION.includes(prevWord.charAt(prevWord.length - 1))) {\n randomText += '.'\n }\n return randomText.trim()\n }", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n}", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n}", "function wordRandomizer() {\r\n\treturn randomWords[Math.floor(Math.random()*randomWords.length)];\r\n}", "word(){\n let index = Math.floor((Math.random() * words.length));\n return words[index];\n }", "function getRandomWord(){\n return randomWords[Math.floor(Math.random() * randomWords.length)];\n}", "static readRandomSentence(theme) {\r\n console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); \r\n }", "function getRandom(word) {\n return word[Math.floor(Math.random() * word.length)];\n }", "function getRandomHardWord() {\n theWord = wordsHard[Math.floor(Math.random() * wordsHard.length)];\n console.log(theWord);\n return theWord\n}", "function getSentence (name) {\n\t\t// capitalise first letter of user name\n\t\tname = name.charAt(0).toUpperCase() + name.slice(1);\n\t\t// list of sentences\n\t\tvar sentences = [\n\t\t\tname + \"'s on an adventure right now...\",\n\t\t\t\"let's check in with \" + name + \"...\",\n\t\t\tname + \" is using Get Your Guide right now...\"\n\t\t];\n\t\t// random index generated\n\t\tvar index = Math.random();\n\t\t// upper value limit\n\t\tvar max = sentences.length - 1;\n\t\t// lower value limit\n\t\tvar min = 0;\n\t\t// return random value between max and min values\n\t\tindex = Math.floor(index * (max - min + 1)) + min;\n\t\t// return randomly selected sentence\n\t\treturn sentences[index];\n\t}", "getRandomPhrase() {\r\n let randomNumber = Math.floor(Math.random() * this.phrase.length);\r\n //console.log(randomNumber); \r\n return this.phrase[randomNumber];\r\n}", "function getRandomEasyWord() {\n theWord = wordsEasy[Math.floor(Math.random() * wordsEasy.length)];\n console.log(theWord);\n return theWord\n}", "function SelectWord() {\n\treturn words[Math.floor(Math.random()*words.length)];\n}", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * Math.floor(5));\n const randomPhrase = this.phrases[randNum];\n return randomPhrase;\n }", "getRandomPhrase() { // Gets a random phrase\n const rand = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n return rand;\n }", "function generateSentence() {\nvar randomIndex = Math.floor(Math.random() * sentences.length);\ncurrentSentence = sentences[randomIndex];\nprompt.innerHTML = currentSentence;\n}", "getRandomPhrase () {\n const phrases = this.phrases;\n const randIndex = Math.floor(Math.random() * phrases.length);\n return phrases[randIndex];\n }", "function str_rand() {\n var result = '';\n var words = '0123456789 qwertyuiop asdfghjklz xcvbnmQWER TYUIOPASDF GHJKLZXCVBNM';\n var max_position = words.length - 1;\n for (i = 0; i < 20; ++i) {\n position = Math.floor(Math.random() * max_position);\n result = result + words.substring(position, position + 1);\n }\n return result;\n}", "getRandomPhrase() {\n let randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\r\n let randomPhrase = this.phrases[Math.floor(Math\r\n .random() * this.phrases.length)];\r\n return randomPhrase;\r\n }", "function pickWord() {\n \"use strict\";\n return words[Math.floor(Math.random() * words.length)];\n}", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * this.phrases.length);\n const phrase = this.phrases[randNum];\n return phrase;\n }", "function chooseSentence (list) {\n var index = _.random(list.length - 1);\n var sentence = list[index];\n var madlibRequired = /{\\s*(?:noun|adj|buzz|num)\\s*}/i.test(sentence);\n\n if (madlibRequired) {\n sentence = madlib(sentence);\n }\n\n output(sentence);\n }", "getRandomPhrase() {\n let randomOneToFive = Math.floor(Math.random() * 5);\n return this.phrases[randomOneToFive];\n }", "getRandomPhrase() {\n //Generates random number between 0 and this.phrase.length -1 \n let num = Math.floor(Math.random() * this.phrases.length);\n let randomPhrase = this.phrases[num];\n return randomPhrase;\n }", "function generateRandomWord() {\n randomWord = words[Math.floor(Math.random() * (words.length))];\n}", "randomWords() {\n\n\t\tlet result = \"\";\n\t\tif(this.words.length !== 0) {\n\t\t\tlet count = this.words.length - 1;\n\t\t\tlet randomNumber = Math.round(Math.random(0, count) * count);\n\t\t\tlet word = this.words[randomNumber];\n\t\t\tresult = word.word.trim();\n\t\t}\n\t\treturn result;\n\t}", "function getWord() {\n var number = Math.floor(Math.random() * words.length);\n return words[number].toLowerCase();\n }", "getRandomPhrase() {\n var randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber]\n }", "function chooseWord(list_of_words){ \n return list_of_words[Math.floor(Math.random()*list_of_words.length)];\n}", "function pickWord(words) {\n return words[Math.floor(Math.random() * words.length)]\n}", "function getWord() {\n var wordIndex = Math.floor(Math.random() * 10);\n var word = words[wordIndex]\n return word\n}", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\r\n return this.phrases[Math.floor(Math.random()*this.phrases.length)];\r\n }", "function randomBlocText(k){\n result=\"\";\n for(var i=0;i<k;i++){\n var newWord=randomWord();\n if(i==0){\n newWord=capitalizeFirstLetter(newWord);\n }\n result+=randomPhrase();\n }\n return result;\n}", "getRandomPhrase() {\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "getRandomPhrase() {\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "getRandomPhrase(){\r\n let randomNumber = Math.floor((Math.random() * 5))\r\n return this.phrases[randomNumber];\r\n }", "getRandomPhrase() {\n let phraseArray = this.phrases;\n let randomPhrase = phraseArray[Math.floor(Math.random() * phraseArray.length)];\n return randomPhrase;\n }", "function pick() {\r\n index = Math.floor(Math.random() * words.length);\r\n return words[index];\r\n}", "getRandomPhrase(){\r\n const phraseIdx = Math.floor(Math.random() * this.phrases.length);\r\n return this.phrases[phraseIdx];\r\n }", "getRandomPhrase(){\n \t\tconst randomIndex = Math.floor(Math.random()*this.phrases.length)\n \t\treturn this.phrases[randomIndex];\n \t}", "function generateRandom() {\n // some random function to generate code, hidden\n return text;\n}", "randomWord() {\n return this.randomOption(this.words);\n }", "function getRandomWord() {\n var x = Math.random() * library.length;\n x = Math.floor(x);\n return library[x];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "function randomWord() {\r\n answer = guessme[Math.floor(Math.random() * guessme.length)];\r\n console.log(answer);\r\n}", "function selectWord() {\n return wordList[Math.floor(Math.random() * wordList.length)];\n }", "function getRandomWord() {\n // array taken from https://gist.github.com/borlaym/585e2e09dd6abd9b0d0a\n wordList = [\n \"Aardvark\",\n \"Albatross\",\n \"Alligator\",\n \"Alpaca\",\n \"Ant\",\n \"Anteater\",\n \"Antelope\",\n \"Ape\",\n \"Armadillo\",\n \"Donkey\",\n \"Baboon\",\n \"Badger\",\n \"Barracuda\",\n \"Bat\",\n \"Bear\",\n \"Beaver\",\n \"Bee\",\n \"Bison\",\n \"Boar\",\n \"Buffalo\",\n \"Butterfly\",\n \"Camel\",\n \"Capybara\",\n \"Caribou\",\n \"Cassowary\",\n \"Cat\",\n \"Caterpillar\",\n \"Cattle\",\n \"Chamois\",\n \"Cheetah\",\n \"Chicken\",\n \"Chimpanzee\",\n \"Chinchilla\",\n \"Chough\",\n \"Clam\",\n \"Cobra\",\n \"Cockroach\",\n \"Cod\",\n \"Cormorant\",\n \"Coyote\",\n \"Crab\",\n \"Crane\",\n \"Crocodile\",\n \"Crow\",\n \"Curlew\",\n \"Deer\",\n \"Dinosaur\",\n \"Dog\",\n \"Dogfish\",\n \"Dolphin\",\n \"Dotterel\",\n \"Dove\",\n \"Dragonfly\",\n \"Duck\",\n \"Dugong\",\n \"Dunlin\",\n \"Eagle\",\n \"Echidna\",\n \"Eel\",\n \"Eland\",\n \"Elephant\",\n \"Elk\",\n \"Emu\",\n \"Falcon\",\n \"Ferret\",\n \"Finch\",\n \"Fish\",\n \"Flamingo\",\n \"Fly\",\n \"Fox\",\n \"Frog\",\n \"Gaur\",\n \"Gazelle\",\n \"Gerbil\",\n \"Giraffe\",\n \"Gnat\",\n \"Gnu\",\n \"Goat\",\n \"Goldfinch\",\n \"Goldfish\",\n \"Goose\",\n \"Gorilla\",\n \"Goshawk\",\n \"Grasshopper\",\n \"Grouse\",\n \"Guanaco\",\n \"Gull\",\n \"Hamster\",\n \"Hare\",\n \"Hawk\",\n \"Hedgehog\",\n \"Heron\",\n \"Herring\",\n \"Hippopotamus\",\n \"Hornet\",\n \"Horse\",\n \"Human\",\n \"Hummingbird\",\n \"Hyena\",\n \"Ibex\",\n \"Ibis\",\n \"Jackal\",\n \"Jaguar\",\n \"Jay\",\n \"Jellyfish\",\n \"Kangaroo\",\n \"Kingfisher\",\n \"Koala\",\n \"Kookabura\",\n \"Kouprey\",\n \"Kudu\",\n \"Lapwing\",\n \"Lark\",\n \"Lemur\",\n \"Leopard\",\n \"Lion\",\n \"Llama\",\n \"Lobster\",\n \"Locust\",\n \"Loris\",\n \"Louse\",\n \"Lyrebird\",\n \"Magpie\",\n \"Mallard\",\n \"Manatee\",\n \"Mandrill\",\n \"Mantis\",\n \"Marten\",\n \"Meerkat\",\n \"Mink\",\n \"Mole\",\n \"Mongoose\",\n \"Monkey\",\n \"Moose\",\n \"Mosquito\",\n \"Mouse\",\n \"Mule\",\n \"Narwhal\",\n \"Newt\",\n \"Nightingale\",\n \"Octopus\",\n \"Okapi\",\n \"Opossum\",\n \"Oryx\",\n \"Ostrich\",\n \"Otter\",\n \"Owl\",\n \"Oyster\",\n \"Panther\",\n \"Parrot\",\n \"Partridge\",\n \"Peafowl\",\n \"Pelican\",\n \"Penguin\",\n \"Pheasant\",\n \"Pig\",\n \"Pigeon\",\n \"Pony\",\n \"Porcupine\",\n \"Porpoise\",\n \"Quail\",\n \"Quelea\",\n \"Quetzal\",\n \"Rabbit\",\n \"Raccoon\",\n \"Rail\",\n \"Ram\",\n \"Rat\",\n \"Raven\",\n \"Red deer\",\n \"Red panda\",\n \"Reindeer\",\n \"Rhinoceros\",\n \"Rook\",\n \"Salamander\",\n \"Salmon\",\n \"Sand Dollar\",\n \"Sandpiper\",\n \"Sardine\",\n \"Scorpion\",\n \"Seahorse\",\n \"Seal\",\n \"Shark\",\n \"Sheep\",\n \"Shrew\",\n \"Skunk\",\n \"Snail\",\n \"Snake\",\n \"Sparrow\",\n \"Spider\",\n \"Spoonbill\",\n \"Squid\",\n \"Squirrel\",\n \"Starling\",\n \"Stingray\",\n \"Stinkbug\",\n \"Stork\",\n \"Swallow\",\n \"Swan\",\n \"Tapir\",\n \"Tarsier\",\n \"Termite\",\n \"Tiger\",\n \"Toad\",\n \"Trout\",\n \"Turkey\",\n \"Turtle\",\n \"Viper\",\n \"Vulture\",\n \"Wallaby\",\n \"Walrus\",\n \"Wasp\",\n \"Weasel\",\n \"Whale\",\n \"Wildcat\",\n \"Wolf\",\n \"Wolverine\",\n \"Wombat\",\n \"Woodcock\",\n \"Woodpecker\",\n \"Worm\",\n \"Wren\",\n \"Yak\",\n \"Zebra\"\n ];\n\n var x = Math.floor((Math.random() * wordList.length));\n return wordList[x].toUpperCase();\n }", "makeText(numWords = 100) {\n // TODO\n const keys = Object.keys(this.chains)\n let text = ''\n let prevWord;\n for(let i = 0; i <= numWords; i++){\n if(prevWord === undefined){\n let ranKey = keys[Math.floor(Math.random() * keys.length)]\n let ranWord = this.chains[ranKey][Math.floor(Math.random() * this.chains[ranKey].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord\n }\n }else{\n let ranWord = this.chains[prevWord][Math.floor(Math.random() * this.chains[prevWord].length)]\n if(ranWord !== undefined){\n text = text+ranWord+' '\n prevWord = ranWord;\n }else{\n break\n }\n }\n }\n return text.trim();\n }", "function getRandomWord() {\n var wordList = [\"DOG\",\"BIRD\",\"MOOSE\",\"CAT\",\"HORSE\",\"COW\",\"PIG\"];\n return wordList[Math.floor(Math.random() * wordList.length)];\n }", "static generateRandomText() {\n return Math.random().toString(36).substr(2); // remove `0.`\n }", "function getRandomWord() {\n const index = Math.floor(Math.random() * dictionary.length);\n return dictionary[index];\n}", "generateRandomSentence() {\n if (this.state.loaded) {\n var name = this.state.wubbynames[getRandomInt(0, this.state.wubbynames.length-1)].content;\n var action = this.state.sentenceActions[getRandomInt(0, this.state.sentenceActions.length-1)].content;\n var obj = this.state.sentenceObjects[getRandomInt(0, this.state.sentenceObjects.length-1)].content;\n\n var sentence = 'I want ' + name + ' to ' + action + ' with ' + obj;\n this.setState({ currentSentence: sentence });\n }\n\n }", "function randWord(){\n var a = 'abtchyplwwah'; \n var b = 'aeyuioee';\n var c = 'eetleouiynmcc'\n var d = 'mnbceeytplttk';\n var w = [a,b,c,d];\n var str = '';\n for(var i=0; i++; i<4)\n {\n var n = (w[i][Math.floor(Math.random() * w[i].length)]);\n n = n || 'e';\n str += n;\n }\n\n }", "function generateContent() {\n const content = faker.lorem.text();\n return content = content[Math.floor(Math.random() * content.length)];\n}", "function getSearchSeed() {\n if(randomWords.length === 0 && !isPopulating) {\n populateRandomWords();\n }\n\n algo = Math.floor(Math.random() * 9) + 1;\n if(algo === 1) {\n return nonsenseWord();\n } else if(algo === 2) {\n return nonsenseChinesePhrase();\n } else if(algo === 3) {\n return nonsenseJapanesePhrase();\n } else if(algo === 4) {\n return nonsenseCyrillic();\n } else if(algo === 5) {\n return randomCharacters();\n } else if(algo === 6) {\n return nonsenseHangul();\n } else if(algo === 7) {\n return nonsenseArabic();\n } else if(algo === 8) {\n return nonsenseLatin();\n } else if (algo === 9) {\n if(randomWords.length === 0) {\n return nonsenseLatin();\n } else {\n var word = randomWords.pop();\n return word;\n }\n }\n}", "makeText(numWords = 100) {\n // TODO\n\n let chainObj = this.makeChains();\n let randomStarIdx = Math.floor(Math.random() * this.words.length);\n let randomStartWord = this.words[randomStarIdx];\n let text = [randomStartWord];\n\n for (let i = 0; i < numWords - 1; i++) {\n let value = chainObj[text[i]]\n\n if (value[0] === null) {\n return text.join(' ');\n }\n if (value.length === 1) {\n text.push(value);\n } else {\n let randomIdx = Math.floor(Math.random() * value.length);\n let randomWord = value[randomIdx];\n text.push(randomWord);\n }\n }\n\n return text.join(' ');\n }", "function pickWord(words) {\n var word = stringToArray(words[Math.floor((Math.random() * words.length) + 0)]);\n return word;\n}", "function randomWord() {\n result = wordslist[Math.floor(Math.random()*wordslist.length)];\n}", "getRandomPhrase() {\n const randomPhrase = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomPhrase];\n }", "function randomizeLine(num){\n var result = \"\";\n while (num > 0){\n var j = Math.round(Math.random() * (num - 1) + 1);\n var randomWord = getRandomWord(j);\n result += randomWord + \" \";\n num -= j;\n }\n\n return result;\n}", "makeText(numWords = 50) {\n let newText = \"\";\n // initially word will be a random word from words arr\n let word = this.words[Math.floor(Math.random() * this.words.length)]\n newText = newText + word + \" \";\n for (let i=0; i<numWords; i++) {\n if (this.chains[word][0] == null) {\n return newText;\n } else {\n word = this.chains[word][Math.floor(Math.random() * this.chains[word].length)]\n newText = newText + word + \" \";\n }\n }\n\n return newText;\n }", "makeText(numWords = 100) {\n const numWordsAv = Object.keys(this.chains).length;\n let randNum, text;\n do {\n randNum = Math.floor(Math.random() * numWordsAv);\n text = [Object.keys(this.chains)[randNum]];\n } while (text[0] === text[0].toLowerCase())\n\n if (text[0].slice(-1) === '.') {\n return text.toString();\n }\n \n for (let i = 0; i < numWords - 1; i++) {\n let randNum = Math.floor(Math.random() * this.chains[text[i]].length);\n if (this.chains[text[i]][randNum] === null ) {\n break;\n } else {\n text.push(this.chains[text[i]][randNum])\n if (this.chains[text[i]][randNum].slice(-1) ==='.') break;\n }\n }\n return text.join(\" \")\n }", "function getRandomWord() {\r\n\twordString = wordRandomizer();\r\n\tlowerCaseRandomWord = wordString.toLowerCase();\r\n}", "function randomWord(){\n answer = fruits[Math.floor(Math.random() * fruits.length)];\n}", "getRandomPhrase(){\n return this.phrases[Math.floor(Math.random() * this.phrases.length)];\n }", "function getSearchPhrase() {\n return (['Search', 'Find', 'Let\\'s Travel', 'Look up', 'Go'])[Math.floor(Math.random() * 5)];\n}", "function GetRandomPieceOfText(theText, size) {\n\tvar repeat = 0;\n\tvar offset = 0;\n\tvar ret = \"\";\n\n\tif (size < theText.length) {\n\t\t// We can deliver the string size they want, but start at the end to give differnet strings in different instances\n\t\t// first, figure out how many chunks of text of size 'size' are in my lorem\n\t\tvar availChunks = parseInt(theText.length / size);\n\t\t// Pick a random chunk to fulfill this call\n\t\tvar thechunk = Math.floor(Math.random() * availChunks);\n\t\toffset = thechunk * size;\n\t\tret = theText.substr(offset, size);\n\t}\n\telse {\n\t\t// Requested length is longer than the string we have, so repeat it.\n\t\trepeat = parseInt(theText.length / size);\n\t\tvar times = 0;\n\t\tfor (times = 0; times < repeat; times++) {\n\t\t\tret += theText;\n\t\t}\n\t\tvar left = size - (theText.length * repeat);\n\t\tret += theText.substr(0, left);\n\t}\n\n\treturn ret;\n}", "function randomWord(){\n\tsecretWord = words[Math.floor(Math.random()*words.length)].split(\"\");\n\twordSize = secretWord.length;\n}", "function selectWord() { \n var words = [\"apple\", \"ice\", \"orange\", \"car\", \"computer\", \n \"game\", \"math\", \"school\", \"juice\", \"soda\", \n \"carrot\", \"purple\", \"movie\", \"superhero\"];\n return words[Math.round(Math.random() * words.length)];\n}", "function randomWordGen() {\n randomWord = words[Math.floor(Math.random() * words.length)];\n console.log(randomWord);\n return randomWord;\n\n}", "function getRandomWord(json, partOfSpeech) {\n\tvar possibilities = [];\n\n\tfor(var i = 0; i < json.length; i++) {\n\t\tvar word = json[i];\n\t\tif(word.tags) {\n\t\t\tif(word.tags.indexOf(partOfSpeech) > -1 && word.word.indexOf(\" \") < 0) {\n\t\t\t\tpossibilities.push(word.word);\n\t\t\t}\n\t\t}\n\t}\n\treturn possibilities[Math.floor(Math.random()*possibilities.length)];\n}", "getText(numWords = 100) {\n let outputText = [];\n \n let keys = Array.from(Object.keys(this.markovChains));\n let keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n while (numWords > 0) {\n let wordChoices = this.markovChains[keyWord];\n let nextWord = MarkovMachine.randomlyPickElement(wordChoices);\n\n if (nextWord === null) {\n outputText.push(`${keyWord}.`);\n keyWord = MarkovMachine.randomlyPickElementNotNull(keys);\n\n } else {\n outputText.push(keyWord);\n keyWord = nextWord;\n\n }\n\n numWords--;\n }\n\n let returnedText = outputText.join(\" \");\n return returnedText;\n\n }", "function randomizer (word) {\n\t\treturn Math.floor((Math.random() * 800) + word.length*55); //used to be +200\n\t}", "function pickword() {\n let word = wordPool[Math.floor(Math.random() * wordPool.length)];\n return word;\n}", "function rndChooseWord() {\n\n // This randomly selects a word from the list\n currentWordPos = (Math.floor(Math.random() * (wordstring.length)) + 1);\n\n}", "function selectRandomWord(words){\n let wordIndex = Math.floor(Math.random()*words.length);\n return words[wordIndex];\n }", "getRandomPhrase() {\n const index1 = Math.floor(Math.random() * this.phrases.length);\n function index2(index1) {\n return Math.floor(Math.random() * game.phrases[index1].length);\n }\n if (index1 === 0) {\n this.clue = 'Video Games';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 1) {\n this.clue = 'Literature';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 2) {\n this.clue = 'Golden Girls Quotes';\n return this.phrases[index1][index2(index1)];\n } else {\n this.clue = 'Crafts';\n return this.phrases[index1][index2(index1)];\n }\n }", "getRandomPhrase() {\n const randomPhrase = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n //return the function by calling the randomPhrase variable\n return randomPhrase;\n }", "getText(numWords = 100) {\n // MORE CODE HERE\n let textArr = [];\n let wordChoice = Array.from(this.words);\n let word = this.getRandomElement(wordChoice)\n \n \n while (textArr.length < numWords && word !== null){\n textArr.push(word)\n\n let nextWord = this.getRandomElement(this.chain.get(word))\n //append to textarr the newly defined word\n word = nextWord\n\n }\n return textArr.join(\" \");\n }", "function generateSentence(msgContent){\r\n var words = [];\r\n var sentence = \"\";\r\n var returnSentence = \"\";\r\n var no = false;\r\n var continueWordLoop = true;\r\n var beginLength = 0;\r\n\r\n var lastWords = \"\";\r\n\r\n var random = Math.random();\r\n if(random < startWordR.length/(startWordR.length+startWordIIR.length+startWordIIIR.length) ){\r\n beginLength = 1;\r\n }else if(random < (startWordR.length+startWordIIR.length)/(startWordR.length+startWordIIR.length+startWordIIIR.length) ){\r\n beginLength = 2;\r\n }else{\r\n beginLength = 3;\r\n }\r\n\r\n if(beginLength == 1){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordR.length; i++){\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordR[i] == currentContext[j]){startTempList[startTempList.length] = startWordR[i]}\r\n }\r\n }\r\n if(startTempList.length > 0){\r\n words[0] = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n }else{\r\n words[0] = startWordR[Math.floor(Math.random()*startWordR.length)];\r\n };\r\n }\r\n\r\n if(beginLength == 2){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordIIR.length; i++){\r\n var matchCounter = 0;\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordIIR[i][0] == currentContext[j]){matchCounter++};\r\n if(startWordIIR[i][1] == currentContext[j]){matchCounter++};\r\n }\r\n for(var j = 0; j < matchCounter; j++){\r\n startTempList[startTempList.length] = startWordIIR[i];\r\n }\r\n }\r\n if(startTempList.length > 0){\r\n words = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n }else{\r\n words = startWordIIR[Math.floor(Math.random()*startWordIIR.length)];\r\n };\r\n }\r\n\r\n if(beginLength == 3){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordIIIR.length; i++){\r\n var matchCounter = 0;\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordIIIR[i][0] == currentContext[j]){matchCounter++};\r\n if(startWordIIIR[i][1] == currentContext[j]){matchCounter++};\r\n if(startWordIIIR[i][2] == currentContext[j]){matchCounter++};\r\n }\r\n for(var j = 0; j < matchCounter; j++){\r\n startTempList[startTempList.length] = startWordIIIR[i];\r\n };\r\n };\r\n if(startTempList.length > 0){\r\n words = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n for(var i = 0; i < startWordIIIR.length; i++){\r\n if(startWordIIIR[i] == words){var number = i}\r\n }\r\n }else{\r\n var number = Math.floor(Math.random()*startWordIIIR.length);\r\n words = startWordIIIR[number];\r\n };\r\n\r\n\r\n lastWords = words;\r\n lastWordsNumber = 0;\r\n\r\n var loopCounter = 0;\r\n do{\r\n for(var j = 0; j <= seqR.length; j++){\r\n if(j < seqR.length){\r\n if(seqR[j][0][0] == lastWords[0] && seqR[j][0][1] == lastWords[1] && seqR[j][0][2] == lastWords[2]){\r\n lastWordsNumber = j\r\n foundResult = true;\r\n break;\r\n }\r\n }else{\r\n continueWordLoop = false;\r\n }\r\n }\r\n var tempList = [];\r\n for(var i = 1; i < seqR[lastWordsNumber].length; i++){\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(currentContext[j] == seqR[lastWordsNumber][i]){\r\n tempList[tempList.length] = currentContext[j];\r\n }\r\n }\r\n }\r\n var nextWord = \"\";\r\n if(tempList.length > 0){\r\n nextWord = tempList[ Math.floor(Math.random()*tempList.length) ];\r\n }else{\r\n nextWord = seqR[lastWordsNumber][ Math.floor(Math.random()*(seqR[lastWordsNumber].length-1))+1 ];\r\n }\r\n if(nextWord != \"█| END |█\"){\r\n words[words.length] = nextWord;\r\n startWordIIIR[number] = [ startWordIIIR[number][0], startWordIIIR[number][1], startWordIIIR[number][2] ];\r\n lastWords = [ words[words.length-3], words[words.length-2], words[words.length-1] ];\r\n }else{\r\n continueWordLoop = false;\r\n }\r\n loopCounter++\r\n if(loopCounter > 1000){\r\n continueWordLoop = false;\r\n console.log(\"\\nWARNING\\nInfinite (or super long) loop!\\nTerminating sentence.\");\r\n }\r\n }while(continueWordLoop);\r\n }\r\n\r\n for(var i = 0; i < words.length; i++){\r\n sentence = sentence + \" \" + words[i];\r\n }\r\n returnSentence = sentence;\r\n //checking if sentence is not banned\r\n for(var i = 0; i < bannedSentences.length; i++){\r\n if(returnSentence == bannedSentences[i]){\r\n no = true;\r\n }\r\n }\r\n if(no){\r\n generateSentence(msgContent);\r\n }else{\r\n return returnSentence;\r\n }\r\n}", "makeText(numWords = 100) {\n let keys = Object.keys(this.chains);\n let key = keys[Math.floor(Math.random() * Math.floor(keys.length))];\n let textArray = [];\n\n while (textArray.length < numWords && key !== null) {\n textArray.push(key);\n key = this.chains[key][\n Math.floor(Math.random() * Math.floor(this.chains[key].length))\n ];\n }\n return textArray.join(\" \");\n }", "function randomize(text){\n var textArray=[];\n\n //first turn the string into an array\n for(var i=0;i<text.length;i++){\n textArray[i]=text.charAt(i);\n }\n \n var aux;\n var random;\n\n //For the lenght of the array, every element is randomly switched \n for(var i=0;i<text.length;i++){\n random=Math.floor(Math.random()*textArray.length);\n aux=textArray[random];\n textArray[random]=textArray[i];\n textArray[i]=aux;\n }\n\n var resp=\"\";\n\n //turn the array into a string\n for(var i=0;i<text.length;i++){\n resp=resp.concat(textArray[i]);\n }\n\n //return the mixed string\n return resp;\n}", "function simpleText()\n {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n for( var i=0; i < 5; i++ )\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n\n return text;\n }" ]
[ "0.7842455", "0.75747615", "0.74690783", "0.740224", "0.7359653", "0.71818244", "0.718092", "0.71750075", "0.7074708", "0.7059686", "0.7034547", "0.7031459", "0.6985719", "0.69676095", "0.6965873", "0.69494635", "0.69494635", "0.6946161", "0.69311845", "0.69005877", "0.69005656", "0.68963397", "0.68943405", "0.6873174", "0.6865729", "0.6855027", "0.68317854", "0.6803237", "0.68011373", "0.67986035", "0.67895526", "0.67714584", "0.6769939", "0.6761557", "0.67614615", "0.6755019", "0.6744934", "0.674113", "0.67270356", "0.67241085", "0.6721767", "0.6720896", "0.6709656", "0.6699846", "0.6686373", "0.6675594", "0.6665265", "0.6665265", "0.6665265", "0.6658877", "0.6652013", "0.664933", "0.664933", "0.66489446", "0.6646566", "0.66362035", "0.66345304", "0.66278565", "0.66262686", "0.6625906", "0.66233927", "0.6591151", "0.65783024", "0.6574544", "0.65736824", "0.65717125", "0.65712243", "0.6570147", "0.6563523", "0.65610236", "0.65493816", "0.6546642", "0.654479", "0.65419996", "0.6535113", "0.6529489", "0.65287644", "0.65278935", "0.6524668", "0.65093344", "0.65025187", "0.6499899", "0.64982164", "0.64980227", "0.64881206", "0.6477134", "0.6465393", "0.64630127", "0.64612925", "0.6457262", "0.6449761", "0.6444982", "0.64221257", "0.6418435", "0.64150697", "0.6409824", "0.6407013", "0.6401564", "0.63975805", "0.63958365", "0.63821805" ]
0.0
-1
method to pick a random selected theme part of sentence and return it
readRandomThemedPart(theme) { //filter compare the theme of every elements of the array to return those with the theme we selected let filteredFirstPart = this.addPart.filter(element=>element.theme === theme); if (filteredFirstPart.length === 0) { filteredFirstPart = this.addPart; //if the variable stores nothing, we use the entire array console.warn("Aucune correspondance pour ce thème, toutes les phrases sont utilisées."); } //variable that select a random part a/mong filteredFirstPart. const selectedPartIndex = this.random(0,filteredFirstPart.length-1); return filteredFirstPart[selectedPartIndex].toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectWord() {\n\treturn words[Math.floor(Math.random()*words.length)];\n}", "static readRandomSentence(theme) {\r\n console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); \r\n }", "function selectWord() {\n return wordList[Math.floor(Math.random() * wordList.length)];\n }", "function selectWord() { \n var words = [\"apple\", \"ice\", \"orange\", \"car\", \"computer\", \n \"game\", \"math\", \"school\", \"juice\", \"soda\", \n \"carrot\", \"purple\", \"movie\", \"superhero\"];\n return words[Math.round(Math.random() * words.length)];\n}", "function pick() {\r\n index = Math.floor(Math.random() * words.length);\r\n return words[index];\r\n}", "function pickWord() {\n \"use strict\";\n return words[Math.floor(Math.random() * words.length)];\n}", "function pickTweetText() {\n let options = [\n \"Actually... Crypto stands for CRYPTOGRAPHY!\",\n \"Hey, just a reminder, hashtag CRYPTO means cryptography 🤓\",\n \"crypto => C.R.Y.P.T.O.G.R.A.P.H.Y not cryptocurrency! 🤨\",\n \"Will you stop using hashtag *crypto* ... it's CRYPTOGRAPHY, not cryptocurrency #goStudy\",\n \"Please stop using the word *crypto* incorrectly. It stands for CRYPTOGRAPHY, not cryptocurrency 🤨\",\n \"Kind correction: crypto stands for cryptography, NOT cryptocurrency ;)\"\n ];\n return options[Math.floor(Math.random() * 5)];\n}", "function selectRandomWord(words){\n let wordIndex = Math.floor(Math.random()*words.length);\n return words[wordIndex];\n }", "function rndChooseWord() {\n\n // This randomly selects a word from the list\n currentWordPos = (Math.floor(Math.random() * (wordstring.length)) + 1);\n\n}", "function pickWord(words) {\n return words[Math.floor(Math.random() * words.length)]\n}", "function chooseWord(list_of_words){ \n return list_of_words[Math.floor(Math.random()*list_of_words.length)];\n}", "function pickWord(word) {\n var words = [\"monkey\", \"crocodile\", \"hippopotamus\", \"giraffe\", \"pterodactyl\"];\n var word = words[Math.floor(Math.random() * words.length)];\n return word; // Return a random word\n}", "function random_word(){\n var n = 4 + Math.floor(Math.random() * 6);\n return random_text(n);\n }", "function pickWord(words) {\n var word = stringToArray(words[Math.floor((Math.random() * words.length) + 0)]);\n return word;\n}", "function pickword() {\n let word = wordPool[Math.floor(Math.random() * wordPool.length)];\n return word;\n}", "function pickword(dictionary) {\n return dictionary[Math.floor(Math.random() * (dictionary.length - 1))];\n }", "function chooseRandomWord() {\n //store random word\n currentWord = wordLibraryArray[Math.floor(Math.random() * wordLibraryArray.length)];\n currentWordArray = currentWord.split('');\n remainingLetters = currentWord.length;\n displayStatus(currentWord);\n}", "function randColor() {\n\n // Set random word\n\n\n // Set random word color\n\n\n }", "function pickSearchTerm() {\n let options = [\"stop\", \"mad\", \"angry\", \"annoyed\", \"cut it\" ];\n return options[Math.floor(Math.random() * 4)];\n}", "function getWord() {\n var number = Math.floor(Math.random() * words.length);\n return words[number].toLowerCase();\n }", "function getWord() {\n\tvar index = getRandomIntInclusive(0, words.length - 1);\n\twordSelected = words[index];\n\treturn wordSelected;\n}", "word(){\n let index = Math.floor((Math.random() * words.length));\n return words[index];\n }", "function getword(partOfSpeech) {\n return partOfSpeech[Math.floor(Math.random() * partOfSpeech.length)];\n}", "function getWord() {\n var wordIndex = Math.floor(Math.random() * 10);\n var word = words[wordIndex]\n return word\n}", "function wordSelect() {\n // Select a word\n //Math.floor(Math.random() * (max - min) + min)\n let rnd = Math.floor(Math.random() * wordBank.length);\n\n let word = wordBank[rnd].toLowerCase();\n // let word = \"node js\"; // for testing\n //console.log(word);\n \n let result = new Word(word);\n // store the word\n return result;\n}", "function selectRandom(){\n var randomNumber = Math.floor(Math.random() * (1, arrayLength));\n var randomWord = wordArray[randomNumber];\n return randomWord;\n}", "function getRandom(word) {\n return word[Math.floor(Math.random() * word.length)];\n }", "function pickWord(list) {\n return list[Math.floor(Math.random() * list.length)];\n}", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n\n}", "randomText(positive) {\n const posPhrases = [\n 'Goed gedaan!',\n 'Netjes!',\n 'Je doet het súper!',\n 'Helemaal goed!',\n 'Je bent een topper!'\n ]\n const negPhrases = [\n 'Ik weet dat je het kunt!',\n 'Jammer, probeer het nog eens!',\n 'Bijna goed!',\n 'Helaas pindakaas'\n ]\n\n const phrases = positive ? posPhrases : negPhrases\n const maximumNumber = phrases.length\n const randomNumber = Math.floor(Math.random() * maximumNumber)\n \n return phrases[randomNumber]\n }", "function randomStartingPhrase() {\n if (Math.random() < 0.33) {\n return phrases[Math.floor(Math.random() * phrases.length)]\n }\n return ''\n}", "function getRandomPhrase() {\n const phrase = phrases[Math.floor(Math.random() * phrases.length)];\n return phrase;\n}", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n}", "function getRandomWord() {\n return words[Math.floor(Math.random() * words.length)];\n}", "function getRandomWord(){\n return randomWords[Math.floor(Math.random() * randomWords.length)];\n}", "function getRandomNormalWord() {\n theWord = wordsNormal[Math.floor(Math.random() * wordsNormal.length)];\n console.log(theWord);\n return theWord\n}", "randomWord() {\n return this.randomOption(this.words);\n }", "function getRandomWord() {\n var x = Math.random() * library.length;\n x = Math.floor(x);\n return library[x];\n }", "getRandomPhrase() {\n const index1 = Math.floor(Math.random() * this.phrases.length);\n function index2(index1) {\n return Math.floor(Math.random() * game.phrases[index1].length);\n }\n if (index1 === 0) {\n this.clue = 'Video Games';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 1) {\n this.clue = 'Literature';\n return this.phrases[index1][index2(index1)];\n } else if (index1 === 2) {\n this.clue = 'Golden Girls Quotes';\n return this.phrases[index1][index2(index1)];\n } else {\n this.clue = 'Crafts';\n return this.phrases[index1][index2(index1)];\n }\n }", "function randomizeSentence(sentence) {\n\n}", "function selectWord() {\n var words = [\"mongoose\", \"pressure\", \"cooker\", \"reactor\", \"sequel\", \"onomatopoeia\", \"monitor\", \"printer\", \"speakers\", \"drive\"];\n randomWord = words[Math.floor(Math.random() * words.length)];\n //console.log(\"random Word: \" + randomWord); // testing\n var newRandWord = new Word(randomWord);\n return newRandWord;\n}", "function getRandomWord() {\n var wordList = [\"DOG\",\"BIRD\",\"MOOSE\",\"CAT\",\"HORSE\",\"COW\",\"PIG\"];\n return wordList[Math.floor(Math.random() * wordList.length)];\n }", "function chooseWord () {\n var word = words[Math.floor(Math.random() * words.length)];\n answer = word.toUpperCase();\n hiddenWord(answer);\n}", "function getRandomWord() {\n // array taken from https://gist.github.com/borlaym/585e2e09dd6abd9b0d0a\n wordList = [\n \"Aardvark\",\n \"Albatross\",\n \"Alligator\",\n \"Alpaca\",\n \"Ant\",\n \"Anteater\",\n \"Antelope\",\n \"Ape\",\n \"Armadillo\",\n \"Donkey\",\n \"Baboon\",\n \"Badger\",\n \"Barracuda\",\n \"Bat\",\n \"Bear\",\n \"Beaver\",\n \"Bee\",\n \"Bison\",\n \"Boar\",\n \"Buffalo\",\n \"Butterfly\",\n \"Camel\",\n \"Capybara\",\n \"Caribou\",\n \"Cassowary\",\n \"Cat\",\n \"Caterpillar\",\n \"Cattle\",\n \"Chamois\",\n \"Cheetah\",\n \"Chicken\",\n \"Chimpanzee\",\n \"Chinchilla\",\n \"Chough\",\n \"Clam\",\n \"Cobra\",\n \"Cockroach\",\n \"Cod\",\n \"Cormorant\",\n \"Coyote\",\n \"Crab\",\n \"Crane\",\n \"Crocodile\",\n \"Crow\",\n \"Curlew\",\n \"Deer\",\n \"Dinosaur\",\n \"Dog\",\n \"Dogfish\",\n \"Dolphin\",\n \"Dotterel\",\n \"Dove\",\n \"Dragonfly\",\n \"Duck\",\n \"Dugong\",\n \"Dunlin\",\n \"Eagle\",\n \"Echidna\",\n \"Eel\",\n \"Eland\",\n \"Elephant\",\n \"Elk\",\n \"Emu\",\n \"Falcon\",\n \"Ferret\",\n \"Finch\",\n \"Fish\",\n \"Flamingo\",\n \"Fly\",\n \"Fox\",\n \"Frog\",\n \"Gaur\",\n \"Gazelle\",\n \"Gerbil\",\n \"Giraffe\",\n \"Gnat\",\n \"Gnu\",\n \"Goat\",\n \"Goldfinch\",\n \"Goldfish\",\n \"Goose\",\n \"Gorilla\",\n \"Goshawk\",\n \"Grasshopper\",\n \"Grouse\",\n \"Guanaco\",\n \"Gull\",\n \"Hamster\",\n \"Hare\",\n \"Hawk\",\n \"Hedgehog\",\n \"Heron\",\n \"Herring\",\n \"Hippopotamus\",\n \"Hornet\",\n \"Horse\",\n \"Human\",\n \"Hummingbird\",\n \"Hyena\",\n \"Ibex\",\n \"Ibis\",\n \"Jackal\",\n \"Jaguar\",\n \"Jay\",\n \"Jellyfish\",\n \"Kangaroo\",\n \"Kingfisher\",\n \"Koala\",\n \"Kookabura\",\n \"Kouprey\",\n \"Kudu\",\n \"Lapwing\",\n \"Lark\",\n \"Lemur\",\n \"Leopard\",\n \"Lion\",\n \"Llama\",\n \"Lobster\",\n \"Locust\",\n \"Loris\",\n \"Louse\",\n \"Lyrebird\",\n \"Magpie\",\n \"Mallard\",\n \"Manatee\",\n \"Mandrill\",\n \"Mantis\",\n \"Marten\",\n \"Meerkat\",\n \"Mink\",\n \"Mole\",\n \"Mongoose\",\n \"Monkey\",\n \"Moose\",\n \"Mosquito\",\n \"Mouse\",\n \"Mule\",\n \"Narwhal\",\n \"Newt\",\n \"Nightingale\",\n \"Octopus\",\n \"Okapi\",\n \"Opossum\",\n \"Oryx\",\n \"Ostrich\",\n \"Otter\",\n \"Owl\",\n \"Oyster\",\n \"Panther\",\n \"Parrot\",\n \"Partridge\",\n \"Peafowl\",\n \"Pelican\",\n \"Penguin\",\n \"Pheasant\",\n \"Pig\",\n \"Pigeon\",\n \"Pony\",\n \"Porcupine\",\n \"Porpoise\",\n \"Quail\",\n \"Quelea\",\n \"Quetzal\",\n \"Rabbit\",\n \"Raccoon\",\n \"Rail\",\n \"Ram\",\n \"Rat\",\n \"Raven\",\n \"Red deer\",\n \"Red panda\",\n \"Reindeer\",\n \"Rhinoceros\",\n \"Rook\",\n \"Salamander\",\n \"Salmon\",\n \"Sand Dollar\",\n \"Sandpiper\",\n \"Sardine\",\n \"Scorpion\",\n \"Seahorse\",\n \"Seal\",\n \"Shark\",\n \"Sheep\",\n \"Shrew\",\n \"Skunk\",\n \"Snail\",\n \"Snake\",\n \"Sparrow\",\n \"Spider\",\n \"Spoonbill\",\n \"Squid\",\n \"Squirrel\",\n \"Starling\",\n \"Stingray\",\n \"Stinkbug\",\n \"Stork\",\n \"Swallow\",\n \"Swan\",\n \"Tapir\",\n \"Tarsier\",\n \"Termite\",\n \"Tiger\",\n \"Toad\",\n \"Trout\",\n \"Turkey\",\n \"Turtle\",\n \"Viper\",\n \"Vulture\",\n \"Wallaby\",\n \"Walrus\",\n \"Wasp\",\n \"Weasel\",\n \"Whale\",\n \"Wildcat\",\n \"Wolf\",\n \"Wolverine\",\n \"Wombat\",\n \"Woodcock\",\n \"Woodpecker\",\n \"Worm\",\n \"Wren\",\n \"Yak\",\n \"Zebra\"\n ];\n\n var x = Math.floor((Math.random() * wordList.length));\n return wordList[x].toUpperCase();\n }", "function selectWord() {\n var randomNumber0to1 = Math.random();\n var randomDecimal = randomNumber0to1 * artistsNames.length;\n var randomIndex = Math.floor(randomDecimal); \n currentWord = new Word(artistsNames[randomIndex]);\n}", "function Words() {\n var random = Math.floor(Math.random() * words.length);\n var randomword = words[random];\n console.log(randomword);\n}", "function wordRandomizer() {\r\n\treturn randomWords[Math.floor(Math.random()*randomWords.length)];\r\n}", "function showWord(words){\r\n const randIndex = Math.floor(Math.random()*words.length);\r\n currentWord.innerHTML = words[randIndex];\r\n}", "function getRandomEasyWord() {\n theWord = wordsEasy[Math.floor(Math.random() * wordsEasy.length)];\n console.log(theWord);\n return theWord\n}", "function getRandom() {\n return Math.floor(Math.random() * words.length);\n}", "function getRandomWord(listOfWords) {\n return listOfWords[getRandomNumber()]\n}", "function randomWord(){\n answer = fruits[Math.floor(Math.random() * fruits.length)];\n}", "makeText(numWords = 100) {\n const startWordIndex = Math.floor(Math.random() * Object.keys(this.startChains).length);\n let prevWord = Object.keys(this.startChains)[startWordIndex];\n let randomText = prevWord;\n\n for (let i = 1; i < numWords; i++) {\n const nextRandom = Math.floor(Math.random() * this.chains[prevWord].length);\n const nextWord = this.chains[prevWord][nextRandom];\n randomText += ' ';\n if (nextWord) {\n randomText += nextWord.toLowerCase();\n prevWord = nextWord;\n } else {\n randomText += this.makeText(numWords - i);\n break;\n }\n }\n if (prevWord.charAt(prevWord.length - 1) === ',') {\n randomText = randomText.slice(0, randomText.length - 1)\n }\n if (!END_PUNCTUATION.includes(prevWord.charAt(prevWord.length - 1))) {\n randomText += '.'\n }\n return randomText.trim()\n }", "function chooseRandomWord() {\n\n randomWord = wordList[Math.floor(Math.random() * wordList.length)].toUpperCase();\n someWord = new word(randomWord);\n\n console.log(gameTextColor(\"Your word contains \" + randomWord.length + \" letters.\"));\n console.log(gameTextColor(\"WORD TO GUESS: \" + randomWord));\n\n someWord.splitWord();\n someWord.generateLetters();\n guessLetter();\n}", "function getWord(){\r\n\t// gets a random number within the list number of elements.\r\n\tvar randomNumber = Math.floor(Math.random() * wordList.length);\r\n\t// gets the word from that random position.\r\n\tvar returnWord = wordList[randomNumber];\r\n\treturn returnWord;\r\n}", "function chooseSentence (list) {\n var index = _.random(list.length - 1);\n var sentence = list[index];\n var madlibRequired = /{\\s*(?:noun|adj|buzz|num)\\s*}/i.test(sentence);\n\n if (madlibRequired) {\n sentence = madlib(sentence);\n }\n\n output(sentence);\n }", "getRandomPhrase () {\n const phrases = this.phrases;\n const randIndex = Math.floor(Math.random() * phrases.length);\n return phrases[randIndex];\n }", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * Math.floor(5));\n const randomPhrase = this.phrases[randNum];\n return randomPhrase;\n }", "getRandomPhrase() {\n const randNum = Math.floor(Math.random() * this.phrases.length);\n const phrase = this.phrases[randNum];\n return phrase;\n }", "function randomWord() {\n result = wordslist[Math.floor(Math.random()*wordslist.length)];\n}", "function getRandomWord() {\n const index = Math.floor(Math.random() * dictionary.length);\n return dictionary[index];\n}", "function showword(words){\n const randindex = Math.floor(Math.random() * words.length);\n\n //output random word\n currentword.innerHTML = words[randindex];\n}", "function chooseRandomWord(word1, word2, word3) {\n var wordNum = 3;\n var randomNum = Math.random() * wordNum;\n var flooredRandomNum = Math.floor(randomNum);\n var randomWordNum = flooredRandomNum + 1;\n var chosenWord;\n //instead of assigning value manually, what if we make the chooser choose the value\n //how do we make it choose the word?\n\n if (randomWordNum === 1) {\n chosenWord = word1;\n } else if (randomWordNum === 2) {\n chosenWord = word2;\n } else if (randomWordNum === 3) {\n chosenWord = word3;\n }\n return chosenWord;\n}", "function showWord(words){\n // generate random Array Index\n const randIndex = Math.floor(Math.random() * words.length);\n // output random word\n currentWord.innerHTML = words[randIndex].toUpperCase();\n \n}", "function changeToNextwords() {\n var myarray = fourTheme.act;\n var random = myarray[Math.floor(Math.random() * 6)];\n\n guessWord = random\n\n document.getElementById(\"newWords\").innerHTML = random;\n}", "getRandomPhrase() {\n let randomOneToFive = Math.floor(Math.random() * 5);\n return this.phrases[randomOneToFive];\n }", "function getRandomHardWord() {\n theWord = wordsHard[Math.floor(Math.random() * wordsHard.length)];\n console.log(theWord);\n return theWord\n}", "function getRandomWord(listOfWords) {\n indexWordSelect = Math.floor(Math.random() * wordsList.length);\n return listOfWords[indexWordSelect];\n}", "function showWord(words) {\n const randIndex = Math.floor(Math.random() * words.length);\n currentWord.innerHTML = words[randIndex];\n}", "getRandomPhrase() {\n let randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber];\n }", "function showWord(words) {\r\n const randIndex = Math.floor(Math.random() * words.length);\r\n currentWord.innerHTML = words[randIndex];\r\n }", "function RandomWord() {\n var wordRandom = Math.floor(Math.random() * (wordList.length));\n return wordList[parseInt(wordRandom)];\n}", "function wordSelectorFromArray(theArray, theId){\n\n var adjectivesLength = theArray.length;\n var myRandomNumber = Math.floor(Math.random()*(adjectivesLength-1));\n document.getElementById(theId).innerHTML = theArray[myRandomNumber];\n\n}", "getRandomPhrase() {\n const randomPhrase = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n //return the function by calling the randomPhrase variable\n return randomPhrase;\n }", "function selectWord() {\n compGuess = mtnNames[Math.floor(Math.random()*mtnNames.length)];\n isPlaying = true;\n compGuessArr = compGuess.split(\"\");\n console.log('Comp guess array set here '+compGuessArr);\n }", "function getRandomWord() {\r\n\twordString = wordRandomizer();\r\n\tlowerCaseRandomWord = wordString.toLowerCase();\r\n}", "function findRandomWord () {\n let number = getRandomNumber(0, commonWords.length);\n state.randomWord = commonWords[number];\n return state.randomWord;\n}", "function showWord(words){\r\n //Generate random array Index\r\n const randIndex=Math.floor(Math.random()*words.length);\r\n //Output random word\r\n currentWord.innerHTML=words[randIndex];\r\n}", "getRandomPhrase() {\r\n let randomPhrase = this.phrases[Math.floor(Math\r\n .random() * this.phrases.length)];\r\n return randomPhrase;\r\n }", "function pickWords()\n{\n\tfor (var i = 0; i < textNodes.length; i++)\n\t{\n\t\t// splits string into array of word strings\n\t\tvar stringArray = textNodes[i].split(\" \");\n\n\t\tvar j = Math.floor(Math.random() * 15) + 2;\n\t\twhile (j < stringArray.length)\n\t\t{\n\t\t\t// TODO: make translation snippets randomly varied in word length, don't cut across sentences\n\t\t\t// \t\t at some point, make snippets logical phrases for better translation\n\t\t\t// \t\t (e.g. \"and then he said\" instead of \"cat and then\")\n\t\t\tvar phraseToTranslate = stringArray[j] + \" \" + stringArray[j+1] + \" \" + stringArray[j+2];\n\t\t\tif (validate(phraseToTranslate))\n\t\t\t{\n\t\t\t\tvar item = {\n\t\t\t\t\tuntranslated : phraseToTranslate,\n\t\t\t\t\ttranslated : \"\"\n\t\t\t\t};\n\n\t\t\t\tjsonObject.phraseArray.push(item);\n\t\t\t}\n\n\t\t\tj += Math.floor(Math.random() * 90) + 80;\n\t\t}\n\t}\n\n\tvar arrLength = jsonObject.phraseArray.length.toString();\n\tchrome.runtime.sendMessage({ type: \"setBadge\", badgeText : arrLength });\n\n\tloadLangs();\n}", "function showWord(words){\n\n //Generate randow array index\n const randIndex = Math.floor(Math.random() *words.length);\n //Output random word\n currentWord.innerHTML=words[randIndex];\n}", "function showWord(words){\n //get random index of array\n const randIndex = Math.floor(Math.random() * words.length);\n //Output random word\n currentWord.innerHTML = words[randIndex];\n}", "function setGameWord() {\n\tlet random = Math.floor(Math.random() * wordArray.length);\n\tselectedWord = wordArray[random];\n}", "getRandomPhrase() {\n const randomPhrase = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomPhrase];\n }", "function randomLanguage() {\n return strings[Math.floor(Math.random() * strings.length)];\n}", "function generateRandomWord() {\n randomWord = words[Math.floor(Math.random() * (words.length))];\n}", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "function showWord(words){\r\n// generate random array index//\r\nconst randIndex =math.floor(math.random() * words.length);\r\n// output random words//\r\ncurrentWord.innerHTML = words[randIndex];\r\n}", "function selectTweet(tweets) {\n const index = Math.floor(Math.random() * tweets.length)\n return tweets[index];\n}", "getRandomPhrase() {\n const randomNumber = Math.floor(Math.random() * this.phrases.length);\n return this.phrases[randomNumber];\n }", "getRandomPhrase() { // Gets a random phrase\n const rand = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n return rand;\n }", "function randomWord() {\r\n answer = guessme[Math.floor(Math.random() * guessme.length)];\r\n console.log(answer);\r\n}", "getRandomPhrase() {\n var randomNumber = Math.floor(Math.random() * 5);\n return this.phrases[randomNumber]\n }", "function getWords() {\n word.innerText = list[Math.floor(Math.random() * list.length)];\n}", "function compWord() {\n var compGuess = futbolWords[Math.floor(Math.random() * futbolWords.length)];\n return compGuess;\n}", "getRandomPhrase() {\r\n let randomNumber = Math.floor(Math.random() * this.phrase.length);\r\n //console.log(randomNumber); \r\n return this.phrase[randomNumber];\r\n}", "function generateSentence() {\nvar randomIndex = Math.floor(Math.random() * sentences.length);\ncurrentSentence = sentences[randomIndex];\nprompt.innerHTML = currentSentence;\n}", "function getWord(){\nrdm = Math.floor((Math.random() * words.length-1) + 1);\n console.log('Word: ' + words[rdm]);\nconsole.log('Random: ' + rdm)\ndocument.getElementById(\"printWord\").innerHTML = words[rdm];\ndocument.getElementById(\"cajatexto\").value =\"\";\nfocusTextBox();\ndspWord = words[rdm];\ndraw();\n}" ]
[ "0.74161154", "0.738704", "0.7358178", "0.72726977", "0.71537715", "0.71203005", "0.70771426", "0.7031855", "0.70303464", "0.6998866", "0.6977343", "0.6971064", "0.6950724", "0.6921006", "0.69105035", "0.68811274", "0.6880051", "0.6840534", "0.6801679", "0.67960584", "0.67669106", "0.67606914", "0.6717882", "0.670608", "0.6702837", "0.66907567", "0.6640252", "0.66386425", "0.65926903", "0.65809584", "0.6576296", "0.6574606", "0.65646535", "0.65646535", "0.65512645", "0.6550989", "0.6527256", "0.6526856", "0.65266263", "0.65217173", "0.6517034", "0.6515799", "0.6508973", "0.6508595", "0.6506163", "0.64969385", "0.6473421", "0.6448515", "0.64482653", "0.64428866", "0.6440792", "0.6436846", "0.64359695", "0.6435906", "0.6427117", "0.64201665", "0.6419363", "0.6417754", "0.64113665", "0.63835835", "0.6378219", "0.6373642", "0.6372659", "0.6364973", "0.63551736", "0.6325409", "0.6324178", "0.632376", "0.63232857", "0.6312464", "0.63114345", "0.6305603", "0.630384", "0.6302955", "0.63028616", "0.6294724", "0.62922037", "0.6287391", "0.62865394", "0.6275619", "0.62746656", "0.6273712", "0.626565", "0.62631094", "0.6248114", "0.6244653", "0.6241437", "0.6241437", "0.6241437", "0.624007", "0.6235843", "0.62292796", "0.622749", "0.62231153", "0.6222818", "0.6221306", "0.6221182", "0.6215948", "0.6214636", "0.621296" ]
0.6808055
18
class with all second parts of sentence
constructor() { super(); this.addPart.push(new NormalPart("j'en ai conclu que la mousse au chocolat n'était mon fort, ")); this.addPart.push(new NormalPart("j'ai appellé les Avengers pour m'aider dans ma quête, ")); this.addPart.push(new NormalPart("j'ai crié après le perroquet ")); this.addPart.push(new NormalPart("j'ai toujours voulu devenir un super-héros ")); this.addPart.push(new NormalPart("mon copain a acheté des champignons hallucinogènes ")); this.addPart.push(new NormalPart("j'ai acheté des nouvelles épées kikoodelamortquitue ")); this.addPart.push(new NormalPart("Nina mon perroquet a crié son mécontentement ")); this.addPart.push(new NormalPart("ma copine m'a dit : Lui c'est un mec facile !, ")); this.addPart.push(new NormalPart("je me suis mise à écouter Rammstein ")); this.addPart.push(new NormalPart("j'ai ressorti ma vieille Nintendo DS ")); this.addPart.push(new NormalPart("le père Noël est sorti de sous la cheminée ")); this.addPart.push(new NormalPart("ma mère m'a dit : Rien ne vaut les gâteaux !, ")); this.addPart.push(new NormalPart("je me suis poussée à me remettre au sport ")); this.addPart.push(new NormalPart("un castor est sorti de la rivière ")); this.addPart.push(new NormalPart("Jean-pierre Pernault à parlé du Coronavirus au 20h çà m'a fait réfléchir, ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sentence(part1, part2) {\n return part1 + part2;\n}", "function ClozeCard(fullText, cloze) {\n // first argument contains full sentence\n this.fullText = fullText;\n // 2nd argument contains removed words\n this.cloze = cloze;\n // method for replacing the removed words with ellipses ... (leaving the partial text)\n this.partialText = function() {\n //doesn't work, but tried to search then repace cloze txt with ellipses\n // if (/[this.cloze]/i.test(this.fullText) {\n // console.log(\"works so far\");\n\n }\n\n\n}", "getSentenceHelper(element) {\n if (!element.includes('<') && !element.includes('>')) {\n return element;\n }\n\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n\n let subSentence = '';\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n subSentence += this.getSentenceHelper(syntax[i]);\n } else {\n subSentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n return subSentence;\n }", "function splitSentence(split_id){\n //1 split the sentence display\n var sentence_id = parseInt(split_id.split(\".\")[0]),\n word_id = parseInt(split_id.split(\".\")[1]);\n\n var sentence = getSentence(sentence_id-1).split(\" \");\n console.log(sentence)\n //\n var sentence_part1 = sentence.slice(0,word_id).join(\" \"),\n sentence_part2 = sentence.slice(word_id+1,sentence.length).join(\" \");\n\n var part1_html = \"<div><h3>Subsentence Part 1</h3>\" + sentence_part1 + \"</div>\";\n var part2_html = \"<div><h3>Subsentence Part 2</h3>\" + sentence_part2 + \"</div>\";\n\n $('#selected-sentence').append(part1_html);\n $('#selected-sentence').append(part2_html);\n\n //add subsentence classification to the rubrick\n\n addClassification('#classification_selection');\n\n}", "function FullSent( strText, numSentThres ) {\n //VAR: strText = string that is the document that will be analyzed\n //VAR: numSentThres = integer that is the threshold value for the number of characters that should be in a sentence\n //METHOD: this is a class that will manipulate a document\n if ( !(this instanceof FullSent) )\n return new FullSent( strText, numSentThres );\n\n \n //STEP: save the initial parameters for this object\n this.delimEOS = \". \"; //delimEOS = delimiter End Of Sentence. The string that will be appended to the end of each sentence.\n this.numSentThres = numSentThres;\n\n //need to consider the space between \"Ph.\" & \"D\" as the function \"setDoc_organizeOrigText()\" adds \". \" to incomplete sentences\n this.arrStrEndings = [ \" Mrs\", \" Ms\", \" Mr\", \" Dr\", \" Ph\", \" Ph. D\", \" al\" ];\n\n //process the text to separate into individual, complete sentences\n this.arrCompSent = this.makeFullSent( strText );\n\n //create stemmmer class\n // this.stemmer = new classStemmer(strText, stemMinLen, minSimThres);\n // this.arrCompSent_stem = this.stemmer.translateWordToStem(this.arrCompSent);\n\n //TEST:: \n // var dispArr = arrTools_showArr_ConsoleLog( this.arrCompSent );\n // console.log( \"full sent = \" + dispArr );\n}", "classify(phrase) { return this.clf.classify(phrase) }", "function createSentence() { \n var sentence = noun[1] + ' ' + verb[1] + ' ' + preposition[1]; \n return sentence;\n}", "function joinStep2(str){\t\t\r\n\t\tvar pom;\r\n\t\tvar pom2=str.indexOf('has recruited');\r\n\t\tif(pom2==-1){\r\n\t\t\tpom2=str.indexOf('day into ');\r\n\t\t\tif(pom2>-1){\r\n\t\t\t\tpom2+=9;\r\n\t\t\t\tstr=str.substr(pom2, str.indexOf(\"'s\")-pom2);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tpom=str.indexOf('character_info\">')+17;\r\n\t\t\t\tstr = str.substr(pom,str.indexOf(' is ')-pom); \r\n\t\t\t}\r\n\t\t}\r\n\t\telse{\t\t\r\n\t\t\tpom=str.indexOf('class=\"center\">')+16;\t\r\n\t\t\tstr = str.substr(pom,str.indexOf('has recruited')-pom); \t\t\t\r\n\t\t}\r\n\t\tif(pom==-1){\r\n\t\t\talert('Error :(');\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar nick=str.replace(/ |\\t|\\n/g,\"\");\r\n\t\treg(nick,link);\t\r\n\t}", "function ParseSentence(phrase) {\n let words = phrase.toLowerCase().split(/\\s/).filter(word => word.trim());\n let ktoWords = words.map(word => ParseWord(word));\n return new Kto.Sentence(ktoWords);\n }", "sentanceExtractor({ numSentances = 1, startIndex = false, text = fakeData.loremIpsum } = {}) {\n //Works only with big Chunks of text\n //Specifically made for the loremIpsum text from fakeData\n let start = startIndex ? startIndex : math.rand(0, Math.floor(text.length / 2));\n let outputText = '';\n function findNextSentance() {\n let temp = start;\n //The 'or' might be error prone\n while (text[start] !== '.' || (start - temp) < 4) {\n start++;\n }\n }\n\n //Search for beginning of next sentance\n if (text[start] !== '.') {\n findNextSentance();\n start += 2;\n } else {\n start += 2;\n }\n\n for (numSentances; numSentances != 0; numSentances--) {\n let sentStartIndex = start;\n findNextSentance();\n outputText += text.substring(sentStartIndex, start++) + '.';\n }\n return outputText;\n\n //String.indexOf(); maybe?\n }", "function wordsComplex() {\n\n}", "introduce(){\n let introduce=super.introduce()+' '+'I am a Teacher. I teach ';\n if(this.klasses==null){\n return introduce+'No Class.';\n }else{\n introduce+='Class ';\n for(var i=0;i<this.klasses.length;i++){\n introduce+=this.klasses[i].number;\n (i!==this.klasses.length-1)?introduce+=', ':introduce+='.'\n }\n return introduce;\n }\n }", "function makeClassName(text) {\n\treturn text.toLowerCase().replace(' ', '_');\n}", "getSentence(element) {\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n let sentence = '';\n\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n sentence += `${this.getSentenceHelper(syntax[i])}`;\n } else {\n sentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n sentence = sentence.charAt(0).toUpperCase() + sentence.substr(1);\n return (sentence.includes('.') || sentence.includes('?') ? sentence : sentence.concat('.'));\n }", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function Sentence(id, tokens, cite) {\n this.id = id;\n this.tokens = tokens;\n this.cite = cite;\n }", "function tokenPart(token){\n var part = makePartSpan(token.value, self.doc); \n part.className = token.style;\n return part;\n }", "function madLibs(str, array) {\n var finalSentence = '';\n //segments [ 'Marching is fun: ', ', ', ', ', ', ', '!' ]\n var segments = str.split('*');\n var nextWordIdx = 0;\n\n for (var i = 0; i < segments.length - 1; i++) {\n //adds element then word at array and then add them to the finalString\n var segment = segments[i];\n segment += array[nextWordIdx];\n finalSentence += segment;\n // increase the counter \n nextWordIdx = nextWordIdx + 1 < array.length ? nextWordIdx + 1 : 0;\n }\n\n finalSentence += segments[segments.length - 1];\n \n return finalSentence;\n }", "function isClassesPlural() {\n const $classText = $(\".sentence-text-classes\");\n //two because the last element in ajax is the trainer name, not a class.\n if (trainerClassInfo.length === 2) {\n $classText.append(\"class this week\");\n } else {\n $classText.append(\"classes this week\");\n }\n }", "sentenceSplits(text, chunkArray) {\n \tvar sentenceArray = text.split(\". \");\n \tfor (var i = sentenceArray.length - 2; i >= 0; i--) {\n \t\tsentenceArray[i] = sentenceArray[i] + \".\";\n \t}\n \treturn sentenceArray;\n }", "function _usfSplitByText(desc, txt,first = true, description_words = '...') {\r\n return first ? desc.slice(0,desc.indexOf(txt)) + description_words : desc.slice(desc.indexOf(txt) + txt.length,desc.length) + description_words\r\n}", "wordClass(word) {\r\n return {\r\n der: word.artikel == \"der\",\r\n die: word.artikel == \"die\",\r\n das: word.artikel == \"das\",\r\n marked: word.marker\r\n }\r\n }", "function extractNames(paragraph){\n var start = paragraph.indexOf(\"(mother \") + \"(mother \".length;\n var end = paragraph.indexOf(\")\");\n console.log(start, end);\n return paragraph.slice(start, end);\n \n}", "function Vc(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function Me(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function getSentence({subject, verb, object}) { // deconstructing an object into properties\n\treturn `${subject} ${verb} ${object}`;\n}", "function prosesSentence(name, age, addres, hobby){\n return name + age + addres + hobby }", "function takeString(stg)\n{ \n return sentence.substring(0,3);\n}", "function get_classname(text) {\r\n // execute the regex statement and return the second group (the classname)\r\n const regex = text.match(/(?:\"classname\" \")(.*?)(?:\")/);\r\n if (!Array.isArray(regex) || !regex.length) {\r\n // array does not exist, is not an array, or is empty\r\n return null;\r\n }\r\n return regex[1];\r\n}", "function testMe(words) {\n var n = words.split(\" \");\n return \".\" + n[n.length - 1];\n }", "function generateSentence() {\r\n return selectChud()+' '+selectVerb()+' '+selectLefty()+' With '+selectAdjective()+' '+selectEnding();\r\n}", "function f(phrase) {\n return class {\n sayHi() { console.log(phrase) }\n }\n}", "parseCharacterClass() {\n this.expect('[');\n const node = {\n type: 'CharacterClass',\n invert: false,\n ClassRanges: undefined,\n };\n node.invert = this.eat('^');\n node.ClassRanges = this.parseClassRanges();\n this.expect(']');\n return node;\n }", "function cutFirst(sentence){\n sentence = sentence.substring(2);\n return sentence\n }", "function makeIntoTitle(sentence) {\n // Your code here\n if (typeof sentence === \"string\") {\n let newSentence = \"\";\n sentenceArray = sentence.split(\" \");\n for (let j = 0; j < sentenceArray.length; j++) {\n let wordArray = sentenceArray[j].split(\"\");\n wordArray[0] = wordArray[0].toUpperCase();\n for (let i = 1; i < sentenceArray[j].length; i++) {\n wordArray[i] = wordArray[i].toLowerCase();\n }\n if (j < sentenceArray.length - 1) {\n newSentence = newSentence.concat(wordArray.join(\"\"), \" \");\n } else {\n newSentence = newSentence.concat(wordArray.join(\"\"));\n }\n }\n return newSentence;\n }\n return undefined;\n}", "function createStudent(text) {\n\t\t\n\t\treturn text.substring(text.length-9, text.length-1);\n\t}", "function processSentence(){\n return 'Nama saya ' + name +', umur saya '+ age +' tahun, alamat saya di ' +address +', dan saya punya hobby yaitu '+ hobby\n}", "function buildSentence( category, phrase ) {\n if (category.length > 0) {\n sentence += phrase;\n if (category.length == 1) {\n sentence += category[0] + \". \";\n } else if (category.length == 2) {\n sentence += category[0] + \" & \" + category[1] + \". \";\n } else {\n for (var i = 0; i < category.length; i++) {\n if (i < category.length - 1) {\n sentence += category[i] + \", \";\n } else {\n sentence += \" and \" + category[i] + \". \";\n }\n }\n }\n } \n }", "function processSentence(name,age,address,hobby) {\n return \"Nama saya \" + name + \", umur saya \" + age + \", alamat saya di \" + address + \", dan saya punya hobby yaitu \" + hobby + \"!\"\n }", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32\n /* SPACE */\n ) {\n startIndex++;\n }\n\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32\n /* SPACE */\n ) {\n startIndex++;\n }\n\n return startIndex;\n }", "constructor(text) {\n this.text = text;\n this.words = [];\n \n }", "function textin(s){\n return s.replace(/two|too|to/gi,2)\n }", "function find(){\n var str = 'When i was young ,I love a girl in neighoubr class';\n // search( ) substring()\n\n}", "function fromMeToYou(sentence) {\n sentence = sentence.split(' ');\n let result = [];\n\n for (let i = 0; i < sentence.length; i++) {\n if (sentence[i] === 'me') {\n result.push('you');\n } else {\n result.push(sentence[i]);\n }\n }\n\n return result.join(' ');\n}", "function processSentence(name,age,alamat,hobby){\n return 'Nama saya ' + name + ', umur saya ' + age + ' tahun' + ', alamat saya di ' + alamat + ', dan saya punya hobby yaitu ' + hobby + ' !' \n }", "function transformer(word, slicer) {\n characters = word.split('');\n var firstSegment = word.slice(0, slicer);\n var secondSegment = word.slice(slicer);\n if ((vowelChecker(characters[0]) === true) && (characters[0] !== \"y\")) {\n return \"<span id=\\\"secondSegment\\\">\" + secondSegment + \"</span>\" + \"<span id=\\\"firstSegment\\\">\" + firstSegment.toUpperCase() + \"</span>\" + \"<span id=\\\"ender\\\">\" + \"Way\" + \"</span>\";\n } else {\n return \"<span id=\\\"secondSegment\\\">\" + secondSegment + \"</span>\" + \"<span id=\\\"firstSegment\\\">\" + firstSegment.toUpperCase() + \"</span>\" + \"<span id=\\\"ender\\\">\" + \"ay\" + \"</span>\";\n }\n }", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun'] // change this line\n return sentence;\n }", "function displayText2() {\n let t1 = createElement('span', 'TEXT 2 (yeah) <br>');\n t1.parent('text2');\n t1.class('large'); \n}", "function texte2(){\n document.querySelector(\".textM\").classList.add(\"textM3\")\n document.querySelector(\".textM\").innerText= `fonctionne en bluethoot ! ou part cable !\n peut se rechargé sur un socle transportable`;\n}", "function startAnimation2() {\n\nconst text = document.querySelector(\".hero-text-two\");\nconst strText = text.textContent;\nconst splitText = strText.split(\"\");\ntext.textContent = \"\";\n\nfor (let i=0; i < splitText.length; i++) {\n text.innerHTML += \"<span>\" + splitText[i] + \"</span>\";\n}\n\nlet char = 0;\nlet timer = setInterval(onTick2, 150);\n\nfunction onTick2() {\n const span = text.querySelectorAll('span')[char];\n span.classList.add('fade');\n char++\n if (char === splitText.length) {\n complete();\n return;\n }\n}\n\nfunction complete() {\n clearInterval(timer);\n timer = null;\n }\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n let markovChain = this.makeChains(words);\n this.words = words;\n this.markovChain = markovChain;\n }", "function uuklasssub(node, // @param Node:\r\n classNames) { // @param String(= \"\"): \"class1 class2 ...\"\r\n // @return Node:\r\n node.className = uutriminner(\r\n node.className.replace(_classNameMatcher(uusplit(classNames)), \"\"));\r\n return node;\r\n}", "function Ib(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function twoWordSameFirstLetter(sent, tags) {\n let arrBandNames = [];\n let nounIndexes = [];\n for (var i = 1; i < tags.length; i++) {\n if (tags[i] === 'Noun') {\n nounIndexes.push(i);\n }\n }\n // Check if the tags before noun matches pattern\n nounIndexes = nounIndexes.filter(function(nounIndex) {\n let prevTag = tags[nounIndex-1];\n return prevTag === 'Adjective' || prevTag === 'Adverb';\n });\n // Check if the two words have same first char\n nounIndexes = nounIndexes.filter(function(nounIndex) {\n return sent.terms[nounIndex].text[0].toLowerCase() === sent.terms[nounIndex-1].text[0].toLowerCase();\n });\n // Conjure band names with the remaining nouns + their preceding adv+adj\n nounIndexes.forEach(function(nounIndex) {\n let bandName = capitalize(sent.terms[nounIndex-1].text) + ' ' +\n capitalize(sent.terms[nounIndex].text);\n arrBandNames.push(bandName);\n });\n return arrBandNames;\n}", "function nicer(sentence){\n // converted into array\n var sentenceArray = sentence.split(\" \");\n // console.log(sentenceArray);\n // create a var that makes both strings equal eachother.\n for (var i = 0; i < sentenceArray.length; i++) {\n\n var currentWord = sentenceArray[i];\n\n if(currentWord === \"heck\" || currentWord === \"darn\" || currentWord === \"crappy\" || currentWord === \"dang\"){\n sentenceArray.splice(i, 1);\n }\n // remove from array @ i\n // sentenceArray.splice(i.1)\n // sentenceArray[i] = currentSentence;\n // var str = \"dad get the heck in here and bring me a darn sandwich.\"\n // var res = sentence.slice(2,3,10); THIS DID NOT WORK\n }\n // var string1 = string2\n // need to define string2 THIS didn't work at all.\n var cleanSentence = sentenceArray.join(\" \");\n return cleanSentence;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function iPutTheFunIn(string){\n\n var firstSlice = \"\";\n\n var seconSlice = \"\";\n\n var newWord = \"\";\n\n firstSlice = string.slice(0, string.length/2);\n\n secondSlice = string.slice(string.length/2);\n\n newWord = firstSlice + \"fun\" + secondSlice;\n\n return newWord;\n}", "function lassocP1(x){\r\n return parserPlus(lassocP(x), return_(x));\r\n }", "function getClassesNames(string) {\n var salaSubIndexesStart = [];\n var salaSubIndexesEnd = [];\n var classesNames = [];\n\n\n // If the string is undefined, return \"\"\n if (string == undefined) return \"\";\n\n // Getting all \"Sala\" substrings indexes\n for (var i = 0, j = 0; i < string.length; i++) {\n if (string.slice(i, i + 4) == \"Sala\") {\n // Getting substring start index\n salaSubIndexesStart.push(i);\n\n // Getting substring end index\n j = i + 4;\n while (string[j] == \" \") j++;\n while(string[j] >= '0' && string[j] <= '9') j++;\n salaSubIndexesEnd.push(j);\n }\n }\n\n // Getting all Sala substrings\n for (var i = 0; i < salaSubIndexesStart.length; i++) {\n var subStart = salaSubIndexesStart[i];\n var subEnd = salaSubIndexesEnd[i];\n\n classesNames.push(string.slice(subStart, subEnd));\n }\n\n\n return classesNames;\n}", "function sentenceToCamelCase(str){\n //const m = /[0-9]*\\.?[0-9]+%\\s/ig;\n //const m2 = /^[a-zA-Z]/;\n // const m2 = /^[a-z]|[A-Z]/g; \n // const m3 = /\\s[a-zA-Z]/g;\n const m3 = /^[a-zA-Z]|\\s[a-zA-Z]/g;\n // let matchArr = str.match(m3);\n return str.replace(m3,(el,idx)=>{\n return el.trim().toUpperCase();\n })\n}", "function class_name(name) {\n return /^[A-Z]/.test(_.last(name.split(/\\./)));\n}", "function cut_first_sentence(string) {\n let index = string.indexOf(\".\");\n return string.substring(index + 1, string.length).trim();\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n this.makeBigrams();\n }", "function breakLines(text){\n let multiLineName = {\n first : \"\",\n second : \"\"\n };\n\n let splitedText = text.split(\" \");\n if (splitedText.length > 2) {\n for (var i = 0; i < 2; i++) {\n if (i > splitedText.length) { //??\n break;\n }\n multiLineName.first = multiLineName.first+splitedText[i]+\" \";\n }\n multiLineName.first = multiLineName.first.slice(0, -1);\n\n for (i = 2; i < splitedText.length; i++) {\n multiLineName.second = multiLineName.second+splitedText[i]+\" \";\n }\n multiLineName.second = multiLineName.second.slice(0, -1);\n\n }\n else {\n multiLineName.first = text;\n multiLineName.second = \"\";\n }\n return multiLineName;\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n console.log(words);\n // MORE CODE HERE\n this.words = words;\n this.chain = this.makeChains();\n\n }", "constructor(text) {\n console.log(\"constructor ran, this is text:\", text);\n this.words = text.split(/[ \\r\\n]+/);\n this.chains = {};\n this.text = \"\";\n }", "function defwords(words, class) {\r\n\tfor (var i = 0; i < words.length; i++) {\r\n\t var w = words[i].replace(/^=/, \"\");\r\n\t patterns.push(new RegExp(\"([^a-zA-Z])(\" + w + \")([^a-zA-Z])\",\r\n\t\twords[i].match(/^=/) ? \"g\" : \"gi\"));\r\n\t classes.push(class);\r\n\t}\r\n }", "function buildSentence (num) {\n\t\t\t\tvar s = buildWordList(num).join(' ');\n\t\t\t\treturn s.charAt(0).toUpperCase() + \n\t\t\t\t\ts.substring(1) + getPunctuation() + ' ';\n\t\t\t}", "function f(phrase) {\n return class {\n sayHi() { alert(phase); }\n };\n}", "function getClassName(string, startIdx) {\n const classSlice = string.slice(startIdx)\n const nameOfClass = classSlice.split(/[ ]+/)[1]\n return nameOfClass\n }", "function separateText() {\r\n var $curNode = $(this);\r\n $curNode.html($curNode.text().replace(/\\b(\\w+)\\b/g, \"<span text=\\\"word\\\">$1</span>\"));\r\n}", "function replaceEO(str) {\n var phrase = str.split(' ');\n // console.log(phrase);\n for (var i = 0; i < phrase.length; i++) {\n\n let word = phrase[i];\n\n if(i%2===0)\n {\n word = word.toUpperCase();\n }\n\n console.log(word);\n }\n\n}", "function doubleMetaphone(value) {\n var primary = ''\n var secondary = ''\n var index = 0\n var length = value.length\n var last = length - 1\n var isSlavoGermanic\n var isGermanic\n var subvalue\n var next\n var prev\n var nextnext\n var characters\n\n value = String(value).toUpperCase() + ' '\n isSlavoGermanic = slavoGermanic.test(value)\n isGermanic = germanic.test(value)\n characters = value.split('')\n\n // Skip this at beginning of word.\n if (initialExceptions.test(value)) {\n index++\n }\n\n // Initial X is pronounced Z, which maps to S. Such as `Xavier`.\n if (characters[0] === 'X') {\n primary += 'S'\n secondary += 'S'\n index++\n }\n\n while (index < length) {\n prev = characters[index - 1]\n next = characters[index + 1]\n nextnext = characters[index + 2]\n\n switch (characters[index]) {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y':\n case 'À':\n case 'Ê':\n case 'É':\n if (index === 0) {\n // All initial vowels now map to `A`.\n primary += 'A'\n secondary += 'A'\n }\n\n index++\n\n break\n case 'B':\n primary += 'P'\n secondary += 'P'\n\n if (next === 'B') {\n index++\n }\n\n index++\n\n break\n case 'Ç':\n primary += 'S'\n secondary += 'S'\n index++\n\n break\n case 'C':\n // Various Germanic:\n if (\n prev === 'A' &&\n next === 'H' &&\n nextnext !== 'I' &&\n !vowels.test(characters[index - 2]) &&\n (nextnext !== 'E' ||\n (subvalue =\n value.slice(index - 2, index + 4) &&\n (subvalue === 'BACHER' || subvalue === 'MACHER')))\n ) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Special case for `Caesar`.\n if (index === 0 && value.slice(index + 1, index + 6) === 'AESAR') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n // Italian `Chianti`.\n if (value.slice(index + 1, index + 4) === 'HIA') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n if (next === 'H') {\n // Find `Michael`.\n if (index > 0 && nextnext === 'A' && characters[index + 3] === 'E') {\n primary += 'K'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Greek roots such as `chemistry`, `chorus`.\n if (index === 0 && initialGreekCh.test(value)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Germanic, Greek, or otherwise `CH` for `KH` sound.\n if (\n isGermanic ||\n // Such as 'architect' but not 'arch', orchestra', 'orchid'.\n greekCh.test(value.slice(index - 2, index + 4)) ||\n (nextnext === 'T' || nextnext === 'S') ||\n ((index === 0 ||\n prev === 'A' ||\n prev === 'E' ||\n prev === 'O' ||\n prev === 'U') &&\n // Such as `wachtler`, `weschsler`, but not `tichner`.\n chForKh.test(nextnext))\n ) {\n primary += 'K'\n secondary += 'K'\n } else if (index === 0) {\n primary += 'X'\n secondary += 'X'\n // Such as 'McHugh'.\n } else if (value.slice(0, 2) === 'MC') {\n // Bug? Why matching absolute? what about McHiccup?\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'X'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Czerny`.\n if (next === 'Z' && value.slice(index - 2, index) !== 'WI') {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n // Such as `Focaccia`.\n if (value.slice(index + 1, index + 4) === 'CIA') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n // Double `C`, but not `McClellan`.\n if (next === 'C' && !(index === 1 && characters[0] === 'M')) {\n // Such as `Bellocchio`, but not `Bacchus`.\n if (\n (nextnext === 'I' || nextnext === 'E' || nextnext === 'H') &&\n value.slice(index + 2, index + 4) !== 'HU'\n ) {\n subvalue = value.slice(index - 1, index + 4)\n\n // Such as `Accident`, `Accede`, `Succeed`.\n if (\n (index === 1 && prev === 'A') ||\n subvalue === 'UCCEE' ||\n subvalue === 'UCCES'\n ) {\n primary += 'KS'\n secondary += 'KS'\n // Such as `Bacci`, `Bertucci`, other Italian.\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n } else {\n // Pierce's rule.\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n }\n\n if (next === 'G' || next === 'K' || next === 'Q') {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Italian.\n if (\n next === 'I' &&\n // Bug: The original algorithm also calls for A (as in CIA), which is\n // already taken care of above.\n (nextnext === 'E' || nextnext === 'O')\n ) {\n primary += 'S'\n secondary += 'X'\n index += 2\n\n break\n }\n\n if (next === 'I' || next === 'E' || next === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 2\n\n break\n }\n\n primary += 'K'\n secondary += 'K'\n\n // Skip two extra characters ahead in `Mac Caffrey`, `Mac Gregor`.\n if (\n next === ' ' &&\n (nextnext === 'C' || nextnext === 'G' || nextnext === 'Q')\n ) {\n index += 3\n break\n }\n\n // Bug: Already covered above.\n // if (\n // next === 'K' ||\n // next === 'Q' ||\n // (next === 'C' && nextnext !== 'E' && nextnext !== 'I')\n // ) {\n // index++;\n // }\n\n index++\n\n break\n case 'D':\n if (next === 'G') {\n // Such as `edge`.\n if (nextnext === 'E' || nextnext === 'I' || nextnext === 'Y') {\n primary += 'J'\n secondary += 'J'\n index += 3\n // Such as `Edgar`.\n } else {\n primary += 'TK'\n secondary += 'TK'\n index += 2\n }\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n primary += 'T'\n secondary += 'T'\n index += 2\n\n break\n }\n\n primary += 'T'\n secondary += 'T'\n index++\n\n break\n case 'F':\n if (next === 'F') {\n index++\n }\n\n index++\n primary += 'F'\n secondary += 'F'\n\n break\n case 'G':\n if (next === 'H') {\n if (index > 0 && !vowels.test(prev)) {\n primary += 'K'\n secondary += 'K'\n index += 2\n\n break\n }\n\n // Such as `Ghislane`, `Ghiradelli`.\n if (index === 0) {\n if (nextnext === 'I') {\n primary += 'J'\n secondary += 'J'\n } else {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n // Parker's rule (with some further refinements).\n if (\n // Such as `Hugh`. The comma is not a bug.\n ((subvalue = characters[index - 2]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `bough`. The comma is not a bug.\n ((subvalue = characters[index - 3]),\n subvalue === 'B' || subvalue === 'H' || subvalue === 'D') ||\n // Such as `Broughton`. The comma is not a bug.\n ((subvalue = characters[index - 4]),\n subvalue === 'B' || subvalue === 'H')\n ) {\n index += 2\n\n break\n }\n\n // Such as `laugh`, `McLaughlin`, `cough`, `gough`, `rough`, `tough`.\n if (index > 2 && prev === 'U' && gForF.test(characters[index - 3])) {\n primary += 'F'\n secondary += 'F'\n } else if (index > 0 && prev !== 'I') {\n primary += 'K'\n secondary += 'K'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'N') {\n if (index === 1 && vowels.test(characters[0]) && !isSlavoGermanic) {\n primary += 'KN'\n secondary += 'N'\n // Not like `Cagney`.\n } else if (\n value.slice(index + 2, index + 4) !== 'EY' &&\n value.slice(index + 1) !== 'Y' &&\n !isSlavoGermanic\n ) {\n primary += 'N'\n secondary += 'KN'\n } else {\n primary += 'KN'\n secondary += 'KN'\n }\n\n index += 2\n\n break\n }\n\n // Such as `Tagliaro`.\n if (value.slice(index + 1, index + 3) === 'LI' && !isSlavoGermanic) {\n primary += 'KL'\n secondary += 'L'\n index += 2\n\n break\n }\n\n // -ges-, -gep-, -gel- at beginning.\n if (index === 0 && initialGForKj.test(value.slice(1, 3))) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // -ger-, -gy-.\n if (\n (value.slice(index + 1, index + 3) === 'ER' &&\n prev !== 'I' &&\n prev !== 'E' &&\n !initialAngerException.test(value.slice(0, 6))) ||\n (next === 'Y' && !gForKj.test(prev))\n ) {\n primary += 'K'\n secondary += 'J'\n index += 2\n\n break\n }\n\n // Italian such as `biaggi`.\n if (\n next === 'E' ||\n next === 'I' ||\n next === 'Y' ||\n ((prev === 'A' || prev === 'O') && next === 'G' && nextnext === 'I')\n ) {\n // Obvious Germanic.\n if (value.slice(index + 1, index + 3) === 'ET' || isGermanic) {\n primary += 'K'\n secondary += 'K'\n } else {\n primary += 'J'\n\n // Always soft if French ending.\n if (value.slice(index + 1, index + 5) === 'IER ') {\n secondary += 'J'\n } else {\n secondary += 'K'\n }\n }\n\n index += 2\n\n break\n }\n\n if (next === 'G') {\n index++\n }\n\n index++\n\n primary += 'K'\n secondary += 'K'\n\n break\n case 'H':\n // Only keep if first & before vowel or btw. 2 vowels.\n if (vowels.test(next) && (index === 0 || vowels.test(prev))) {\n primary += 'H'\n secondary += 'H'\n\n index++\n }\n\n index++\n\n break\n case 'J':\n // Obvious Spanish, `jose`, `San Jacinto`.\n if (\n value.slice(index, index + 4) === 'JOSE' ||\n value.slice(0, 4) === 'SAN '\n ) {\n if (\n value.slice(0, 4) === 'SAN ' ||\n (index === 0 && characters[index + 4] === ' ')\n ) {\n primary += 'H'\n secondary += 'H'\n } else {\n primary += 'J'\n secondary += 'H'\n }\n\n index++\n\n break\n }\n\n if (\n index === 0\n // Bug: unreachable (see previous statement).\n // && value.slice(index, index + 4) !== 'JOSE'.\n ) {\n primary += 'J'\n\n // Such as `Yankelovich` or `Jankelowicz`.\n secondary += 'A'\n // Spanish pron. of such as `bajador`.\n } else if (\n !isSlavoGermanic &&\n (next === 'A' || next === 'O') &&\n vowels.test(prev)\n ) {\n primary += 'J'\n secondary += 'H'\n } else if (index === last) {\n primary += 'J'\n } else if (\n prev !== 'S' &&\n prev !== 'K' &&\n prev !== 'L' &&\n !jForJException.test(next)\n ) {\n primary += 'J'\n secondary += 'J'\n // It could happen.\n } else if (next === 'J') {\n index++\n }\n\n index++\n\n break\n case 'K':\n if (next === 'K') {\n index++\n }\n\n primary += 'K'\n secondary += 'K'\n index++\n\n break\n case 'L':\n if (next === 'L') {\n // Spanish such as `cabrillo`, `gallegos`.\n if (\n (index === length - 3 &&\n ((prev === 'A' && nextnext === 'E') ||\n (prev === 'I' && (nextnext === 'O' || nextnext === 'A')))) ||\n (prev === 'A' &&\n nextnext === 'E' &&\n (characters[last] === 'A' ||\n characters[last] === 'O' ||\n alle.test(value.slice(last - 1, length))))\n ) {\n primary += 'L'\n index += 2\n\n break\n }\n\n index++\n }\n\n primary += 'L'\n secondary += 'L'\n index++\n\n break\n case 'M':\n if (\n next === 'M' ||\n // Such as `dumb`, `thumb`.\n (prev === 'U' &&\n next === 'B' &&\n (index + 1 === last || value.slice(index + 2, index + 4) === 'ER'))\n ) {\n index++\n }\n\n index++\n primary += 'M'\n secondary += 'M'\n\n break\n case 'N':\n if (next === 'N') {\n index++\n }\n\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'Ñ':\n index++\n primary += 'N'\n secondary += 'N'\n\n break\n case 'P':\n if (next === 'H') {\n primary += 'F'\n secondary += 'F'\n index += 2\n\n break\n }\n\n // Also account for `campbell` and `raspberry`.\n subvalue = next\n\n if (subvalue === 'P' || subvalue === 'B') {\n index++\n }\n\n index++\n\n primary += 'P'\n secondary += 'P'\n\n break\n case 'Q':\n if (next === 'Q') {\n index++\n }\n\n index++\n primary += 'K'\n secondary += 'K'\n\n break\n case 'R':\n // French such as `Rogier`, but exclude `Hochmeier`.\n if (\n index === last &&\n !isSlavoGermanic &&\n prev === 'E' &&\n characters[index - 2] === 'I' &&\n characters[index - 4] !== 'M' &&\n (characters[index - 3] !== 'E' && characters[index - 3] !== 'A')\n ) {\n secondary += 'R'\n } else {\n primary += 'R'\n secondary += 'R'\n }\n\n if (next === 'R') {\n index++\n }\n\n index++\n\n break\n case 'S':\n // Special cases `island`, `isle`, `carlisle`, `carlysle`.\n if (next === 'L' && (prev === 'I' || prev === 'Y')) {\n index++\n\n break\n }\n\n // Special case `sugar-`.\n if (index === 0 && value.slice(1, 5) === 'UGAR') {\n primary += 'X'\n secondary += 'S'\n index++\n\n break\n }\n\n if (next === 'H') {\n // Germanic.\n if (hForS.test(value.slice(index + 1, index + 5))) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 2\n break\n }\n\n if (\n next === 'I' &&\n (nextnext === 'O' || nextnext === 'A')\n // Bug: Already covered by previous branch\n // || value.slice(index, index + 4) === 'SIAN'\n ) {\n if (isSlavoGermanic) {\n primary += 'S'\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n // German & Anglicization's, such as `Smith` match `Schmidt`, `snider`\n // match `Schneider`. Also, -sz- in slavic language although in\n // hungarian it is pronounced `s`.\n if (\n next === 'Z' ||\n (index === 0 &&\n (next === 'L' || next === 'M' || next === 'N' || next === 'W'))\n ) {\n primary += 'S'\n secondary += 'X'\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n }\n\n if (next === 'C') {\n // Schlesinger's rule.\n if (nextnext === 'H') {\n subvalue = value.slice(index + 3, index + 5)\n\n // Dutch origin, such as `school`, `schooner`.\n if (dutchSch.test(subvalue)) {\n // Such as `schermerhorn`, `schenker`.\n if (subvalue === 'ER' || subvalue === 'EN') {\n primary += 'X'\n secondary += 'SK'\n } else {\n primary += 'SK'\n secondary += 'SK'\n }\n\n index += 3\n\n break\n }\n\n if (\n index === 0 &&\n !vowels.test(characters[3]) &&\n characters[3] !== 'W'\n ) {\n primary += 'X'\n secondary += 'S'\n } else {\n primary += 'X'\n secondary += 'X'\n }\n\n index += 3\n\n break\n }\n\n if (nextnext === 'I' || nextnext === 'E' || nextnext === 'Y') {\n primary += 'S'\n secondary += 'S'\n index += 3\n break\n }\n\n primary += 'SK'\n secondary += 'SK'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index - 2, index)\n\n // French such as `resnais`, `artois`.\n if (index === last && (subvalue === 'AI' || subvalue === 'OI')) {\n secondary += 'S'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (\n next === 'S'\n // Bug: already taken care of by `German & Anglicization's` above:\n // || next === 'Z'\n ) {\n index++\n }\n\n index++\n\n break\n case 'T':\n if (next === 'I' && nextnext === 'O' && characters[index + 3] === 'N') {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n subvalue = value.slice(index + 1, index + 3)\n\n if (\n (next === 'I' && nextnext === 'A') ||\n (next === 'C' && nextnext === 'H')\n ) {\n primary += 'X'\n secondary += 'X'\n index += 3\n\n break\n }\n\n if (next === 'H' || (next === 'T' && nextnext === 'H')) {\n // Special case `Thomas`, `Thames` or Germanic.\n if (\n isGermanic ||\n ((nextnext === 'O' || nextnext === 'A') &&\n characters[index + 3] === 'M')\n ) {\n primary += 'T'\n secondary += 'T'\n } else {\n primary += '0'\n secondary += 'T'\n }\n\n index += 2\n\n break\n }\n\n if (next === 'T' || next === 'D') {\n index++\n }\n\n index++\n primary += 'T'\n secondary += 'T'\n\n break\n case 'V':\n if (next === 'V') {\n index++\n }\n\n primary += 'F'\n secondary += 'F'\n index++\n\n break\n case 'W':\n // Can also be in middle of word (as already taken care of for initial).\n if (next === 'R') {\n primary += 'R'\n secondary += 'R'\n index += 2\n\n break\n }\n\n if (index === 0) {\n // `Wasserman` should match `Vasserman`.\n if (vowels.test(next)) {\n primary += 'A'\n secondary += 'F'\n } else if (next === 'H') {\n // Need `Uomo` to match `Womo`.\n primary += 'A'\n secondary += 'A'\n }\n }\n\n // `Arnow` should match `Arnoff`.\n if (\n ((prev === 'E' || prev === 'O') &&\n next === 'S' &&\n nextnext === 'K' &&\n (characters[index + 3] === 'I' || characters[index + 3] === 'Y')) ||\n // Maybe a bug? Shouldn't this be general Germanic?\n value.slice(0, 3) === 'SCH' ||\n (index === last && vowels.test(prev))\n ) {\n secondary += 'F'\n index++\n\n break\n }\n\n // Polish such as `Filipowicz`.\n if (\n next === 'I' &&\n (nextnext === 'C' || nextnext === 'T') &&\n characters[index + 3] === 'Z'\n ) {\n primary += 'TS'\n secondary += 'FX'\n index += 4\n\n break\n }\n\n index++\n\n break\n case 'X':\n // French such as `breaux`.\n if (\n !(\n index === last &&\n // Bug: IAU and EAU also match by AU\n // (/IAU|EAU/.test(value.slice(index - 3, index))) ||\n (prev === 'U' &&\n (characters[index - 2] === 'A' || characters[index - 2] === 'O'))\n )\n ) {\n primary += 'KS'\n secondary += 'KS'\n }\n\n if (next === 'C' || next === 'X') {\n index++\n }\n\n index++\n\n break\n case 'Z':\n // Chinese pinyin such as `Zhao`.\n if (next === 'H') {\n primary += 'J'\n secondary += 'J'\n index += 2\n\n break\n } else if (\n (next === 'Z' &&\n (nextnext === 'A' || nextnext === 'I' || nextnext === 'O')) ||\n (isSlavoGermanic && index > 0 && prev !== 'T')\n ) {\n primary += 'S'\n secondary += 'TS'\n } else {\n primary += 'S'\n secondary += 'S'\n }\n\n if (next === 'Z') {\n index++\n }\n\n index++\n\n break\n default:\n index++\n }\n }\n\n return [primary, secondary]\n}", "function getSentences(tag) {\n for (i = 0; i < tag.length; i++) {\n var text = tag[i].textContent\n if (text.indexOf(\" \") !== 1) {\n if (text !== \"\") {\n allTexts.push(text);\n }\n }\n }\n\n\n\n for (i = 0; i < allTexts.length; i++) {\n article = allTexts.join(\"\\n\");\n allWords = article.split(/\\W+/);\n }\n }", "function makeSentence(){\n var o = wordObj.letterBank.vowels[3];\n var n = wordObj.letterBank.singleLetters.two;\n var space = wordObj.space;\n var my = wordObj.letterBank.pairedLetters.one;\n var way = wordObj.wordBank.one;\n var t = wordObj.letterBank.singleLetters.one;\n var e = wordObj.letterBank.vowels[1];\n var ch = wordObj.letterBank.pairedLetters.two;\n var tonic = wordObj.wordBank.two;\n var exclamation = wordObj.punctuation;\n \n return (o.toUpperCase()+n+space+my+space+way+space+t+o+space+t.toUpperCase()+e+ch+tonic+exclamation);\n}", "function Wb(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function Phrase(content) {\n this.content = content;\n\n // Makes the phrase LOUDER.\n this.louder = function() {\n // FILL IN\n let loudy = this.content.toUpperCase()\n return loudy\n };\n}", "function __doubleMetaphone(value) {\n var primary = '',\n secondary = '',\n index = 0,\n length = value.length,\n last = length - 1,\n isSlavoGermanic = SLAVO_GERMANIC.test(value),\n isGermanic = GERMANIC.test(value),\n characters = value.split(''),\n subvalue,\n next,\n prev,\n nextnext;\n\n value = String(value).toUpperCase() + ' ';\n\n // Skip this at beginning of word.\n if (INITIAL_EXCEPTIONS.test(value))\n index++;\n\n // Initial X is pronounced Z, which maps to S. Such as `Xavier`\n if (characters[0] === 'X') {\n primary += 'S';\n secondary += 'S';\n\n index++;\n }\n\n while (index < length) {\n prev = characters[index - 1];\n next = characters[index + 1];\n nextnext = characters[index + 2];\n\n switch (characters[index]) {\n case 'A':\n case 'E':\n case 'I':\n case 'O':\n case 'U':\n case 'Y':\n case 'À':\n case 'Ê':\n case 'É':\n case 'É':\n if (index === 0) {\n // All initial vowels now map to `A`.\n primary += 'A';\n secondary += 'A';\n }\n\n index++;\n\n break;\n case 'B':\n primary += 'P';\n secondary += 'P';\n\n if (next === 'B')\n index++;\n\n index++;\n\n break;\n case 'Ç':\n primary += 'S';\n secondary += 'S';\n index++;\n\n break;\n case 'C':\n // Various Germanic:\n if (prev === 'A' &&\n next === 'H' &&\n nextnext !== 'I' &&\n !VOWELS.test(characters[index - 2]) &&\n (nextnext !== 'E' || (subvalue = value.slice(index - 2, index + 4) &&\n (subvalue === 'BACHER' || subvalue === 'MACHER')))\n ) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Special case for `Caesar`.\n if (index === 0 && value.slice(index + 1, index + 6) === 'AESAR') {\n primary += 'S';\n secondary += 'S';\n index += 2;\n\n break;\n }\n\n // Italian `Chianti`.\n if (value.slice(index + 1, index + 4) === 'HIA') {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n if (next === 'H') {\n // Find `Michael`.\n if (index > 0 && nextnext === 'A' && characters[index + 3] === 'E') {\n primary += 'K';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n // Greek roots such as `chemistry`, `chorus`.\n if (index === 0 && GREEK_INITIAL_CH.test(value)) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Germanic, Greek, or otherwise `CH` for `KH` sound.\n if (isGermanic ||\n // Such as 'architect' but not 'arch', orchestra', 'orchid'.\n GREEK_CH.test(value.slice(index - 2, index + 4)) ||\n (nextnext === 'T' || nextnext === 'S') ||\n ((index === 0 ||\n prev === 'A' ||\n prev === 'E' ||\n prev === 'O' ||\n prev === 'U') &&\n // Such as `wachtler`, `weschsler`, but not `tichner`.\n CH_FOR_KH.test(nextnext))\n ) {\n primary += 'K';\n secondary += 'K';\n } else if (index === 0) {\n primary += 'X';\n secondary += 'X';\n } else if (value.slice(0, 2) === 'MC') { // Such as 'McHugh'.\n // Bug? Why matching absolute? what about McHiccup?\n primary += 'K';\n secondary += 'K';\n } else {\n primary += 'X';\n secondary += 'K';\n }\n\n index += 2;\n\n break;\n }\n\n // Such as `Czerny`.\n if (next === 'Z' && value.slice(index - 2, index) !== 'WI') {\n primary += 'S';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n // Such as `Focaccia`.\n if (value.slice(index + 1, index + 4) === 'CIA') {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n // Double `C`, but not `McClellan`.\n if (next === 'C' && !(index === 1 && characters[0] === 'M')) {\n // Such as `Bellocchio`, but not `Bacchus`.\n if ((nextnext === 'I' ||\n nextnext === 'E' ||\n nextnext === 'H') &&\n value.slice(index + 2, index + 4) !== 'HU'\n ) {\n subvalue = value.slice(index - 1, index + 4);\n\n // Such as `Accident`, `Accede`, `Succeed`.\n if ((index === 1 && prev === 'A') || subvalue === 'UCCEE' || subvalue === 'UCCES') {\n primary += 'KS';\n secondary += 'KS';\n } else { // Such as `Bacci`, `Bertucci`, other Italian.\n primary += 'X';\n secondary += 'X';\n }\n\n index += 3;\n\n break;\n } else {\n // Pierce's rule.\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n }\n\n if (next === 'G' || next === 'K' || next === 'Q') {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Italian.\n if (next === 'I' && (nextnext === 'A' || nextnext === 'E' || nextnext === 'O')) {\n primary += 'S';\n secondary += 'X';\n index += 2;\n\n break;\n }\n\n if (next === 'I' || next === 'E' || next === 'Y') {\n primary += 'S';\n secondary += 'S';\n index += 2;\n\n break;\n }\n\n primary += 'K';\n secondary += 'K';\n\n // Skip two extra characters ahead in `Mac Caffrey`, `Mac Gregor`.\n if (next === ' ' && (nextnext === 'C' || nextnext === 'G' || nextnext === 'Q')) {\n index += 3;\n break;\n }\n\n if (next === 'K' || next === 'Q' || (next === 'C' && nextnext !== 'E' && nextnext !== 'I'))\n index++;\n\n index++;\n\n break;\n case 'D':\n if (next === 'G') {\n // Such as `edge`.\n if (nextnext === 'E' || nextnext === 'I' || nextnext === 'Y') {\n primary += 'J';\n secondary += 'J';\n index += 3;\n } else { // Such as `Edgar`.\n primary += 'TK';\n secondary += 'TK';\n index += 2;\n }\n\n break;\n }\n\n if (next === 'T' || next === 'D') {\n primary += 'T';\n secondary += 'T';\n index += 2;\n\n break;\n }\n\n primary += 'T';\n secondary += 'T';\n index++;\n\n break;\n case 'F':\n if (next === 'F')\n index++;\n\n index++;\n primary += 'F';\n secondary += 'F';\n\n break;\n case 'G':\n if (next === 'H') {\n if (index > 0 && !VOWELS.test(prev)) {\n primary += 'K';\n secondary += 'K';\n index += 2;\n\n break;\n }\n\n // Such as `Ghislane`, `Ghiradelli`.\n if (index === 0) {\n if (nextnext === 'I') {\n primary += 'J';\n secondary += 'J';\n } else {\n primary += 'K';\n secondary += 'K';\n }\n index += 2;\n break;\n }\n\n // Parker's rule (with some further refinements).\n if ((// Such as `Hugh`\n subvalue = characters[index - 2],\n subvalue === 'B' ||\n subvalue === 'H' ||\n subvalue === 'D'\n ) ||\n (// Such as `bough`.\n subvalue = characters[index - 3],\n subvalue === 'B' ||\n subvalue === 'H' ||\n subvalue === 'D'\n ) ||\n (// Such as `Broughton`.\n subvalue = characters[index - 4],\n subvalue === 'B' ||\n subvalue === 'H'\n )\n ) {\n index += 2;\n\n break;\n }\n\n // Such as `laugh`, `McLaughlin`, `cough`, `gough`, `rough`, `tough`.\n if (index > 2 && prev === 'U' && G_FOR_F.test(characters[index - 3])) {\n primary += 'F';\n secondary += 'F';\n } else if (index > 0 && prev !== 'I') {\n primary += 'K';\n secondary += 'K';\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'N') {\n if (index === 1 && VOWELS.test(characters[0]) && !isSlavoGermanic) {\n primary += 'KN';\n secondary += 'N';\n } else if (\n // Not like `Cagney`.\n value.slice(index + 2, index + 4) !== 'EY' &&\n value.slice(index + 1) !== 'Y' &&\n !isSlavoGermanic\n ) {\n primary += 'N';\n secondary += 'KN';\n } else {\n primary += 'KN';\n secondary += 'KN';\n }\n\n index += 2;\n\n break;\n }\n\n //Such as `Tagliaro`.\n if (value.slice(index + 1, index + 3) === 'LI' && !isSlavoGermanic) {\n primary += 'KL';\n secondary += 'L';\n index += 2;\n\n break;\n }\n\n // -ges-, -gep-, -gel- at beginning.\n if (index === 0 && INITIAL_G_FOR_KJ.test(value.slice(1, 3))) {\n primary += 'K';\n secondary += 'J';\n index += 2;\n\n break;\n }\n\n // -ger-, -gy-.\n if ((value.slice(index + 1, index + 3) === 'ER' &&\n prev !== 'I' && prev !== 'E' &&\n !INITIAL_ANGER_EXCEPTION.test(value.slice(0, 6))\n ) ||\n (next === 'Y' && !G_FOR_KJ.test(prev))\n ) {\n primary += 'K';\n secondary += 'J';\n index += 2;\n\n break;\n }\n\n // Italian such as `biaggi`.\n if (next === 'E' || next === 'I' || next === 'Y' || (\n (prev === 'A' || prev === 'O') &&\n next === 'G' && nextnext === 'I'\n )\n ) {\n // Obvious Germanic.\n if (value.slice(index + 1, index + 3) === 'ET' || isGermanic) {\n primary += 'K';\n secondary += 'K';\n } else {\n // Always soft if French ending.\n if (value.slice(index + 1, index + 5) === 'IER ') {\n primary += 'J';\n secondary += 'J';\n } else {\n primary += 'J';\n secondary += 'K';\n }\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'G')\n index++;\n\n index++;\n\n primary += 'K';\n secondary += 'K';\n\n break;\n case 'H':\n // Only keep if first & before vowel or btw. 2 vowels.\n if (VOWELS.test(next) && (index === 0 || VOWELS.test(prev))) {\n primary += 'H';\n secondary += 'H';\n\n index++;\n }\n\n index++;\n\n break;\n case 'J':\n // Obvious Spanish, `jose`, `San Jacinto`.\n if (value.slice(index, index + 4) === 'JOSE' || value.slice(0, 4) === 'SAN ') {\n if (value.slice(0, 4) === 'SAN ' || (index === 0 && characters[index + 4] === ' ')) {\n primary += 'H';\n secondary += 'H';\n } else {\n primary += 'J';\n secondary += 'H';\n }\n\n index++;\n\n break;\n }\n\n if (index === 0) {\n // Such as `Yankelovich` or `Jankelowicz`.\n primary += 'J';\n secondary += 'A';\n } else if (// Spanish pron. of such as `bajador`.\n !isSlavoGermanic &&\n (next === 'A' || next === 'O') &&\n VOWELS.test(prev)\n ) {\n primary += 'J';\n secondary += 'H';\n } else if (index === last) {\n primary += 'J';\n } else if (prev !== 'S' && prev !== 'K' && prev !== 'L' && !J_FOR_J_EXCEPTION.test(next)) {\n primary += 'J';\n secondary += 'J';\n } else if (next === 'J') {\n index++;\n }\n\n index++;\n\n break;\n case 'K':\n if (next === 'K')\n index++;\n\n primary += 'K';\n secondary += 'K';\n index++;\n\n break;\n case 'L':\n if (next === 'L') {\n // Spanish such as `cabrillo`, `gallegos`.\n if ((index === length - 3 && ((\n prev === 'I' && (\n nextnext === 'O' || nextnext === 'A'\n )\n ) || (\n prev === 'A' && nextnext === 'E'\n )\n )) || (\n prev === 'A' && nextnext === 'E' && ((\n characters[last] === 'A' || characters[last] === 'O'\n ) || ALLE.test(value.slice(last - 1, length))\n )\n )\n ) {\n primary += 'L';\n index += 2;\n\n break;\n }\n\n index++;\n }\n\n primary += 'L';\n secondary += 'L';\n index++;\n\n break;\n case 'M':\n // Such as `dumb`, `thumb`.\n if (next === 'M' || (\n prev === 'U' && next === 'B' && (\n index + 1 === last || value.slice(index + 2, index + 4) === 'ER')\n )\n ) {\n index++;\n }\n\n index++;\n primary += 'M';\n secondary += 'M';\n\n break;\n case 'N':\n if (next === 'N')\n index++;\n\n index++;\n primary += 'N';\n secondary += 'N';\n\n break;\n case 'Ñ':\n index++;\n primary += 'N';\n secondary += 'N';\n\n break;\n case 'P':\n if (next === 'H') {\n primary += 'F';\n secondary += 'F';\n index += 2;\n\n break;\n }\n\n // Also account for `campbell` and `raspberry`.\n subvalue = next;\n\n if (subvalue === 'P' || subvalue === 'B')\n index++;\n\n index++;\n\n primary += 'P';\n secondary += 'P';\n\n break;\n case 'Q':\n if (next === 'Q') {\n index++;\n }\n\n index++;\n primary += 'K';\n secondary += 'K';\n\n break;\n case 'R':\n // French such as `Rogier`, but exclude `Hochmeier`.\n if (index === last &&\n !isSlavoGermanic &&\n prev === 'E' &&\n characters[index - 2] === 'I' &&\n characters[index - 4] !== 'M' && (\n characters[index - 3] !== 'E' &&\n characters[index - 3] !== 'A'\n )\n ) {\n secondary += 'R';\n } else {\n primary += 'R';\n secondary += 'R';\n }\n\n if (next === 'R')\n index++;\n\n index++;\n\n break;\n case 'S':\n // Special cases `island`, `isle`, `carlisle`, `carlysle`.\n if (next === 'L' && (prev === 'I' || prev === 'Y')) {\n index++;\n\n break;\n }\n\n // Special case `sugar-`.\n if (index === 0 && value.slice(1, 5) === 'UGAR') {\n primary += 'X';\n secondary += 'S';\n index++;\n\n break;\n }\n\n if (next === 'H') {\n // Germanic.\n if (H_FOR_S.test(value.slice(index + 1, index + 5))) {\n primary += 'S';\n secondary += 'S';\n } else {\n primary += 'X';\n secondary += 'X';\n }\n\n index += 2;\n break;\n }\n\n if (next === 'I' && (nextnext === 'O' || nextnext === 'A')) {\n if (!isSlavoGermanic) {\n primary += 'S';\n secondary += 'X';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n index += 3;\n\n break;\n }\n\n /*\n * German & Anglicization's, such as `Smith` match `Schmidt`,\n * `snider` match `Schneider`. Also, -sz- in slavic language\n * although in hungarian it is pronounced `s`.\n */\n if (next === 'Z' || (\n index === 0 && (\n next === 'L' || next === 'M' || next === 'N' || next === 'W'\n )\n )\n ) {\n primary += 'S';\n secondary += 'X';\n\n if (next === 'Z')\n index++;\n\n index++;\n\n break;\n }\n\n if (next === 'C') {\n // Schlesinger's rule.\n if (nextnext === 'H') {\n subvalue = value.slice(index + 3, index + 5);\n\n // Dutch origin, such as `school`, `schooner`.\n if (DUTCH_SCH.test(subvalue)) {\n // Such as `schermerhorn`, `schenker`.\n if (subvalue === 'ER' || subvalue === 'EN') {\n primary += 'X';\n secondary += 'SK';\n } else {\n primary += 'SK';\n secondary += 'SK';\n }\n\n index += 3;\n\n break;\n }\n\n if (index === 0 && !VOWELS.test(characters[3]) && characters[3] !== 'W') {\n primary += 'X';\n secondary += 'S';\n } else {\n primary += 'X';\n secondary += 'X';\n }\n\n index += 3;\n\n break;\n }\n\n if (nextnext === 'I' || nextnext === 'E' || nextnext === 'Y') {\n primary += 'S';\n secondary += 'S';\n index += 3;\n break;\n }\n\n primary += 'SK';\n secondary += 'SK';\n index += 3;\n\n break;\n }\n\n subvalue = value.slice(index - 2, index);\n\n // French such as `resnais`, `artois`.\n if (index === last && (subvalue === 'AI' || subvalue === 'OI')) {\n secondary += 'S';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n if (next === 'S' || next === 'Z')\n index++;\n\n index++;\n\n break;\n case 'T':\n if (next === 'I' && nextnext === 'O' && characters[index + 3] === 'N') {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n subvalue = value.slice(index + 1, index + 3);\n\n if ((next === 'I' && nextnext === 'A') || (next === 'C' && nextnext === 'H')) {\n primary += 'X';\n secondary += 'X';\n index += 3;\n\n break;\n }\n\n if (next === 'H' || (next === 'T' && nextnext === 'H')) {\n // Special case `Thomas`, `Thames` or Germanic.\n if (isGermanic || ((nextnext === 'O' || nextnext === 'A') && characters[index + 3] === 'M')) {\n primary += 'T';\n secondary += 'T';\n } else {\n primary += '0';\n secondary += 'T';\n }\n\n index += 2;\n\n break;\n }\n\n if (next === 'T' || next === 'D')\n index++;\n\n index++;\n primary += 'T';\n secondary += 'T';\n\n break;\n case 'V':\n if (next === 'V')\n index++;\n\n primary += 'F';\n secondary += 'F';\n index++;\n\n break;\n case 'W':\n // Can also be in middle of word (as already taken care of for initial).\n if (next === 'R') {\n primary += 'R';\n secondary += 'R';\n index += 2;\n\n break;\n }\n\n if (index === 0) {\n // `Wasserman` should match `Vasserman`.\n if (VOWELS.test(next)) {\n primary += 'A';\n secondary += 'F';\n } else if (next === 'H') {\n // Need `Uomo` to match `Womo`.\n primary += 'A';\n secondary += 'A';\n }\n }\n\n // `Arnow` should match `Arnoff`.\n if (((prev === 'E' || prev === 'O') &&\n next === 'S' && nextnext === 'K' && (\n characters[index + 3] === 'I' ||\n characters[index + 3] === 'Y'\n )\n ) || value.slice(0, 3) === 'SCH' || (index === last && VOWELS.test(prev))\n ) {\n secondary += 'F';\n index++;\n\n break;\n }\n\n // Polish such as `Filipowicz`.\n if (next === 'I' && (nextnext === 'C' || nextnext === 'T') && characters[index + 3] === 'Z') {\n primary += 'TS';\n secondary += 'FX';\n index += 4;\n\n break;\n }\n\n index++;\n\n break;\n case 'X':\n // French such as `breaux`.\n if (index === last || (prev === 'U' && (\n characters[index - 2] === 'A' ||\n characters[index - 2] === 'O'\n ))\n ) {\n primary += 'KS';\n secondary += 'KS';\n }\n\n if (next === 'C' || next === 'X')\n index++;\n\n index++;\n\n break;\n case 'Z':\n // Chinese pinyin such as `Zhao`.\n if (next === 'H') {\n primary += 'J';\n secondary += 'J';\n index += 2;\n\n break;\n } else if ((next === 'Z' && (\n nextnext === 'A' || nextnext === 'I' || nextnext === 'O'\n )) || (\n isSlavoGermanic && index > 0 && prev !== 'T'\n )\n ) {\n primary += 'S';\n secondary += 'TS';\n } else {\n primary += 'S';\n secondary += 'S';\n }\n\n if (next === 'Z')\n index++;\n\n index++;\n\n break;\n default:\n index++;\n\n }\n }\n\n return [primary, secondary];\n }", "get_entitys(text) {\r\n // everything between {}\r\n const items = text.match(/\\{([^}]+)\\}/g);\r\n // the length of items \r\n const items_length = items.length;\r\n // loop through all items\r\n for (let i = 0; i < items_length; i++) { \r\n // check if the item contains \"classname\", this usally means that its a entity\r\n if (items[i].match(/(?:\"classname\")/)) {\r\n // do stuff it the itme contains \"origin\"\r\n // add the item to the list of entitys\r\n this.entitys.push(items[i]);\r\n }\r\n }\r\n }", "static parse(s) {\n const split = s.split('\\.', 7);\n if (split.length !== 7) {\n console.error(s + ' is not a valid Noun');\n }\n const noun = new Noun();\n // gender\n noun.masculine = 'M' === split[0];\n // singular/plural\n noun.singular = split[1];\n noun.plural = split[2];\n // stat\n noun.stats = new Map();\n split[3].split('\\|').forEach(stat => {\n if (stat.indexOf('=') !== -1) {\n const statSplit = stat.split('=');\n noun.stats.set(statSplit[0], Number(statSplit[1]));\n }\n });\n // tag\n noun.tags = split[4].split('\\|');\n // power\n noun.powers = split[5].split('\\|');\n noun.price = _price__WEBPACK_IMPORTED_MODULE_2__[\"Price\"].parse(split[6], split[1]);\n return noun;\n }", "function solution(S) {\n // we need regex\n // First, we seperate everything by sentences, this includes delimiters (needs to be removed)\n var sentArr = S.match(/[^\\.!\\?]+[\\.!\\?]+/g);\n // Next we clean up each sentence. Remove trailing spaces. Convert multiple sequential spaces to one\n sentArr = sentArr.map(item => {\n return item.trim().replace(/ +/g, \" \");\n });\n // Next we clean up any edge cases \"Save time .\" should be \"Save time.\"\n\n console.log(sentArr);\n // Next, we count number of spaces. If there's 2 spaces, that means there's 3 words\n var result = 0;\n for (let i = 0; i < sentArr.length; i++) {\n let numWordsInSentence = sentArr[i].split(\" \").length;\n if (result < numWordsInSentence) {\n result = numWordsInSentence;\n }\n }\n return result;\n}", "class_string() {\n\t\treturn \"Student\";\n\t}", "function correctSentence(text) {\n text = text.charAt(0).toUpperCase().concat(text.substr(1));\n if(!text.endsWith('.')){\n return text.concat('.');\n } \n return text;\n}", "function processSentence(nama, umur, alamat, hobi) {\n return 'Nama saya ' + nama + ', ' + 'umur saya ' + umur + ' tahun,' + ' alamat saya di ' + alamat + ', dan saya punya hobi yaitu ' + hobi + '!'\n}", "function GenerateNewText() {\n\n this.choices = []; // create this so we don't duplicate the sentences chosen\n\n // Add property to the object\n this.sentences =\n [\n \"The term \\\"tested in an ABM mode\\\" used in Article II of the Treaty refers to: (a) an ABM interceptor missile if while guided by an ABM radar it has intercepted a strategic ballistic missile or its elements in flight trajectory regardless of whether such intercept was successful or not; or if an ABM interceptor missile has been launched from an ABM launcher and guided by an ABM radar. If ABM interceptor missiles are given the capability to carry out interception without the use of ABM radars as the means of guidance, application of the term \\\"tested in an ABM mode\\\" to ABM interceptor missiles in that event shall be subject to additional discussion and agreement in the Standing Consultative Commission; (b) an ABM launcher if it has been used for launching an ABM interceptor missile; (c) an ABM radar if it has tracked a strategic ballistic missile or its elements in flight trajectory and guided an ABM interceptor missile toward them regardless of whether the intercept was successful or not; or tracked and guided an ABM interceptor missile; or tracked a strategic ballistic missile or its elements in flight trajectory in conjunction with an ABM radar, which is tracking a strategic ballistic missile or its elements in flight trajectory and guiding an ABM interceptor missile toward them or is tracking and guiding an ABM interceptor missile.\",\n \"EWO launch: If sequence does not start after coordinated key turn, refer to Fig 2-1 and Notify command post of type deviation, ETOR, and intent to perform TCCPS; Post ETOR to EWO documents.\",\n \"(For classified information on the RV, refer to the 11N series Technical Orders.)\",\n \"Here's my strategry on the Cold War: we win, they lose.\",\n \"The only thing that kept the Cold War cold was the mutual deterrance afforded by nuclear weapons.\",\n \"The weapons of war must be abolished before they abolish us.\",\n \"Ours is a world of nuclear giants and ethical infants.\",\n \"The safety and arming devices are acceleration-type, arming-delay devices that prevent accidental warhead detonation.\",\n \"The immediate fireball reaches temperatures in the ranges of tens of millions of degrees, ie, as hot as the interior temperatures of the sun.\",\n \"In a typical nuclear detonation, because the fireball is so hot, it immediately begins to rise in altitude. As it rises, a vacuum effect is created under the fireball, and air that had been pushed away from the detonation rushes back toward the fireball, causing an upward flow of air and dust that follows it.\",\n \"The RV/G&C van is used to transport and remove/replace the RV and the MGS for the MM II weapon system.\",\n \"Computer components include a VAX 11/750 main computer, an Intel 80186 CPU in the buffer, and the Ethernet LAN which connects the buffer with the main computer.\",\n \"The Specific Force Integrating Receiver (SFIR) is one of the instruments within the IMU of the Missile G&C Set (MGCS) which measures velocity along three orthogonal axes.\",\n \"The SFIR incorporates a pendulous integrating gyro having a specific mass unbalance along the spin axis, and provides correction rates to the Missile Electronics Computer Assembly (MECA) which provides ouputs to the different direction control units resulting in control of the missile flight.\",\n \"SAC has directed that all VAFB flight test systems and the PK LSS will be compatible with the SAC ILSC requirement.\",\n \"The ground shock accompanying the blast is nullified in the control center by a three-level, steel, shock-isolation cage, which is supported by eight shock mounts hung from the domed roof.\",\n \"(Prior to MCL 3252) Fixed vapor sensing equipment consists of an oxidizer vapor detector, a fuel vapor detector, a vapor detector annunciator panel, and associated sensing devices located throughout the silo area.\",\n \"The LAUNCH CONTROL AND MONITOR section contains switches to lock out the system, select a target, initiate a lunch, shutdown and reset.\",\n \"The CMG-1 chassis contains the logic required to control launch.\",\n \"Attention turned to the Nike X concept, a layered system with more than one type of missile.\",\n \"At this point a fight broke out between the Air Force and Army over who had precedence to develop land-based ABM systems.\",\n \"It is such a big explosion, it can smash in buildings and knock signboards over, and break windows all over town, but if you duck and cover, like Bert [the Turtle], you will be much safer.\",\n \"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.\",\n \"The living will envy the dead.\",\n \"Frequent fear of nuclear war in adolescents seems to be an indicator for an increased risk for common mental disorders and deserves serious attention.\",\n \"The Peacekeeper was the first U.S. ICBM to use cold launch technology.\",\n \"The Protocol to the Agreement with regard to Article III, entitled the United States to have no more than 710 SLBM launchers on 44 modern ballistic missile submarines, and the USSR, no more than 950 SLBM launchers on 62 submarines.\",\n \"Well hell, I'd piss on a spark plug if you thought it would do any good.\",\n \"Do you want to play a game?\",\n \"Gentlemen! You can't fight in here! This is the war room!\",\n \"I do not avoid women, Mandrake. But I do deny them my essence.\",\n \"Mr. Ryan, be careful what you shoot at. Most things here don't react well to bullets.\",\n \"If OPERATE OK on the BVLC does not light in step 5, verify that the proper code is inserted.\",\n \"PEACETIME launch: If abnormal indications occur prior to step 8, report to Launch Director and proceed as directed.\",\n \"The missile silo (figure 1-2) is a reinforced, concrete structure with inside dimensions of approximately 146 feet in depth and 55 feet in diameter.\",\n \"General, you are listening to a machine.\",\n \"The mechanism is... Oh James, James... Will you make love to me all the time in England?\",\n \"I never joke about my work, 007.\", \n \"Eventually Kwajalein Island was selected, as it was 4,800 miles from California, perfect for ICBMs, and already had a US Navy base with considerable housing stocks and an airstrip.\",\n \"From Stettin in the Baltic to Trieste in the Adriatic an iron curtain has descended across the Continent.\",\n \"Whether you like it or not, history is on our side. We will bury you.\",\n \"I like Mr. Gorbachev. We can do business together.\",\n \"Mr. Gorbachev, tear down this wall!\",\n \"Gort! Klaatu barada nikto!\",\n \"It is no concern of ours how you run your own planet. But if you threaten to extend your violence, this Earth of yours will be reduced to a burned-out cinder.\",\n \"The remaining base in North Dakota, the Stanley R. Mickelsen Safeguard Complex, became active on 1 April 1975 and fully operational on 1 October 1975. By that time the House Appropriations Committee had already voted to deativate it. The base was shutdown on 10 February 1976.\"\n\n\n ];\n\n console.log(\"How many sentences? \",this.sentences.length);\n}", "function splitSentences(text) {\n\treturn text.replace(/([!?]|\\.\\.\\.)\\s+/g, \"$1. \").split(/[.;]\\s/);\n}", "function spreadOut() {\r\n let fragment = ['to', 'code'];\r\n let sentence = ['learning', ...fragment, 'is', 'fun']; // Change this line\r\n return sentence;\r\n}", "function getFirstTwoLettersOfEachWord(list) {\n\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun'];\n return sentence;\n}", "function getMiddle(s) {\n //Code goes here!\n const strArray = s.split('')\n const evenLength = s.length % 2 === 0\n\n if (evenLength) {\n const half = strArray.length / 2\n return `${strArray[half - 1]}${strArray[half]}`\n }\n\n const half = Math.floor(strArray.length / 2)\n return strArray[half]\n}", "function makespeakable(phrase) {\n phrase = phrase.replace(/['\"]/g, \"\");\n phrase = phrase.replace(/[-+]/g, \" \");\n phrase = phrase.replace(/([A-Z])(?=[A-Z])/g, \"$1 \"); //split apart capitals\n phrase = phrase.replace(/([A-Za-z])([0-9])/g, \"$1 $2\"); // split letter-number\n phrase = phrase.replace(/([0-9])([A-Za-z])/g, \"$1 $2\"); // split number-letter\n return phrase.replace(/\\b[A-Z](?=[[:space:][:punct:]])/g, function(match) {\n return say_letter[match.toUpperCase()];\n })\n .replace(/[0-9]+ ?(st|nd|rd|th)\\b/g, function(match) {\n return n2w.toOrdinalWords(parseInt(match)).replace(/[-,]/g, \" \");\n })\n .replace(/[0-9]+/g, function(match) {\n return n2w.toWords(match).replace(/[-,]/g, \" \");\n });\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = // change this line\n return sentence;\n}" ]
[ "0.5737212", "0.54941344", "0.5410099", "0.5369701", "0.5354802", "0.5353968", "0.5340265", "0.5315714", "0.52826196", "0.52625024", "0.5234835", "0.52286196", "0.5227268", "0.5195015", "0.5161688", "0.5161688", "0.51535517", "0.51467836", "0.51465833", "0.5129645", "0.5106079", "0.51040715", "0.5097675", "0.5083864", "0.507201", "0.50719136", "0.5067073", "0.50409585", "0.5020564", "0.5007236", "0.5007085", "0.49904084", "0.49834573", "0.4972308", "0.49656358", "0.4962403", "0.4959908", "0.49512997", "0.49491715", "0.49454024", "0.49434832", "0.49269453", "0.49217364", "0.49126986", "0.49119332", "0.49055266", "0.4902462", "0.49010897", "0.4892365", "0.48842785", "0.488255", "0.4877192", "0.48717427", "0.4866513", "0.4865649", "0.48591235", "0.4854597", "0.48517558", "0.48517558", "0.48517558", "0.48517558", "0.48517558", "0.48517558", "0.48476687", "0.48475525", "0.4837586", "0.4833493", "0.48188433", "0.48169613", "0.4804764", "0.48045877", "0.4804018", "0.48035824", "0.48029536", "0.4799807", "0.47986513", "0.47959813", "0.47940704", "0.4788343", "0.47878993", "0.47787777", "0.47770983", "0.47760716", "0.47666213", "0.47666213", "0.47607478", "0.47477978", "0.47372076", "0.47370696", "0.4733242", "0.47328463", "0.47320402", "0.47296488", "0.47222492", "0.4720124", "0.47195116", "0.47190407", "0.47178987", "0.47136566", "0.4707413", "0.4697922" ]
0.0
-1
class with all third parts of sentence
constructor() { super(); this.addPart.push(new NormalPart("çà m'a donné la diarhée!")); this.addPart.push(new NormalPart("j'ai déclaré forfait.")); this.addPart.push(new NormalPart("de toute façon le coronavirus va tous nous tuer!")); this.addPart.push(new NormalPart("du coup à la place, j'ai chanté du Feder sous la douche.")); this.addPart.push(new NormalPart("et sinon, l'apocalypse est toujours prévu pour 2012?")); this.addPart.push(new NormalPart("toutefois, je suis toujours en train de bûcher sur ce projet!")); this.addPart.push(new NormalPart("toute contente, j'ai pris mon copain dans les bras.")); this.addPart.push(new NormalPart("je regrette déjà mon régime... ")); this.addPart.push(new NormalPart("et finalement j'ai appris que mon vol pour la Thailande était annulé... :'(")); this.addPart.push(new NormalPart("du coup je suis allée acheter des oeufs.")); this.addPart.push(new NormalPart("et je me rends compte qu'inventer des phrases sans queue ni tête était un vrai sport !")); this.addPart.push(new NormalPart("c'est alors que mon chat s'est mis à bouder car il avait plus de croquette.")); this.addPart.push(new NormalPart("et je me suis rendue compte que le confinement c'est pas si mal en fait.")); this.addPart.push(new NormalPart("c'est là que j'ai compris que lire un dictionnaire en Anglais n'aiderait en rien.")); this.addPart.push(new NormalPart("faut dire que lire Le monde de Narnia qui fait 1200pages çà m'a bien motivé!")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeClassName(text) {\n\treturn text.toLowerCase().replace(' ', '_');\n}", "classify(phrase) { return this.clf.classify(phrase) }", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function takeString(stg)\n{ \n return sentence.substring(0,3);\n}", "wordClass(word) {\r\n return {\r\n der: word.artikel == \"der\",\r\n die: word.artikel == \"die\",\r\n das: word.artikel == \"das\",\r\n marked: word.marker\r\n }\r\n }", "introduce(){\n let introduce=super.introduce()+' '+'I am a Teacher. I teach ';\n if(this.klasses==null){\n return introduce+'No Class.';\n }else{\n introduce+='Class ';\n for(var i=0;i<this.klasses.length;i++){\n introduce+=this.klasses[i].number;\n (i!==this.klasses.length-1)?introduce+=', ':introduce+='.'\n }\n return introduce;\n }\n }", "function isClassesPlural() {\n const $classText = $(\".sentence-text-classes\");\n //two because the last element in ajax is the trainer name, not a class.\n if (trainerClassInfo.length === 2) {\n $classText.append(\"class this week\");\n } else {\n $classText.append(\"classes this week\");\n }\n }", "function Vc(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function wordsComplex() {\n\n}", "function buildSentence( category, phrase ) {\n if (category.length > 0) {\n sentence += phrase;\n if (category.length == 1) {\n sentence += category[0] + \". \";\n } else if (category.length == 2) {\n sentence += category[0] + \" & \" + category[1] + \". \";\n } else {\n for (var i = 0; i < category.length; i++) {\n if (i < category.length - 1) {\n sentence += category[i] + \", \";\n } else {\n sentence += \" and \" + category[i] + \". \";\n }\n }\n }\n } \n }", "get_entitys(text) {\r\n // everything between {}\r\n const items = text.match(/\\{([^}]+)\\}/g);\r\n // the length of items \r\n const items_length = items.length;\r\n // loop through all items\r\n for (let i = 0; i < items_length; i++) { \r\n // check if the item contains \"classname\", this usally means that its a entity\r\n if (items[i].match(/(?:\"classname\")/)) {\r\n // do stuff it the itme contains \"origin\"\r\n // add the item to the list of entitys\r\n this.entitys.push(items[i]);\r\n }\r\n }\r\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n let markovChain = this.makeChains(words);\n this.words = words;\n this.markovChain = markovChain;\n }", "function ClozeCard(fullText, cloze) {\n // first argument contains full sentence\n this.fullText = fullText;\n // 2nd argument contains removed words\n this.cloze = cloze;\n // method for replacing the removed words with ellipses ... (leaving the partial text)\n this.partialText = function() {\n //doesn't work, but tried to search then repace cloze txt with ellipses\n // if (/[this.cloze]/i.test(this.fullText) {\n // console.log(\"works so far\");\n\n }\n\n\n}", "function defwords(words, class) {\r\n\tfor (var i = 0; i < words.length; i++) {\r\n\t var w = words[i].replace(/^=/, \"\");\r\n\t patterns.push(new RegExp(\"([^a-zA-Z])(\" + w + \")([^a-zA-Z])\",\r\n\t\twords[i].match(/^=/) ? \"g\" : \"gi\"));\r\n\t classes.push(class);\r\n\t}\r\n }", "function Me(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function processSentence(a,b,c,d){\n return \"Nama saya \" + a + \", Umur saya \"+ b + \" tahun, alamat saya di \" + c + \", hobby saya \"+ d + \"!.\";\n}", "function get_classname(text) {\r\n // execute the regex statement and return the second group (the classname)\r\n const regex = text.match(/(?:\"classname\" \")(.*?)(?:\")/);\r\n if (!Array.isArray(regex) || !regex.length) {\r\n // array does not exist, is not an array, or is empty\r\n return null;\r\n }\r\n return regex[1];\r\n}", "function createClassName(text)\n{\n\n // Ensure there is a non-null class name\n if (!text) { \n var text = 'empty';\n }\n\n // Replace invalid characters, lowercase and trim whitespace\n var conv = text.replace(/[!\\\"#$%&'\\(\\)\\*\\+,\\.\\/:;<=>\\?\\@\\[\\\\\\]\\^`\\{\\|\\}~]/g, '');\n var className = conv.replace (/ /g, \"-\")\n .toLowerCase()\n .trim();\n\n // Ensure first character is non-numeric \n if (!isNaN(parseInt(className.charAt(0), 10))) {\n className = (\"_\" + className);\n } \n\n return className;\n}", "sentanceExtractor({ numSentances = 1, startIndex = false, text = fakeData.loremIpsum } = {}) {\n //Works only with big Chunks of text\n //Specifically made for the loremIpsum text from fakeData\n let start = startIndex ? startIndex : math.rand(0, Math.floor(text.length / 2));\n let outputText = '';\n function findNextSentance() {\n let temp = start;\n //The 'or' might be error prone\n while (text[start] !== '.' || (start - temp) < 4) {\n start++;\n }\n }\n\n //Search for beginning of next sentance\n if (text[start] !== '.') {\n findNextSentance();\n start += 2;\n } else {\n start += 2;\n }\n\n for (numSentances; numSentances != 0; numSentances--) {\n let sentStartIndex = start;\n findNextSentance();\n outputText += text.substring(sentStartIndex, start++) + '.';\n }\n return outputText;\n\n //String.indexOf(); maybe?\n }", "function tokenPart(token){\n var part = makePartSpan(token.value, self.doc); \n part.className = token.style;\n return part;\n }", "constructor(text) {\n console.log(\"constructor ran, this is text:\", text);\n this.words = text.split(/[ \\r\\n]+/);\n this.chains = {};\n this.text = \"\";\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n this.makeBigrams();\n }", "function getClassesNames(string) {\n var salaSubIndexesStart = [];\n var salaSubIndexesEnd = [];\n var classesNames = [];\n\n\n // If the string is undefined, return \"\"\n if (string == undefined) return \"\";\n\n // Getting all \"Sala\" substrings indexes\n for (var i = 0, j = 0; i < string.length; i++) {\n if (string.slice(i, i + 4) == \"Sala\") {\n // Getting substring start index\n salaSubIndexesStart.push(i);\n\n // Getting substring end index\n j = i + 4;\n while (string[j] == \" \") j++;\n while(string[j] >= '0' && string[j] <= '9') j++;\n salaSubIndexesEnd.push(j);\n }\n }\n\n // Getting all Sala substrings\n for (var i = 0; i < salaSubIndexesStart.length; i++) {\n var subStart = salaSubIndexesStart[i];\n var subEnd = salaSubIndexesEnd[i];\n\n classesNames.push(string.slice(subStart, subEnd));\n }\n\n\n return classesNames;\n}", "constructor(text) {\n this.text = text;\n this.words = [];\n \n }", "function createSentence() { \n var sentence = noun[1] + ' ' + verb[1] + ' ' + preposition[1]; \n return sentence;\n}", "function prosesSentence(name, age, addres, hobby){\n return name + age + addres + hobby }", "function processSentence(){\n return 'Nama saya ' + name +', umur saya '+ age +' tahun, alamat saya di ' +address +', dan saya punya hobby yaitu '+ hobby\n}", "function threeWordAdvAdjNoun(sent, tags) {\n let arrBandNames = [];\n let nounIndexes = [];\n for (var i = 2; i < tags.length; i++) {\n if (tags[i] === 'Noun') {\n nounIndexes.push(i);\n }\n }\n // Check if the tags before noun matches pattern\n nounIndexes = nounIndexes.filter(function(nounIndex) {\n let advTag = tags[nounIndex-2];\n let adjTag = tags[nounIndex-1];\n return advTag === 'Adverb' && adjTag === 'Adjective';\n });\n // Conjure band names with the remaining nouns + their preceding adv+adj\n nounIndexes.forEach(function(nounIndex) {\n let bandName = capitalize(sent.terms[nounIndex-2].text) + ' ' +\n capitalize(sent.terms[nounIndex-1].text) + ' ' +\n capitalize(sent.terms[nounIndex].text);\n arrBandNames.push(bandName);\n });\n return arrBandNames;\n}", "function FullSent( strText, numSentThres ) {\n //VAR: strText = string that is the document that will be analyzed\n //VAR: numSentThres = integer that is the threshold value for the number of characters that should be in a sentence\n //METHOD: this is a class that will manipulate a document\n if ( !(this instanceof FullSent) )\n return new FullSent( strText, numSentThres );\n\n \n //STEP: save the initial parameters for this object\n this.delimEOS = \". \"; //delimEOS = delimiter End Of Sentence. The string that will be appended to the end of each sentence.\n this.numSentThres = numSentThres;\n\n //need to consider the space between \"Ph.\" & \"D\" as the function \"setDoc_organizeOrigText()\" adds \". \" to incomplete sentences\n this.arrStrEndings = [ \" Mrs\", \" Ms\", \" Mr\", \" Dr\", \" Ph\", \" Ph. D\", \" al\" ];\n\n //process the text to separate into individual, complete sentences\n this.arrCompSent = this.makeFullSent( strText );\n\n //create stemmmer class\n // this.stemmer = new classStemmer(strText, stemMinLen, minSimThres);\n // this.arrCompSent_stem = this.stemmer.translateWordToStem(this.arrCompSent);\n\n //TEST:: \n // var dispArr = arrTools_showArr_ConsoleLog( this.arrCompSent );\n // console.log( \"full sent = \" + dispArr );\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n console.log(words);\n // MORE CODE HERE\n this.words = words;\n this.chain = this.makeChains();\n\n }", "function processSentence(name,age,address,hobby) {\n return \"Nama saya \" + name + \", umur saya \" + age + \", alamat saya di \" + address + \", dan saya punya hobby yaitu \" + hobby + \"!\"\n }", "function sentence(part1, part2) {\n return part1 + part2;\n}", "static addClass(element, classString) {\n let part, i;\n part = classString.split(' ');\n for (i = 0; i < part.length; i++) {\n if (part[i].trim() !== '') {\n element.classList.add(part[i]);\n }\n }\n }", "function processSentence(name,age,alamat,hobby){\n return 'Nama saya ' + name + ', umur saya ' + age + ' tahun' + ', alamat saya di ' + alamat + ', dan saya punya hobby yaitu ' + hobby + ' !' \n }", "parseCharacterClass() {\n this.expect('[');\n const node = {\n type: 'CharacterClass',\n invert: false,\n ClassRanges: undefined,\n };\n node.invert = this.eat('^');\n node.ClassRanges = this.parseClassRanges();\n this.expect(']');\n return node;\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = this.makeChains();\n }", "testAddWithSpacesInClassName() {\n const el = dom.getElement('p1');\n classes.add(el, 'CLASS1 CLASS2', 'CLASS3 CLASS4');\n assertTrue('Should have CLASS1', classes.has(el, 'CLASS1'));\n assertTrue('Should have CLASS2', classes.has(el, 'CLASS2'));\n assertTrue('Should have CLASS3', classes.has(el, 'CLASS3'));\n assertTrue('Should have CLASS4', classes.has(el, 'CLASS4'));\n }", "function threeWords(str) {\n\tconst regex = /[a-zA-Z]/g; // describes all lowercase and capital letters\n\tconst words = str.split(\" \");\n\tlet count = 0;\n\t// null check\n\tif (words.length < 3) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < words.length; i++) {\n\t\twords[i].match(regex) ? (count += 1) : (count = 0);\n\t\tif (count === 3) return true;\n\t}\n\treturn false;\n}", "constructor(text) {\n const words = text.split(/[ \\r\\n]+/);\n this.markovChains = this.makeChains(words);\n\n }", "function splitSentence(split_id){\n //1 split the sentence display\n var sentence_id = parseInt(split_id.split(\".\")[0]),\n word_id = parseInt(split_id.split(\".\")[1]);\n\n var sentence = getSentence(sentence_id-1).split(\" \");\n console.log(sentence)\n //\n var sentence_part1 = sentence.slice(0,word_id).join(\" \"),\n sentence_part2 = sentence.slice(word_id+1,sentence.length).join(\" \");\n\n var part1_html = \"<div><h3>Subsentence Part 1</h3>\" + sentence_part1 + \"</div>\";\n var part2_html = \"<div><h3>Subsentence Part 2</h3>\" + sentence_part2 + \"</div>\";\n\n $('#selected-sentence').append(part1_html);\n $('#selected-sentence').append(part2_html);\n\n //add subsentence classification to the rubrick\n\n addClassification('#classification_selection');\n\n}", "function checkPseudoClass3(i){var start=i;var l=0; // Skip `:`.\n\ti++;if(i >= tokensLength)return 0;if(l = checkIdentOrInterpolation(i))i += l;else return 0;if(i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis)return 0;var right=tokens[i].right; // Skip `(`.\n\ti++;if(l = checkSC(i))i += l;if(l = checkUnary(i))i += l;if(i >= tokensLength)return 0;if(tokens[i].type === TokenType.DecimalNumber)i++;if(i >= tokensLength)return 0;if(tokens[i].value === 'n')i++;else return 0;if(l = checkSC(i))i += l;if(i >= tokensLength)return 0;if(tokens[i].value === '+' || tokens[i].value === '-')i++;else return 0;if(l = checkSC(i))i += l;if(tokens[i].type === TokenType.DecimalNumber)i++;else return 0;if(l = checkSC(i))i += l;if(i !== right)return 0;return i - start + 1;}", "function GenerateNewText() {\n\n this.choices = []; // create this so we don't duplicate the sentences chosen\n\n // Add property to the object\n this.sentences =\n [\n \"The term \\\"tested in an ABM mode\\\" used in Article II of the Treaty refers to: (a) an ABM interceptor missile if while guided by an ABM radar it has intercepted a strategic ballistic missile or its elements in flight trajectory regardless of whether such intercept was successful or not; or if an ABM interceptor missile has been launched from an ABM launcher and guided by an ABM radar. If ABM interceptor missiles are given the capability to carry out interception without the use of ABM radars as the means of guidance, application of the term \\\"tested in an ABM mode\\\" to ABM interceptor missiles in that event shall be subject to additional discussion and agreement in the Standing Consultative Commission; (b) an ABM launcher if it has been used for launching an ABM interceptor missile; (c) an ABM radar if it has tracked a strategic ballistic missile or its elements in flight trajectory and guided an ABM interceptor missile toward them regardless of whether the intercept was successful or not; or tracked and guided an ABM interceptor missile; or tracked a strategic ballistic missile or its elements in flight trajectory in conjunction with an ABM radar, which is tracking a strategic ballistic missile or its elements in flight trajectory and guiding an ABM interceptor missile toward them or is tracking and guiding an ABM interceptor missile.\",\n \"EWO launch: If sequence does not start after coordinated key turn, refer to Fig 2-1 and Notify command post of type deviation, ETOR, and intent to perform TCCPS; Post ETOR to EWO documents.\",\n \"(For classified information on the RV, refer to the 11N series Technical Orders.)\",\n \"Here's my strategry on the Cold War: we win, they lose.\",\n \"The only thing that kept the Cold War cold was the mutual deterrance afforded by nuclear weapons.\",\n \"The weapons of war must be abolished before they abolish us.\",\n \"Ours is a world of nuclear giants and ethical infants.\",\n \"The safety and arming devices are acceleration-type, arming-delay devices that prevent accidental warhead detonation.\",\n \"The immediate fireball reaches temperatures in the ranges of tens of millions of degrees, ie, as hot as the interior temperatures of the sun.\",\n \"In a typical nuclear detonation, because the fireball is so hot, it immediately begins to rise in altitude. As it rises, a vacuum effect is created under the fireball, and air that had been pushed away from the detonation rushes back toward the fireball, causing an upward flow of air and dust that follows it.\",\n \"The RV/G&C van is used to transport and remove/replace the RV and the MGS for the MM II weapon system.\",\n \"Computer components include a VAX 11/750 main computer, an Intel 80186 CPU in the buffer, and the Ethernet LAN which connects the buffer with the main computer.\",\n \"The Specific Force Integrating Receiver (SFIR) is one of the instruments within the IMU of the Missile G&C Set (MGCS) which measures velocity along three orthogonal axes.\",\n \"The SFIR incorporates a pendulous integrating gyro having a specific mass unbalance along the spin axis, and provides correction rates to the Missile Electronics Computer Assembly (MECA) which provides ouputs to the different direction control units resulting in control of the missile flight.\",\n \"SAC has directed that all VAFB flight test systems and the PK LSS will be compatible with the SAC ILSC requirement.\",\n \"The ground shock accompanying the blast is nullified in the control center by a three-level, steel, shock-isolation cage, which is supported by eight shock mounts hung from the domed roof.\",\n \"(Prior to MCL 3252) Fixed vapor sensing equipment consists of an oxidizer vapor detector, a fuel vapor detector, a vapor detector annunciator panel, and associated sensing devices located throughout the silo area.\",\n \"The LAUNCH CONTROL AND MONITOR section contains switches to lock out the system, select a target, initiate a lunch, shutdown and reset.\",\n \"The CMG-1 chassis contains the logic required to control launch.\",\n \"Attention turned to the Nike X concept, a layered system with more than one type of missile.\",\n \"At this point a fight broke out between the Air Force and Army over who had precedence to develop land-based ABM systems.\",\n \"It is such a big explosion, it can smash in buildings and knock signboards over, and break windows all over town, but if you duck and cover, like Bert [the Turtle], you will be much safer.\",\n \"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.\",\n \"The living will envy the dead.\",\n \"Frequent fear of nuclear war in adolescents seems to be an indicator for an increased risk for common mental disorders and deserves serious attention.\",\n \"The Peacekeeper was the first U.S. ICBM to use cold launch technology.\",\n \"The Protocol to the Agreement with regard to Article III, entitled the United States to have no more than 710 SLBM launchers on 44 modern ballistic missile submarines, and the USSR, no more than 950 SLBM launchers on 62 submarines.\",\n \"Well hell, I'd piss on a spark plug if you thought it would do any good.\",\n \"Do you want to play a game?\",\n \"Gentlemen! You can't fight in here! This is the war room!\",\n \"I do not avoid women, Mandrake. But I do deny them my essence.\",\n \"Mr. Ryan, be careful what you shoot at. Most things here don't react well to bullets.\",\n \"If OPERATE OK on the BVLC does not light in step 5, verify that the proper code is inserted.\",\n \"PEACETIME launch: If abnormal indications occur prior to step 8, report to Launch Director and proceed as directed.\",\n \"The missile silo (figure 1-2) is a reinforced, concrete structure with inside dimensions of approximately 146 feet in depth and 55 feet in diameter.\",\n \"General, you are listening to a machine.\",\n \"The mechanism is... Oh James, James... Will you make love to me all the time in England?\",\n \"I never joke about my work, 007.\", \n \"Eventually Kwajalein Island was selected, as it was 4,800 miles from California, perfect for ICBMs, and already had a US Navy base with considerable housing stocks and an airstrip.\",\n \"From Stettin in the Baltic to Trieste in the Adriatic an iron curtain has descended across the Continent.\",\n \"Whether you like it or not, history is on our side. We will bury you.\",\n \"I like Mr. Gorbachev. We can do business together.\",\n \"Mr. Gorbachev, tear down this wall!\",\n \"Gort! Klaatu barada nikto!\",\n \"It is no concern of ours how you run your own planet. But if you threaten to extend your violence, this Earth of yours will be reduced to a burned-out cinder.\",\n \"The remaining base in North Dakota, the Stanley R. Mickelsen Safeguard Complex, became active on 1 April 1975 and fully operational on 1 October 1975. By that time the House Appropriations Committee had already voted to deativate it. The base was shutdown on 10 February 1976.\"\n\n\n ];\n\n console.log(\"How many sentences? \",this.sentences.length);\n}", "step3a (word) {\n let result = word\n if (endsin(result, 'heid') && result.length - 4 >= this.r2 && result[result.length - 5] !== 'c') {\n // Delete\n result = removeSuffix(result, 4)\n // Treat a preceding en as in step 1b\n result = this.step1b(result, ['en'])\n }\n if (DEBUG) {\n console.log('step 3a: ' + result)\n }\n return result\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.chains = {};\n this.makeChains();\n }", "function\ton_decs3(str21){\n \n \n\tvar str=new String(str21);\n\t\n var dot=str.indexOf(\".\");\n var str1;\n\t\n\tif(dot>0) \n\t\tstr1=str.slice(0,dot);\n\telse\n\t\tstr1=str;\n\t\t\n var size=str1.length;\n \n\tvar new_str='';\n var i;\n\t\n\tfor(i=size;i>0&&i>3;i-=3){\n\t \n\t new_str=str1.slice(i-3,i)+new_str;\n \t new_str=\" \"+new_str;\n\t}\n\tnew_str=str.slice(0,i)+new_str;\n\tif(dot>0)\n\t new_str=new_str+str.slice(dot);\n\treturn new_str;\n }", "function madLibs(str, array) {\n var finalSentence = '';\n //segments [ 'Marching is fun: ', ', ', ', ', ', ', '!' ]\n var segments = str.split('*');\n var nextWordIdx = 0;\n\n for (var i = 0; i < segments.length - 1; i++) {\n //adds element then word at array and then add them to the finalString\n var segment = segments[i];\n segment += array[nextWordIdx];\n finalSentence += segment;\n // increase the counter \n nextWordIdx = nextWordIdx + 1 < array.length ? nextWordIdx + 1 : 0;\n }\n\n finalSentence += segments[segments.length - 1];\n \n return finalSentence;\n }", "showMatchedLetter(letter){\n\n const phrases = document.querySelector('#phrase ul').children;\n\n\n\n for (let i = 0; i < phrases.length; i++) {\n if (phrases[i].textContent === letter) {\n phrases[i].setAttribute('class', `show letter ${letter}`);\n\n }\n }\n }", "sentenceSplits(text, chunkArray) {\n \tvar sentenceArray = text.split(\". \");\n \tfor (var i = sentenceArray.length - 2; i >= 0; i--) {\n \t\tsentenceArray[i] = sentenceArray[i] + \".\";\n \t}\n \treturn sentenceArray;\n }", "function Sentence(id, tokens, cite) {\n this.id = id;\n this.tokens = tokens;\n this.cite = cite;\n }", "function extractNames(paragraph){\n var start = paragraph.indexOf(\"(mother \") + \"(mother \".length;\n var end = paragraph.indexOf(\")\");\n console.log(start, end);\n return paragraph.slice(start, end);\n \n}", "function Ib(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function GenerateNewText() {\n // Add property to the object\n this.sentences = doggoarray;\n this.punctuation = [\".\", \",\", \"!\", \"?\", \".\", \",\", \",\", \"!!\", \".\", \",\"];\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter((c) => c !== \"\");\n this.makeChains();\n }", "function texte2(){\n document.querySelector(\".textM\").classList.add(\"textM3\")\n document.querySelector(\".textM\").innerText= `fonctionne en bluethoot ! ou part cable !\n peut se rechargé sur un socle transportable`;\n}", "function divideByThree (string) {\r\n const arr = string.split(' ')\r\n const result = [];\r\n arr.map(el => {\r\n for (let i = 0; i < el.length; i+=3) {\r\n result.push(el.slice(i, i + 3));\r\n }\r\n })\r\n return result\r\n }", "getSentenceHelper(element) {\n if (!element.includes('<') && !element.includes('>')) {\n return element;\n }\n\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n\n let subSentence = '';\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n subSentence += this.getSentenceHelper(syntax[i]);\n } else {\n subSentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n return subSentence;\n }", "export() {\n const wordToConll = (word, indexOverride = null) => {\n const stringifyList = object => {\n let pairs = []\n for (const key in object) {\n pairs.push(`${key}=${object[key]}`)\n }\n pairs.sort()\n let string = pairs.join(\"|\")\n return string ? string : \"_\"\n }\n let data = [].fill(\"_\", 0, 9)\n data[0] = indexOverride || word.index || \"_\"\n data[1] = word.inflection || \"_\"\n data[2] = word.lemma || \"_\"\n data[3] = word.uposTag || \"_\"\n data[4] = word.xposTag || \"_\"\n data[5] = stringifyList(word.features)\n data[6] = word.parent === 0 ? 0 : word.parent || \"_\"\n data[7] = this.settings.relations[word.relation] || \"_\"\n data[8] = word.dependencies || \"_\"\n data[9] = stringifyList(word.misc)\n let line = data.join(\"\\t\")\n //Add an extra line for each following empty node\n word.emptyNodes.forEach( (emptyNode, index) => {\n line = line + \"\\n\" + wordToConll(new Word(emptyNode), `${word.index}.${index+1}`)\n })\n return line\n }\n\n let lines = []\n this.sentences.forEach(sentence => {\n sentence.comments.forEach(comment => lines.push(comment))\n sentence.words.forEach(word => lines.push(wordToConll(word)))\n lines[lines.length-1] += \"\\n\" //sentence separator\n })\n\n return lines.join(\"\\n\")\n }", "function f(phrase) {\n return class {\n sayHi() { console.log(phrase) }\n }\n}", "getSentence(element) {\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n let sentence = '';\n\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n sentence += `${this.getSentenceHelper(syntax[i])}`;\n } else {\n sentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n sentence = sentence.charAt(0).toUpperCase() + sentence.substr(1);\n return (sentence.includes('.') || sentence.includes('?') ? sentence : sentence.concat('.'));\n }", "function getClass(line){\n\tif (line.includes(openBrack) || line.includes(closeBrack)){\n\t\treturn (classStart + selectClass);\n\t} \n\tif (line.includes(closeValue)){\n\t\treturn (classStart + elemClass);\n\t} else {\n\t\treturn (classStart + commentClass);\n\t}\n}", "function make_sentence(sentence_type, creatures, property) {\n if (sentence_type == \"generic\") {\n return '\"' + creatures + \" have \" + property + '.\"';\n } else if (sentence_type == \"always\") {\n return '\"' + creatures + \" always have \" + property + '.\"';\n } else if (sentence_type == \"usually\") {\n return '\"' + creatures + \" usually have \" + property + '.\"';\n } else if (sentence_type == \"sometimes\") {\n return '\"' + creatures + \" sometimes have \" + property + '.\"';\n } else if (sentence_type == \"negation\") {\n return '\"' + creatures + \" do not have \" + property + '.\"';\n } else {\n alert(\"ERROR1: what kind of sentence is \" + sentence_type + \"?\");\n }\n}", "function getClass() {\n const data = a.split(/\\s*\\n/);\n // variabel ini adalah varibael yang menampung banyak nya jumlah class\n const ClassData = [];\n // variabel ini berisi index dari setiap lokasi string dari setiap value dari data\n let ClassDeclaration = [];\n // ini untuk jumlah class\n let count = 0;\n // variabel ini berisi class class yang telah di ambil\n const revition = [];\n // variabel ini akan berisi string nama class\n const class_name = [];\n\n for (let x = 0; x < data.length; x++) {\n // mengecek setiap value dari array data yang terdapat string class\n if (data[x].match(/\\w*class/) && data[x].match(/\\w*{/)) {\n count++;\n ClassData.push(count);\n // di sini mengambil nama kelas\n class_name.push(data[x]);\n ClassDeclaration.push({\n // memasukan lokasi awal string class\n [count]: x,\n });\n } else if (data[x].match(/\\w*}/)) {\n // memasukan lokasi akhir string } dari setiap class\n ClassDeclaration.push({\n [count]: x,\n });\n }\n }\n\n // kita urutkan semua index class nya dari yang terkecil ke yang terbesar\n ClassDeclaration = ClassDeclaration.sort((a, b) => {\n return a - b;\n });\n\n // kita ambil kelas dari si variabel data berdasarkam index dari ClassData\n for (let x = 0; x < ClassDeclaration.length - 1; x++) {\n for (const y of ClassData) {\n if (ClassDeclaration[x][y]) {\n const clear_class = data.slice(ClassDeclaration[x][y], ClassDeclaration[x + 1][y] + 1);\n const class_property = data.slice(ClassDeclaration[x][y] + 1, ClassDeclaration[x + 1][y]);\n if (clear_class.length > 0) {\n revition.push(clear_class);\n }\n }\n }\n }\n\n // variabel ini akan menampung class class yang telah di ambil dan akan\n // di jadikan array\n let class_rev = \"\";\n\n // kita ambil setiap class dari variabel revition dan memisahkan setiap class\n for (let i = 0; i < revition.length; i++) {\n if (revition[i].join(\" \").match(/\\w*[},]/igm).length > 2) {\n revition[i] = [revition[i].join(\" \").replace(\"}\", \" \")];\n }\n\n if (revition[i].join(\" \").match(/\\w*class/igm)) {\n class_rev += \"$\" + revition[i].join(\" \");\n } else {\n class_rev += revition[i].join(\" \");\n }\n }\n\n // kita gunakan js beauty agar sintaks nya lebih rapi\n const class_prop = beautify(class_rev, {\n indent_size: 2,\n space_in_empty_paren: true,\n });\n\n // kita kembalikan class yang telah di olah dan di jadiin array\n return [class_prop.split(\"$\"), class_name.join(\"\").replace(/\\w*{/igm, \"\\n\").replace(/\\w*class|=/igm, \"\").split(\"\\n\")];\n}", "function xphasclass($s) {\n return strcat(\"//*[contains(concat(' ',@class,' '),' \",$s,\" ')]\");\n}", "function Phrase(content) {\n this.content = content;\n\n this.palindrome = function palindrome() {\n if(!this.content){ return false; } else {\n return this.processedContent() === this.processedContent().reverse();}\n }\n\n this.processedContent = function processedContent(){\n return this.letters().toLowerCase();\n }\n\n this.letters = function letters() {\n return Array.from(this.content).filter(n => n.match(/[^\\s\\W]/)).join(\"\");\n }\n\n this.LOUDER = function LOUDER(){\n return content.toUpperCase();\n }\n}", "function createThemedClasses(mode, color, classes) {\n let classObj = {};\n return classes.split(' ')\n .reduce((classObj, classString) => {\n classObj[classString] = true;\n if (mode) {\n classObj[`${classString}-${mode}`] = true;\n if (color) {\n classObj[`${classString}-${color}`] = true;\n classObj[`${classString}-${mode}-${color}`] = true;\n }\n }\n return classObj;\n }, classObj);\n}", "function styleTutorialsAndArticles() {\n //find the article section\n const articles = document.querySelectorAll(\"article\");\n //loop through the article\n for (let article of articles) {\n //get the inner text of the article and name it content\n let content = article.innerText;\n //if the content includes the word: tutorial\n if (content.includes(\"Tutorial\")) {\n //add the tutorial class list to it\n article.classList.add(\"tutorial\");\n } else {\n //if the content doesnt include the word: tutorial\n //add the article classlist to it\n article.classList.add(\"article\");\n }\n }\n /*\n //querySelector all the articles\n const body = document.querySelectorAll(\".container .articles\");\n const headings = document.querySelectorAll(\" article\");\n //loop through all the article elements\n for (let i = 0; i < headings.length; i++) {\n const article = headings[i].innerText;\n console.log(headings[i]);\n //if the article contains the word \"tutorial\", add the tutorial class\n if (article.includes(\"Tutorial\")) {\n article.classList.add(\"tutorial\");\n //otherwise add the article class\n } else article.classList.add(\"article\");\n }\n */\n}", "function lineClass(data) {\n var classes = 'team ';\n classes += team2class(data.name);\n if (data.conference === 'Eastern') {\n classes += ' eastern';\n }\n if (data.conference === 'Western') {\n classes += ' western';\n }\n return classes;\n }", "function sillySentence(string1, string2, string3) {\n return `I am so ${string1} because I ${string2} coding! Time to write some more awesome ${string3}!`;\n}", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "constructor(text) {\n let words = text.split(/[ \\r\\n]+/);\n this.words = words.filter(c => c !== \"\");\n this.makeChains();\n }", "determineWord(str) {\r\n\r\n\r\n\r\n // virgüllü kelime\r\n if (str.includes(\",\")) {\r\n var str = str.substring(0, (str.length - 1));\r\n\r\n\r\n var determinedKelime = new KelimeWithNoktalama(str, \",\");\r\n\r\n }\r\n\r\n\r\n\r\n\r\n else if (str.includes(\".\")) {\r\n var str = str.substring(0, (str.length - 1));\r\n\r\n var determinedKelime = new KelimeWithNoktalama(str, \".\");\r\n\r\n\r\n\r\n }\r\n else if (!str.includes(\",\") && !str.includes(\".\")) {\r\n\r\n var determinedKelime = new Kelime(str);\r\n }\r\n\r\n return determinedKelime;\r\n\r\n }", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32\n /* SPACE */\n ) {\n startIndex++;\n }\n\n return startIndex;\n }", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32\n /* SPACE */\n ) {\n startIndex++;\n }\n\n return startIndex;\n}", "function lassocP1(x){\r\n return parserPlus(lassocP(x), return_(x));\r\n }", "function classmates (){\n\n\n\n\n}", "function joinStep2(str){\t\t\r\n\t\tvar pom;\r\n\t\tvar pom2=str.indexOf('has recruited');\r\n\t\tif(pom2==-1){\r\n\t\t\tpom2=str.indexOf('day into ');\r\n\t\t\tif(pom2>-1){\r\n\t\t\t\tpom2+=9;\r\n\t\t\t\tstr=str.substr(pom2, str.indexOf(\"'s\")-pom2);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tpom=str.indexOf('character_info\">')+17;\r\n\t\t\t\tstr = str.substr(pom,str.indexOf(' is ')-pom); \r\n\t\t\t}\r\n\t\t}\r\n\t\telse{\t\t\r\n\t\t\tpom=str.indexOf('class=\"center\">')+16;\t\r\n\t\t\tstr = str.substr(pom,str.indexOf('has recruited')-pom); \t\t\t\r\n\t\t}\r\n\t\tif(pom==-1){\r\n\t\t\talert('Error :(');\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar nick=str.replace(/ |\\t|\\n/g,\"\");\r\n\t\treg(nick,link);\t\r\n\t}", "function Wb(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "chooseClass(data) {\n if (data == \"R\"){\n return \"republican votesPercentageText\";\n }\n else if (data == \"D\"){\n return \"democrat votesPercentageText\";\n }\n else if (data == \"I\"){\n return \"independent votesPercentageText\";\n }\n }", "function threeWordValAdjNoun(sent, tags) {\n let arrBandNames = [];\n let nounIndexes = [];\n for (var i = 2; i < tags.length; i++) {\n if (tags[i] === 'Noun') {\n nounIndexes.push(i);\n }\n }\n // Check if the tags before noun matches pattern\n nounIndexes = nounIndexes.filter(function(nounIndex) {\n let valTag = tags[nounIndex-2];\n let adjTag = tags[nounIndex-1];\n return valTag === 'Value' && adjTag === 'Adjective';\n });\n // Conjure band names with the remaining nouns + their preceding val+adj\n nounIndexes.forEach(function(nounIndex) {\n let bandName = capitalize(sent.terms[nounIndex-2].text) + ' ' +\n capitalize(sent.terms[nounIndex-1].text) + ' ' +\n capitalize(sent.terms[nounIndex].text);\n arrBandNames.push(bandName);\n });\n return arrBandNames;\n}", "constructor(text) {\n\t\tlet words = text.split(/[ \\r\\n]+/);\n\t\tthis.words = words.filter((c) => c !== \"\");\n\t\tthis.makeChains();\n\t}", "function makeClass(phrase){\r\n // declare a class and return it\r\n return class {\r\n sayHi(){\r\n alert(phrase);\r\n };\r\n };\r\n}", "function coolText(thing) {\n $(thing).html( fillWhitespace(thing) );\n $(thing).lettering().children(\"span\").addClass(\"coolText\");\n}", "function createThemedClasses(mode, color, classes) {\n var classObj = {};\n return classes.split(' ')\n .reduce(function (classObj, classString) {\n classObj[classString] = true;\n if (mode) {\n classObj[classString + \"-\" + mode] = true;\n if (color) {\n classObj[classString + \"-\" + color] = true;\n classObj[classString + \"-\" + mode + \"-\" + color] = true;\n }\n }\n return classObj;\n }, classObj);\n}", "function formal_class_add(aclass, x) {\n var occurrences = formal_class_has_attribute(aclass, x);\n if (occurrences == 1)\n return aclass;\n \n if (occurrences > 1)\n var r = formal_class_remove(aclass, x);\n else\n var r = aclass;\n \n var tmp = r.split(\" \").concat([x]);\n return tmp.join(\" \");\n}", "function stringDotify(cnt) {\n var str_cnt = cnt.toString();\n var ret_str = \"\";\n for (var i = str_cnt.length; i >= 0; i -= 3) {\n if (i - 3 > 0) {\n ret_str = \".\" + str_cnt.slice(i - 3, i) + ret_str;\n } else {\n ret_str = str_cnt.slice(0, i) + ret_str;\n }\n }\n return ret_str;\n}", "function f(phrase) {\n return class {\n sayHi() { alert(phase); }\n };\n}", "static parse(s) {\n const split = s.split('\\.', 7);\n if (split.length !== 7) {\n console.error(s + ' is not a valid Noun');\n }\n const noun = new Noun();\n // gender\n noun.masculine = 'M' === split[0];\n // singular/plural\n noun.singular = split[1];\n noun.plural = split[2];\n // stat\n noun.stats = new Map();\n split[3].split('\\|').forEach(stat => {\n if (stat.indexOf('=') !== -1) {\n const statSplit = stat.split('=');\n noun.stats.set(statSplit[0], Number(statSplit[1]));\n }\n });\n // tag\n noun.tags = split[4].split('\\|');\n // power\n noun.powers = split[5].split('\\|');\n noun.price = _price__WEBPACK_IMPORTED_MODULE_2__[\"Price\"].parse(split[6], split[1]);\n return noun;\n }", "function processSentence(nama, umur, alamat, hobi) {\n return 'Nama saya ' + nama + ', ' + 'umur saya ' + umur + ' tahun,' + ' alamat saya di ' + alamat + ', dan saya punya hobi yaitu ' + hobi + '!'\n}", "function madlib(str, str2, str3, str4) {\n var sentence = str + \" was walking to the \" + str2 + \" when their good friend \" + str3 + \" saw them. They walked up to them and said \" + str4 + \".\";\n return sentence;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}", "function consumeClassToken(text, startIndex, endIndex) {\n while (startIndex < endIndex && text.charCodeAt(startIndex) > 32 /* SPACE */) {\n startIndex++;\n }\n return startIndex;\n}" ]
[ "0.56275976", "0.5519651", "0.54939574", "0.54939574", "0.5457164", "0.5452373", "0.54422134", "0.5434054", "0.5388739", "0.53813875", "0.5364217", "0.5349868", "0.53496706", "0.5311877", "0.5299774", "0.52774864", "0.5274068", "0.52543515", "0.5242325", "0.52358925", "0.52169853", "0.51948506", "0.51896137", "0.5185994", "0.51412296", "0.5136617", "0.51289445", "0.51184124", "0.5115263", "0.51107717", "0.5104054", "0.5100141", "0.5087007", "0.50839573", "0.5076181", "0.5067534", "0.5067423", "0.5067423", "0.50665945", "0.5059114", "0.5054173", "0.50427955", "0.50209105", "0.5009506", "0.50061285", "0.5004576", "0.49855253", "0.49655014", "0.49634144", "0.4962914", "0.49515268", "0.49437952", "0.49360588", "0.4931587", "0.4927386", "0.49252918", "0.4921699", "0.49191648", "0.49190602", "0.48982674", "0.48957506", "0.48954332", "0.48945153", "0.48879582", "0.4882274", "0.48795345", "0.48770475", "0.4877038", "0.487601", "0.48753384", "0.48747626", "0.48747626", "0.48747626", "0.48747626", "0.48747626", "0.48747626", "0.48747626", "0.4864346", "0.48619774", "0.48587078", "0.48527002", "0.48504052", "0.48485297", "0.4845838", "0.48433426", "0.4842952", "0.4837089", "0.48361352", "0.4828251", "0.48235494", "0.48228306", "0.4822793", "0.48104993", "0.4810385", "0.48102656", "0.48072398", "0.4802516", "0.4802516", "0.4802516", "0.4802516", "0.4802516" ]
0.0
-1
Method that add the three parts to make one sentence.
static readRandomSentence(theme) { console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sentence(part1, part2) {\n return part1 + part2;\n}", "function createSentence() { \n var sentence = noun[1] + ' ' + verb[1] + ' ' + preposition[1]; \n return sentence;\n}", "function prosesSentence(name, age, addres, hobby){\n return name + age + addres + hobby }", "function processSentence(){\n return 'Nama saya ' + name +', umur saya '+ age +' tahun, alamat saya di ' +address +', dan saya punya hobby yaitu '+ hobby\n}", "function processSentence(a,b,c,d){\n return \"Nama saya \" + a + \", Umur saya \"+ b + \" tahun, alamat saya di \" + c + \", hobby saya \"+ d + \"!.\";\n}", "function generateSentence() {\r\n return selectChud()+' '+selectVerb()+' '+selectLefty()+' With '+selectAdjective()+' '+selectEnding();\r\n}", "function processSentence(name,age,alamat,hobby){\n return 'Nama saya ' + name + ', umur saya ' + age + ' tahun' + ', alamat saya di ' + alamat + ', dan saya punya hobby yaitu ' + hobby + ' !' \n }", "function processSentence(name,age,address,hobby) {\n return \"Nama saya \" + name + \", umur saya \" + age + \", alamat saya di \" + address + \", dan saya punya hobby yaitu \" + hobby + \"!\"\n }", "function buildSentence( category, phrase ) {\n if (category.length > 0) {\n sentence += phrase;\n if (category.length == 1) {\n sentence += category[0] + \". \";\n } else if (category.length == 2) {\n sentence += category[0] + \" & \" + category[1] + \". \";\n } else {\n for (var i = 0; i < category.length; i++) {\n if (i < category.length - 1) {\n sentence += category[i] + \", \";\n } else {\n sentence += \" and \" + category[i] + \". \";\n }\n }\n }\n } \n }", "function GenerateNewText() {\n\n this.choices = []; // create this so we don't duplicate the sentences chosen\n\n // Add property to the object\n this.sentences =\n [\n \"The term \\\"tested in an ABM mode\\\" used in Article II of the Treaty refers to: (a) an ABM interceptor missile if while guided by an ABM radar it has intercepted a strategic ballistic missile or its elements in flight trajectory regardless of whether such intercept was successful or not; or if an ABM interceptor missile has been launched from an ABM launcher and guided by an ABM radar. If ABM interceptor missiles are given the capability to carry out interception without the use of ABM radars as the means of guidance, application of the term \\\"tested in an ABM mode\\\" to ABM interceptor missiles in that event shall be subject to additional discussion and agreement in the Standing Consultative Commission; (b) an ABM launcher if it has been used for launching an ABM interceptor missile; (c) an ABM radar if it has tracked a strategic ballistic missile or its elements in flight trajectory and guided an ABM interceptor missile toward them regardless of whether the intercept was successful or not; or tracked and guided an ABM interceptor missile; or tracked a strategic ballistic missile or its elements in flight trajectory in conjunction with an ABM radar, which is tracking a strategic ballistic missile or its elements in flight trajectory and guiding an ABM interceptor missile toward them or is tracking and guiding an ABM interceptor missile.\",\n \"EWO launch: If sequence does not start after coordinated key turn, refer to Fig 2-1 and Notify command post of type deviation, ETOR, and intent to perform TCCPS; Post ETOR to EWO documents.\",\n \"(For classified information on the RV, refer to the 11N series Technical Orders.)\",\n \"Here's my strategry on the Cold War: we win, they lose.\",\n \"The only thing that kept the Cold War cold was the mutual deterrance afforded by nuclear weapons.\",\n \"The weapons of war must be abolished before they abolish us.\",\n \"Ours is a world of nuclear giants and ethical infants.\",\n \"The safety and arming devices are acceleration-type, arming-delay devices that prevent accidental warhead detonation.\",\n \"The immediate fireball reaches temperatures in the ranges of tens of millions of degrees, ie, as hot as the interior temperatures of the sun.\",\n \"In a typical nuclear detonation, because the fireball is so hot, it immediately begins to rise in altitude. As it rises, a vacuum effect is created under the fireball, and air that had been pushed away from the detonation rushes back toward the fireball, causing an upward flow of air and dust that follows it.\",\n \"The RV/G&C van is used to transport and remove/replace the RV and the MGS for the MM II weapon system.\",\n \"Computer components include a VAX 11/750 main computer, an Intel 80186 CPU in the buffer, and the Ethernet LAN which connects the buffer with the main computer.\",\n \"The Specific Force Integrating Receiver (SFIR) is one of the instruments within the IMU of the Missile G&C Set (MGCS) which measures velocity along three orthogonal axes.\",\n \"The SFIR incorporates a pendulous integrating gyro having a specific mass unbalance along the spin axis, and provides correction rates to the Missile Electronics Computer Assembly (MECA) which provides ouputs to the different direction control units resulting in control of the missile flight.\",\n \"SAC has directed that all VAFB flight test systems and the PK LSS will be compatible with the SAC ILSC requirement.\",\n \"The ground shock accompanying the blast is nullified in the control center by a three-level, steel, shock-isolation cage, which is supported by eight shock mounts hung from the domed roof.\",\n \"(Prior to MCL 3252) Fixed vapor sensing equipment consists of an oxidizer vapor detector, a fuel vapor detector, a vapor detector annunciator panel, and associated sensing devices located throughout the silo area.\",\n \"The LAUNCH CONTROL AND MONITOR section contains switches to lock out the system, select a target, initiate a lunch, shutdown and reset.\",\n \"The CMG-1 chassis contains the logic required to control launch.\",\n \"Attention turned to the Nike X concept, a layered system with more than one type of missile.\",\n \"At this point a fight broke out between the Air Force and Army over who had precedence to develop land-based ABM systems.\",\n \"It is such a big explosion, it can smash in buildings and knock signboards over, and break windows all over town, but if you duck and cover, like Bert [the Turtle], you will be much safer.\",\n \"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.\",\n \"The living will envy the dead.\",\n \"Frequent fear of nuclear war in adolescents seems to be an indicator for an increased risk for common mental disorders and deserves serious attention.\",\n \"The Peacekeeper was the first U.S. ICBM to use cold launch technology.\",\n \"The Protocol to the Agreement with regard to Article III, entitled the United States to have no more than 710 SLBM launchers on 44 modern ballistic missile submarines, and the USSR, no more than 950 SLBM launchers on 62 submarines.\",\n \"Well hell, I'd piss on a spark plug if you thought it would do any good.\",\n \"Do you want to play a game?\",\n \"Gentlemen! You can't fight in here! This is the war room!\",\n \"I do not avoid women, Mandrake. But I do deny them my essence.\",\n \"Mr. Ryan, be careful what you shoot at. Most things here don't react well to bullets.\",\n \"If OPERATE OK on the BVLC does not light in step 5, verify that the proper code is inserted.\",\n \"PEACETIME launch: If abnormal indications occur prior to step 8, report to Launch Director and proceed as directed.\",\n \"The missile silo (figure 1-2) is a reinforced, concrete structure with inside dimensions of approximately 146 feet in depth and 55 feet in diameter.\",\n \"General, you are listening to a machine.\",\n \"The mechanism is... Oh James, James... Will you make love to me all the time in England?\",\n \"I never joke about my work, 007.\", \n \"Eventually Kwajalein Island was selected, as it was 4,800 miles from California, perfect for ICBMs, and already had a US Navy base with considerable housing stocks and an airstrip.\",\n \"From Stettin in the Baltic to Trieste in the Adriatic an iron curtain has descended across the Continent.\",\n \"Whether you like it or not, history is on our side. We will bury you.\",\n \"I like Mr. Gorbachev. We can do business together.\",\n \"Mr. Gorbachev, tear down this wall!\",\n \"Gort! Klaatu barada nikto!\",\n \"It is no concern of ours how you run your own planet. But if you threaten to extend your violence, this Earth of yours will be reduced to a burned-out cinder.\",\n \"The remaining base in North Dakota, the Stanley R. Mickelsen Safeguard Complex, became active on 1 April 1975 and fully operational on 1 October 1975. By that time the House Appropriations Committee had already voted to deativate it. The base was shutdown on 10 February 1976.\"\n\n\n ];\n\n console.log(\"How many sentences? \",this.sentences.length);\n}", "function GenerateNewText() {\n this.sentences = [\n \"Nice.\",\n \"Do you have a sound test?\",\n \"Check out my sound test.\",\n \"Instead of asking for a keyboard rec, try building your own keyboard.\",\n \"What switches are those?\",\n \"I don’t know, I’m still waiting on a group buy.\",\n \"My GMK set is delayed.\",\n \"Well regardless, those caps are nice.\",\n \"Please check out my interest check!\",\n \"I built it myself.\",\n \"Sadly, I had to pay after market prices for these.\",\n \"I’m a tactile person myself.\",\n \"This is end game, for sure.\",\n \"I have one pair of hands but 24 keyboards.\",\n \"Specs?\",\n \"I need something to test out my new soldering iron.\",\n \"There’s a new group buy coming up that I’m waiting for.\",\n \"GMK is delayed by a year.\",\n \"Yeah once the caps come in, I’ll have this keyboard done.\", \n \"How much was your latest build?\",\n \"Wow do you use all those keyboards?\",\n \"I forgot to lube my switches.\",\n \"Been thinking about getting a custom handmade wrist rest to match my keyboard.\",\n \"It was supposed to be a budget build.\",\n \"You're a fool if you think the first build will be your last.\",\n \"Hopefully there will be a round 2 for that.\",\n \"I'm pretty sure I saw that on someone's build stream.\",\n \"That's a really nice build.\",\n \"Yeah, I have a custom coiled cable to match my custom mechanical keyboard and custom wrist rest that all fit nicely in my custom keyboard case.\",\n \"Finally had some time to lube these switches.\",\n \"Are those Cherry MX Browns?\",\n \"Really loving the caps!\",\n \"I wonder how long it took for everything to arrive.\", \n \"I find lubing switches to be therapeutic.\",\n \"I'm already thinking about my next build.\",\n \"You have to lube your switches though.\", \n \"Cool build.\",\n \"Thinking about getting an IKEA wall mount to display my boards.\",\n \"I bought that in a group buy a year ago.\",\n \"You won't believe how much shipping was.\",\n \"Not sure when my keyboard will come in honestly.\",\n \"Listen to the type test of this board.\",\n \"Soldered this PCB myself.\",\n \"Imagine buying GMK sets to flip them.\",\n \"My keyboard is stuck in customs.\",\n \"I have a collection of desk mats and only 1 desk.\",\n \"I've seen some cursed builds out there.\",\n \"Keyboards made me broke.\",\n \"I fell in too deep in the rabbit hole.\",\n \"I'm about to spend $500 on a rectangle.\",\n \"Not sure if this is a hobby or hell.\",\n \"Give me some feedback on my first build!\",\n \"The group buy is live now.\",\n \"I think I just forgot to join a group buy.\",\n \"RNG gods please bless me.\",\n \"It's gasket-mounted.\",\n \"But actuation force though.\",\n \"Never really thought of it that way now that you say it.\",\n \"Lots of people get into this hobby without doing their research and it shows.\",\n \"A custom keyboard can change your life, I would know.\",\n \"Group buys have taught me a different type of patience I didn't know I had.\",\n \"This was a group buy, you can't really find this unless you search after market.\"\n ]\n}", "function make_sentence(sentence_type, creatures, property) {\n if (sentence_type == \"generic\") {\n return '\"' + creatures + \" have \" + property + '.\"';\n } else if (sentence_type == \"always\") {\n return '\"' + creatures + \" always have \" + property + '.\"';\n } else if (sentence_type == \"usually\") {\n return '\"' + creatures + \" usually have \" + property + '.\"';\n } else if (sentence_type == \"sometimes\") {\n return '\"' + creatures + \" sometimes have \" + property + '.\"';\n } else if (sentence_type == \"negation\") {\n return '\"' + creatures + \" do not have \" + property + '.\"';\n } else {\n alert(\"ERROR1: what kind of sentence is \" + sentence_type + \"?\");\n }\n}", "function processSentence(nama, umur, alamat, hobi) {\n return 'Nama saya ' + nama + ', ' + 'umur saya ' + umur + ' tahun,' + ' alamat saya di ' + alamat + ', dan saya punya hobi yaitu ' + hobi + '!'\n}", "function makeSentence(){\n var o = wordObj.letterBank.vowels[3];\n var n = wordObj.letterBank.singleLetters.two;\n var space = wordObj.space;\n var my = wordObj.letterBank.pairedLetters.one;\n var way = wordObj.wordBank.one;\n var t = wordObj.letterBank.singleLetters.one;\n var e = wordObj.letterBank.vowels[1];\n var ch = wordObj.letterBank.pairedLetters.two;\n var tonic = wordObj.wordBank.two;\n var exclamation = wordObj.punctuation;\n \n return (o.toUpperCase()+n+space+my+space+way+space+t+o+space+t.toUpperCase()+e+ch+tonic+exclamation);\n}", "function createSentence(next_sentence) {\n\tvar name = \"SENTENCE CHOICE \" + next_sentence.toString();\n\tvar new_sentence = \n\t$(\"<div>\").attr(\"class\", \"large-6 columns\")\n\t.append(\n\t\t$(\"<div>\").attr(\"class\", \"sentence\").attr(\"id\", next_sentence)\n\t\t.append(\n\t\t\t$(\"<div>\").attr(\"class\", \"header\").html(name)\n\t\t\t.append(\n\t\t\t\t$(\"<img>\").attr(\"src\", \"img/delete.png\").attr(\"class\", \"delete\")\n\t\t\t\t)\n\t\t\t)\n\t\t.append(\n\t\t\t$(\"<div>\").attr(\"class\", \"new\")\n\t\t\t)\n\t\t.append(\n\t\t\t$(\"<div>\").attr(\"class\", \"row dispadd\")\n\t\t\t.append(\n\t\t\t\t$(\"<div>\").attr(\"class\", \"small-1 columns\")\n\t\t\t\t.append(\n\t\t\t\t\t$(\"<div>\").attr(\"class\", \"addsub add\")\n\t\t\t\t\t.append(\n\t\t\t\t\t\t$(\"<img>\").attr(\"src\", \"img/add.jpg\")\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t.append(\n\t\t\t\t$(\"<div>\").attr(\"class\", \"small-11 columns\")\n\t\t\t\t.html(\"...add disposition\")\n\t\t\t\t)\n\t\t\t)\n\t\t.append(\n\t\t\t$(\"<div>\").attr(\"class\", \"row total\")\n\t\t\t.html(\"TOTAL : 0\")\n\t\t\t)\n\t\t);\n\treturn new_sentence;\n}", "function GenerateNewText() {\n\t//Add property to the object\n\tthis.sentences = \n\t[\n\t\t\"Quote number 1.\",\n\t\t\"Second cool quote.\",\n\t\t\"Another nice quote.\",\n\t\t\"The very last quote.\"\n\t];\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun'] // change this line\n return sentence;\n }", "function buildSentence (num) {\n\t\t\t\tvar s = buildWordList(num).join(' ');\n\t\t\t\treturn s.charAt(0).toUpperCase() + \n\t\t\t\t\ts.substring(1) + getPunctuation() + ' ';\n\t\t\t}", "function sillySentence(string1, string2, string3) {\n return `I am so ${string1} because I ${string2} coding! Time to write some more awesome ${string3}!`;\n}", "function sentence(firstName, lastName){\n return `My first name is ${firstName} and my last name is ${lastName}.`;\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun']; // Change this line\n return sentence;\n}", "function madlib(str, str2, str3, str4) {\n var sentence = str + \" was walking to the \" + str2 + \" when their good friend \" + str3 + \" saw them. They walked up to them and said \" + str4 + \".\";\n return sentence;\n}", "function spreadOut() {\r\n let fragment = ['to', 'code'];\r\n let sentence = ['learning', ...fragment, 'is', 'fun']; // Change this line\r\n return sentence;\r\n}", "function emphasize(sentence, amount, adjective) {\n sentence = sentence + \", which is\";\n for (let i = 0; i < amount; i++) {\n sentence = sentence + \" very\";\n }\n return sentence + \" \" + adjective;\n}", "function randomString(){\n var verbs, nouns, adjectives, adverbs, preposition;\n nouns = [\"bird\", \"clock\", \"boy\", \"plastic\", \"duck\", \"teacher\", \"old lady\", \"professor\", \"hamster\", \"dog\"];\n verbs = [\"kicked\", \"ran\", \"flew\", \"dodged\", \"sliced\", \"rolled\", \"died\", \"breathed\", \"slept\", \"killed\"];\n adjectives = [\"beautiful\", \"lazy\", \"professional\", \"lovely\", \"dumb\", \"rough\", \"soft\", \"hot\", \"vibrating\", \"slimy\"];\n adverbs = [\"slowly\", \"elegantly\", \"precisely\", \"quickly\", \"sadly\", \"humbly\", \"proudly\", \"shockingly\", \"calmly\", \"passionately\"];\n preposition = [\"down\", \"into\", \"up\", \"on\", \"upon\", \"below\", \"above\", \"through\", \"across\", \"towards\"];\n\n function randGen() {\n return Math.floor(Math.random() * 5);\n }\n\n function sentence() {\n var rand1 = Math.floor(Math.random() * 10);\n var rand2 = Math.floor(Math.random() * 10);\n var rand3 = Math.floor(Math.random() * 10);\n var rand4 = Math.floor(Math.random() * 10);\n var rand5 = Math.floor(Math.random() * 10);\n var rand6 = Math.floor(Math.random() * 10);\n var content = \"The \" + adjectives[rand1] + \" \" + nouns[rand2] + \" \" + adverbs[rand3] + \" \" + verbs[rand4] + \" because some \" + nouns[rand1] + \" \" + adverbs[rand1] + \" \" + verbs[rand1] + \" \" + preposition[rand1] + \" a \" + adjectives[rand2] + \" \" + nouns[rand5] + \" which, became a \" + adjectives[rand3] + \", \" + adjectives[rand4] + \" \" + nouns[rand6] + \".\";\n return content;\n };\n var thisString = sentence();\n return thisString;\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun']; // change this line\n return sentence;\n}", "function wordsToSentence(words) {\n //your code here\n\n return words.join(' ');\n\n }", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = // change this line\n return sentence;\n}", "function madLib(wordToAdd){\n // This <word> is the coolest thing ever\n var thisString = \"This \";\n var coolestString = \" is the coolest thing ever\";\n // concat'd in the middle of my two vars with word to add\n var outputString = thisString + wordToAdd + coolestString;\n // Output the sentence\n return outputString;\n}", "function splitSentence(split_id){\n //1 split the sentence display\n var sentence_id = parseInt(split_id.split(\".\")[0]),\n word_id = parseInt(split_id.split(\".\")[1]);\n\n var sentence = getSentence(sentence_id-1).split(\" \");\n console.log(sentence)\n //\n var sentence_part1 = sentence.slice(0,word_id).join(\" \"),\n sentence_part2 = sentence.slice(word_id+1,sentence.length).join(\" \");\n\n var part1_html = \"<div><h3>Subsentence Part 1</h3>\" + sentence_part1 + \"</div>\";\n var part2_html = \"<div><h3>Subsentence Part 2</h3>\" + sentence_part2 + \"</div>\";\n\n $('#selected-sentence').append(part1_html);\n $('#selected-sentence').append(part2_html);\n\n //add subsentence classification to the rubrick\n\n addClassification('#classification_selection');\n\n}", "function greetings3 ({ first_name, last_name, profession, age }) {\n return `Hi, I am ${first_name} ${last_name}.\n I am a ${profession}\n My age is ${age}`\n}", "function GenerateNewText() {\n // Add property to the object\n this.sentences = doggoarray;\n this.punctuation = [\".\", \",\", \"!\", \"?\", \".\", \",\", \",\", \"!!\", \".\", \",\"];\n}", "function buildSentence(movie){ //for input of \"movie\", needs to do following:\n var result = \"You have \";\n if(movie.hasWatched){\n result += \"watched \";\n } else {\n result += \"not seen \";\n }\n result += \"\\\"\" + movie.title + \"\\\" - \";\n result += movie.rating + \" stars\";\n return result; //different from the console.log above\n //return will be made each time function is called (number of items in array)\n}", "function spreadOut() {\n let fragment = ['to', 'code'];\n let sentence = ['learning', ...fragment, 'is', 'fun'];\n return sentence;\n}", "function makeIntoTitle(sentence) {\n // Your code here\n if (typeof sentence === \"string\") {\n let newSentence = \"\";\n sentenceArray = sentence.split(\" \");\n for (let j = 0; j < sentenceArray.length; j++) {\n let wordArray = sentenceArray[j].split(\"\");\n wordArray[0] = wordArray[0].toUpperCase();\n for (let i = 1; i < sentenceArray[j].length; i++) {\n wordArray[i] = wordArray[i].toLowerCase();\n }\n if (j < sentenceArray.length - 1) {\n newSentence = newSentence.concat(wordArray.join(\"\"), \" \");\n } else {\n newSentence = newSentence.concat(wordArray.join(\"\"));\n }\n }\n return newSentence;\n }\n return undefined;\n}", "function textAdd() {\n let IntroParagraph = document.getElementById(\"IntroParagraph\");\n let introtext = \"Now is the time to travel to Greece. The country may be going through an economic crisis, but many travellers say that it hasn't impacted the experience of visiting. Plus, there may be some great deals. Greece has 1,400 islands, though only 230 of them are inhabited. And while everyone knows about Santorini and Mykonos, there are gorgeous lesser-known islands in Greece, too.\";\n IntroParagraph.textContent = introtext;\n\n let Folegandros = document.getElementById(\"Folegandros\");\n let text2 = \"Folegandros is almost a Greek cliché, full of beautiful whitewashed houses with bright blue doors lining cobblestoned streets on steep cliffs. Rugged and remote, without chain hotels or package tours — not even a bank or ATM — and accessible only by ferry, the volcanic island boasts solitude in spades, secluded beaches, and incredible sunsets. \";\n Folegandros.textContent = text2;\n\n let Alonissos = document.getElementById(\"Alonissos\");\n let text3 = \"Off the mainland, this island, whose surrounding waters are a designated marine park full of seals and dolphins, is a nature lover's dream. The spectacular spot's crystal clear waters and beautiful beaches are perfect for diving, and its lush flora and dense forests ideal for hikes. Since the rich landscape is chock full of indigenous herbs, it's also known for its traditional medicine, and home of the International Academy of Homeopathy. \";\n Alonissos.textContent = text3;\n\n let Spetses = document.getElementById(\"Spetses\");\n let text4 = \"Off the mainland, \";\n Spetses.textContent = text4;\n\n let Amorgos = document.getElementById(\"Amorgos\");\n let text5 = \"Shipwrecks, sea caves and beautiful clear waters make Amorgos popular with snorkelers, but the mountainous island is the perfect compromise between unwinding and adventure, boasting beautiful beaches but also hiking, scuba diving and rock-climbing. One of the island's main attractions is the 11th-century cliffside monastery of Panayia Hozoviótissa, which is precariously carved into a cliff. \";\n Amorgos.textContent = text5;\n\n let Syros = document.getElementById(\"Syros\");\n let text6 = \"A favourite Athenian escape and former shipowners' vacation spot full of grand mansions, Syros is little known to foreigners. Famous for its neoclassical architecture and perfectly preserved heritage, its capital, Ermoupolis, was a 13th-century Venetian-built town and important trade and industrial centre, and boasts giant churches and beautiful villas, a stunning town hall, and labyrinthine streets and stairways. \";\n Syros.textContent = text6;\n\n let Milos = document.getElementById(\"Milos\");\n let text7 = \"This volcanic island, with catacombs and ancient iron mines to explore, is dramatically rugged, and famous for its stunning rock formations. Often likened to a moonscape, it's also known for its hot springs, the ancient Venus De Milo statue that was found here, and for its diversity of incredible beaches. Known as `the island of colours` it's home to around 80 beaches — some only accessible by boat — ranging from stunningly white, to striking black, and even unusual red and grey. However, each beach has the same Evian-clear turquoise waters, and is surrounded by a rugged mountain landscape. \";\n Milos.textContent = text7;\n\n let Hydra = document.getElementById(\"Hydra\");\n let text8 = \"The first thing you'll notice on this beautiful island is the lack of cars — and buses, motorcycles, or other wheeled vehicles, as well as high rises. The winding little streets full of beautiful 18th-century mansions, churches, cathedrals, museums and art galleries are covered in cobblestones, and mostly trafficked by donkeys and humans. Back in the day, the island attracted celebrities like Leonard Cohen and Sophia Loren, but was somehow forgotten over the years. That means that travellers to Hydra can have the chic yet almost rural island paradise more or less to themselves. \";\n Spetses.textContent = text8;\n\n let Ithaca = document.getElementById(\"Ithaca\");\n let text9 = \"Most famous for being the home of Odysseus, and a prominent figure in Homer's `The Odyssey,` Ithaca is said to have been inhabited since the 2nd millennium BC. Made up of two islands joined by a narrow strip of land, many visit it to see the legendary sites mentioned by Homer. However, Ithaca is more than its mythical counterpart, beckoning with secluded beaches, dramatic cliffs, beautiful olive groves, and sleepy fishing villages full of Byzantine churches and monasteries. \";\n Ithaca.textContent = text9;\n\n let Gavdos = document.getElementById(\"Gavdos\");\n let text10 = \"Near the more well-known Crete, Gavdos is the most southern island in Greece — and the most southern spot in Europe discounting the Canaries. Only accessible by ferry, the remote island has only about 50 permanent residents, and can feel like your private playground. Local legend has it that the island was the home of goddess Calypso, who kept Odysseus prisoner here. Today, a favorite tourist activity is to visit the spot believed to be her cave. Be warned, you won't find any luxury hotels here. While the romantically under-developed, super laid back island has a number of rooms for rent, those are limited, as the real draw here for many is the free, seaside camping. \";\n Gavdos.textContent = text10;\n\n\n\n }", "function getSentence({subject, verb, object}) { // deconstructing an object into properties\n\treturn `${subject} ${verb} ${object}`;\n}", "function generateSentence(ngrams, stemWord) {\n var sent = generateChain(ngrams, stemWord, 'backw', 20).reverse()\n sent = sent.concat( generateChain(ngrams, stemWord, 'forw', 20).slice(1) )\n sent = alignPunctuation( sent.join(' ')+'.' )\n return cleanSentence(sent)\n}", "function addExcitement (theWordArray) {\n var stringPrint = ''\n var exclam = 1\n for (var i = 0; i < sentence.length; i = i + 1){\n stringPrint += sentence[i]\n if ((i + 1) % 3 === 0) {\n stringPrint += '!'.repeat(exclam);\n exclam++ \n }\n console.log(stringPrint);\n };\n}", "async add(message, connection, args) {\n if (args.length < 3) {\n message.reply('The Format is !sno add |Common Noun (N)/Personal Noun (PN)/Adj/Transitive Verb (TV)/Intransitive Verb (IV)/Sentence (S)/Insult (I)| |Word/Sentence|');\n Speaker.googleSpeak('Wrong!', this.voice, this.volume, connection, Speaker.speak);\n return;\n }\n let symbol = args[1].toLowerCase().trim();\n const availableSymbols = ['n', 'pn', 'tv', 'iv', 's', 'i', 'adj'];\n if (!availableSymbols.includes(symbol)) {\n message.reply('The Format is !sno add |Common Noun (N)/Personal Noun (PN)/Adj/Transitive Verb (TV)/Intransitive Verb (IV)/Sentence (S)/Insult (I)| |Word/Sentence|');\n Speaker.googleSpeak('Wrong!', this.voice, this.volume, connection, Speaker.speak);\n return;\n }\n if (symbol === 's') {\n symbol = 'sentences';\n }\n if (symbol === 'i') {\n symbol = 'insults';\n }\n let sentence = args[2].toLowerCase().trim();\n for (let i = 3; i < args.length; i += 1) {\n sentence += ` ${args[i].toLowerCase()}`;\n }\n if (!symbols[symbol].includes(sentence)) {\n symbols[symbol].push(sentence.trim());\n const json = JSON.stringify(symbols);\n const writeFile = util.promisify(fs.writeFile);\n await writeFile('symbols.json', json);\n message.reply(`Added ${sentence} as a ${symbol}`);\n } else {\n message.reply(`${sentence} is already saved as a ${symbol}`);\n Speaker.googleSpeak('Whoopsie', this.voice, this.volume, connection, Speaker.speak);\n }\n }", "function introduce(name, age, address, hobby) {\n return (\"Nama saya \" + name + \", umur saya \" + \" age tahun,\" + \" alamat saya di \" + address + \", dan saya punya hobby yaitu \" + hobby)\n}", "function verse1() {\n let output = ''\n output = '<p>In the heart of Holy See</p>' +\n '<p>In the home of Christianity</p>' +\n '<p>The Seat of power is in danger</p>'\n\n return output\n}", "function SentenceGenerator() {\n var sentence = [], lastone, handler;\n sentence.push('By the end of the day I hope I\\'m done');\n sentence.push('mirror/rorrim');\n sentence.push('In my timezone it is ' + new Date().toString());\n\n handler = function () {\n lastone = sentence.pop();\n if (lastone !== undefined) {\n send(lastone);\n window.setTimeout(\n handler,\n getRandomArbitrary(minutes(10), minutes(45))\n );\n } else {\n console.log('sentences done...');\n }\n };\n\n window.setTimeout(handler, getRandomArbitrary(minutes(10), minutes(45)));\n }", "function madLib(word1, word2, word3, word4){\n return 'The ' + word1 + word2 + word3 + word4 + \"!\";\n}", "function XDisplaySentence(targetId, WordIdPrefix, punctuation) {\n //alert('Display Function');\n //Build the Sentence\n var sentence = \"\".concat($(WordIdPrefix + LastSentenceSelections[0]).text(), \" \", $(WordIdPrefix + LastSentenceSelections[1]).text(), \" \", $(WordIdPrefix + LastSentenceSelections[2]).text(), \" \", $(WordIdPrefix + LastSentenceSelections[3]).text(), punctuation);\n\n $(targetId).text(sentence);//Display the sentence in the header\n}", "function makeExciting(sentence) {\n\n var excitingSentence = sentence + \"!!!\";\n\n console.log(excitingSentence);\n\n return excitingSentence;\n}", "function madLibs(str, array) {\n var finalSentence = '';\n //segments [ 'Marching is fun: ', ', ', ', ', ', ', '!' ]\n var segments = str.split('*');\n var nextWordIdx = 0;\n\n for (var i = 0; i < segments.length - 1; i++) {\n //adds element then word at array and then add them to the finalString\n var segment = segments[i];\n segment += array[nextWordIdx];\n finalSentence += segment;\n // increase the counter \n nextWordIdx = nextWordIdx + 1 < array.length ? nextWordIdx + 1 : 0;\n }\n\n finalSentence += segments[segments.length - 1];\n \n return finalSentence;\n }", "function wordsComplex() {\n\n}", "function verse1() {\n let output = 'Would you climb a hill? Anything.<br>Wear a dafodill? Anything.<br>Leave me all your will? Anything.<br>Even fight my bill? What fisticuffs?'\n\n return output\n}", "function makeExciting(sentence) {\n var excitingSentence = sentence + \"!!!\";\n\n console.log(excitingSentence);\n\n return excitingSentence;\n}", "async insult(message, connection, args) {\n if (args.length === 2) {\n const person = `${args[1].charAt(0).toUpperCase() + args[1].substring(1)} `;\n const insult = await this.solver.getSentence('<pi>').toLowerCase();\n message.channel.send(person + insult);\n Speaker.googleSpeak(person + insult, this.voice, this.volume, connection, Speaker.speak);\n } else {\n const insult = await this.solver.getSentence('<i>');\n message.channel.send(insult);\n Speaker.googleSpeak(insult, this.voice, this.volume, connection, Speaker.speak);\n }\n }", "function wordsToSentence(anArray) {\n for(i = 0; i < anArray.length; i++) {\n completeSentence += anArray[i] + \" \";\n }\n completeSentence.slice(0,-1); //Trim last space\n console.log(\"Your complete sentence: \" + completeSentence);\n}", "setTextParts(result, textParts) {\n return textParts.prefix + result + textParts.suffix;\n }", "function introduce(name, age, address, hobby) {\n return '\"Nama saya ' + name + \", umur saya \" + age + \" tahun, alamat saya di \" + address + \", dan saya punya hobby yaitu \" + hobby + '!\"';\n}", "function texte2(){\n document.querySelector(\".textM\").classList.add(\"textM3\")\n document.querySelector(\".textM\").innerText= `fonctionne en bluethoot ! ou part cable !\n peut se rechargé sur un socle transportable`;\n}", "makeText(numWords = 100) {\n // TODO\n\n let chainObj = this.makeChains();\n let randomStarIdx = Math.floor(Math.random() * this.words.length);\n let randomStartWord = this.words[randomStarIdx];\n let text = [randomStartWord];\n\n for (let i = 0; i < numWords - 1; i++) {\n let value = chainObj[text[i]]\n\n if (value[0] === null) {\n return text.join(' ');\n }\n if (value.length === 1) {\n text.push(value);\n } else {\n let randomIdx = Math.floor(Math.random() * value.length);\n let randomWord = value[randomIdx];\n text.push(randomWord);\n }\n }\n\n return text.join(' ');\n }", "function wordsToSentence(words) {\n let str = \"\"\n \n for(let word of words){\n str += (word + \" \") \n }\n \n return str.trim()\n }", "function moreFunctions() {\n var sentence = \"I am learning\";\n sentence += \" a lot from The Tech Academy!\";\n document.getElementById(\"Holmes\").innerHTML = sentence;\n}", "getSentenceHelper(element) {\n if (!element.includes('<') && !element.includes('>')) {\n return element;\n }\n\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n\n let subSentence = '';\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n subSentence += this.getSentenceHelper(syntax[i]);\n } else {\n subSentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n return subSentence;\n }", "function firstCarAdd(word, l) {\n    var newWord = \"\";\n    for (i = 0; i < l; i++) {\n        newWord += word[i];\n    } \n newWord += \"...\";\n    return newWord;\n}", "randomSentence () {\n let sentenceArray = []\n let sentence1 = this.randomSentenceHelper();\n //sentence Array tracks each relative clause generated\n sentenceArray.push(sentence1);\n let num = Math.random();\n //loop continues to generate relative clauses until it fails to meet\n //the random check.\n while(num < Math.min(.85, this.complexity)) {\n let conj = this.randomWord(this.conjunctions);\n sentenceArray.push(conj);\n tempSentence = this.randomSentenceHelper();\n sentenceArray.push(tempSentence);\n num = Math.random();\n }\n joinedSentence = sentenceArray.join(' ');\n //change the first letter to uppercase and replace the last ',' with a '.'\n fullSentence = joinedSentence[0].toUpperCase() + joinedSentence.slice(1, joinedSentence.length -1) + '.';\n return fullSentence;\n }", "createNew() {\n this.fading = 0;\n // Splitting sentence in multiple lines\n var splitted = this.sentence.split(' ');\n this.line = [];\n this.lineOffesets = [];\n var k = 0;\n this.line[0] = splitted[0];\n var constOffeset = this.canvasWidth / 2;\n\n // 50 chars they say is helps readbility\n for (var i = 1; i < splitted.length; i++) {\n // First condition for mobile second on desktop\n if (this.getTextWidth(this.line[k] + splitted[i], this.size + this.font) < (this.canvasWidth - this.X - 15) && this.line[k].length < 50) {\n this.line[k] += \" \" + splitted[i];\n } else {\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n k++;\n this.line[k] = splitted[i];\n }\n }\n // One last time, because the incrementing logic if offset by one\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n\n if (this.author != null) {\n k++;\n this.line[k] = this.author;\n this.lineOffesets[k] = constOffeset - (this.getTextWidth(this.line[k]) / 2);\n }\n }", "getSentence(element) {\n const rules = this.grammar.get(element);\n const index = Math.floor(Math.random() * rules.length);\n\n let syntax = rules[index];\n syntax = syntax.split(/ +/);\n let sentence = '';\n\n let i;\n for (i = 0; i < syntax.length; i += 1) {\n if (i === syntax.length - 1) {\n sentence += `${this.getSentenceHelper(syntax[i])}`;\n } else {\n sentence += `${this.getSentenceHelper(syntax[i])} `;\n }\n }\n\n sentence = sentence.charAt(0).toUpperCase() + sentence.substr(1);\n return (sentence.includes('.') || sentence.includes('?') ? sentence : sentence.concat('.'));\n }", "function sentencePartsHandler() { \n const currentTask = \"sentence\";\n const taskDiv = window.utils.createEl('div'), \n taskHeading = window.utils.createEl('p'), \n submitButton = window.utils.createEl('button'),\n warning = window.utils.createEl('p'),\n pWrapper = window.utils.createEl('p');\n\n const pickedObj = _.sample(window.tasks.sentenceParts);\n const splitted = pickedObj.sentence.split(' ');\n for (let i = 0; i < splitted.length; i++){\n pWrapper.appendChild(window.utils.createEl('span'));\n pWrapper.lastChild.classList.add('part');\n pWrapper.lastChild.textContent = (i === splitted.length-1) ? splitted[i] : splitted[i] + \" \"; \n } \n\n taskHeading.appendChild(window.utils.createEl('span'));\n taskHeading.appendChild(window.utils.createEl('span'));\n taskDiv.classList.add('task');\n taskDiv.classList.add('sentence');\n taskHeading.classList.add('task-heading');\n pWrapper.classList.add('p-wrapper');\n submitButton.classList.add('submit-button');\n taskHeading.firstChild.textContent = \" Разбери предложение по составу\";\n taskHeading.lastChild.textContent = \"*1 клик - выбор подлежащего/очистить выбор, 2 - выбор сказуемого\";\n submitButton.textContent = \"Я сделал!\";\n\n const storage = [];\n storage.push(taskHeading, pWrapper, submitButton, warning);\n storage.forEach(function(el){taskDiv.appendChild(el);});\n window.utils.addDocumentFragment(taskDiv, taskWrapper);\n \n pWrapper.addEventListener('click', pickSubject);\n pWrapper.addEventListener('dblclick', pickPredicate);\n // supportive function\n function pickSubject(event) {\n if (event.target.tagName === \"SPAN\"){ \n if (event.target.classList.contains('predicate')) {event.target.classList.remove('predicate') }\n event.target.classList.toggle('subject');\n } \n }\n\n function pickPredicate(event) {\n if (event.target.tagName === \"SPAN\"){\n if (event.target.classList.contains('subject')) {event.target.classList.remove('subject') }\n event.target.classList.toggle('predicate');\n } \n }\n \n submitButton.addEventListener('click', checkAnswer);\n let subject = [], predicate = [];\n \n function checkAnswer(){\n _.forEach(pWrapper.querySelectorAll('.subject'), function(item){subject.push(_.trim(item.textContent));})\n _.forEach(pWrapper.querySelectorAll('.predicate'), function(item){predicate.push(_.trim(item.textContent));})\n if (!predicate.length) { \n warning.textContent = 'Выполни задание'\n } else {\n const condition = (_.isEqual(subject, pickedObj.subject) && _.isEqual(predicate, pickedObj.predicate));\n window.main.isCorrect(condition, taskDiv, taskWrapper, currentTask);\n }\n }\n}", "function tripleTrouble(one, two, three) {\n var word = \"\";\n for (var i = 0; i < one.length; i++) {\n word += one.charAt(i) + two.charAt(i) + three.charAt(i);\n //add iterative characters from each string\n }\n return word;\n}", "introduce(){\n let introduce=super.introduce()+' '+'I am a Teacher. I teach ';\n if(this.klasses==null){\n return introduce+'No Class.';\n }else{\n introduce+='Class ';\n for(var i=0;i<this.klasses.length;i++){\n introduce+=this.klasses[i].number;\n (i!==this.klasses.length-1)?introduce+=', ':introduce+='.'\n }\n return introduce;\n }\n }", "function makeAPhrase (){\n var word1 = [\"Waz Up\", \"Sucky Sucky\", \"Chopy Chopy\", \"Vada Ving\", \"Vada Vunm\"]\n var word2 = [\"Trumper\", \"Out there!\", \"MOSt folf\", \"Wolf of Wall Street\", \"lambo\" ];\n var word3 = [ \"Porche\", \"Samsung\", \"Motorola\", \"Wolfagangpck\", \" DOODOO DID\"];\n\n var rand1 = Math.floor (Math.random() * word1.length);\n var rand2 = Math.floor (Math.random() * word2.length);\n var rand3 = Math.floor (Math.random() * word3.length);\n\n var phraseOfTheDay = word1[rand1] + \" \" + word2[rand2] + \" \" + word3[rand3];\n\n alert(phraseOdTheDay);\n}", "function joinSentence(terms) {\n var separator = arguments.length <= 1 || arguments[1] === undefined ? \"or\" : arguments[1];\n\n if (terms.length < 2) {\n return terms[0] || 'any';\n } else {\n var last = terms.pop();\n return terms.join(', ') + ' ' + separator + ' ' + last;\n }\n }", "addTexts(){\n var startingMessage = (game.singleplayer || game.vsAi) ? \"Current Turn: X\" : \"Searching for Opponent\"\n\n game.turnStatusText = game.add.text(\n game.world.centerX, 50, startingMessage,\n { font: '50px Arial', fill: '#ffffff' }\n )\n //setting anchor centers the text on its x, y coordinates\n game.turnStatusText.anchor.setTo(0.5, 0.5)\n game.turnStatusText.key = 'text'\n\n game.playerPieceText = game.add.text(\n game.world.centerX, 600-50, '',\n { font: '50px Arial', fill: '#ffffff' }\n )\n //setting anchor centers the text on its x, y coordinates\n game.playerPieceText .anchor.setTo(0.5, 0.5)\n game.playerPieceText.key = 'text'\n\n\n\n }", "function tripleTrouble(one, two, three){\n let result = \"\";\n one.split(\"\");\n two.split(\"\");\n three.split(\"\");\n\n for(i=0;i < one.length;i++) {\n result+=one[i]+two[i]+three[i];\n }\n return result;\n }", "function createMLSentence(){\n let arrIndex = 0;\n for(i=0; i < mLArray.length; i++){\n let matchIndex = mLArray.indexOf(\"~\");\n mLArray[matchIndex] = inputArray[arrIndex];\n arrIndex++;\n }\n\n document.getElementById(\"output1\").value = mLArray.join(\" \");\n }", "function formatWords(sentence, show) {\n\n // split all the words and store it in an array\n var words = sentence.split(' ');\n // var words = sentence;\n var new_sentence = '';\n\n // loop through each word\n for (i = 0; i < words.length; i++) {\n\n // process words that will visible to viewer\n if (i <= show) {\n new_sentence += words[i] + ' ';\n \n // process the rest of the words\n } else {\n \n // add a span at start\n if (i == (show + 1)) new_sentence += '<span class=\"ellipsis\">... </span><span class=\"more_text hide\">'; \n\n new_sentence += words[i] + ' ';\n \n // close the span tag and add read more link in the very end\n if (words[i+1] == null) new_sentence += '</span><a href=\"#\" class=\"more_link\"> Read more</a>';\n } \n } \n\n return new_sentence;\n\n}", "function textSection1() {\r\n const t = `The full name is ${messi.fullName} an ${messi.nationality} ${messi.positions} soccer player. He was born in ${messi.dateOfBirth} as the third child of 4. His father Jorge Messi was a steel factory manager and his mother was working in a magnet manufacturing workshop.\r\n His career started with ${messi.youthClubs[0]} in the duration ${messi.youthClubsDurations[0]} then moved to ${messi.youthClubs[0]} starting from ${messi.youthClubsDurations[1]}.\r\n If we dug up a little further through Lionel's personality, we will find that is calm and concentrating in the field. Not only just in the field, but also outside of the football field, which means he cares so much about the style of management of the club he plays for.\r\n Until this very moment, ${messi.fullName} still plays for ${messi.youthClubs[1]}. However, his future with the club is a mystery in the moment due to the instabilty of the club's management.`;\r\n //Text to be added to section 1\r\n addTextToSection(t,0); \r\n}//This function is used to add the data of the first section about the player from the js file to the html file.", "function makephrases(){\n myPhrase1 = new p5.Phrase('hihatc', makeSound, patterns[0]); \n myPhrase2 = new p5.Phrase('hihato', makeSound2, patterns[1]); \n myPhrase3 = new p5.Phrase('snare', makeSound3, patterns[2]);\n myPhrase4 = new p5.Phrase('ht', makeSound4, patterns[3]);\n myPhrase5 = new p5.Phrase('lt', makeSound5, patterns[4]);\n myPhrase6 = new p5.Phrase('clap', makeSound6, patterns[5]);\n myPhrase7 = new p5.Phrase('kicker', makeSound7, patterns[6]);\n \n \n myPart.addPhrase(myPhrase1);\n myPart.addPhrase(myPhrase2);\n myPart.addPhrase(myPhrase3);\n myPart.addPhrase(myPhrase4);\n myPart.addPhrase(myPhrase5);\n myPart.addPhrase(myPhrase6);\n myPart.addPhrase(myPhrase7);\n myPart.setBPM(110);\n myPart.onStep(grow); \n}", "makeText(numWords = 100) {\n let randNum = Math.floor(Math.random() * this.words.length)\n let word = this.words[randNum]\n let str = ''\n\n for (let i = 0; i < numWords; i++) {\n str += `${word} `\n let randIdx = Math.floor(Math.random() * this.wordsObj[word].length)\n const nextWord = this.wordsObj[word][randIdx]\n if (nextWord === null) {\n // Remove the trailing space at the end of the sentence.\n str.replace(/\\s+$/, '')\n break\n }\n word = nextWord\n }\n\n return str\n }", "makeText(numWords = 100) {\n let words = Object.keys(this.chains);\n\n let capWords = words.filter(word => word[0] === word[0].toUpperCase());\n let text = this.randomPick(capWords);\n let firstWord = text;\n let nextWord = this.singleChain(firstWord);\n\n for (let i=1; i < numWords - 1; i++) {\n text += \" \";\n let bigram = `${firstWord} ${nextWord}`;\n firstWord = nextWord;\n if (this.bigrams[bigram]) {\n let pick = this.randomPick(this.bigrams[bigram]);\n nextWord = pick ? pick : this.randomPick(words);\n } else {\n nextWord = this.singleChain(firstWord);\n }\n text += nextWord;\n }\n return text;\n }", "noun( num, singular, plutal, append ) {\n append = String( append || '' );\n return String( num +' '+ ( parseFloat( num ) === 1 ? singular : plutal ) +' '+ append ).trim();\n }", "makeText(numWords = 100) {\n const startWordIndex = Math.floor(Math.random() * Object.keys(this.startChains).length);\n let prevWord = Object.keys(this.startChains)[startWordIndex];\n let randomText = prevWord;\n\n for (let i = 1; i < numWords; i++) {\n const nextRandom = Math.floor(Math.random() * this.chains[prevWord].length);\n const nextWord = this.chains[prevWord][nextRandom];\n randomText += ' ';\n if (nextWord) {\n randomText += nextWord.toLowerCase();\n prevWord = nextWord;\n } else {\n randomText += this.makeText(numWords - i);\n break;\n }\n }\n if (prevWord.charAt(prevWord.length - 1) === ',') {\n randomText = randomText.slice(0, randomText.length - 1)\n }\n if (!END_PUNCTUATION.includes(prevWord.charAt(prevWord.length - 1))) {\n randomText += '.'\n }\n return randomText.trim()\n }", "function writeSentences() {\n \n var tempCounter = 0; // count the number of lines read\n console.log(\"start counting... \" + tempCounter);\n\n tempData = \"\"; // reset tempData var\n \n //clear text in box first\n document.getElementById(\"loremIpsumBox\").innerHTML = (\"\"); // empty the div\n \n var rS = randomStart; // temp var to hold the random starting point\n \n // find lines here\n \n var stringData = []; //create stringData array\n \n //start by finding the right paragraph\n for (var findPara = 0; tempCounter < rS; findPara++) {\n var numTemp = globalJsonVar[movieIndex].paragraphs[findPara].length;\n tempCounter = tempCounter + numTemp;\n console.log(\"still counting... \" + tempCounter);\n }\n //which paragraph are we on - or where should we start?\n console.log(\"start on paragraph number \" + findPara);\n\n var countLines = 0; //temp var to count the lines grabbed\n \n for (var grab = 0; countLines < numberSelect; grab++) {\n //add new line after each paragraph\n if (grab !== 0) {\n console.log(\"NEW LINE!!!\");\n stringData.push(\"\\n\" + \" \"); //add return after paragraph - NOT WORKING\n console.log(stringData);\n }\n \n for (s = 0; countLines < numberSelect; s++) {\n tempData = (globalJsonVar[movieIndex].paragraphs[findPara+grab][s] + \" \"); // grab a line from the randomStart paragraph\n stringData.push(tempData); // add new string to array\n countLines++;\n \n //check next line for 'undefined'\n //console.log(\"Check next line...\");\n //console.log(globalJsonVar[movieIndex].paragraphs[findPara+grab][s+1]);\n if (typeof (globalJsonVar[movieIndex].paragraphs[findPara+grab][s+1]) == 'undefined') {\n console.log(\"Next line is blank!!!\");\n break;\n }\n \n }\n }\n\n stringData = stringData.join(\" \"); // remove the commas from the output\n document.getElementById(\"loremIpsumBox\").innerHTML += (\"<p>\" + stringData + \"</p>\"); // puts the words in the div\n \n}", "function myFunction() {\n var sentence = \"I am learning\";\n sentence += \" a lot from this book!\";\n document.getElementById(\"Concatenate\").innerHTML = sentence;\n}", "function joint(string1, string2) {\n\t\tvar temp = [],\n\t\ti = 0;\n\t\tvar string1,string2\n\t\ttemp[i++] = string1;\n\t\ttemp[i++] = string2;\n\t\tvar text = temp.join(\"\");\n\t\treturn text\n\t}", "introduce() {\n console.log(\n `This is a ${this.make} ${this.model} that was made in ${this.yearMade} and has a top speed of ${this.topSpeed}`\n );\n }", "constructor() {\r\n super();\r\n this.addPart.push(new NormalPart(\"j'en ai conclu que la mousse au chocolat n'était mon fort, \"));\r\n this.addPart.push(new NormalPart(\"j'ai appellé les Avengers pour m'aider dans ma quête, \"));\r\n this.addPart.push(new NormalPart(\"j'ai crié après le perroquet \"));\r\n this.addPart.push(new NormalPart(\"j'ai toujours voulu devenir un super-héros \"));\r\n this.addPart.push(new NormalPart(\"mon copain a acheté des champignons hallucinogènes \"));\r\n this.addPart.push(new NormalPart(\"j'ai acheté des nouvelles épées kikoodelamortquitue \"));\r\n this.addPart.push(new NormalPart(\"Nina mon perroquet a crié son mécontentement \"));\r\n this.addPart.push(new NormalPart(\"ma copine m'a dit : Lui c'est un mec facile !, \"));\r\n this.addPart.push(new NormalPart(\"je me suis mise à écouter Rammstein \"));\r\n this.addPart.push(new NormalPart(\"j'ai ressorti ma vieille Nintendo DS \"));\r\n this.addPart.push(new NormalPart(\"le père Noël est sorti de sous la cheminée \"));\r\n this.addPart.push(new NormalPart(\"ma mère m'a dit : Rien ne vaut les gâteaux !, \"));\r\n this.addPart.push(new NormalPart(\"je me suis poussée à me remettre au sport \"));\r\n this.addPart.push(new NormalPart(\"un castor est sorti de la rivière \"));\r\n this.addPart.push(new NormalPart(\"Jean-pierre Pernault à parlé du Coronavirus au 20h çà m'a fait réfléchir, \"));\r\n }", "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n // Your code below this line\n var result = \"\";\n result+= \"My \"+myAdjective+\" \"+myNoun+\" \"+myVerb+\" away \"+myAdverb+\".\";\n // Your code above this line\n return result;\n}", "randomText(positive) {\n const posPhrases = [\n 'Goed gedaan!',\n 'Netjes!',\n 'Je doet het súper!',\n 'Helemaal goed!',\n 'Je bent een topper!'\n ]\n const negPhrases = [\n 'Ik weet dat je het kunt!',\n 'Jammer, probeer het nog eens!',\n 'Bijna goed!',\n 'Helaas pindakaas'\n ]\n\n const phrases = positive ? posPhrases : negPhrases\n const maximumNumber = phrases.length\n const randomNumber = Math.floor(Math.random() * maximumNumber)\n \n return phrases[randomNumber]\n }", "function generateSentence(msgContent){\r\n var words = [];\r\n var sentence = \"\";\r\n var returnSentence = \"\";\r\n var no = false;\r\n var continueWordLoop = true;\r\n var beginLength = 0;\r\n\r\n var lastWords = \"\";\r\n\r\n var random = Math.random();\r\n if(random < startWordR.length/(startWordR.length+startWordIIR.length+startWordIIIR.length) ){\r\n beginLength = 1;\r\n }else if(random < (startWordR.length+startWordIIR.length)/(startWordR.length+startWordIIR.length+startWordIIIR.length) ){\r\n beginLength = 2;\r\n }else{\r\n beginLength = 3;\r\n }\r\n\r\n if(beginLength == 1){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordR.length; i++){\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordR[i] == currentContext[j]){startTempList[startTempList.length] = startWordR[i]}\r\n }\r\n }\r\n if(startTempList.length > 0){\r\n words[0] = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n }else{\r\n words[0] = startWordR[Math.floor(Math.random()*startWordR.length)];\r\n };\r\n }\r\n\r\n if(beginLength == 2){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordIIR.length; i++){\r\n var matchCounter = 0;\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordIIR[i][0] == currentContext[j]){matchCounter++};\r\n if(startWordIIR[i][1] == currentContext[j]){matchCounter++};\r\n }\r\n for(var j = 0; j < matchCounter; j++){\r\n startTempList[startTempList.length] = startWordIIR[i];\r\n }\r\n }\r\n if(startTempList.length > 0){\r\n words = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n }else{\r\n words = startWordIIR[Math.floor(Math.random()*startWordIIR.length)];\r\n };\r\n }\r\n\r\n if(beginLength == 3){\r\n var startTempList = [];\r\n for(var i = 0; i < startWordIIIR.length; i++){\r\n var matchCounter = 0;\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(startWordIIIR[i][0] == currentContext[j]){matchCounter++};\r\n if(startWordIIIR[i][1] == currentContext[j]){matchCounter++};\r\n if(startWordIIIR[i][2] == currentContext[j]){matchCounter++};\r\n }\r\n for(var j = 0; j < matchCounter; j++){\r\n startTempList[startTempList.length] = startWordIIIR[i];\r\n };\r\n };\r\n if(startTempList.length > 0){\r\n words = startTempList[Math.floor(Math.random()*startTempList.length)];\r\n for(var i = 0; i < startWordIIIR.length; i++){\r\n if(startWordIIIR[i] == words){var number = i}\r\n }\r\n }else{\r\n var number = Math.floor(Math.random()*startWordIIIR.length);\r\n words = startWordIIIR[number];\r\n };\r\n\r\n\r\n lastWords = words;\r\n lastWordsNumber = 0;\r\n\r\n var loopCounter = 0;\r\n do{\r\n for(var j = 0; j <= seqR.length; j++){\r\n if(j < seqR.length){\r\n if(seqR[j][0][0] == lastWords[0] && seqR[j][0][1] == lastWords[1] && seqR[j][0][2] == lastWords[2]){\r\n lastWordsNumber = j\r\n foundResult = true;\r\n break;\r\n }\r\n }else{\r\n continueWordLoop = false;\r\n }\r\n }\r\n var tempList = [];\r\n for(var i = 1; i < seqR[lastWordsNumber].length; i++){\r\n for(var j = 0; j < currentContext.length; j++){\r\n if(currentContext[j] == seqR[lastWordsNumber][i]){\r\n tempList[tempList.length] = currentContext[j];\r\n }\r\n }\r\n }\r\n var nextWord = \"\";\r\n if(tempList.length > 0){\r\n nextWord = tempList[ Math.floor(Math.random()*tempList.length) ];\r\n }else{\r\n nextWord = seqR[lastWordsNumber][ Math.floor(Math.random()*(seqR[lastWordsNumber].length-1))+1 ];\r\n }\r\n if(nextWord != \"█| END |█\"){\r\n words[words.length] = nextWord;\r\n startWordIIIR[number] = [ startWordIIIR[number][0], startWordIIIR[number][1], startWordIIIR[number][2] ];\r\n lastWords = [ words[words.length-3], words[words.length-2], words[words.length-1] ];\r\n }else{\r\n continueWordLoop = false;\r\n }\r\n loopCounter++\r\n if(loopCounter > 1000){\r\n continueWordLoop = false;\r\n console.log(\"\\nWARNING\\nInfinite (or super long) loop!\\nTerminating sentence.\");\r\n }\r\n }while(continueWordLoop);\r\n }\r\n\r\n for(var i = 0; i < words.length; i++){\r\n sentence = sentence + \" \" + words[i];\r\n }\r\n returnSentence = sentence;\r\n //checking if sentence is not banned\r\n for(var i = 0; i < bannedSentences.length; i++){\r\n if(returnSentence == bannedSentences[i]){\r\n no = true;\r\n }\r\n }\r\n if(no){\r\n generateSentence(msgContent);\r\n }else{\r\n return returnSentence;\r\n }\r\n}", "sentenceSplits(text, chunkArray) {\n \tvar sentenceArray = text.split(\". \");\n \tfor (var i = sentenceArray.length - 2; i >= 0; i--) {\n \t\tsentenceArray[i] = sentenceArray[i] + \".\";\n \t}\n \treturn sentenceArray;\n }", "createPhrase( ) {\n for (let i = 0; i < 5; i++) {\n let randomPhrase = '';\n let adjective = '';\n let noun = '';\n let declaration = '';\n let verb = '';\n const words = { // excuse the absurdities; I got carried away. This is an object of arrays. \n adjective: ['rich', 'ugly', 'divorced', 'skilled','widowed', 'frisky', 'pregnant', 'infected', 'smart', 'scared', 'pretty', 'nice', 'evil', 'virgin', 'married', 'baptised', 'acquitted', 'drunk', 'christian'],\n noun: ['dogs', 'cats', 'husbands', 'women', 'athletes','housewives', 'zoomers', 'cosmonauts','immigrants','hipsters', 'lawyers', 'priests', 'artists', 'fish', 'zombies', 'veterans', 'inmates', 'hippies'],\n declaration: ['never', 'always', 'rarely', 'long to','often', 'cannot', 'refuse to', 'are willing to', 'love to', 'eagerly'],\n verb: ['cry', 'smile', 'snuggle','surrender', 'offend', 'lose', 'win','say thank you','settle','beg', 'spoon','die', 'nark', 'drive','eat', 'lie', 'sleep', 'fart', 'sweat', 'puke', 'help', 'talk', 'divorce', 'kill', 'have sex', 'remarry', 'pray', 'protest']\n } \n /**\n * generates a random index based on @param.length\n * @param {array} wordList - an object of arrays \n */\n const randomIndex = (wordList) => Math.floor( Math.random() * wordList.length );\n\n for (let prop in words) {\n const list = words[`${prop}`];\n const index = randomIndex(list);\n if (prop === 'adjective') adjective = words[`${prop}`][index];\n if (prop === 'noun') noun = words[`${prop}`][index];\n if (prop === 'declaration') declaration = words[`${prop}`][index];\n if (prop === 'verb') verb = words[`${prop}`][index];\n }\n randomPhrase = `${adjective} ${noun} ${declaration} ${verb}`; \n this.phrases.push(new Phrase(randomPhrase, noun, adjective, verb)); \n }\n }", "function addExcitement (theWordArray) {\n // Each time the for loop executes, you're going to add one more word to this string\n let buildMeUp = \"\"\n\n for (let i = 0; i < theWordArray.length; i++) {\n if ((i+1)%3===0) {\n buildMeUp += `${theWordArray[i]}!`\n } else {\n // Concatenate the new word onto buildMeUp\n buildMeUp += `${theWordArray[i] }` }\n console.log(buildMeUp)\n // Print buildMeUp to the console \n }\n}", "function pattern_3_answer() {\n return maybe(['Typical human!','Well, well, well...','Ooooh...']) + ' You will ' + choice(['never','definitely','soon']) +' '+\n choice(['become','be','feel']) + ' very ' + choice(['rich','walthy','poor']);\n}", "function pattern_1_greeting() {\n return choice([\"Hi\", \"Yo, man\", \"Yo, brotha from another Motha\", \"Well, hello there\"]) + ', ' \n + choice(['My name is Shorty', \"I'm Shorty\"]) + \"! I'm \" \n + choice([\"feelin'\", \"doin'\"]) + ' ' \n + choice([\"pimpin'\", 'amazeballz', \"gangsta as f*ck\"])\n + choice(['!', \", mah n*gga.\", ', mah sistah from another mistah.']) + ' '\n + choice(['Whazzaaaa', 'Whaddup', \"How you doin'\"]) + '?';\n}", "function buildText(options) {\n html += `<p class =\"text\">${options[0]}</p>`\n}", "function takeString(stg)\n{ \n return sentence.substring(0,3);\n}", "function madlib(text1, text2, text3, text4) {\n var mad = ('Once upon a time, a ' + text1 + ' and a ' + text2 + ' lived with a ' + text3 + ' and a ' + text4 + '');\n return mad;\n}", "function madLibPaulRevere (adjective1, adverb1, maleCeleb, nationality, noun1, noun2, noun3, noun4, noun5, place1, pluralNoun1, state, typeOfLiquid) {\n \n return `\n ${sentence1(state, adjective1, noun1)}. He was \n a soldier in the French and ${nationality} War\n and was at the famous Boston ${noun2} Party when\n Americans dressed as Indians dumped tons of \n ${ typeOfLiquid } into the ocean. \n On April 18, 1775, Paul Revere waited in \n ${place1} for a signal light from a church\n tower. The signal was to be one if by ${noun3},\n two if by ${noun4}. \n When he got the message, he mounted his faithful\n ${noun5} and rode off ${adverb1}. On the way, he\n kept yelling, \"The ${pluralNoun1} are coming! The\n ${pluralNoun1} are coming! This was the beginning\n of the American War for Independence from King ${maleCeleb}. \n `\n}", "function sayHelloAdv(first, last) {\r\n return sayHello(first +\" \" + last);\r\n}", "function improvedCombine(word1, word2, glue){\n console.log(word1 + word2 + word3)\n }", "function tripleTrouble(one, two, three){\n let string = '';\n for (let i=0; i<one.length; i++){\n string+=one[i]+two[i]+three[i];\n }\n return string;\n}", "export() {\n const wordToConll = (word, indexOverride = null) => {\n const stringifyList = object => {\n let pairs = []\n for (const key in object) {\n pairs.push(`${key}=${object[key]}`)\n }\n pairs.sort()\n let string = pairs.join(\"|\")\n return string ? string : \"_\"\n }\n let data = [].fill(\"_\", 0, 9)\n data[0] = indexOverride || word.index || \"_\"\n data[1] = word.inflection || \"_\"\n data[2] = word.lemma || \"_\"\n data[3] = word.uposTag || \"_\"\n data[4] = word.xposTag || \"_\"\n data[5] = stringifyList(word.features)\n data[6] = word.parent === 0 ? 0 : word.parent || \"_\"\n data[7] = this.settings.relations[word.relation] || \"_\"\n data[8] = word.dependencies || \"_\"\n data[9] = stringifyList(word.misc)\n let line = data.join(\"\\t\")\n //Add an extra line for each following empty node\n word.emptyNodes.forEach( (emptyNode, index) => {\n line = line + \"\\n\" + wordToConll(new Word(emptyNode), `${word.index}.${index+1}`)\n })\n return line\n }\n\n let lines = []\n this.sentences.forEach(sentence => {\n sentence.comments.forEach(comment => lines.push(comment))\n sentence.words.forEach(word => lines.push(wordToConll(word)))\n lines[lines.length-1] += \"\\n\" //sentence separator\n })\n\n return lines.join(\"\\n\")\n }", "function mathify(number1, number2,){\n\n var description = \"The following values were generated from \" + number1 + \" and \" + number2 + \".\";\n console.log(description)\n\n var add = number1 + number2;\n var addSentence = \" number 1 plus number 2 = \" + add;\n console.log(addSentence)\n\n var sub = number1 - number2;\n var subSentence = \" number 1 subtract number 2 = \" + sub;\n console.log(subSentence)\n\n var divide = number1 / number2;\n var divSentence = \" number 1 divided by number 2 = \" + divide;\n console.log(divSentence)\n\n var multiply = number1 * number2;\n var multiSentence = \" number 1 multiply by number 2 = \" + multiply;\n console.log(multiSentence)\n}", "function addExcitement(theWordArray, puncutation) {\n // Each time the for loop executes, you're going to add one more word to this string\n let buildMeUp = \"\";\n\n for (let i = 0; i < theWordArray.length; i++) {\n if ([i] % 3 === 0 && [i] != 0) {\n buildMeUp += \" \" + theWordArray[i] + puncutation;\n } else {\n buildMeUp += \" \" + theWordArray[i];\n }\n // Print buildMeUp to the console\n console.log(buildMeUp);\n }\n}" ]
[ "0.7262592", "0.71608746", "0.7085116", "0.6888762", "0.68186605", "0.6756931", "0.672306", "0.6660628", "0.66434205", "0.64102817", "0.63987917", "0.6297102", "0.6293899", "0.6198951", "0.61930394", "0.6184027", "0.6174484", "0.61708903", "0.6140403", "0.6123345", "0.60680854", "0.6043893", "0.6038222", "0.5977652", "0.59471303", "0.5932203", "0.5927869", "0.5923914", "0.5903057", "0.58940244", "0.5881709", "0.58473206", "0.5835161", "0.5818895", "0.58174247", "0.581289", "0.57872224", "0.5770902", "0.57451284", "0.5728843", "0.57235587", "0.5716337", "0.57122165", "0.5704551", "0.5682951", "0.56801176", "0.5675211", "0.567026", "0.56673825", "0.56525236", "0.56266063", "0.56234956", "0.5611921", "0.56096655", "0.560082", "0.5592921", "0.559197", "0.5590059", "0.55865", "0.5583708", "0.5576054", "0.5554513", "0.5541293", "0.5535496", "0.5513832", "0.551296", "0.55064565", "0.5498007", "0.549267", "0.54817027", "0.5480693", "0.5467682", "0.5459368", "0.54553914", "0.54545933", "0.543842", "0.5430783", "0.54236776", "0.5421494", "0.54170436", "0.5412349", "0.540957", "0.5409048", "0.54020184", "0.53910667", "0.5375907", "0.5373752", "0.53714615", "0.5367758", "0.5366623", "0.53659326", "0.53583425", "0.53567106", "0.5355813", "0.53545624", "0.53543866", "0.5345972", "0.53401166", "0.5331426", "0.53237617", "0.5318054" ]
0.0
-1
Empty to hold prototypical stuff.
function Runner() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function empty () {}", "function empty () {}", "function empty () {}", "function Empty(){}", "function Empty(){}", "function Empty(){}", "function Empty(){}", "function Empty(){}", "function Proto() {\n\n // empty functions\n}", "function Noop() {}", "function Noop() {}", "function Noop() {}", "static clear() {\n CallbackConstructorRegistry.constructors = {};\n }", "emptyMethod() {}", "function jv_EmptyInterface() {}", "function emptyFunction(){}", "function emptyFunction(){}", "function emptyFunction(){}", "function emptyFunction(){}", "function emptyFunction(){}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function empty() {}", "function Empty() {\n}", "static get EMPTY()\n\t{\n\t\treturn 0;\n\t}", "function empty() {\n }", "function empty() {\n\treturn Object.create(null);\n}", "static noop() {\n // Nothing.\n }", "function Object$empty() {\n return {};\n }", "function Object$empty() {\n return {};\n }", "function noop() {\n }", "function emptyFunction() { // 306\n // dummy // 307\n } // 308", "function noop () { }", "function noop () { }", "function noop () { }", "function noop () { }", "function noop() {\r\n }", "static noop() {\n // Do nothing.\n }", "function theBigBang() {\n\t\tinitLibs();\n\t\tinitFuncs();\n\t\tObject.setPrototypeOf(Universe.prototype, universe.kjsclasses._primitive_prototype);\n\t\tObject.setPrototypeOf(Object.prototype, universe); // [0]\n\t}", "__init2() {this.noAnonFunctionType = false}", "function emptyFunction() {}", "function emptyFunction() {}", "function emptyFunction() {}", "function emptyFunction() {}", "function emptyFunction() {}", "function emptyFunction() {}", "function emptyFunction() {}" ]
[ "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.66090727", "0.66090727", "0.66090727", "0.6468324", "0.6468324", "0.6468324", "0.6468324", "0.6468324", "0.6363211", "0.6337503", "0.6337503", "0.6337503", "0.63207066", "0.6318698", "0.6310472", "0.6283363", "0.6283363", "0.6283363", "0.6283363", "0.6283363", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.6256418", "0.61748797", "0.6169315", "0.61586946", "0.61506873", "0.61362416", "0.6132614", "0.6132614", "0.6084661", "0.6079868", "0.606532", "0.606532", "0.606532", "0.606532", "0.6039486", "0.6030718", "0.6024751", "0.6013564", "0.5976591", "0.5976591", "0.5976591", "0.5976591", "0.5976591", "0.5976591", "0.5976591" ]
0.0
-1
AppDefaulState: This function will update state in every page.
appDefaultState(userLogged) { this.setState({ user: userLogged }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setApplicationState( state ){\n console.log(\"Setting APPLICATION STATE to: \" + state );\n switch ( state ){\n \n case ApplicationState.LOGGED_IN:\n currentApplicationState = ApplicationState.LOGGED_IN;\n $(\"#signinLink\").css(\"display\", \"none\");\n \t$(\"#registerLink\").css(\"display\", \"none\");\n \t$(\"#usernameLink\").css(\"display\", \"inline\");\n \t$(\"#logoutLink\").css(\"display\", \"inline\");\n \tsetDrawerState( DrawerState.CLOSED );\n break;\n \n case ApplicationState.LOGGED_OUT:\n currentApplicationState = ApplicationState.LOGGED_OUT;\n $(\"#signinLink\").css(\"display\", \"inline\");\n \t$(\"#registerLink\").css(\"display\", \"inline\");\n \t$(\"#usernameLink\").css(\"display\", \"none\");\n \t$(\"#logoutLink\").css(\"display\", \"none\");\n \t//TweenMax.to( $(\"body\"), 1, { scrollTop:1 , ease:TARGET_EASE, overwrite:2 } );\n \tsetDrawerState( DrawerState.CLOSED );\n break;\n \n default:\n console.log(\"APPLICATION STATE: \" + state + \" is invalid\");\n break;\n }\n \n}", "function advState() {\n $(\"body\").empty();\n state++;\n pages();\n}", "updateAppState(appState){\n this.appState = appState\n }", "_setApplicationState() {\n const update = {\n applications: this.makeApplicationState()\n };\n this.setState(update);\n }", "function updateState() {\n\n\t\teditHistory.pushState();\n\t\tupdatePageBackground();\n\t}", "function AppState() {\n this.isLoggedOn = false;\n this.Account = undefined;\n this.VkAccessToken = undefined;\n this.VkExpire = undefined;\n }", "_handleAppStateChange(currentAppState) {\n this._appState = currentAppState;\n this._checkInitialURL();\n }", "onStateChange() {\n\t\t// brute force update entire UI on store change to keep demo app simple\n\t\tthis.forceUpdate();\n\t}", "getAppState() {\n return window.appState;\n }", "function createAppNavigationState() {\n return {\n tabs: {\n index: 0,\n routes: [\n { key: \"learn\" },\n { key: \"beans\" },\n { key: \"record\" },\n { key: \"list\" },\n { key: \"profile\" }\n ]\n },\n learn: {\n index: 0,\n routes: [{ key: \"Learn Home\", title: \"Roast Buddy\" }]\n },\n record: {\n index: 0,\n routes: [{ key: \"Record Home\", title: \"Record\" }]\n },\n list: {\n index: 0,\n routes: [{ key: \"List Home\" }]\n },\n profile: {\n index: 0,\n routes: [{ key: \"Profile Home\" }]\n },\n beans: {\n index: 0,\n routes: [{ key: \"Bean Home\", title: \"Beans\" }]\n }\n };\n}", "function WelcomeState() {\n\n}", "function updatePage() {\n switch (currentState)\n {\n case pageStates.DEFAULT:\n displayDefault();\n break;\n case pageStates.UNITY:\n displayUnity();\n break;\n case pageStates.CUSTOM:\n displayCustom();\n break;\n case pageStates.WEB:\n displayWeb();\n break;\n default:\n displayDefault();\n break;\n }\n}", "setState(object: AppState) {\n super.setState(object);\n }", "function updateState(){\r\n // If we already have hash on URL it won't trigger hash change\r\n // So I force a hash change\r\n if ( firstLoad && hash || isReload){\r\n window.location.hash = '#';\r\n } \r\n\r\n window.location.hash = '#' + presentSlideNumber;\r\n updateCurrentSlide();\r\n }", "function resetState() {\n state = 1\n changePage()\n}", "function homePageMarkupUpdate() {\n refs.header.classList.remove('header__background-myLibrary');\n refs.header.classList.add('header__background-home');\n refs.mylibraryBtn.classList.remove('current');\n refs.homeBtn.classList.add('current');\n}", "function safeRefreshNotifyState(state)\n {\n // Only update mainpage if there is no owner or we are the owner.\n if(mainpage.dataset.owner === PANEOWNER.NONE || mainpage.dataset.owner === PANEOWNER.ATHENS) {\n if (state === 0) {\n mainpage.dataset.state = \"none\";\n }\n else {\n if (!mainpage.dataset.state || mainpage.dataset.state === \"none\") {\n mainpage.dataset.state = \"notify\";\n }\n } \n requestParentSizeChange();\n }\n }", "function storeAppState() {\n\tapp_state['global_vars'] = global_vars;\n\tsetItemInLocalStorage(\"dx_app_state\",btoa(JSON.stringify(app_state)));\n}", "function respondToState(){\n\t\t_oldUrl = _currentUrl;\n\t\tif(_useAPI) _currentUrl = cleanUrl(window.location.pathname || \"\");\n\t\telse _currentUrl = cleanUrl(window.location.hash || \"\");\n\t\t//Remove slash in beginning\n\t\tif(_currentUrl == \"/\") _currentUrl = \"\";\n\t\telse if(_currentUrl.indexOf(\"/\") == 0) _currentUrl = _currentUrl.substr(1);\n\t\t//Add slash in end\n\t\tif(_currentUrl.substr(_currentUrl.length-1) != \"/\") _currentUrl = _currentUrl+\"/\";\n\t\tif(_allowCookies || _firstTime) track(); //Track first page. After that only when cookies have been accepted.\n\t\tsetCanonical();\n\t\treadParameters();\n\t\tif(!_firstTime && _oldUrl == _currentUrl){\n\t\t\t//console.log(\"Same url firing statechange\", _oldUrl);\n\t\t\twindow.dispatchEvent(GLBCustomEvent(\"subPageChange\", 0));\n\t\t\treturn;\n\t\t}\n\t\t_firstTime = false;\n\t\tsetTitle();\n\t\t//Pages listening can animIn/Out\n\t\twindow.dispatchEvent(GLBCustomEvent(\"pageChange\", 0));\n\t}", "pushInitialState () {\r\n this.subnav[ 0 ].classList.add(\"active\");\r\n this.indexPages[ 0 ].classList.add(\"active\");\r\n history.pushState({ selector: \"#flight-ops-home\", index: 0 }, null, location.pathname + location.search);\r\n }", "reset() {\r\n this._state = this._config.initial;\r\n this._history.push(this._state);\r\n }", "home(){\n this.setState({\n listorslideshow:false,\n loginform:false,\n actor:false,\n slideshow:true,\n sort_toggle:{\n visibility:'hidden'\n }\n })\n }", "function updateStateMaps() {\n // XXX\n }", "function setPageStateOnPageLoad(e) {\n var title = getParams().title;\n\n if (title === undefined) {\n title = \"Set Title\";\n }\n setPageTitle(title);\n // Set the state for this initial page, so we can set the title back\n // later (in window.popstate event) if the user uses the \"back\" button\n // to come back to this page.\n // Note that we use replaceState, because when the user goes to this\n // page with title \"ABC\", pressing the \"back\" button should not stay\n // at this page (this \"Set Title\" web app). He/she should go back to\n // whatever page he/she was browsing.\n window.history.replaceState(\n {title: title}, // the state is used for window.popstate\n // event\n title\n /* we don't pass a new url here */\n );\n}", "goHome() {\n\t\t__WEBPACK_IMPORTED_MODULE_7__stores_storeActions__[\"a\" /* default */].clearTags();\n\t\t__WEBPACK_IMPORTED_MODULE_7__stores_storeActions__[\"a\" /* default */].clearFilteredApps();\n\t\t__WEBPACK_IMPORTED_MODULE_7__stores_storeActions__[\"a\" /* default */].clearApp();\n\t\tthis.setState({\n\t\t\tactiveApp: null,\n\t\t\tforceSearch: false\n\t\t});\n\t}", "stateChangeSuccess(toState) {\n if (angular.isDefined(toState.data)) {\n if (angular.isDefined(toState.data.pageTitle)) {\n document.title = `Weather APP | ${toState.data.pageTitle}`;\n }\n }\n\n document.body.scrollTop = document.documentElement.scrollTop = 0;\n }", "function initialisePage(){\n\t\t\tcurrent_tab = \"about\";\n\t\t\tgenerateNav(register_navevents);\n\t\t\tgenerateFramework(current_tab, generatePage);\n\t\t\t// Enable button again\n\t\t\tbuttonOff();\n\t\t}", "function _onEveryPage() {\n _updateConfig();\n\t_defineCookieDomain();\n\t_defineAgencyCDsValues();\n}", "loadInitailState() {\n return {};\n }", "function initApp(apiUrl) {\n //localStorage.clear();\n localStorage.setItem(\"api\", apiUrl);\n localStorage.setItem(\"currPost\", 0);\n // Initialises the page.\n genNavBar();\n genSearch(\"generate\");\n genLogin(\"generate\");\n genSignup(\"generate\");\n genProfile(\"generate\");\n genModDelPost(\"generate\");\n genFeed(\"generate\");\n genPages(\"generate\");\n genUpvotes(\"generate\");\n genComments(\"generate\");\n genPost(\"generate\");\n eventListen();\n scroll();\n}", "updateStateHash() {\n\t\t// todo hash influenced by screen/page instance / active screen (unique every time it is active)\n\t\tthis._stateHash = utils.stringHash(\"ScreenMetadataObject\" + this.state.ui.activeMenuItem);\n\t}", "switchPage() {\n this.setState({homePage: false, showLoadingGifMap: true}); // hack fix\n }", "static initializeState() {\n // Set the default values for the script's state.\n _.defaults(state, {\n CheckItOut: {}\n });\n _.defaults(state.CheckItOut, {\n graphics: {},\n themeName: 'default',\n userOptions: {}\n });\n\n // Add useroptions to the state.\n let userOptions = globalconfig && globalconfig.checkitout;\n if (userOptions)\n _.extend(state.CheckItOut.userOptions, userOptions);\n\n // Set default values for the unspecificed useroptions.\n _.defaults(state.CheckItOut.userOptions, {\n defaultDescription: DEFAULT_DESCRIPTION\n });\n }", "function updateState() {\n\t\tif (property !== 'hidden') {\n\t\t\tdocument.hidden = $support.pageVisibility ? document[property] : undefined;\n\t\t}\n\t}", "function loadApp() {\n console.log(\"loadApp\");\n displayHomePage();\n}", "function stateCalled(e){\r\n hideSharePopUp();\r\n\r\n // update current slide number with history state slide number value\r\n presentSlideNumber = setSlideNumberFromURL();\r\n\r\n // using scene go slide since we update state in our go method\r\n window.scene.goSlide( presentSlideNumber );\r\n\r\n updateState();\r\n updateGUI();\r\n }", "reset() {\r\n this.currentState = this.config.initial;\r\n this.history.push(this.currentState);\r\n }", "home() {\n this.setState({componentState: \"home\"});\n }", "function App() {\n _classCallCheck(this, App);\n\n //**********CREATE STATE**********/\n var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this));\n\n _this.state = {\n // name: 'Joe',\n listingsData: _listingsData2.default,\n city: 'All',\n house_type: 'All',\n bedrooms: '0',\n min_price: '0',\n max_price: '1000000',\n min_space: '0',\n max_space: '8000',\n elevator: false,\n storage: false,\n jacuzzi_tub: false,\n separate_shower: false,\n fireplace: false,\n swimming_pool: false,\n filteredData: _listingsData2.default,\n populateFormsData: '',\n sort: 'price-descending',\n view: 'grid',\n search: '',\n bgColor: ''\n };\n\n _this.change = _this.change.bind(_this);\n _this.filteredData = _this.filteredData.bind(_this);\n _this.populateFormsData = _this.populateFormsData.bind(_this);\n _this.changeView = _this.changeView.bind(_this);\n return _this;\n }", "function PageState_init()\r\n{\r\n\tif (PageState_initialized)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\tif (typeof PageState_serverid != \"undefined\")\r\n\t\tPageState_initializeServerId();\r\n\t\r\n\tsetTimeout(PageState_sendkeepalive, 1);\r\n\r\n\tPageState_initialized = true;\r\n}", "prepareState() {\n /* ... */\n }", "resetPage() {\n this._showApplicationComponentsPage();\n }", "function App() {\n // this.state = { homeShow: true };\n\n\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n\n <MainHome />\n\n\n <h2 className=\"headerFooter\">Sarah Lois Thompson\n </h2>\n\n </header>\n </div>\n );\n}", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function updateValuesAndStates() {\n [values, states] = generateDefaultStateArray(getItemCount());\n}", "function reDrawHomePage(el, state) {\n hideZoomImage();\n\n collapseSidebar();\n\n // Reset the background map\n d3.select('#background-image')\n .transition()\n .duration(300)\n .attr('width', sizes.screenWidth)\n .attr('height', sizes.screenHeight)\n .attr('x', 0)\n .attr('y', 0);\n\n $('.then-now').remove();\n\n // Remove home button\n $('div.home-button').remove();\n\n drawPlaces(\n el,\n mapProjection(state.settings),\n state.places,\n state.images,\n );\n}", "function setPageTo(pageName, doNotPushState = false) {\n let pages = $(\".pages\");\n let delay = 100, fadePromises = [];\n let activeIndex = -1;\n for(let p in self.models.pages){\n self.models.pages[p].isActive = p === pageName;\n\n if(p === pageName){\n activeIndex = Object.keys(self.models.pages).indexOf(p);\n }\n \n // toggle page sections based on isActive\n let pageSection = pages.find(self.models.pages[p].el);\n fadePromises.push(new Promise((fulfill,reject) => {\n pageSection.fadeOut(delay, () => fulfill());\n }));\n }\n\n if(activeIndex === -1){\n pageName = \"Error\";\n activeIndex = Object.keys(self.models.pages).indexOf(pageName); //default to error page on invalid tab\n }\n\n self.log(\"activeIndex\", activeIndex);\n self.tabBars.forEach(tabBar => tabBar.activeTabIndex = activeIndex);\n \n if(!doNotPushState){\n window.history.pushState('pagechange', `JCCC - ${pageName}`, `./?link=${pageName}`); // from https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page\n }\n\n $('title').text(`JCCC - ${pageName}`);\n\n return Promise.all(fadePromises)\n .then(() => {\n return new Promise((fulfill,reject) => {\n if(self.models.pages[pageName]){\n pages.find(self.models.pages[pageName].el)\n .animate({ scrollTop: 0 }, 0)\n .fadeIn(delay, () => fulfill());\n }else{\n fulfill(); //don't do anything --> may change to showing error page?\n }\n });\n }).then(() => self.log(\"Set page to\",pageName));\n }", "changePage (newPage) {\n let toUpdate = {};\n for(let key in this.state.page){\n toUpdate[key] = false;\n }\n toUpdate[newPage] = true;\n this.setState({page: toUpdate })\n }", "function defaultActiveStateChangeHandler(state) {\n ActiveStore.updateState(state);\n}", "reset() {\r\n this.activeState = this.config.initial;\r\n }", "function onInit() {\n siteOrigin = sessionStorage.getItem('origin')\n ctrl.isSplashShowed.value = true;\n\n lodash.defaults(ctrl, { createFunctionWhenEmpty: true });\n\n initFunctions();\n initPagination();\n\n // initializes function actions array\n ctrl.functionActions = angular.copy(FunctionsService.initFunctionActions());\n\n // initializes version actions array\n ctrl.versionActions = angular.copy(FunctionsService.initVersionActions());\n\n $scope.$on('action-checkbox-all_check-all', onCheckAll);\n $scope.$on('action-checkbox-all_checked-items-count-change', onItemsCountChange);\n $scope.$on('action-checkbox_item-checked', onItemChecked);\n $scope.$on('action-panel_fire-action', onFireAction);\n\n $transitions.onStart({}, stateChangeStart);\n $transitions.onError({}, stateChangeError);\n\n updatePanelActions();\n\n $timeout(function () {\n // update breadcrumbs\n var title = {\n project: ctrl.project,\n tab: $i18next.t('common:FUNCTIONS', { lng: lng })\n };\n\n NuclioHeaderService.updateMainHeader('common:PROJECTS', title, $state.current.name);\n });\n }", "update(state) {\n\n const old_state = this._state;\n if (!('page' in old_state)) {\n old_state.page = window.location.pathname.replace(/\\//g, '') || null;\n }\n this._state = Object.assign({}, old_state, state);\n\n // serialize state to url, forcing page change as needed\n const url_search_params = new URLSearchParams(window.location.search);\n for (const k of Object.keys(url_param_names)) {\n if (k in this._state) {\n if (typeof this._state[k] === \"undefined\" || this._state[k] === null) {\n url_search_params.delete(k)\n } else {\n url_search_params.set(url_param_names[k], this._state[k])\n }\n }\n }\n\n const url = new URL(window.location);\n url.search = '?' + url_search_params.toString();\n if (old_state['page'] !== this._state['page'] || old_state['area_id'] !== this._state['area_id']) {\n if (!!state['page']) {\n url.pathname = '/' + state['page'] + '/';\n } else {\n url.pathname = '/'\n }\n window.location.href = url;\n } else {\n window.history.replaceState(null, document.title, url.toString())\n }\n }", "function appDefaultView(){\n\t//clears everything on the page\n\t\n\tclearSection();\n\t\n\tvar local_simulation = get_local_simulation();\n\t//sets the top bar to be the default look\n\tdefaultheaderView();\n\tif(getVerified() == false){\n\t\talert('You do not have permission to access this. Please get a token first.');\n\t}else{\n\t\t//sets the page to view to 'user information' page\n\t\tvar apps = DeviceAppsListTemplate(local_simulation.apps);\n\t\tvar content = getContainer();\n\t\tif(local_simulation.apps==''||local_simulation.apps==null){\n\t\t\tapps += \"No applications are registed to this simulation.\";\n\t\t}\n\t\tcontent.innerHTML = apps;\n\t\t//sets the sidebar to the sidebar for when inside a simulation\n\t\tsimulationSideBarView();\n\t\tremoveClass('active');\n\t\tdocument.getElementById('my-apps-link').className='active';\n\t}\n}", "function getAppState() {\n return {\n users: AppStore.getUsers(),\n roles: AppStore.getRoles(),\n userToEdit: AppStore.getUserToEdit()\n }\n}// === end of function to get the state === //", "function pageReset(){\n setPage({\n currPage:1,\n pageLoaded:[1]\n })\n }", "async getPage(url = 'api/posts'){\n const res = await api.get(url)\n AppState.posts = res.data.posts\n AppState.propost = res.data\n AppState.newer = res.data.newer\n AppState.older = res.data.older\n // AppState.posts = res.data.posts\n \n // AppState.page++\n \n \n}", "resetGlobalState() {\n globalState = {\n ...globalInitialValue,\n };\n }", "function setState(value) {\n state = value;\n appView.filterAll();\n }", "function initializer ($rootScope, $anchorScroll, $state, $window, $http, $templateCache, $location, httpInterceptor, esAnalyticsHelper) {\n\n var _watchStateChanges = function () {\n // carry over all query string params from state to state\n $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {\n var searchObj = $location.search();\n\n // if toParams query param doesn't match the searchObj,\n // that means it has been updated within the app\n for (var prop in searchObj) {\n if (searchObj[prop] !== toParams[prop] && toParams[prop] != undefined) {\n searchObj[prop] = toParams[prop];\n }\n }\n\n // pass any extra query params in url to state params\n angular.extend(toParams, searchObj);\n\n });\n\n $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {\n $anchorScroll();\n\n // Google Analytics\n esAnalyticsHelper.firePageview(toState.name);\n\n });\n }\n\n return {\n watchStateChanges: _watchStateChanges\n }\n }", "renderPage(page){\n this.setState({\n atHome: false,\n pageToNavigate: page \n });\n }", "function reset() {\n $(\"body\").empty();\n state = 0;\n pages();\n}", "_onChangeState() {\n\n\n }", "function state (url, no_push) {\n $('#main').load(url+(url.indexOf('?')>0?'&':'?')+'_main');\n load_page_data(url);\n if (no_push !== 'no push') {\n history.pushState({}, undefined, url);\n }\n}", "function reset_app() {\n store.set('is_registered_x', 0);\n}", "render() {\n if(this.state.page === 'home') {\n return (\n <div className = \"App\">\n <Home />\n <a href className = \"Bt\" onClick={this.switchPage}>\n </a>\n </div>\n );\n } else if (this.state.page == 'daily'){\n return (\n <div className = \"App\">\n <Daily />\n <a href className = \"Bt\" onClick={this.switchPage}>\n </a>\n </div>\n );\n } else if (this.state.page == 'questions') {\n return (\n <div className = \"App\">\n <Questions handleDayChange={(deadline) => this.handleAppDeadline(deadline)} \n handleTime={(time) => this.handleAppTime(time)}\n handleTotal={(total) => this.handleAppTotal(total)}\n handleAsn={(title) => this.handleAppTitle(title)}/>\n <Button type=\"submit\" onClick={this.switchPage}>Submit</Button>\n </div>\n );\n } else if (this.state.page == 'api') {\n return(\n <div className = \"App\">\n <API />\n </div>\n );\n }\n }", "handler() {\n this.setState({ viewPage: \"Dash\" });\n }", "function onPreappinit() {\n kony.print(\"LOG : onPreappinit - START\");\n gAppData = new initAppData();\n}", "function stateChangeStart(event, toState) { // eslint-disable-line angular/on-watch\n // Set page title\n $rootScope.pageTitle = (toState.data && toState.data.pageTitle) ? toState.data.pageTitle : 'Jack Forbes';\n }", "function getAppState() {\n\t //console.log(\"A CHANGE IN USER OR POST STORE\");\n\t return {\n\t allPosts: PostStore.getAll(),\n\t currentUser: UserStore.getCurrentUser(),\n\t isLoggedIn: UserStore.isSignedIn(),\n\t isAdmin: UserStore.isAdmin(),\n\t currentSongList: PostStore.getSortedPosts(),\n\t currentSong: PostStore.getCurrentSong()\n\t };\n\t}", "function homePage() {\n window.location.href = initApi.homeUrl;\n //location.reload();\n }", "stateChanged(state) {\n let subpageObj = state.app.page.subpage;\n this._subpage = subpageObj ? subpageObj.name : \"\";\n this._authenticated = state.admin.authStatus;\n this._authRes = state.admin.actionResults.auth;\n }", "function init() {\n injectModifiedPushState();\n }", "generateInitialState(dashboardConfig) {\n let initialState = {};\n initialState.widget = {};\n dashboardConfig.widgets.forEach(widgetConfig => {\n initialState.widget[widgetConfig.id] = {\n sizeInfo: {}\n };\n });\n logger.info(\"Initial application state initialized to \", initialState);\n return initialState;\n }", "changeState(state) {\r\n if(this.config.states[state] === undefined){\r\n throw new Error('State is undefined by config. So, Fuck Off!');\r\n }\r\n this.prevState=this.currentState;\r\n this.currentState = state;\r\n }", "function run($rootScope, $state) {\n $rootScope.states = {};\n function updateStates() {\n // Creates a flat object for each state name and whether it is currently\n // active, based on $state.includes\n angular.forEach($state.get(), function (state) {\n $rootScope.states[state.name] = $state.includes(state.name)\n });\n }\n updateStates();\n $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {\n updateStates();\n })\n }", "onRender () {\n let Navigation = new NavigationView();\n App.navigationRegion.show(Navigation);\n Navigation.setItemAsActive(\"home\");\n }", "appScreensNavi() {\n this.setState({\n showAppScreens: true\n })\n }", "home(){\n this.setState({\n listorslideshow:false,\n userlist:false,\n actor:false,\n slideshow:true,\n sort_toggle:{\n visibility:'hidden'\n },\n keyword:''\n })\n }", "setWindowState(state) {\n this.windowState = state;\n switch (state) {\n case 0:\n $(\"#user-input\").show();\n $(\"#details\").hide();\n $(\"#graphic\").hide();\n $(\".footer-row\").show();\n $(\"#user-input\").empty();\n $(\".nav-item[data-action='back-to-input']\").hide();\n var content = this.input.generateDetailsLabel();\n $(\"#user-input\").append(content.html);\n this.input.addListeners(content.id);\n if (this.input.isValid().value) {\n $(\"#send-input\").removeClass(\"disabled\");\n $(\"#ext-solution\").css(\"display\", \"inline-block\");\n } else {\n $(\"#send-input\").addClass(\"disabled\");\n $(\"#ext-solution\").css(\"display\", \"none\");\n }\n $(\"#solution-comparison\").hide();\n $(\".nav-item[data-action='leave']\").hide();\n break;\n case 1:\n $(\".nav-item[data-action='back-to-input']\").show();\n $(\"#user-input\").hide();\n $(\"#details\").show();\n $(\"#graphic\").show();\n $(\".footer-row\").hide();\n $(\"#solution-comparison\").hide();\n $(\".nav-item[data-action='leave']\").hide();\n break;\n case 2:\n $(\".nav-item[data-action='back-to-input']\").hide();\n $(\"#user-input\").hide();\n $(\"#details\").hide();\n $(\"#graphic\").hide();\n $(\".footer-row\").hide();\n $(\"#solution-comparison\").show();\n $(\".nav-item[data-action='leave']\").show();\n this.fillSolutionComparison();\n break;\n }\n }", "function initPageManagement () {\n\n\t\tPAGE('*', function load(ctx) {\n\t\t\ttry {\n\n\t\t\t\tvar pathname = ctx.pathname;\n\t//debugger;\n\t//console.log(\"ON PAGE CHANGE ctx\", ctx);\n\n\t\t\t\t// IE Fix\n\t\t\t\tif (\n\t\t\t\t\tpathname !== PATHNAME &&\n\t\t\t\t\tpathname.indexOf(\"#\") === -1\n\t\t\t\t) {\n\t\t\t\t\tpathname = PATHNAME + \"#\" + pathname.substring(1);\n\t\t\t\t}\n\n//console.log(\"pathname1: \" + pathname);\n\n\t\t\t\tvar view = pathname.replace(PATHNAME, \"\").replace(/^#/, \"\");\n\n//console.log(\"view: \" + view);\n//console.log(\"pathname2: \" + pathname);\n\t\t\t\tif (\n\t\t\t\t\t/^\\//.test(view) &&\n\t\t\t\t\tappContext.get('lockedView') &&\n\t\t\t\t\tview !== appContext.get('lockedView') &&\n\t\t\t\t\tappContext.get('lockedView').split(\",\").indexOf(view) === -1\n\t\t\t\t) {\n\t//console.log(\"REDIRECT TO\", window.location.origin + view);\n\t\t\t\t\t// We are selecting a new view and updating the URL using a REDIRECT which\n\t\t\t\t\t// loads the new page from the server.\n\n\t\t\t\t\t// NOTE: This will not work if only the Hash changes.\n\t\t\t\t\t// In those cases you need to redirect to a new URL.\n\t\t\t\t\twindow.location.href = appContext.get(\"windowOrigin\") + view;\n\t\t\t\t} else {\n//console.log(\"SET VIEW\", view);\n\n\t\t\t\t\t// We are selecting a new view and updating the URL using PUSH-STATE\n\t\t\t\t\t// without reloading the page.\n\n\t\t\t\t\tappContext.set('selectedView', view);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(\"page changed error:\", err.stack);\n\t\t\t}\n\t\t});\n\t\tPAGE({\n\t\t\tpopstate: false,\n\t\t\tclick: false\n\t\t});\n\n/*\nappContext.get(\"data\").collection(\"page\").add({\n\t\"id\": \"loaded\",\n\t\"selectedDay\": MOMENT().format(\"YYYY-MM-DD\"),\n\t\"selectedEvent\": context.dbfilter.event_id\n});\n*/\n\n\t\tappContext.on(\"change:selectedDayId\", function () {\n\nconsole.info(\"CHANEGD SELECETD DAY!\", appContext.get(\"selectedDayId\"));\n\n\t\t\tappContext.get(\"data\").collection(\"page\").get(\"loaded\").set(\n\t\t\t\t\"selectedDay\",\n\t\t\t\tappContext.get(\"selectedDayId\")\n\t\t\t);\n\t\t});\n\n\n\t\tappContext.on(\"change:selectedView\", function () {\n\n\t\t\ttry {\n\n\t//console.log(\"ON VIEW CHANGE appContext.selectedView\", appContext.selectedView);\n\t//console.log(\"ON VIEW CHANGE appContext.lockedView\", appContext.lockedView);\n\n\t\t\t\tif (\n\t\t\t\t\tappContext.get('lockedView') &&\n\t\t\t\t\tappContext.get('selectedView') !== appContext.get('lockedView') &&\n\t\t\t\t\tappContext.get('lockedView').split(\",\").indexOf(appContext.get('selectedView')) === -1\n\t\t\t\t) {\n\t//console.log(\"REDIRECT TO\", window.location.origin + PATHNAME + \"#\" + appContext.selectedView);\n\t\t\t\t\t// We are selecting a new view and updating the URL using a REDIRECT which\n\t\t\t\t\t// loads the new page from the server.\n\n\t\t\t\t\t// NOTE: This will not work if only the Hash changes.\n\t\t\t\t\t// In those cases you need to redirect to a new URL.\n\t\t\t\t\twindow.location.href = appContext.get(\"windowOrigin\") + PATHNAME + \"#\" + appContext.get('selectedView');\n\t\t\t\t} else {\n\n\t//console.log(\"SET PAGE1\", PATHNAME + \"#\" + appContext.selectedView);\n\n\t\t\t\t\t// We are selecting a new view and updating the URL using PUSH-STATE\n\t\t\t\t\t// without reloading the page.\n\n\t\t\t\t\tif (handleSelectedViewInit()) return;\n\t//console.log(\"SET PAGE2\", PATHNAME + \"#\" + appContext.selectedView);\n\n\t\t\t\t\tPAGE.redirect(PATHNAME + \"#\" + appContext.get('selectedView'));\n\n\t//\t\t\t\tPAGE(PATHNAME + \"#\" + appContext.selectedView);\n\t//console.log(\"SET PAGE DONE\", PATHNAME + \"#\" + appContext.selectedView);\n\n\t\t\t\t\twindow.scrollTo(0, 0);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(\"selectedView change error:\", err.stack);\n\t\t\t}\n\t\t});\n/*\n\t\tappContext.on(\"change:selectedDay\", function () {\n\t\t\tif (appContext.get('selectedView') != \"Landing\") {\n\t\t\t\tappContext.set('selectedView', \"Landing\");\n\t\t\t}\n\t\t});\n*/\n\t}", "function activate() {\n\t\t\tappState.pageTitle = \"About\";\n\t\t}", "function InitApplication() {\n ProcessCtrl.ePage.Masters.Application = {};\n ProcessCtrl.ePage.Masters.Application.OnApplicationChange = OnApplicationChange;\n }", "reset() {\r\n this.currentState = this.config.initial;\r\n }", "setFirstLoad(state, val = true){\n state.firstLoad = false;\n }", "function resetApplicationState() {\r\n Canvas.clearCanvas();\r\n Animation.reset();\r\n animating = false;\r\n\r\n AlgoSelect.deselectAlgButtons();\r\n AlgoSelect.loadAlgoInfo('default');\r\n\r\n // save to undo history\r\n saveCurrentState()\r\n}", "function updateAppStatus(app){\n if (app.running){\n if (app.state == \"STOPPED\"){\n app.state = \"MONITORING\";\n app.status = \"RUNNING\";\n }\n else if (app.state == \"STOPPING\"){\n app.status = \"STOPPING\";\n }\n else if (app.state == \"STARTING\"){\n app.state = \"MONITORING\";\n app.status = \"RUNNING\";\n }\n else {\n app.state = \"RUNNING\";\n app.status = \"RUNNING\";\n }\n }\n else { //!app.running\n if (app.state == \"STARTING\"){\n app.status = \"STARTING\";\n }\n else if (app.state == \"MONITORING\" && app.restart == \"true\"){\n startApp(app);\n }\n else {\n app.state = \"STOPPED\";\n app.status = \"STOPPED\";\n }\n }\n updateAppLabelStatus(app);\n}", "function getAppState() {\n return {\n searchGridState: ApiStore.getData(),\n didFirstSearch: ApiStore.didFirstSearch(),\n states: ApiStore.getStates(),\n orgTypes: ApiStore.getOrgTypes(),\n cities: ApiStore.getCities(),\n counties: ApiStore.getCounties(),\n };\n}", "offlineFunc()\n {\n this.setState({offlineFlag:false});\n this.setState({backend_Down_Popup:false});\n this.props.setNav('Home');\n }", "constructor() {\n super();\n this.state = {\n displayHomepage: true,\n displayResults: false,\n loading: false,\n };\n }", "_onChange(){\n\t\tlog(\"Home Component received change event from App store\", DEBUG);\n\n this.state.events = AppStore._getEvents();\n this.setState(this.state);\n //log(\"Updated this.state.events: \" + JSON.stringify(this.state.events['future_events']),DEBUG);\n }", "function AppPage() {\n Page.apply(this, arguments);\n }", "constructor() {\n super();\n this.state = {\n display: \"landing\"\n };\n }", "function State() {\n\n }", "_setInitialState() {\n const urlPath = `${WINDOW$1.location.pathname}${WINDOW$1.location.hash}${WINDOW$1.location.search}`;\n const url = `${WINDOW$1.location.origin}${urlPath}`;\n\n this.performanceEvents = [];\n\n // Reset _context as well\n this._clearContext();\n\n this._context.initialUrl = url;\n this._context.initialTimestamp = new Date().getTime();\n this._context.urls.push(url);\n }", "reset() {\r\n this.state = this.config.initial;\r\n }", "function handleHome(e){\n e.preventDefault()\n dispatch(getGames(e.target.value))\n setCurrentPage(1)\n}", "componentWillMount() {\n this.setState({\n homeFlag: false\n })\n }", "function setGlobalState(state, toComplete)\n {\n buttonsLocked = true;\n users = [];\n currentState = state;\n requestsToComplete = toComplete;\n }" ]
[ "0.6572873", "0.6453642", "0.6252108", "0.61839354", "0.606696", "0.59711236", "0.59583545", "0.5891898", "0.57992995", "0.57646614", "0.57525814", "0.57509196", "0.57421947", "0.57408786", "0.56599134", "0.56398267", "0.5619595", "0.55940866", "0.5587352", "0.5586463", "0.555173", "0.5549656", "0.554834", "0.54905796", "0.54853207", "0.54780173", "0.54412353", "0.5430032", "0.5423525", "0.5417889", "0.54129475", "0.54107153", "0.54088736", "0.5400603", "0.5396937", "0.5394873", "0.5384913", "0.5361815", "0.5299411", "0.52992594", "0.5298687", "0.52942735", "0.52903754", "0.5288596", "0.5288596", "0.5288596", "0.52850205", "0.5284514", "0.52843606", "0.528331", "0.5280451", "0.5270562", "0.52655655", "0.52623", "0.5253827", "0.5251514", "0.52433234", "0.52404326", "0.5235967", "0.5233073", "0.5231599", "0.52307254", "0.5228492", "0.52236086", "0.5220141", "0.5217156", "0.52166647", "0.52148885", "0.52044696", "0.52026325", "0.52016187", "0.519731", "0.5196776", "0.5192138", "0.5188985", "0.5187235", "0.5184557", "0.5183181", "0.51744956", "0.5171134", "0.51696706", "0.51691127", "0.5168735", "0.51666373", "0.5166213", "0.5164141", "0.5162287", "0.51597583", "0.51595557", "0.5154262", "0.5153911", "0.51513314", "0.5149561", "0.5136182", "0.51357865", "0.5135017", "0.5134598", "0.51332957", "0.51306826", "0.5130024" ]
0.52556455
54
ComponentDidMount: This function will get Data from LocalStorage.
componentDidMount () { const isLogged = JSON.parse(localStorage.getItem('UserSession')); if (isLogged) { // console.log("Stored session: ", this.isLogged); this.setState({ user: isLogged }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n console.log('fetching data');\n // JSON.stringify takes object and makes it into string representation\n // JSON.parse takes string representation, and puts into JSON object\n try {\n const json = localStorage.getItem('options');\n const options = JSON.parse(json);\n if (options) {\n this.setState(() => ({ options }));\n }\n } catch (e) {\n // do nothing\n }\n \n }", "componentDidMount() {\n /** Gets and stores Entries from LocalStorage. */\n let LocalStorageEntries = localStorage.getItem('entries');\n LocalStorageEntries = JSON.parse(LocalStorageEntries);\n /** If there are entries in LocalStorage */\n if(LocalStorageEntries && LocalStorageEntries.entries.length !== 0) {\n /** Displays the entries from LocalStorage onto the Display Section. */\n this.props.initEntries(LocalStorageEntries.entries);\n };\n }", "componentDidMount(){\n console.log(\"--componentDidMount() --> fetching data!\");\n \n try {\n const json = localStorage.getItem('options');\n const options = JSON.parse(json);\n \n if (options) {\n this.setState(() => ({ options: options }));\n }\n } catch (e) {\n \n }\n }", "componentDidMount(){\n try{\n // console.log('Did Mount!, fetching data');\n const json = localStorage.getItem('options'); //brings the data which is in localStorage\n const options = JSON.parse(json);\n if(options){//to ensure we are not setting the options array null in our state\n this.setState ( () => ({options: options}) ); //set the options with the value in localstorage\n }\n }\n catch(e){//to catch invalid values of JSON when parsing\n //do nothing, but avoids braking the app\n \n }\n }", "componentDidMount(){\n const Items = JSON.parse(window.localStorage.getItem(\"items\"));\n if(Items != null || Items != undefined){\n this.setState({items:Items});\n }\n }", "componentDidMount(){\n\t\tconst jsonTodo = localStorage.getItem('TodoItems');\n\t const SavedTodoItems = JSON.parse(jsonTodo);\n\t if(SavedTodoItems){\n\t \tthis.setState(() => ({ \n\t \tTodoItems:SavedTodoItems}));\n\t }\n\n\t const jsonDone = localStorage.getItem('DoneItems');\n\t const SavedDoneItems = JSON.parse(jsonDone);\n\t if(SavedDoneItems){\n\t \tthis.setState(() => ({ \n\t \tDoneItems:SavedDoneItems}));\n\t }\n\t}", "componentWillMount() {\n const cache = localStorage['carData']\n if(cache && cache !== '[]') {\n const carData = JSON.parse(localStorage['carData'])\n console.log(carData)\n this.setState({ carData, showForm: true })\n }\n }", "componentDidMount() {\n this.localStorageSetGet(\"getLocal\")\n }", "componentDidMount() {\n if (localStorage.getItem('todos') !== null) {\n const storedTodos = JSON.parse(localStorage.getItem('todos'))\n this.setState({ todos: storedTodos, todo: '' })\n }\n }", "componentDidMount(){\n //eror\n this.setState({\n error:false\n })\n // fin error\n \n const citasLS = localStorage.getItem('citas');\n \n if(citasLS){\n this.setState({\n citas: JSON.parse(citasLS)\n })\n }\n //console.log('cuando el componente esta listo');\n }", "componentWillMount() {\n this.fetchData();\n\n this.loadDatafromLocalStorage();\n }", "componentDidMount() {\n const items = localStorage.getItem('items');\n\n if (items){\n this.setState({ items: JSON.parse(items) });\n }\n }", "componentDidMount(){\r\n let state = localStorage.getItem(this.props.storageKey);\r\n state = JSON.parse(state);\r\n this.setState(state);\r\n }", "componentDidMount() {\n let itemsList = localStorage.getItem('languages')\n if (itemsList) {\n this.setState({\n languages: JSON.parse(localStorage.getItem('languages'))\n })\n }\n }", "async componentWillMount() {\n try{\n let elements = await window.localStorage.getItem('todo_elements');\n if (elements) {\n this.setState({\n elements: JSON.parse(elements)\n });\n } else {\n this.setState({\n elements: []\n });\n }\n }catch (error){\n console.log(error);\n }\n }", "componentDidMount() {\n this.setState({\n contacts: JSON.parse(localStorage.getItem('contacts')) || []\n });\n }", "componentDidMount() {\n var savedNamesString = localStorage.getItem(\"savedNames\");\n if (savedNamesString) {\n var savedNames = JSON.parse(savedNamesString);\n this.setState({ names: savedNames });\n }\n }", "componentDidMount() {\n try {\n const json = localStorage.getItem('tasks');\n const tasks = JSON.parse(json);\n if (tasks) {\n this.setState(() => ({ tasks: tasks }))\n }\n\n } catch(e) {\n // do nothing at all - catch for some errors\n }\n }", "componentDidMount(){\n const citasLS = localStorage.getItem('citas')\n if(citasLS){\n this.setState({citas: JSON.parse(citasLS)})\n }\n\n \n }", "componentDidMount() {\n const stringifiedList = localStorage.getItem('list')\n if (stringifiedList) {\n const newList = JSON.parse(stringifiedList)\n this.setState({\n list: newList\n });\n }\n }", "componentWillMount() {\n localStorage.getItem('Contacts') && this.setState({\n contacts: JSON.parse(localStorage.getItem('Contacts'))\n })\n }", "componentWillMount() {\n if(localStorage && localStorage.getItem('tasks'))\n {\n var tasks =JSON.parse(localStorage.getItem('tasks'));\n this.setState({\n tasks:tasks\n })\n }\n }", "componentDidMount(){\n const eventosLS = localStorage.getItem('eventos');\n if (eventosLS){\n this.setState({\n eventos: JSON.parse(eventosLS)\n })\n }\n }", "componentDidMount() {\n if (localStorage.getItem(\"todos\") != null && localStorage.getItem(\"todos\").length > 0) {\n var items = localStorage.getItem(\"todos\").split(\",\");\n this.setState({ todoList: items });\n } else\n this.setState({ todoList: [] });\n }", "componentDidMount() {\n try {\n const json = localStorage.getItem('options');\n const options = JSON.parse(json);\n \n if (options) {\n this.setState(() => ({ options }));\n }\n } catch (events) {\n // do nothing at all if data is invalid\n }\n }", "componentDidMount(){\n this.setState({\n success : false,\n name: localStorage.getItem('restaurantName'),\n zip: localStorage.getItem('restaurantZip')\n })\n }", "componentDidMount(){\n const citasLS = localStorage.getItem('citas');\n if (citasLS) {\n this.setState({\n citas: JSON.parse(citasLS)\n })\n }\n }", "componentDidMount() {\n const citasLS = localStorage.getItem(\"citas\");\n if (citasLS) {\n this.setState({\n citas: JSON.parse(citasLS)\n });\n }\n }", "componentWillMount() {\n // check if there is any todos in local storage\n const localStorageRef = localStorage.getItem('todos');\n\n if (localStorageRef) {\n const todos = JSON.parse(localStorageRef);\n // update our App component order state\n this.setState({\n todos: Object.keys(todos).map(key => todos[key]), // Parses object into array format\n });\n }\n }", "componentDidMount(){\n this.setState({\n username:localStorage.getItem('username')\n });\n\n console.log(this.state.username)\n }", "componentDidMount() {\n let savedItems = localStorage.getItem('todo:items');\n if (savedItems) {\n savedItems = JSON.parse(savedItems);\n this.props.onSetItems(savedItems);\n }\n }", "componentDidMount(){\n const citasLS = localStorage.getItem('citas');\n if(citasLS){\n this.setState({citas: JSON.parse(citasLS)});\n }\n }", "componentDidMount(){\n if (localStorage.userToken){\n this.getUserData(localStorage.userToken)\n }\n }", "componentWillMount(){\n let user = JSON.parse(localStorage.getItem('user'));\n this.setState({user:user})\n }", "componentDidMount() {\n console.log(\"component did mount\");\n //get data stored in localstorage\n let storedItems = localStorage.getItem(\"to-do-app\");\n //converting into original form\n let convertedToOriginal = JSON.parse(storedItems);\n\n if (storedItems !== null) {\n //storing it in our state\n this.setState({\n items: convertedToOriginal,\n });\n }\n }", "componentDidMount() {\n try {\n const json = localStorage.getItem('options')\n const options = JSON.parse(json)\n\n if (options) {\n this.setState(() => ({options}))\n }\n } catch (e) {\n // Do nothing at all\n }\n }", "componentDidMount() {\n let itemsFromStorage = JSON.parse(localStorage.getItem(\"priorities\"));\n\n // if there is data in local storage it will update the state with the data\n \n if(itemsFromStorage) {\n this.setState(itemsFromStorage);\n }\n }", "componentDidMount() {\n try {\n const json = localStorage.getItem('options');\n const options = JSON.parse(json);\n\n if (options) {\n // es6 Shorthand\n this.setState(() => ({ options }));\n }\n } catch (e) {\n // do nothing if the data is corrupt\n }\n }", "componentDidMount() {\n // get the items from local storage\n const items = JSON.parse(localStorage.getItem('inventory'));\n\n if(!items) {\n return;\n }\n // set state\n this.setState({\n items: items,\n });\n }", "componentDidMount() {\n\t\tthis.setState({\n\t\t\tlocations: JSON.parse(localStorage.getItem('locations'))\n\t\t});\n\t}", "async componentWillMount() {\n let values = await AsyncStorage.getItem(\"products\");\n let products = await JSON.parse(values)\n this.setState({\n products: products,\n });\n }", "componentDidMount () {\n const { recentItems } = JSON.parse(localStorage.getItem('redux')) ? JSON.parse(localStorage.getItem('redux')) : {\n recentItems: {\n rCharacters: null,\n rEpisodes: null,\n error: null\n }\n }\n this.setState({\n characters: recentItems.rCharacters,\n episodes: recentItems.rEpisodes,\n error: recentItems.error\n })\n console.log(recentItems)\n }", "componentDidMount(){\n const techs = localStorage.getItem('techs')\n\n if(techs){\n this.setState({techs: JSON.parse(techs)})\n }\n}", "async getStorageData() {\n\t\ttry {\n\t\t const user_id = await AsyncStorage.getItem('userId');\n\t\t const jwt_token = await AsyncStorage.getItem('token');\n\n\t\t this.setState({myKey: user_id, token: jwt_token});\n\n\t\t this.getData();\n\t\t} catch (error) {\n\t\t console.log(\"Error retrieving data\" + error);\n\t\t}\n\t }", "componentDidMount() {\n const data = localStorage.getItem('states')\n if(data) {\n \n this.setState(prevState => {\n return JSON.parse(data)\n })\n }\n }", "loadDatafromLocalStorage(){\n const savedBeerList = localStorage.getItem(\"myBeerList\");\n\n if(savedBeerList !== '') {\n this.setState({\n myBeerList: JSON.parse(savedBeerList)\n });\n }\n\n\n }", "componentDidMount(){\n let jwt = localStorage.getItem(\"jwt\")\n console.log(jwt)\n if(jwt){\n this.getInfo(jwt)\n }\n }", "componentWillMount() {\n if (localStorage.getItem('pokeArr')) {\n // check reducer or localstorage\n console.log('getting from localstorage...');\n let parsedData = JSON.parse(localStorage.getItem('pokeArr'));\n this.setState({\n pokeArr: [...parsedData]\n });\n } else {\n fetch('https://pokeapi.co/api/v2/pokemon')\n .then(response => {\n console.log('fetching data...');\n return response.json();\n })\n .then(data => {\n console.log('setting local storage...');\n localStorage.setItem('pokeArr', JSON.stringify(data.results));\n this.setState({\n pokeArr: [...data.results]\n });\n });\n }\n }", "componentDidMount(){\n\n try {\n // get item from local storage(json format by default)\n const json = localStorage.getItem('options');\n // need to parse into regular js object so we can set state\n const options = JSON.parse(json);\n if (options){\n // pass in the updated array only if options is valid\n this.setState(()=>({options: options}))\n }\n\n } catch (e){\n // do nothing\n }\n\n }", "componentDidMount() {\n // Sync and get dishes from firebase\n this.ref = base.syncState(`${this.props.match.params.storeId}/dishes`, {\n context: this,\n state: 'dishes'\n });\n // Grab order data from localStorage\n const localStorageRef = localStorage.getItem(\n this.props.match.params.storeId\n );\n localStorageRef &&\n this.setState({\n order: { ...JSON.parse(localStorageRef) }\n });\n }", "UNSAFE_componentWillMount(){ \n localStorage.getItem('movies') && this.setState({ \n //update states if the data stored in local storage\n jsonData: JSON.parse(localStorage.getItem('movies')),\n movies: JSON.parse(localStorage.getItem('movies')),\n currentMovie: JSON.parse(localStorage.getItem('movieId')),\n loaded: JSON.parse(localStorage.getItem('loaded')),\n isLoading: true\n })\n }", "componentDidMount() {\n const tareasLS = localStorage.getItem(\"tareas\");\n if (tareasLS) {\n this.setState({ tareas: JSON.parse(tareasLS) });\n }\n }", "componentDidMount() {\n console.log ('componentDidMount');\n try { // <= to catch any parsing error\n const json = localStorage.getItem('options')\n const options = JSON.parse (json)\n if (options) {\n this.setState(() => ({options}));\n }\n } catch (e) {\n // do nothing\n }\n }", "componentDidMount() {\n const reservas_localstorage = localStorage.getItem(\"reservas\");\n if (reservas_localstorage) {\n this.setState({\n reservas: JSON.parse(reservas_localstorage)\n });\n }\n }", "UNSAFE_componentWillMount() {\n this.setState(\n {\n products: [],\n cartItems: localStorage.getItem(\"cartItems\") ? JSON.parse(localStorage.getItem(\"cartItems\")) : []\n }\n );\n }", "componentWillMount() {\n this.setState({\n first_name: localStorage.getItem(\"firstName\")\n })\n }", "componentDidMount() {\n console.log(\"comp mounting\");\n this.hydrateStateWithLocalStorage();\n }", "componentDidMount() {\n var fetchedData = JSON.parse(sessionStorage.getItem(\"userData\"));\n this.setState({ username: fetchedData.Username, email: fetchedData.Mail, displayMail: fetchedData.Mail });\n }", "componentDidMount() {\n //get data stored in local storage\n let storedItems = localStorage.getItem(\"to-do-app\");\n //to convert string to object\n let convertedToOriginal = JSON.parse(storedItems);\n\n //to check if item where before execute\n if (storedItems !== null) {\n //to store in state\n this.setState({\n items: convertedToOriginal,\n });\n }\n }", "componentDidMount() {\n let items = JSON.parse(localStorage.getItem(\"items\"));\n if (items != null) {\n this.setState({\n todoItems: items,\n count: items.length,\n });\n }\n }", "componentDidMount() {\n //fetch meallist\n //display top Meals\n //fetch recommended meals\n //create alogirthm that displays certain meals\n AsyncStorage.getItem('meals')\n .then((data) => {\n console.log('meals from AsyncStorage', JSON.parse(data));\n this.setState({\n meals: JSON.parse(data)\n })\n })\n .catch(err => console.log('err',err))\n\n }", "componentDidMount () {\n try {\n const options = JSON.parse(localStorage.getItem('option'));\n if (options){\n this.setState(() => ({options}));\n }\n } catch (e) {\n localStorage.removeItem('option');\n }\n }", "componentDidMount() {\n try {\n const coinList = JSON.parse(localStorage.getItem(\"coinList\"));\n if (coinList) {\n this.setState({coinsToShow: coinList});\n }\n } catch (e) {\n console.log(\"Clearing local storage due to corruption.\");\n localStorage.removeItem(\"coinList\");\n }\n }", "componentDidMount(){\n const repositorios = localStorage.getItem('repositorios');\n if(repositorios){\n this.setState({ repositorios: JSON.parse(repositorios)})\n }\n }", "componentDidMount() {\n const visited = localStorage.getItem(\"visited\") === \"true\";\n if (visited) {\n const localnominationsList = localStorage.getItem(\"localnominationsList\");\n const localcurrentIdList = localStorage.getItem(\"localcurrentIdList\");\n var thisnominationsList = JSON.parse(localnominationsList);\n var thiscurrentIdList = JSON.parse(localcurrentIdList);\n this.setState({\n nominationsList: thisnominationsList,\n currentIdList: thiscurrentIdList,\n });\n console.log(\n \"REFRESH\",\n this.state.nominationsList,\n this.state.currentIdList\n );\n }\n }", "componentWillMount(){\r\n const user=JSON.parse(localStorage.getItem('user')); \r\n this.setState({\r\n remarks:user[this.props.index].remarks\r\n })\r\n }", "function getFromLocalStorage() {\n const localSto = localStorage.getItem('listTask')\n\n if(localSto) {\n listTask = JSON.parse(localSto);\n renderTask(listTask)\n }\n}", "componentDidMount () {\n var logState = localStorage.getItem('logState') || false;\n if(!logState) {\n Router.push('/index');\n }\n var logUser = JSON.parse(localStorage.getItem('user')) || {}\n if(!logUser || logUser.name != \"Mateo Silguero\") {\n Router.push('/index');\n }\n this.getUsers();\n list = JSON.parse(localStorage.getItem('uList'));\n this.setState({list: list});\n }", "componentDidMount() {\n this._buscarDadosDoStorage();\n }", "componentDidMount(){\n //get local stroage\n var list = mystroage.get('todolist');\n if(list){\n this.setState({\n myList: list,\n })\n }\n }", "componentDidMount() {\n const data = {\n 'companyId': localStorage.getItem('companyId')\n }\n console.log(data)\n this.props.getCompanyEvents()\n // axios.defaults.headers.common['authorization'] = localStorage.getItem('token');\n // axios.get(environment.baseUrl+'/company/list-of-jobs-and-events/' + localStorage.getItem('companyId')+'/events')\n // .then((response) => {\n // //update the state with the response data\n // this.setState({\n // eventlist: response.data\n // })\n // console.log(this.state.eventlist)\n // });\n }", "function getFromLocalStorage() {\n const reference = localStorage.getItem('todos');\n // if reference exist\n if (reference) {\n // converts back to arr and store it in todos arr\n todos = JSON.parse(reference);\n renderTodos(todos);\n }\n}", "componentDidMount() {\n this.componentsMounted = true;\n if (this.componentsMounted) {\n AsyncStorage.getItem(\"username\").then((username) => {\n console.log(username);\n this.setState({\n username: username,\n });\n });\n }\n\n return get_products_list().then(response => {\n if (response.detail == \"Invalid token.\") {\n this.props.navigation.navigate('Login');\n }\n if (this.componentsMounted) {\n this.setState({\n isLoading: false,\n dataSource: response.results,\n refreshing: false,\n });\n }\n });\n\n\n }", "function getFromLocalStorage() {\n //mengambil data dari local storage, data masih berupa string of arr of obj\n let ref = localStorage.getItem('todos')\n\n // jika ada datanya, maka kita convert datanya menjadi array\n if (ref) {\n // memperbaharui todos dengan data dari LS yang telah di convert\n todos = JSON.parse(ref) // sudah berupa array of obj\n // console.log(ref, todos)\n\n //tampilkan todos terbaru\n renderTodos(todos)\n }\n}", "UNSAFE_componentWillMount(){\n // Get Hospital and Save to localStorage\n try {\n let licence_id = JSON.parse(localStorage.getItem(\"userdata\")).licence_id\n let email = JSON.parse(localStorage.getItem(\"userdata\")).email\n let url = JSON.parse(localStorage.getItem(\"userdata\")).url\n this.setState({\n lastUpdated : localStorage.getItem(\"last_updated\")\n })\n this.updateStateWithBaseData(licence_id, email, url)\n } catch (error){\n console.log(error)\n this.logout();\n }\n }", "componentDidMount() {\n const repositories = localStorage.getItem('repositories');\n\n if (repositories) {\n this.setState({\n repositories: JSON.parse(repositories),\n });\n }\n }", "componentWillMount() {\n this.retrieveData();\n }", "componentDidMount() {\n let state = localStorage[\"appState\"];\n if (state) {\n let AppState = JSON.parse(state);\n this.setState({\n isLoggedIn: AppState.isLoggedIn,\n user: AppState.user\n });\n }\n }", "componentDidMount() {\n const repos = localStorage.getItem('repos');\n\n if (repos) {\n this.setState({ repos: JSON.parse(repos) });\n }\n }", "componentDidMount() {\n const { params } = this.props.match;\n\n // First reinstate our localStorage\n const localStorageRef = localStorage.getItem(params.storeId);\n\n // User might go to a different store where there is no data in it so it is safe to put a check there to see if there is any stored data\n if (localStorageRef) {\n this.setState({ order: JSON.parse(localStorageRef) });\n }\n\n this.ref = base.syncState(`${params.storeId}/fishes`, {\n context: this,\n state: 'fishes',\n });\n }", "componentDidMount(){\n let items = JSON.parse(localStorage.getItem('selected-programmes')) || { programmes: []};\n\n\n this.setState({\n selected: items.programmes\n })\n }", "componentDidMount() {\n const color = localStorage.getItem(\"color\") || images[7].color;\n this.setState({ color });\n }", "componentDidMount() {\n const token = localStorage.getItem(\"token\");\n this.setState({ token: token });\n console.log(\"token\", JSON.stringify(token));\n }", "componentDidMount() {\n const loggedinUser = localStorage.getItem('user');\n if (loggedinUser) {\n const foundUser = JSON.parse(loggedinUser)\n this.setState({user: foundUser})\n this.setState({isLoggedIn: true})\n }\n this.setState({isLoading: false})\n }", "componentDidMount() {\n try {\n const localOptions = localStorage.getItem(\"options\");\n const optionsParsed = JSON.parse(localOptions);\n console.log(optionsParsed);\n if (optionsParsed) {\n this.setState(() => {\n return {\n options: optionsParsed,\n };\n });\n }\n } catch (error) {\n //! do this to remove the ugly error message and left it default to\n console.log(\"there was an error\");\n }\n }", "function getStorageData() {\r\n if(localStorage.Data) {\r\n Product.all = JSON.parse(localStorage.Data);\r\n }\r\n}", "componentDidMount() { \n let accessToken = localStorage.getItem('token');\n if (accessToken !== null) {\n this.setState({\n user: localStorage.getItem('user')\n });\n this.getMovies(accessToken);\n }\n }", "componentDidMount() {\n const stringNumber = localStorage.getItem(\"number\");\n\n if(stringNumber !== undefined) {\n // Convert strings into objects.\n const intNumber = parseInt(stringNumber, 10);\n this.setState(() => ({count: intNumber}));\n console.log(\"Fetching Data!\");\n }\n }", "componentDidMount() {\n //localStorage.clear()\n const cachedTasks = localStorage.getItem('contacts')\n this.setState({\n contacts: cachedTasks\n ? parseObject(cachedTasks)\n : []\n })\n }", "componentDidMount() {\n let accessToken = localStorage.getItem('token');\n if (accessToken !== null) {\n this.setState({\n user: localStorage.getItem('user')\n });\n this.getMovies(accessToken);\n }\n }", "function getDataFromLocalStorage(){\n var students = JSON.parse(localStorage.getItem(\"students\"));\n return students;\n \n }", "componentDidMount() {\n AsyncStorage.getItem(\"key\").then((newItems) => {\n console.log('checking new items', newItems);\n this.setState({ items: JSON.parse(newItems) });\n });\n }", "componentWillMount() {\n axios\n .get(config.get(\"apiurl\") + \"/info\")\n .then(response => {\n this.setState({ faucetinfo: response.data });\n localStorage.setItem(\"faucetinfo\", response.data);\n })\n // Catch any error here\n .catch(error => {\n console.log(error);\n });\n }", "componentDidMount() {\n // console.log('DidMount');\n //TypeError: this.state.todoList is null\n //////////////// NEED: to check if null first? --> ||\n // console.log(localStorage.todos);\n\n let newList = JSON.parse(localStorage.getItem('todos')) || [];\n\n this.setState(\n {\n todoList: newList\n }\n // ,() => console.log('newList', newList)\n );\n }", "load() {\n try {\n appState.state.cursor().update( cursor => {\n return cursor.merge( JSON.parse( window.localStorage.getItem( APPCONFIG.LS ) ) )\n })\n } catch( err ) {\n console.error( 'Error loading from local storage' )\n console.error( err )\n return\n }\n\n console.log( 'loaded' )\n }", "componentWillMount() {\n // Firebase stuff\n this.ref = base.syncState(`${this.props.params.storeId}/fishes`, {\n context: this,\n state: 'fishes'\n });\n // Check localStorage before loading component\n const doesExist = localStorage.getItem(`order-${this.props.params.storeId}`);\n\n if(doesExist) {\n this.setState({\n order: JSON.parse(doesExist)\n })\n }\n }", "componentDidMount(){\n const {user,pass}=this.state;\n\n let user1=localStorage.getItem(\"name\");\n let psw=localStorage.getItem(\"psw\");\n\n this.setState({\n user:user1,\n pass:psw\n })\n this.authfunction();\n }", "function getFromLocalStorage() {\n const reference = localStorage.getItem('lists');\n // if reference exists\n if (reference) {\n // converts back to array and store it in lists array\n lists = JSON.parse(reference);\n renderLists(lists);\n }\n}", "function getFromLocal() {\n const storageItems = localStorage.getItem('todos');\n if ( storageItems ) {\n todos = JSON.parse(storageItems);\n renderTodos(todos);\n }\n}", "componentDidMount() {\n\t\tconst tasklist = _.getItemStorage('taskslist') || [];\n\t\tthis.state.data.length === 0\n\t\t\t? this.setState(() => ({\n\t\t\t\t\tdata: tasklist\n\t\t\t\t}))\n\t\t\t: '';\n\t}", "async componentDidMount(){\n var self = this;\n var values = [];\n var keys = Object.keys(localStorage);\n var i = keys.length;\n\n //Filling data from localStorage\n while ( i-- ) {\n values.push( localStorage.getItem(keys[i]) );\n }\n\n const userR = JSON.parse(values[0]);\n let url = \"https://parking-system-ecse428.herokuapp.com/reservation/forUser/\" + userR.userID;\n const response = await fetch(url);\n let data = await response.json();\n data = JSON.parse(JSON.stringify(data));\n console.log(data);\n this.setState({reservation: data, loading: false});\n console.log(this.state.reservation);\n }" ]
[ "0.7768264", "0.7742203", "0.7730184", "0.7592346", "0.7570624", "0.7541107", "0.7512477", "0.7474179", "0.7451228", "0.7445406", "0.7441839", "0.74187446", "0.7415352", "0.7409873", "0.739625", "0.73962253", "0.7390547", "0.7359969", "0.7358407", "0.73338425", "0.7331953", "0.7306786", "0.730544", "0.7304306", "0.7296952", "0.7296923", "0.72882575", "0.72743547", "0.7273914", "0.7266124", "0.72603357", "0.72510225", "0.72274274", "0.7211797", "0.72076344", "0.7206572", "0.7198237", "0.719655", "0.7186182", "0.7183255", "0.71770793", "0.7164677", "0.71645194", "0.7156609", "0.7143034", "0.7130957", "0.71194965", "0.710006", "0.70521426", "0.7050265", "0.70497423", "0.70411223", "0.7037235", "0.7034827", "0.70138603", "0.7001134", "0.69990426", "0.6982593", "0.698119", "0.69732565", "0.6973137", "0.6966611", "0.6965767", "0.69595784", "0.69573563", "0.6957151", "0.6948518", "0.69437337", "0.69067156", "0.69027776", "0.690164", "0.687977", "0.6860204", "0.68490875", "0.6838895", "0.6838835", "0.682305", "0.68159825", "0.6808329", "0.680346", "0.6800234", "0.68001163", "0.6798151", "0.6797797", "0.67920583", "0.67900896", "0.6789762", "0.6778926", "0.6773838", "0.6770263", "0.676994", "0.6768674", "0.6763122", "0.67557514", "0.67410505", "0.672714", "0.6726062", "0.6721515", "0.67161757", "0.6710961", "0.670422" ]
0.0
-1
rewrite log4js configuration file by replacing relative paths to absolute
function correcting(log_file) { console.log("Logger: opening log-conf file: " + log_file); var log = fs.readFileSync(log_file, 'utf8'); var d = false; var json = JSON.parse(log, function(key, value) { if (key == 'filename') { var dirname = utils.dirname(value); var basename = value.replace(dirname, ''); var file = utils.search_file(dirname); file = path.join(file, basename) if (file != value) { value = file; d = true; } } return value; }); if (d) { var logFileCorrect = log_file + ".new"; console.log("Logger: write corrections to " + logFileCorrect); fs.writeFileSync(logFileCorrect, JSON.stringify(json, null, 2)); return logFileCorrect; } else { console.log("Logger: Config-file - There is nothing to correct!!!"); } return log_file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_loadFileConfig() {\n try {\n let lines = fs.readFileSync(this._LOGLOVE_CONFIG).toString().split('\\n');\n for (let line of lines) {\n let levelPattern = line.split('=');\n this._setLevelAndPatterns(levelPattern[0], levelPattern[1]);\n }\n } catch (err) {\n // console.log('_loadFileConfig', err);\n }\n }", "function rewriteLocations (root, config) {\n config.packages = R.map(function (pkg) {\n pkg.location = path.relative(root, pkg.location)\n return pkg\n }, config.packages)\n return config\n}", "function configLogger(module) {\n\tvar errorModule = 'error-'+module;\n\tvar allModule = 'all-'+module;\n\tlog4js.loadAppender('file');\n\tlog4js.addAppender(log4js.appenders.file('logs/all-'+module+'.log'), allModule);\n\tlog4js.addAppender(log4js.appenders.file('logs/error-'+module+'.log'), errorModule);\n\tvar errorlogger = log4js.getLogger(errorModule);\n\tvar alllogger = log4js.getLogger(allModule);\n\terrorlogger.setLevel('INFO');\n\talllogger.setLevel('ERROR');\n\tmoduleLoggers[module] = {};\n\tmoduleLoggers[module]['em'] = errorlogger;\n\tmoduleLoggers[module]['am'] = alllogger;\n}", "setFileStream() {\n // e.g.: https://my-domain.com --> http__my_domain_com\n let sanitizedDomain = this.domain.replace(/[^\\w]/gi, '_');\n\n // CASE: target log folder does not exist, show warning\n if (!fs.pathExistsSync(this.path)) {\n this.error('Target log folder does not exist: ' + this.path);\n return;\n }\n\n this.streams['file-errors'] = {\n name: 'file',\n log: bunyan.createLogger({\n name: 'Log',\n streams: [{\n path: `${this.path}${sanitizedDomain}_${this.env}.error.log`,\n level: 'error',\n }],\n serializers: this.serializers,\n })\n };\n\n this.streams['file-all'] = {\n name: 'file',\n log: bunyan.createLogger({\n name: 'Log',\n streams: [{\n path: `${this.path}${sanitizedDomain}_${this.env}.log`,\n level: this.level,\n }],\n serializers: this.serializers,\n }),\n };\n\n if (this.rotation.enabled) {\n this.streams['rotation-errors'] = {\n name: 'rotation-errors',\n log: bunyan.createLogger({\n name: 'Log',\n streams: [{\n type: 'rotation-file',\n path: `${this.path}${sanitizedDomain}_${this.env}.error.log`,\n period: this.rotation.period,\n count: this.rotation.count,\n level: 'error',\n }],\n serializers: this.serializers,\n }),\n };\n\n this.streams['rotation-all'] = {\n name: 'rotation-all',\n log: bunyan.createLogger({\n name: 'Log',\n streams: [{\n type: 'rotation-file',\n path: `${this.path}${sanitizedDomain}_${this.env}.log`,\n period: this.rotation.period,\n count: this.rotation.count,\n level: this.level,\n }],\n serializers: this.serializers,\n }),\n };\n }\n }", "function postProcessCfg(cfg) {\n // fix missed fields;\n if (cfg.publicPath) {\n if (!cfg.publicPath.endsWith('/')) {\n cfg.publicPath += '/';\n }\n } else {\n cfg.publicPath = '';\n }\n\n if (!cfg.outDir) {\n cfg.out_dir = 'build';\n }\n cfg.outDir = path.resolve(__dirname, cfg.outDir);\n\n if (!cfg.srcDir) {\n cfg.src_dir = 'src';\n }\n cfg.srcDir = path.resolve(__dirname, cfg.srcDir);\n\n if (cfg.entry && !cfg.entry.startsWith('./')) {\n cfg.entry = `./${cfg.entry}`;\n }\n\n if (cfg.alias) {\n Object.entries(cfg.alias).forEach(([K, v]) => {\n cfg.alias[K] = path.resolve(cfg.srcDir, v);\n });\n }\n}", "function updateWebjarPaths(config) {\n\tfor (var i = 0; i < config.files.length; i++){\n\t\tconfig.files[i] = config.files[i].replace(\n\t\t\t\t'http://localhost:8080/maven-karma-webjars-example/webjars', \n\t\t\t\t'target/dependency/META-INF/resources/webjars');\n\t}\n}", "function rewriteConfiguration(config) {\n const homeDir = app.getPath('home')\n const qianDir = path.join(homeDir, '.qian')\n const qianFile = path.join(qianDir, 'profil.json')\n if (!fs.existsSync(qianDir)) {\n fs.mkdirSync(qianDir);\n }\n fs.writeFileSync(qianFile, JSON.stringify(config))\n}", "function fixSrcPath(fixRequire){\n return es.map(function(file, cb){\n file.path = file.path.replace(/^.*\\\\Studio\\\\/, file.cwd + \"\\\\\");\n file.base = file.cwd + \"\\\\src\\\\\";\n\n if(fixRequire){\n file.contents = new Buffer(file.contents.toString().replace(/\\..\\/..\\/..\\/..\\/DataFactory\\/src\\//g, DATA_FACTORY_PATH));\n }\n\n cb(null, file);\n });\n}", "function absolutePathResolver () {\n return {\n name: 'absolute-path-resolver', // this name will show up in warnings and errors\n resolveId (importee, importer) {\n if (importer && importer.includes('commonjs-proxy:') === false) {\n if (path.isAbsolute(importee)) {\n const newImportee = `${global.cwd}${importee}`; // importee should already have a leading slash\n console.log(`Rewrote ${chalk.blue(importee)} to ${chalk.blue(newImportee)} in ${chalk.cyan(importer)}`);\n return newImportee;\n }\n }\n\n return null; // other ids should be handled as usually\n },\n };\n}", "function normalize (actual) {\n const dir = path.join(__dirname, '..', '..', '..');\n const reDir = new RegExp(dir.replace(reEscape, '\\\\$1'), 'g');\n const reSep = new RegExp(path.sep.replace(reEscape, '\\\\$1'), 'g');\n\n return actual\n .replace(reDir, '/qunit')\n // Replace backslashes (\\) in stack traces on Windows to POSIX\n .replace(reSep, '/')\n // Convert \"at processModule (/qunit/qunit/qunit.js:1:2)\" to \"at qunit.js\"\n // Convert \"at /qunit/qunit/qunit.js:1:2\" to \"at qunit.js\"\n .replace(/^(\\s+at ).*\\/qunit\\/qunit\\/qunit\\.js.*$/gm, '$1qunit.js')\n // Strip inferred names for anonymous test closures (as Node 10 did),\n // to match the output of Node 12+.\n // Convert \"at QUnit.done (/qunit/test/foo.js:1:2)\" to \"at /qunit/test/foo.js:1:2\"\n .replace(/\\b(at )\\S+ \\((\\/qunit\\/test\\/[^:]+:\\d+:\\d+)\\)/g, '$1$2')\n // Convert sourcemap'ed traces from Node 14 and earlier to the\n // standard format used by Node 15+.\n // https://github.com/nodejs/node/commit/15804e0b3f\n // https://github.com/nodejs/node/pull/37252\n // Convert \"at foo (/min.js:1)\\n -> /src.js:2\" to \"at foo (/src.js:2)\"\n .replace(/\\b(at [^(]+\\s\\()[^)]+(\\))\\n\\s+-> ([^\\n]+)/g, '$1$3$2')\n // CJS-style internal traces:\n // Convert \"at load (internal/modules/cjs/loader.js:7)\" to \"at internal\"\n //\n // ESM-style internal traces from Node 14+:\n // Convert \"at wrap (node:internal/modules/cjs/loader:1)\" to \"at internal\"\n .replace(/^(\\s+at ).+\\([^/)][^)]*\\)$/gm, '$1internal')\n\n // Convert /bin/qunit and /src/cli to internal as well\n // Because there are differences between Node 10 and Node 12 in terms\n // of how much back and forth occurs, so by mapping both to internal\n // we can flatten and normalize across.\n .replace(/^(\\s+at ).*\\/qunit\\/bin\\/qunit\\.js.*$/gm, '$1internal')\n .replace(/^(\\s+at ).*\\/qunit\\/src\\/cli\\/.*$/gm, '$1internal')\n\n // Strip frames from indirect nyc dependencies that are specific\n // to code coverage jobs:\n // Convert \"at load (/qunit/node_modules/append-transform/index.js:6\" to \"at internal\"\n .replace(/ {2}at .+\\/.*node_modules\\/append-transform\\/.*\\)/g, ' at internal')\n // Consolidate subsequent qunit.js frames\n .replace(/^(\\s+at qunit\\.js$)(\\n\\s+at qunit\\.js$)+/gm, '$1')\n // Consolidate subsequent internal frames\n .replace(/^(\\s+at internal$)(\\n\\s+at internal$)+/gm, '$1');\n}", "function replaceFirebaseHost(proxyDir, options){\n var optionsReplacer = {\n files: proxyDir + '/edge.json',\n from: /\"host\"[ ]*:[ ]*\".*\"/g,\n to: '\"host\" : \"' + options.firebaseHost + '\"',\n };\n\n try {\n const changes = replace.sync(optionsReplacer);\n console.log('Modified files:', changes.join(', '));\n }\n catch (error) {\n console.error('Error occurred trying to update the firebase host.');\n //console.error('Error occurred trying to update the firebase host:', error);\n }\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push(\n {\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options: {\n fix: true\n }\n },\n {\n test: /\\.ico$/,\n loader: 'uri-loader',\n exclude: /(node_modules)/\n }\n )\n console.log(config.output.publicPath, 'config.output.publicPath')\n // config.output.publicPath = ''\n }\n }", "function pathfix(t, from=\"src=\\\"\", to=\"src=\\\"/\", offset = 0){\n\tt = t.toString();\n\tlet i = t.slice(offset).indexOf(from);\n\tif (i === -1) return t;\n\tlet pre = t.slice(0, i);\n\tlet pos = t.slice(i);\n\n\tif (pos.slice(5, 12) !== \"http://\" && pos.slice(5, 6) !== \"/\") {\n\t\tpos = pos.replace(from, to);\n\t\treturn pre + pathfix(pos, i + 3);\n\t}\n}", "rewriteConfigFiles() {\r\n const approvedPackagesPolicy = this._rushConfiguration.approvedPackagesPolicy;\r\n if (approvedPackagesPolicy.enabled) {\r\n approvedPackagesPolicy.browserApprovedPackages.saveToFile();\r\n approvedPackagesPolicy.nonbrowserApprovedPackages.saveToFile();\r\n }\r\n }", "updateConfigPath(configPath, manual = true) {\n // store the absolute value of project root\n let pawConfig = configPath;\n if (!path.isAbsolute(configPath)) {\n pawConfig = path.resolve(processDir, configPath);\n }\n let pathStats = fs.lstatSync(pawConfig);\n if(!pathStats.isFile()) {\n // eslint-disable-next-line\n console.warn(`WARNING:: Invalid config file path specified ${configPath}, using ${process.env.PAW_CONFIG_PATH} instead`);\n return;\n }\n if (manual) {\n this.pawConfigManualPath = true;\n }\n \n process.env.PAW_CONFIG_PATH = pawConfig;\n \n }", "function getLocalChangelogFilePath(projectDir) {\n return path.join(projectDir, changelogPath);\n}", "function DebugLogPath(){\treturn UserTempDir() + \"\\\\SuperCopyDebug.txt\";}", "function configureLogging() {\n if (!log4js.configured) {\n log4js.configure({\n appenders: [{\n type: 'console',\n layout: {\n type: 'pattern',\n pattern: '[%[%5.5p%]] - %m'\n }\n }]\n })\n logger.setLevel('INFO')\n }\n}", "function fixUrls(cssText, pathname) {\n // hack & slash\n return cssText.replace(URL, \"$1\" + pathname.slice(0, pathname.lastIndexOf(\"/\") + 1) + \"$2\");\n }", "_updateConfig() {\n let template = null;\n let dest = this.destinationPath('server/config/database.js');\n\n if (program.helpers.isRelationalDB(this.answers.database)) {\n template = this.templatePath('config/sql.stub');\n } else if (this.answers.database === 'mongodb') {\n template = this.templatePath('config/mongo.stub');\n }\n\n let configStub = program.helpers.readTpl(this, template, {\n answers: this.answers\n });\n\n let configData = program.helpers.ast(this.read(dest), function (tree) {\n tree.assignment('module.exports').value()\n .key('database').key(this.answers.identifier).value(configStub);\n }.bind(this));\n this.fs.write(dest, configData);\n }", "function LogRotate(config) {\n this.config = config;\n this.logDir = utils.createLogDir(config.workDir);\n if (this.config.type && this.config.type === 'raw') {\n stream.Transform.call(this, {readableObjectMode: true, writableObjectMode: true});\n } else {\n stream.Transform.call(this);\n }\n this.pipe(logRotateStream({\n path: path.resolve(this.logDir, config.path || 'ut5-%Y-%m-%d.log'), // Write logs rotated by the day\n symlink: path.resolve(this.logDir, config.symlink || 'ut5.log'), // Maintain a symlink called ut5.log\n compress: config.compress || false\n }));\n}", "function rstConfiguration(name, file = '') {\n let config = ConfigurationHandler.get(name);\n let str = config ? config.toRst() : '';\n if (file) {\n fs.writeFileSync(file, str);\n }\n return file ? '' : str;\n}", "function toUrl(origPath) {\n let execPath = origPath;\n\n execPath = removeExternal(execPath);\n execPath = removeRootPath(execPath);\n execPath = relativeToHtml(execPath);\n execPath = normalizePath(execPath);\n\n if (execPath !== origPath) {\n log(\"reduce: %s => %s\", origPath, execPath);\n }\n\n const stamp = timestamp(origPath);\n\n log(\"stamp: %s @ %s\", execPath, stamp);\n\n return `${execPath}?v=${stamp}`;\n }", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__facade_lang__[\"b\" /* isBlank */])(path) ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function concatUserDefinedConfigFile() {\n var userDefinedConfigFilePath = path.join(exports.homedir, USER_DEFINED_CONFIG_FILE_NAME);\n \n if (!fs.existsSync(userDefinedConfigFilePath)) {\n return;\n }\n\n var userConfig;\n try {\n userConfig = JSON.parse(fs.readFileSync(userDefinedConfigFilePath));\n } catch (err) {\n console.log(\"ERROR: empty or malformed configuration file at '\" + userDefinedConfigFilePath +\n \"'. Config file must be in JSON format.\");\n throw err;\n }\n\n if (!userConfig.pluginDirPaths || userConfig.pluginDirPaths.length === 0) {\n return;\n }\n\n exports.config.pluginDirPaths = exports.config.pluginDirPaths.concat(userConfig.pluginDirPaths);\n exports.config.pluginInterfaceDirPaths = exports.config.pluginInterfaceDirPaths.concat(userConfig.pluginInterfaceDirPaths);\n}", "function _joinAndCanonicalizePath(parts){var path=parts[_ComponentIndex.Path];path=path==null?'':_removeDotSegments(path);parts[_ComponentIndex.Path]=path;return _buildFromEncodedParts(parts[_ComponentIndex.Scheme],parts[_ComponentIndex.UserInfo],parts[_ComponentIndex.Domain],parts[_ComponentIndex.Port],path,parts[_ComponentIndex.QueryData],parts[_ComponentIndex.Fragment]);}", "_configure() {\n super._configure();\n Object.assign(this.path, {\n root: 'dist',\n 'package-a': TargetConfigA.packagePath,\n });\n Object.assign(this, { // dependent on this.path\n });\n }", "function _joinAndCanonicalizePath(parts) {\n\t var path = parts[_ComponentIndex.Path];\n\t path = lang_1.isBlank(path) ? '' : _removeDotSegments(path);\n\t parts[_ComponentIndex.Path] = path;\n\t return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n\t}", "rollup(config) {\n const outputDir = process.cwd() + '/dist/';\n\n const [, inputFilename] = config.input.match(filenameMatcher);\n\n config.plugins = [\n postcss({\n config: {\n path: path.resolve(__dirname, './tools/postcss.config.js'),\n },\n minimize: true,\n modules: true,\n extract: 'styles.css',\n }),\n url(),\n svgr({\n ref: true,\n }),\n ...config.plugins,\n ];\n\n // Manual name changes. Not great...\n if (inputFilename === 'alpha') {\n const outputFile = config.output.file;\n const outputSubDir = `${outputDir}${inputFilename}/`;\n config.output.file = outputFile.replace(outputDir, outputSubDir);\n }\n\n return config;\n }", "function prepareDebuggerPath(...parts) {\r\n return path.join(...parts)\r\n .replace('\\\\', '\\\\\\\\')\r\n .replace('.', '\\\\.');\r\n}", "static makeRelative(basePath, fullPath) {\n return fullPath.replace(Path.wrapDirectoryPath(basePath), \"\");\n }", "function normalizeExceptionAndUri(exception, cwd) {\n return exception\n .replace(cwd, '')\n .replace(/\\\\/g, '/')\n .replace('/features', 'features')\n}", "_createLogFilepath(spawnInfo) {\n const spawnConfig = spawnInfo.config;\n const renderLocationCode = spawnConfig.renderingLocation === SpawnerTypes_1.RenderingLocation.Client ? \"csr\" : \"ssr\";\n const now = new Date();\n // Filename format: comm_scserver_<ssr|csr>_YYYY_MM_DD_HH_MM_SS_<id>.log\n const filename = `\\\ncomm_scserver_${renderLocationCode}_\\\n${now.getFullYear()}_\\\n${kTwoDigitFormatter.format(now.getMonth() + 1)}_\\\n${kTwoDigitFormatter.format(now.getDate())}_\\\n${kTwoDigitFormatter.format(now.getHours())}_\\\n${kTwoDigitFormatter.format(now.getMinutes())}_\\\n${kTwoDigitFormatter.format(now.getSeconds())}_\\\n${spawnInfo.id}.log`;\n const filepath = path.join(this._config.logAbsDir, filename);\n return filepath;\n }", "function modifyPathsInCSS(css, absolutePath) {\n\n // make relative paths within href- and src-attributes to absolute paths\n css = css.replace(\n /((?:href)|(?:src))\\s*=\\s*([\"'])?(\\w(?!\\w+:\\/\\/))/gi,\n '$1=$2' + absolutePath + '/$3'\n );\n\n return css;\n}", "updateConfigFile() {\n\t\tconst { config } = this;\n\n\t\ttry {\n\t\t\tfs.writeFileSync(configFilePath, JSON.stringify(config, null, 2));\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t}\n\t}", "resolveAsPath() { }", "function setUrl(src, str) {\n\t\t\t\tvar a = src.split(\"/\");\n\t\t\t\ta[a.length - 2] = str;\n\t\t\t\treturn a.join('/');\n\t\t\t}", "get '^\\\\/dist\\\\/(?:(?!\\\\.css|\\\\.ts|\\\\.js(?!on)|\\\\.tsx|\\\\.jsx|\\\\.mjs).)*(\\\\?.*)?$'() {\n return {\n target: `http://${api.config.frontendServer.hostname}:${api.config.frontendServer.port}`,\n changeOrigin: true,\n rewrite: (path) => {\n return path;\n },\n };\n }", "function enableLogfile() {\n exports.logfile.enabled = true;\n const removeANSIPattern = [\n '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:[a-zA-Z\\\\d]*(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n '(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))',\n ].join('|');\n const removeANSIRe = new RegExp(removeANSIPattern, 'g');\n const removeANSI = (s) => s.replace(removeANSIRe, '');\n debug_1.default.log = function (...args) {\n const formatted = util_1.default.format(args[0], ...args.slice(1)) + '\\n';\n exports.logfile.write(removeANSI(formatted));\n process.stderr.write(formatted);\n };\n}", "_remapPaths(settings, settingsCwd) {\r\n var self = this;\r\n\r\n settings.paths = _.mapValues(settings.paths, function(staticPaths) {\r\n return _.map(staticPaths, (sp) => self._remapPath(sp, settingsCwd));\r\n });\r\n\r\n let defaults = ['notFound', 'badRequest', 'internalServerError'];\r\n defaults.forEach(function(def) {\r\n if (settings[def]) {\r\n settings[def] = self._remapPath(settings[def], settingsCwd);\r\n }\r\n });\r\n }", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n }", "function makeOldURL () {\n const { paths, hosts } = transformToOld({\n paths: pathname.split('/')\n })\n return `http://${hosts.map(el => el + '.').join('')}atcoder.jp/${paths.join(\n '/'\n )}`\n }", "function resolveConfigFilePath(project_dir, platform, file) {\n var filepath = path.join(project_dir, file);\n if (file.indexOf('*') > -1) {\n // handle wildcards in targets using glob.\n var matches = glob.sync(path.join(project_dir, '**', file));\n if (matches.length) filepath = matches[0];\n } else {\n // special-case config.xml target that is just \"config.xml\". this should be resolved to the real location of the file.\n if (file == 'config.xml') {\n if (platform == 'android') {\n filepath = path.join(project_dir, 'res', 'xml', 'config.xml');\n } else {\n var matches = glob.sync(path.join(project_dir, '**', 'config.xml'));\n if (matches.length) filepath = matches[0];\n }\n }\n }\n return filepath;\n}", "function PathTransform(options, baseDir) {\n return function (context) {\n return (node) => {\n if (options.baseUrl) {\n ts.visitEachChild(node, child => {\n if (ts.isImportDeclaration(child)) {\n const specifier = child.moduleSpecifier;\n if (!ts.isStringLiteral(specifier)) {\n throw new Error('Expected child.moduleSpecifier to be StringLiteral');\n }\n let resolved = resolve(specifier.text, baseDir, options);\n if (path.isAbsolute(resolved)) {\n const sourceDir = path.dirname(node.fileName);\n resolved = path.relative(sourceDir, resolved);\n if (!/^\\./.test(resolved)) {\n resolved = `./${resolved}`;\n }\n }\n child.moduleSpecifier = ts.createLiteral(resolved);\n return child;\n }\n return undefined;\n }, context);\n }\n return node;\n };\n };\n}", "set transformPaths(value) {}", "function resolvePath(url) {\n // Redirect the base URL to the index file\n if (url === '/') {\n return indexPath;\n }\n\n // Replace \"/\"\" by \"\\\" on Window\n let filename = path.normalize(url);\n if (path.sep !== '/') {\n filename = filename.split('/').join(path.sep);\n }\n\n // Redirect /dist/* requests to the dist directory where elara is stored.\n if (filename.startsWith(distPathPrefix)) {\n return path.join(distPath, filename.substring(distPathPrefix.length - 1));\n }\n\n // Redirect all other file to the shared directory\n return path.join(sharedPath, filename);\n}", "function prepend (filename, basePath) {\n return basePath + '/' + filename\n}", "function configureEntries (entryBase) {\n return function (entries, dir) {\n var app = path.basename(dir);\n var targets = glob.sync(dir + \"/**/target.js\");\n\n targets.forEach(function(target) {\n var targetName = path.basename(path.dirname(target));\n entries[app + \"__\" + targetName] = entryBase.slice().concat([target]);\n });\n\n return entries;\n }\n}", "_rewriteCssTextBaseUrl(cssText, oldBaseUrl, newBaseUrl) {\n return cssText.replace(constants_1.default.URL, (match) => {\n let path = match.replace(/[\"']/g, '').slice(4, -1);\n path = url_utils_1.rewriteHrefBaseUrl(path, oldBaseUrl, newBaseUrl);\n return 'url(\"' + path + '\")';\n });\n }", "function makeURLsAbsolute(html){\n return html.replace(/FileLocation \\+ \\'([^\\']*)\\'/g, FileLocation + '$1');\n}", "appendLogFileToDebug(logFile) {\n if (logFile && logFile.exists() && logFile.isFile()) {\n let logData = getEnigmailFiles().readFile(logFile);\n\n EnigmailLog.DEBUG(\n `errorHandling.jsm: Process terminated. Human-readable output from gpg:\\n-----\\n${logData}-----\\n`\n );\n try {\n logFile.remove(false);\n } catch (ex) {}\n }\n }", "function getPathMappingsFromTsConfig(fs, tsConfig, projectPath) {\n if (tsConfig !== null && tsConfig.options.baseUrl !== undefined &&\n tsConfig.options.paths !== undefined) {\n return {\n baseUrl: fs.resolve(projectPath, tsConfig.options.baseUrl),\n paths: tsConfig.options.paths,\n };\n }\n }", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function logOncePlugin() {\n return {\n visitor: {\n CallExpression(path, state) {\n const opts = state.opts;\n if (\n !(\n t.isCallExpression(path.node) && path.node.callee.name === 'logOnce'\n )\n ) {\n return;\n }\n\n let file = state.file.opts.filename;\n\n if (typeof opts.resolveFile === 'function') {\n file = opts.resolveFile(file);\n } else if (!opts || opts.segments !== 0) {\n const sep = opts.splitSegment ? opts.splitSegment : '/';\n file = state.file.opts.filename.split(sep);\n let segs = file.slice(Math.max(file.length - opts.segments));\n file = segs.join('/');\n }\n\n let id = [\n file,\n path.node.loc.start.line,\n path.node.loc.start.column,\n ].join(':');\n\n path.node.arguments.unshift({\n type: 'StringLiteral',\n value: id,\n });\n },\n },\n };\n}", "function writeConfig(newConfig, configPath) {\n var fileToWrite = beautify(newConfig, null, 2, 50)\n fs.writeFile(configPath, fileToWrite)\n .then(() => {\n console.log('The new config is updated')\n })\n .catch(err => {\n console.error(err)\n })\n}", "function changeFilePaths(arr, str){\n\t\tvar _str = str;\n\t\tarr.forEach(function(path){\n\t\t\tvar replace = path.replace(base, '').split('/')[path.replace(base, '').split('/').length-1];\n\t\t\tvar search = path.replace(base, '').split('/').join('/').slice(1);\n\t\t\t_str = _str.replace(search, replace);\n\t\t})\n\t\treturn _str;\n\t}", "_normalizeOutputDir(outputDir) {\n const removedRelativePrefix = outputDir.replace(/^\\.\\//, '');\n const removeAbsolutePrefix = removedRelativePrefix.replace(process.cwd(), '');\n return removeAbsolutePrefix;\n }", "function updateLogFile(logData) {\n // uses fs library to manipulate files. This command appends to a file named log.txt and adds data passed by the aove functions along with a divider\n fs.appendFile(\"log.txt\", logData + divider, function (err) {\n\n // If the code experiences any errors it will log the error to the console.\n if (err) {\n return console.log(err);\n }\n\n // Otherwise, it will print: \"log.txt was updated!\"\n console.log(\"log.txt was updated!\");\n });\n}", "function normalizePath(src, prependPath, appendExtension) {\n if (appendExtension != null && src.charAt(src.length-4) != '.') src += appendExtension;\n if (src.substr(0, 4) != 'http') src = prependPath + src;\n return src;\n }", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n}", "function addSlash() {\n function transform(file, cb) {\n var arr = JSON.parse(String(file.contents));\n var res = {};\n\n _.each(arr, function(k, v){\n res['/' + v] = '/' + k;\n });\n\n // read and modify file contents\n file.contents = new Buffer(JSON.stringify(res));\n\n // if there was some error, just pass as the first parameter here\n cb(null, file);\n }\n\n return require('event-stream').map(transform);\n}", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function _joinAndCanonicalizePath(parts) {\n var path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function correctPath (filePath) {\n if (!filePath) {\n return\n }\n filePath = filePath.replace(/\\\\/g, '/')\n if (path.isAbsolute(filePath)) {\n return filePath\n }\n return path.join(process.cwd(), filePath)\n}", "function deriveAbsolutePathFromContext(from, context) {\n // Drop the trailing slash, require.context should always be matched against a folder\n // and we want to normalize the folder name as much as possible to prevent duplicates.\n // This also makes the files show up in the correct location when debugging in Chrome.\n const filePath = from.endsWith(_path.default.sep) ? from.slice(0, -1) : from;\n return (\n filePath +\n \"?ctx=\" +\n toHash(\n [\n context.mode,\n context.recursive ? \"recursive\" : \"\",\n new RegExp(context.filter.pattern, context.filter.flags).toString(),\n ]\n .filter(Boolean)\n .join(\" \")\n )\n );\n}", "function modifyStringForDestination(path) {\n\n // chnage location from src to dist and then remove file name...\n // replace src to dist\n var fileDistination = path.replace(\"src\", 'build');\n\n var arrayOfString = null;\n if (fileDistination.split('/').length > 1) {\n arrayOfString = fileDistination.split('/');\n } else {\n arrayOfString = fileDistination.split('\\\\');\n }\n\n // remove file name from the end\n fileDistination = fileDistination.replace(arrayOfString.pop(), '');\n\n return fileDistination;\n}", "function _joinAndCanonicalizePath(parts) {\n let path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function _joinAndCanonicalizePath(parts) {\n let path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function _joinAndCanonicalizePath(parts) {\n let path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function _joinAndCanonicalizePath(parts) {\n let path = parts[_ComponentIndex.Path];\n path = path == null ? '' : _removeDotSegments(path);\n parts[_ComponentIndex.Path] = path;\n return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);\n}", "function relPath() {\n return '.' + path.sep + path.join.apply(null, arguments);\n}", "function writeConfig(answers, config) {\n var ext = answers.config.toLocaleLowerCase().endsWith('.json') ? 'json' : 'yml';\n var content = ext === 'json' ? JSON.stringify(config) : YAML.stringify(config);\n var fullPath = path_1.resolve(process.cwd(), answers.config);\n var relativePath = path_1.relative(process.cwd(), answers.config);\n fs_1.writeFileSync(fullPath, content, {\n encoding: 'utf-8'\n });\n return {\n relativePath: relativePath,\n fullPath: fullPath\n };\n}", "function writeWebpackConfig (entries) {\n const ws = fs.createWriteStream(WEBPACK_CONFIG_PATH)\n ws.write(CONTENT1)\n ws.write(entries.map(entry => ` '${entry}',`).join('\\n'))\n ws.write(CONTENT2)\n ws.end()\n}", "function _newPath(p){\n return path.join(dcat.root, path.relative(rootTargz, p));\n }", "function expandFilePathInOutput(output, cwd) {\n const lines = output.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n const matches = lines[i].match(/\\s*(\\S+\\.go):(\\d+):/);\n if (matches && matches[1] && !path.isAbsolute(matches[1])) {\n lines[i] = lines[i].replace(matches[1], path.join(cwd, matches[1]));\n }\n }\n return lines.join('\\n');\n}", "function expandFilePathInOutput(output, cwd) {\n const lines = output.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n const matches = lines[i].match(/\\s*(\\S+\\.go):(\\d+):/);\n if (matches && matches[1] && !path.isAbsolute(matches[1])) {\n lines[i] = lines[i].replace(matches[1], path.join(cwd, matches[1]));\n }\n }\n return lines.join('\\n');\n}", "webpack(config) {\n config.resolve.alias['@root'] = path.join(__dirname);\n config.resolve.alias['@components'] = path.join(__dirname, 'components');\n config.resolve.alias['@pages'] = path.join(__dirname, 'pages');\n config.resolve.alias['@services'] = path.join(__dirname, 'services');\n return config;\n }", "function configureRename() {\n config.rename = {\n extname: \".min.js\"\n };\n }", "function sourceDataURI(conf) {\n if (conf.uri) {\n return conf.uri;\n } else if (conf.blob) {\n return 'file:' + conf.blob.name;\n } else if (conf.bwgBlob) {\n return 'file:' + conf.bwgBlob.name;\n } else if (conf.bamBlob) {\n return 'file:' + conf.bamBlob.name;\n } else if (conf.twoBitBlob) {\n return 'file:' + conf.twoBitBlob.name;\n }\n\n return conf.bwgURI || conf.bamURI || conf.jbURI || conf.twoBitURI || 'https://www.biodalliance.org/magic/no_uri';\n}", "writeConfiguration() {\n\t\tconst p = fso.CreateTextFile(this.path, true, true);\n\t\tp.WriteLine('/* Configuration file for Georgia. Manual changes to this file will take effect');\n\t\tp.WriteLine(' on the next reload. To ensure changes are not overwritten or lost, reload theme');\n\t\tp.WriteLine(' immediately after manually changing values. */');\n\t\tp.WriteLine('{');\n\t\tp.WriteLine(`\\t\"configVersion\": \"${currentVersion}\", // used to update saved configs. You probably shouldn't manually edit this.`)\n\t\tthis._configuration.forEach((conf, i) => {\n\t\t\tconst container = conf.definition.container === ConfigurationObjectType.Array ? '[' : '{';\n\t\t\tp.WriteLine(`\\t\"${conf.definition.name}\": ${container}`);\n\t\t\tif (conf.definition.comment) {\n\t\t\t\tlet line = conf.definition.comment;\n\t\t\t\tlet done = false;\n\t\t\t\twhile (!done) {\n\t\t\t\t\tconst lineLen = 100;\n\t\t\t\t\tif (line.length < lineLen) {\n\t\t\t\t\t\tp.WriteLine(`\\t\\t// ${line.trim()}`);\n\t\t\t\t\t\tdone = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst idx = line.lastIndexOf(' ', lineLen);\n\t\t\t\t\t\tp.WriteLine(`\\t\\t// ${line.substr(0, idx).trim()}`);\n\t\t\t\t\t\tline = line.substr(idx);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (conf.definition.fields) {\n\t\t\t\t// array of fields\n\t\t\t\tfor (let i=0; i < conf.values.length; i++) {\n\t\t\t\t\tlet entry = '';\n\t\t\t\t\tif (conf.definition.container === ConfigurationObjectType.Array) {\n\t\t\t\t\t\tconf.definition.fields.forEach(field => {\n\t\t\t\t\t\t\tif (!field.optional || conf.values[i][field.name]) {\n\t\t\t\t\t\t\t\tconst quotes = typeof conf.values[i][field.name] === 'string' ? '\"': '';\n\t\t\t\t\t\t\t\tentry += `, \"${field.name}\": ${quotes}${conf.values[i][field.name]}${quotes}`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tentry = `{${entry.substr(1)} }`;\n\t\t\t\t\t}\n\t\t\t\t\tconst comment = conf.values[i].comment ? ' // ' + conf.values[i].comment : '';\n\t\t\t\t\tp.WriteLine(`\\t\\t${entry}${i < conf.values.length - 1 ? ',' : ''}${comment}`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (conf.definition.container === ConfigurationObjectType.Array) {\n\t\t\t\t\t// array of comma separated entries\n\t\t\t\t\tconf.values.forEach((val, i) => {\n\t\t\t\t\t\tp.WriteLine(`\\t\\t\"${val.replace(/\\\\/g, '\\\\\\\\')}\"${i < conf.values.length - 1 ? ',' : ''}`);\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\t// object with key/value pairs\n\t\t\t\t\tconst keys = Object.keys(conf.values);\n\t\t\t\t\tkeys.forEach((key, i) => {\n\t\t\t\t\t\tconst comment = conf.comments[key] ? ` // ${conf.comments[key]}` : '';\n\t\t\t\t\t\tconst quotes = typeof conf.values[key] === 'string' ? '\"': '';\n\t\t\t\t\t\tp.WriteLine(`\\t\\t\"${key}\": ${quotes}${conf.values[key]}${quotes}${i < keys.length - 1 ? ',' : ''}${comment}`)\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst closeContainer = conf.definition.container === ConfigurationObjectType.Array ? ']' : '}';\n\t\t\tp.WriteLine(`\\t${closeContainer}${i < this._configuration.length - 1 ? ',' : ''}`);\n\t\t});\n\t\tp.WriteLine('}');\n\t\tp.Close();\n\t}", "function trailingSlash(filePath) {\n return _path2.default.normalize(`${filePath}/`);\n}", "function normalizeConfig (config = {}) {\n // Normalize cwd.\n config.cwd = config.cwd || process.cwd()\n\n // Normalize bundlers and content.\n if (typeof config.bundlers === 'string') {\n config.bundlers = config.bundlers.split(/,?\\s+/)\n }\n if (!config.content) {\n config.content = ''\n }\n\n // Process source globs. Make sure source is iterable.\n if (\n (!config.content && globby.hasMagic(config.source)) ||\n (!config.content &&\n typeof config.source === 'string' &&\n fs.statSync(config.source).isDirectory())\n ) {\n config.source = globby.sync(config.source, { dot: true })\n } else if (typeof config.source === 'string') {\n config.source = config.source.split(/,?\\s+/)\n }\n\n // If output is a directory OR if it contains [name] or [ext], process source path files as separate staks. Otherwise process\n // source as a single stak.\n if (config.output) {\n config.stakEachFile =\n config.stakEachFile ||\n config.output.indexOf('[name]') > -1 ||\n isDirectory(config.output)\n // If we're bundling each file, make sure the output path's basename template is set.\n if (config.stakEachFile && config.output.indexOf('[name]') === -1) {\n config.output = path.join(config.output, '[name].[ext]')\n }\n }\n\n // Return normalized config profile.\n return config\n}", "function replaceConfig(config) {\n _buildConfig = config;\n}", "function config() {\n global.config.build.rootDirectory = path.join('../EquiTrack/assets/frontend/', global.config.appName);\n global.config.build.templateDirectory = path.join('../EquiTrack/templates/frontend/', global.config.appName);\n global.config.build.bundledDirectory = '.';\n indexPath = path.join(global.config.build.rootDirectory, 'index.html');\n bowerPath = path.join(global.config.build.rootDirectory, 'bower.json');\n templatePath = global.config.build.templateDirectory;\n}", "function resolveRelativeUrls(srcFilePath, relativePath) {\n\treturn path.join(path.dirname(srcFilePath), relativePath);\n\t}", "replacePublicPath(compiler) {\n const { mainTemplate } = compiler\n this.getHook(mainTemplate, 'require-extensions')((source, chunk, hash) => {\n const buildCode = [\n 'try {',\n ` return '${this.LOCAL_WEBPACK_SERVER.URI}/';`,\n '} catch (e) {',\n `console.error(\"${\n this.PLUGIN_NAME\n }: There was a problem with the public path.\")`,\n '}',\n ].join('\\n')\n\n return [\n source,\n `// ProxyPackDynamicUrl`,\n 'Object.defineProperty(' + mainTemplate.requireFn + ', \"p\", {',\n ' get: function () {',\n buildCode,\n ' }',\n '})',\n ].join('\\n')\n })\n }", "_setDomModuleAssetpaths(ast, oldBaseUrl, newBaseUrl) {\n const domModules = dom5.queryAll(ast, matchers.domModuleWithoutAssetpath);\n for (let i = 0, node; i < domModules.length; i++) {\n node = domModules[i];\n const assetPathUrl = this.bundler.analyzer.urlResolver.relative(newBaseUrl, url_utils_1.stripUrlFileSearchAndHash(oldBaseUrl));\n // There's no reason to set an assetpath on a dom-module if its\n // different from the document's base.\n if (assetPathUrl !== '') {\n dom5.setAttribute(node, 'assetpath', assetPathUrl);\n }\n }\n }", "init() {\n module_utils.patchModule(\n 'winston/lib/winston/logger',\n 'write',\n writeWrapper,\n Logger => Logger.prototype\n );\n }", "rollup(config, options) {\n console.log(config);\n const originalExternal = config.external;\n config.external = function (id) {\n if (id.startsWith(`unist-util-`)) {\n return false;\n }\n return originalExternal(id);\n };\n return config;\n }", "function r(r){let e,t;return r.replace(/^(.*\\/)?([^/]*)$/,((r,a,i)=>(e=a||\"\",t=i||\"\",\"\"))),{dirPart:e,filePart:t}}", "function correctUrl(url) {\n\tvar element;\n\t// we eliminate the prefix so that the url is compatible with the requested apache format\n\tif(url.indexOf(\"https://\") > -1 || url.indexOf(\"http://\") > -1){\t\n\t\tconsole.log(\"If you include https: // or http: // in the url it will be automatically deleted\");\t\n\t\tif (url.indexOf(\"https://\") > -1) {\n\t\t\tvar url = url.replace(\"https://\", \"\");\n\t\t}\n\t\tif (url.indexOf(\"http://\") > -1) {\n\t\t\tvar url = url.replace(\"http://\", \"\");\n\t\t}\n\t}\n\t// add the suffix .local so that the url is friendly in development\n\tif(url.slice(-6) != \".local\") {\n\t\tconsole.log(\"If you do not include .local in the url it is automatically added\");\n\t\telement = url + \".local\";\n\t}else{\n\t\telement = url;\n\t}\n\tproject.url = element;\n}", "getFilePath() {\n let filePath = callsites()[2].getFileName(); // [0] and [1] return global fractal.config.js.\n return filePath.replace('.js', '.yml');\n }", "static encodePath(filePath) {\n filePath = filePath.replace(/\\\\/g, \"/\");\n const encodePathConfig = this.getConfig().encodePath;\n if (encodePathConfig == \"encodeURI\") {\n filePath = encodeURI(filePath);\n }\n else if (encodePathConfig == \"encodeSpaceOnly\") {\n filePath = filePath.replace(/ /g, \"%20\");\n }\n return filePath;\n }", "function vivify_log_links(element) {\n element.innerHTML = element.innerHTML.replace(/ (https:\\S+\\.log\\.html)/,\n function(match, url) {\n return \" <a href=\\\"\" + url + \"\\\" target=\\\"_blank\\\">\" + url + \"</a>\";\n });\n}", "extend(config, ctx) {\n config.devtool = \"source-map\";\n\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/,\n options: {\n fix: true,\n },\n });\n }\n\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.txt$/,\n loader: \"raw-loader\",\n exclude: /(node_modules)/,\n });\n }", "setRoutesFromConfig() {\n //iterate over each host and in it iterate over each route and build the route\n this.config && this.config.hosts && this.config.hosts.forEach(host => {\n console.log(chalk.cyanBright(`Host ${host.host} routes:`))\n host.routes && host.routes.forEach(route => {\n this.buildSingleRoute(host, route)\n })\n })\n }", "function abspath2rel(base_path, target_path) {\n var tmp_str = '';\n base_path = base_path.split('/');\n base_path.pop();\n target_path = target_path.split('/');\n while(base_path[0] === target_path[0]) {\n base_path.shift();\n target_path.shift();\n }\n for (var i = 0; i< base_path.length; i++) {\n tmp_str += '../';\n }\n return tmp_str + target_path.join ('/');\n }", "_expandListenConfig(listens) {\n return listens.map(item => {\n // Subdomain-marked records must have a subdomain (or multiple)\n if (item.charAt(0) == '.') {\n item = '*' + item;\n }\n\n // Add the protocols\n item = '*://' + item;\n\n // Add the ending slash, if none is present (required for listen directives)\n const indexProto = item.indexOf('//');\n const indexPathSlash = (indexProto >= 0) ? item.indexOf('/', indexProto + 2) : item.indexOf('/');\n if (indexPathSlash == -1) {\n item += '/';\n }\n\n // Add the ending wildcard\n item += '*';\n\n // Result\n return item;\n });\n }", "function fixDestination(destination) {\n const slashesRegex = /\\/\\//g;\n return destination.replace(slashesRegex, '/');\n}" ]
[ "0.54720616", "0.5089851", "0.50360763", "0.5010054", "0.4969121", "0.49680153", "0.4944592", "0.49240178", "0.47732988", "0.47269222", "0.469177", "0.46910536", "0.46713278", "0.46398327", "0.46238816", "0.46063665", "0.45993313", "0.45690107", "0.45314348", "0.4530905", "0.44880036", "0.44619435", "0.44484782", "0.44429225", "0.4432754", "0.4428295", "0.44278616", "0.44254813", "0.4404904", "0.4392894", "0.43859398", "0.43767458", "0.43631777", "0.4361671", "0.43603393", "0.43566126", "0.43509772", "0.43474376", "0.43327317", "0.4329204", "0.43208835", "0.43204474", "0.43166417", "0.43163633", "0.43107113", "0.43050236", "0.4304977", "0.42894608", "0.4280997", "0.4273102", "0.42718548", "0.42629334", "0.42558914", "0.42517358", "0.42499498", "0.42481825", "0.42469612", "0.42467466", "0.42451304", "0.42293435", "0.4228043", "0.42271197", "0.42271197", "0.42271197", "0.42127562", "0.4209291", "0.42057583", "0.41898045", "0.41898045", "0.41898045", "0.41898045", "0.41825527", "0.41811198", "0.41798255", "0.41744077", "0.41711867", "0.41711867", "0.41711372", "0.4168601", "0.4157477", "0.41520348", "0.4147689", "0.41423848", "0.41411793", "0.4136026", "0.41301596", "0.41280523", "0.41088843", "0.4107791", "0.41048598", "0.41028082", "0.409368", "0.4090686", "0.409015", "0.40872374", "0.40862915", "0.40853792", "0.4084295", "0.40764594", "0.40727985" ]
0.54788125
0
function to format date
function getDate(unixTime){ var time = new Date(unixTime * 1000); var day1 = time.getDate().toString(); if(day1.length < 2){ var day = '0' + day1; }else { var day = day1; } var month1 = (time.getMonth() + 1).toString(); if(month1.length < 2){ var month = '0' + month1; }else { var month = month1; } var year = time.getFullYear(); var date = day + '/' + month + '/' + year; return date; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth() + 1; //Months are zero based\n var year = date.getFullYear();\n var formattedDate = year + \"-\" + month + \"-\" + day;\n return formattedDate;\n }", "function formatDate(date)\n{\n g_date=date.getDate();\n if(g_date <=9)\n {\n g_date=\"0\"+g_date;\n }\n g_month=date.getMonth();\n g_year=date.getFullYear();\n if (g_year < 2000) g_year += 1900;\n return todaysMonthName(date)+\" \"+g_date+\", \"+g_year;\n}", "function formattedDate(date) {\n\n // Récupération\n var month = String(date.getMonth() + 1);\n var day = String(date.getDate());\n var year = String(date.getFullYear());\n\n // Ajout du 0\n if (month.length < 2) \n month = '0' + month;\n\n // Ajout du 0\n if (day.length < 2) \n day = '0' + day;\n\n return day+'/'+month+'/'+year;\n }", "function formatDate(date) {\n \n var dd = date.getDate();\n if (dd < 10) {\n dd = '0' + dd;\n }\n \n var mm = date.getMonth() + 1;\n if (mm < 10) {\n mm = '0' + mm;\n }\n \n var yy = date.getFullYear();\n if (yy < 10) {\n yy = '0' + yy;\n }\n \n return mm + '/' + dd + '/' + yy;\n }", "function formattedDate(date) {\r\n\t\t\t\t\tvar d = new Date(date),\r\n\t\t\t\t\t\tmonth = '' + (d.getMonth() + 1),\r\n\t\t\t\t\t\tday = '' + d.getDate(),\r\n\t\t\t\t\t\tyear = d.getFullYear();\r\n\r\n\t\t\t\t\tif (month.length < 2) month = '0' + month;\r\n\t\t\t\t\tif (day.length < 2) day = '0' + day;\r\n\t\t\t\t\treturn [year, month, day].join('-');\r\n\t\t\t\t}", "function formatDate(date) {\n var day = date.getDate();\n if (day < 10) {\n day = \"0\" + day;\n }\n\n var month = date.getMonth() + 1;\n if (month < 10) {\n month = \"0\" + month;\n }\n\n var year = date.getFullYear();\n\n return day + \".\" + month + \".\" + year;\n}", "function formatDate(date) {\n var day = (\"0\" + date.getDate()).slice(-2);\n var month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n var year = date.getFullYear().toString().slice(-2);\n return day + month + year;\n}", "formatDate (date){\n var d = new Date(date),\n month = (d.getMonth() + 1),\n day = d.getDate(),\n year = d.getFullYear();\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n return [year, month, day].join('-');\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [year, month, day].join('-');\n }", "function formatDate(date){\n var yyyy = date.getFullYear();\n var mm = date.getMonth() + 1;\n var dd = date.getDate();\n //console.log(\"This is dd\" + dd);\n if(dd<10){\n dd='0'+ dd;\n }\n if(mm<10){\n mm='0'+mm;\n } \n return ( mm + '/' + dd + '/' + yyyy);\n \n }", "function formatDate(date, format){\n if(!date){\n return '0000-00-00';\n }\n var dd = date.substring(0, 2);\n var mm = date.substring(3, 5);\n var yy = date.substring(6);\n if (format == 'dmy') {\n return dd + '-' + mm + '-' + yy;\n } else {\n return yy + '-' + mm + '-' + dd;\n }\n }", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "function formatDate(date) {\r\n\r\n let dd = date.getDate();\r\n if (dd < 10) dd = '0' + dd;\r\n\r\n let mm = date.getMonth() + 1;\r\n if (mm < 10) mm = '0' + mm;\r\n\r\n let yy = date.getFullYear() % 100;\r\n if (yy < 10) yy = '0' + yy;\r\n\r\n return dd + '.' + mm + '.' + yy;\r\n}", "function dateFormatter(date){\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n var day = date.getDate();\n return year + '-' + ('0' + month).slice(-2) + '-' + day; // the '0' and the slicing is for left padding\n}", "function formatDate(date) {\n\t\t\t\treturn date.getDate() + \"-\" + (date.getMonth()+1) + \"-\" + date.getFullYear();\n\t\t\t}", "function formatDate() {\n var d = new Date(),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n \n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n \n return [day, month, year].join('/');\n }", "function formatDate(date) {\n var dd = date.getDate()\n if (dd < 10) dd = '0' + dd;\n var mm = date.getMonth() + 1\n if (mm < 10) mm = '0' + mm;\n var yy = date.getFullYear();\n if (yy < 10) yy = '0' + yy;\n return dd + '.' + mm + '.' + yy;\n}", "function formatDate(date) {\n if (date.length < 2) {\n return \"0\" + date;\n } else {\n return date;\n }\n}", "function formatDate(date) {\n\tif (date == null) {\n\t\treturn null;\n\t}\n\tvar d = date.getDate();\n\tvar m = date.getMonth() + 1;\n\tvar y = date.getFullYear();\n\treturn '' + (d <= 9 ? '0' + d : d) + '-' + (m <= 9 ? '0' + m : m) + '-' + y;\n}", "function formatDate(date){\n\tvar day = date.getDate();\n var monthIndex = date.getMonth();\n var year = date.getFullYear();\n\treturn months[monthIndex] + \" \" + day + \", \" + year;\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) {\n month = '0' + month;\n }\n if (day.length < 2) {\n day = '0' + day;\n }\n\n return [year, month, day].join('-');\n}", "function formatDate(d) {\n return `${d.year}-${d.month}-${d.day}`\n }", "function formatDate(date) {\n const month = date.getMonth() + 1;\n const day = date.getDate();\n const year = date.getFullYear();\n \n return `${month}/${day}/${year}`;\n }", "formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n return [year, month, day].join('-');\n }", "function formatDate(date) {\n let source = new Date(date);\n let day = source.getDate();\n let month = source.getMonth() + 1;\n let year = source.getFullYear();\n\n return `${day}/${month}/${year}`;\n }", "function formatDate(date){\n var dd = date.getDate(),\n mm = date.getMonth()+1, //January is 0!\n yyyy = date.getFullYear();\n\n if(dd<10) dd='0'+dd;\n if(mm<10) mm='0'+mm;\n\n return yyyy+'-'+mm+'-'+dd;\n}", "function formatDate(date) {\n return format(new Date(date), 'yyyy-MM-dd')\n}", "function dateFormat(i){\n var date = data.list[i].dt_txt;\n var year = date.slice(0,4);\n var day = date.slice(5,7);\n var month = date.slice(8,10);\n\n var newDateFormat = day + \"/\" + month + \"/\" + year;\n console.log(newDateFormat);\n return newDateFormat;\n }", "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n }", "function formatDate(val) {\n var d = new Date(val),\n day = d.getDate(),\n month = d.getMonth() + 1,\n year = d.getFullYear();\n\n if (day < 10) {\n day = \"0\" + day;\n }\n if (month < 10) {\n month = \"0\" + month;\n }\n return month + \"/\" + day + \"/\" + year;\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n return [year, month, day].join('-');\n }", "function formatDate(date) {\n var d = new Date(date);\n d = d.toLocaleString();\n return d;\n }", "function formatDate(date) {\r\n date = new Date(date);\r\n let DD = date.getDate();\r\n if (DD < 10) {\r\n DD = \"0\" + DD;\r\n }\r\n let MM = date.getMonth() +1;\r\n if (MM < 10) {\r\n MM = \"0\" + MM;\r\n }\r\n const YYYY = date.getFullYear();\r\n return DD + \"/\" + MM + \"/\" + YYYY;\r\n}", "function get_formatted_date(date) {\n function get_formatted_num(num, expected_length) {\n var str = \"\";\n var num_str = num.toString();\n var num_zeros = expected_length - num_str.length;\n for (var i = 0; i < num_zeros; ++i) {\n str += '0';\n }\n str += num_str;\n return str;\n }\n var msg = get_formatted_num(date.getFullYear(), 4) + \"-\";\n msg += get_formatted_num(date.getMonth() + 1, 2) + \"-\";\n msg += get_formatted_num(date.getDate(), 2) + \" \";\n msg += get_formatted_num(date.getHours(), 2) + \":\";\n msg += get_formatted_num(date.getMinutes(), 2) + \":\";\n msg += get_formatted_num(date.getSeconds(), 2);\n return msg;\n}", "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "function getFormattDate(date) {\n let month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : \"0\" + month;\n\n let day = date.getDate().toString();\n day = day.length > 1 ? day : \"0\" + day;\n\n return (date.getFullYear() + \"-\" + month + \"-\" + day);\n}", "function formatDate(date) {\n\t\tvar day = date.getDate();\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(day / 10) == 0) {\n\t\t\tday = \"0\" + day;\n\t\t}\n\t\t\n\t\tvar month = date.getMonth() + 1; // months start at 0\n\t\t\n\t\t// Add '0' if needed\n\t\tif (parseInt(month / 10) == 0) {\n\t\t\tmonth = \"0\" + month;\n\t\t}\n\t\t\n\t\tvar year = date.getFullYear();\n\t\t\n\t\treturn day + \"/\" + month + \"/\" + year;\n\t}", "function formatDate(date){\n var yr = date.getFullYear();\n var mnth = date.getMonth()+1;\n if(mnth < 10){\n mnth = `0${mnth}`;\n }\n var day = date.getDate()\n if(day < 10){\n day = `0${day}`;\n }\n return yr+\"-\"+mnth+\"-\"+day;\n}", "function formatDate(date) {\r\n var d = date ? new Date(date) : new Date()\r\n month = '' + (d.getMonth() + 1),\r\n day = '' + d.getDate(),\r\n year = d.getFullYear();\r\n if (month.length < 2)\r\n month = '0' + month;\r\n if (day.length < 2)\r\n day = '0' + day;\r\n\r\n return `${day}${month}${year}`;\r\n}", "function formatDate(date) {\n return date.getFullYear() + '-' +\n (date.getMonth() < 9 ? '0' : '') + (date.getMonth()+1) + '-' +\n (date.getDate() < 10 ? '0' : '') + date.getDate();\n}", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toISOString()).substr(0, 10).split('-');\n return dateFns.format(new Date(\n year,\n (month - 1),\n day,\n ), format);\n }", "function formatDate(date) {\n\t\treturn (date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear() + ' - ' + formatTime([date.getHours(), date.getMinutes()]));\n\t}", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "_format(dtf, date) {\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setUTCFullYear` and `setUTCHours` instead.\n const d = new Date();\n d.setUTCFullYear(date.getFullYear(), date.getMonth(), date.getDate());\n d.setUTCHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());\n return dtf.format(d);\n }", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth();\n var year = date.getFullYear();\n month++;\n if (month < 10)\n month = '0' + month;\n if (day < 10)\n day = '0' + day;\n return [year, month, day].join('-').toString();\n}", "function formatDate(date) {\n\treturn new Date(date.split(' ').join('T'))\n}", "formatDate(date) {\n return date.toISOString().replaceAll(\"-\", \"\").substring(0, 8);\n }", "function formatteddate(inputDate){\r\n var inDate = new Date(inputDate);\r\n var month = '' + (inDate.getMonth() + 1);\r\n var day = '' + inDate.getDate();\r\n var year = inDate.getFullYear();\r\n \t if (month.length < 2) month = '0' + month;\r\n \t if (day.length < 2) day = '0' + day;\r\n return [year, month, day].join('-');\r\n }", "function formatDate(date) {\r\n var day = '',\r\n month = '',\r\n year = '',\r\n tmp = [],\r\n str = '';\r\n tmp = date.split('/');\r\n day = tmp[1];\r\n month = tmp[0];\r\n year = '20' + tmp[2];\r\n str = year + '-' + month + '-' + day;\r\n return str;\r\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) {\n \tmonth = '0' + month;\n }\n if (day.length < 2) {\n \tday = '0' + day;\n }\n return [year, month, day].join('-');\n}", "function formatDate(date) {\n return date.replace(/(^\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})$/, '$4.$3.$1')\n}", "date_lisible_format(date){\n var day = date.substring(0, 2),\n month_number = date.substring(3, 5),\n year = date.substring(6, 10);\n\n const Date_Month_Key = new Map([[\"01\", \"Janvier\"], [\"02\", \"Fevrier\"], [\"03\", \"Mars\"], [\"04\", \"Avril\"], [\"05\", \"Mai\"], [\"06\", \"Juin\"], [\"07\", \"Juillet\"], [\"08\", \"Août\"], [\"09\", \"Septembre\"], [\"10\", \"Octobre\"], [\"11\", \"Novembre\"], [\"12\", \"Decembre\"]]); \n var month = Date_Month_Key.get(month_number);\n\n var date_format = day+\" \"+month+\" \"+year;\n\n return date_format;\n }", "function formatDate(date, format) {\n return format\n .replace(/yyyy/i, util_toString(date.getFullYear()))\n .replace(/MM/i, lpad(date.getMonth() + 1))\n .replace(/M/i, util_toString(date.getMonth()))\n .replace(/dd/i, lpad(date.getDate()))\n .replace(/d/i, util_toString(date.getDate()));\n}", "function formatDate(date){\n\treturn [date.getFullYear(), \n\t\t\t(((date.getMonth()+1)<10)?\"0\":\"\") + (date.getMonth()+1),\n\t\t\t((date.getDate()<10)?\"0\":\"\") + date.getDate()\n\t\t ].join(\"-\");\n}", "function formatDate(date) {\n const d = new Date(date);\n return d.getFullYear() + \"-\" + twoDigits(d.getMonth() + 1) + \"-\" + twoDigits(d.getDate());\n}", "function formattedDate(d) {\n let month = String(d.getMonth() + 1);\n let day = String(d.getDate());\n const year = String(d.getFullYear());\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return `${year}-${month}-${day}`;\n }", "function formatDate(date) {\r\n return date.getFullYear().toString() + (date.getMonth() + 1).toString().padStart(2, '0') + date.getDate().toString() \r\n + date.getHours().toString().padStart(2, '0') + date.getMinutes().toString().padStart(2, '0');\r\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n\n return [year, month, day].join('-');\n }", "function dateformat(date) {\n \n // Main array that will be used to sort out the date.\n let dateArray = date.split('-');\n // Sorts days\n let dayArray = dateArray[2].split('T');\n let day = dayArray[0];\n // Sets up month and year months\n let month = dateArray[1];\n let year = dateArray[0];\n // Using the global standard or writing DOB\n let formatedDOB = [day, month, year].join('-');\n // Retuns the data from the formatted DOB.\n return formatedDOB;\n }", "function formatDate(date) {\n result = \"\";\n if (date) {\n result += date.getDate() + \"/\"; // Day\n result += (date.getMonth() + 1) + \"/\";\n result += (date.getYear() + 1900);\n }\n return result;\n}", "function formatDate(date){\n var date_array = date.split('-');\n return date_array[1] + '/' + date_array[2] + '/' + date_array[0]\n }", "function formatDate ( date ) {\n return date.getDate() + nth(date.getDate()) + \" \" +\n months[date.getMonth()] + \" \" +\n date.getFullYear();\n}", "function formatDate(date) {\n let year = date.getFullYear();\n let month = date.getMonth() + 1;\n let day = date.getDate();\n return [year, month, day].join('-');\n}", "getFormattedDate(date) {\n return dayjs(date).format(\"MMM MM, YYYY\");\n }", "function formatDate(date) {\n\tvar datum = new Date(date);\n\tvar jahr = datum.getFullYear();\n\tvar month_number = datum.getMonth();\n\tvar monat = \"\";\n\tswitch(month_number) {\n\t\tcase 0:\n\t\t\tmonat = \"Januar\"; break;\n\t\tcase 1:\n\t\t\tmonat = \"Februar\"; break;\n\t\tcase 2:\n\t\t\tmonat = \"März\"; break;\n\t\tcase 3:\n\t\t\tmonat = \"April\"; break;\n\t\tcase 4:\n\t\t\tmonat = \"Mai\"; break;\n\t\tcase 5:\n\t\t\tmonat = \"Juni\"; break;\n\t\tcase 6:\n\t\t\tmonat = \"Juli\"; break;\n\t\tcase 7:\n\t\t\tmonat = \"August\"; break;\n\t\tcase 8:\n\t\t\tmonat = \"September\"; break;\n\t\tcase 9:\n\t\t\tmonat = \"Oktober\"; break;\n\t\tcase 10:\n\t\t\tmonat = \"November\"; break;\n\t\tcase 11:\n\t\t\tmonat = \"Dezember\"; break;\n\t}\n\tvar tag = datum.getDate();\n\tvar stunden = datum.getHours();\n\tvar min = datum.getMinutes();\n\t// bei den Minuten und Stunden fehlt wenn sie einstellig sind die erste 0\n\tif (stunden < 10) {\n\t\tif (min < 10) {\n\t\t\treturn tag+\". \"+monat+\" \"+jahr+\", 0\"+stunden+\":0\"+min;\n\t\t}\n\t\treturn tag+\". \"+monat+\" \"+jahr+\", 0\"+stunden+\":\"+min;\n\t} else if (min < 10) {\n\t\treturn tag+\". \"+monat+\" \"+jahr+\", \"+stunden+\":0\"+min;\n\t}\n\treturn tag+\". \"+monat+\" \"+jahr+\", \"+stunden+\":\"+min;\n}", "function FormatDate(DateToFormat) {\r\nvar year = \"\";\r\nvar month = \"\";\r\nvar day = \"\";\r\n\r\nyear = DateToFormat.getFullYear();\r\nmonth = DateToFormat.getMonth() + 1;\r\nmonth = \"0\" + month;\r\nif (month.length == 3) { \r\nmonth = month.substr(1,2);\r\n}\r\nday = \"0\" + DateToFormat.getDate();\r\nif (day.length == 3) {\r\nday = day.substr(1,2);\r\n}\r\n\r\nreturn year + \"-\" + month + \"-\" + day;\r\n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return [year, month, day].join('-');\n }", "function formatDate (date) {\n if (date) {\n const year = date.getFullYear()\n const month = date.getMonth() + 1\n const day = date.getDate()\n return year + '-' + month.toString().padStart(2, '0') + '-' + day.toString().padStart(2, '0')\n } else {\n return ''\n }\n}", "function _getFormattedDate(date) {\n var year = date.getFullYear();\n var month = (1 + date.getMonth()).toString();\n month = month.length > 1 ? month : '0' + month;\n var day = date.getDate().toString();\n day = day.length > 1 ? day : '0' + day;\n return month + '/' + day + '/' + year;\n }", "function formatDate(){\n if (!Date.prototype.toISODate) {\n Date.prototype.toISODate = function() {\n return this.getFullYear() + '-' +\n ('0'+ (this.getMonth()+1)).slice(-2) + '-' +\n ('0'+ this.getDate()).slice(-2);\n }\n }\n }", "function GetFormatDate() {\n\tvar d = new Date();\n\tvar yyyy = d.getFullYear();\n\tvar mm = d.getMonth() < 9 ? \"0\" + (d.getMonth() + 1) : (d.getMonth() + 1); // getMonth() is zero-based\n\tvar dd = d.getDate() < 10 ? \"0\" + d.getDate() : d.getDate();\n\tvar hh = d.getHours() < 10 ? \"0\" + d.getHours() : d.getHours();\n\tvar min = d.getMinutes() < 10 ? \"0\" + d.getMinutes() : d.getMinutes();\n\tvar ss = d.getSeconds() < 10 ? \"0\" + d.getSeconds() : d.getSeconds();\n\treturn \"\".concat(yyyy).concat(\"-\").concat(mm).concat(\"-\").concat(dd).concat(\" \").concat(hh).concat(\":\").concat(min).concat(\":\").concat(ss);\n}", "static formatDate (date, format) {\n let year = date.getFullYear(),\n month = Timer.zero(date.getMonth()+1),\n day = Timer.zero(date.getDate()),\n hours = Timer.zero(date.getHours()),\n minute = Timer.zero(date.getMinutes()),\n second = Timer.zero(date.getSeconds()),\n week = date.getDay();\n return format.replace(/yyyy/g, year)\n .replace(/MM/g, month)\n .replace(/dd/g, day)\n .replace(/hh/g, hours)\n .replace(/mm/g, minute)\n .replace(/ss/g, second)\n .replace(/ww/g, Timer.weekName(week));\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2)\n month = '0' + month;\n if (day.length < 2)\n day = '0' + day;\n\n return [year, month, day].join('-');\n}", "function formattedDate(d = new Date()) {\n return [d.getDate(), d.getMonth() + 1, d.getFullYear()]\n .map((n) => (n < 10 ? `0${n}` : `${n}`))\n .join(\"/\")\n .concat(` at ${getTime(d)}`);\n }", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n\n return [year, month, day].join('-');\n}", "formatDate(x) {\n let date = new Date(x)\n let _month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1\n let _date = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()\n let _hour = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours()\n let _minute = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes()\n let _second = date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds()\n let dateStr = `${date.getFullYear()}-${_month}-${_date} ${_hour}:${_minute}:${_second}`\n return dateStr\n }", "static formatDateDDMMYYYY(date) {\n if (Common.isNullOrUndifined(date)) return \"\";\n try {\n return moment(date).format(\"DD/MM/yyyy\");\n } catch (error) {\n console.log(\"formatDateDDMMYYYY\\n\" + error);\n }\n }", "function formattedDate(d = new Date) {\n\treturn [d.getDate(), d.getMonth()+1, d.getFullYear()]\n\t\t.map(n => n < 10 ? `0${n}` : `${n}`).join('/');\n }", "function format(d) {\n const month = d.getMonth() >= 9 ? d.getMonth() + 1 : `0${d.getMonth() + 1}`;\n const day = d.getDate() >= 10 ? d.getDate() : `0${d.getDate()}`;\n const year = d.getFullYear();\n return `${month}/${day}/${year}`;\n}", "function formatDate(d) {\n return (d.getMonth()+1) + '/' +\n d.getDate() + '/' +\n d.getFullYear();\n }", "formatDate(value, format) {\n format = format || '';\n if (value) {\n return window.moment(value)\n .format(format);\n }\n return \"n/a\";\n }", "function formatDate(date)\n{\n date = new Date(date * 1000);\n return '' + date.getFullYear() + '/' + lpad(date.getMonth(), 2, '0') + '/' + lpad(date.getDate(), 2, '0') + ' ' + lpad(date.getHours(), 2, '0') + ':' + lpad(date.getMinutes(), 2, '0');\n}", "function pgFormatDate(date) {\n /* Via http://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date */\n return String(date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()); \n}", "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear().toString().substring(2);\n\n if (month.length < 2) month = '0' + month;\n if (day.length < 2) day = '0' + day;\n\n return [month, day, year].join('-');\n}", "function formatDate(date){\n\t\tvar formatted = {\n\t\t\tdate:date,\n\t\t\tyear:date.getFullYear().toString().slice(2),\n\t\t\tmonth:s.months[date.getMonth()],\n\t\t\tmonthAbv:s.monthsAbv[date.getMonth()],\n\t\t\tmonthNum:date.getMonth() + 1,\n\t\t\tday:date.getDate(),\n\t\t\tslashDate:undefined,\n\t\t\ttime:formatTime(date)\n\t\t}\n\t\tformatted.slashDate = formatted.monthNum + '/' + formatted.day + '/' + formatted.year;\n\t\treturn formatted;\n\t}", "function formatDate(date) {\n var newDate = new Date(date);\n var dd = newDate.getDate();\n var mm = newDate.getMonth() + 1; // January is 0!\n\n var yyyy = newDate.getFullYear();\n\n if (dd < 10) {\n dd = \"0\".concat(dd);\n }\n\n if (mm < 10) {\n mm = \"0\".concat(mm);\n }\n\n var formatedDate = \"\".concat(dd, \"/\").concat(mm, \"/\").concat(yyyy);\n return formatedDate;\n}", "function formatDate(date) {\n var year = date.substring(0, 2);\n var month = date.substring(3, 5);\n var day = date.substring(6, 8);\n\n var monthNames = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n\n var monthString = monthNames[parseInt(month)-1];\n var dayString = parseInt(day);\n var yearString = \"20\" + year;\n\n return monthString + \" \" + dayString + \", \" + yearString;\n}", "function formatDate(date) { \n var dateString = date + \"\";\n return dateString.substring(2);\n}", "returnDateFormat(date){\n var day = new Date(date);\n return day.toDateString();\n }", "function formatDate(date) {\n\tlet d = new Date(date),\n\t\tmonth = \"\" + (d.getMonth() + 1),\n\t\tday = \"\" + d.getDate(),\n\t\tyear = d.getFullYear();\n\n\tif (month.length < 2) month = \"0\" + month;\n\tif (day.length < 2) day = \"0\" + day;\n\n\treturn [year, month, day].join(\"-\");\n}", "function formatDate(input) {\n\tvar d = new Date(input);\n\tvar month = ('0' + (d.getMonth() + 1)).slice(-2);\n var date = ('0' + d.getDate()).slice(-2);\n return d.getFullYear() + \"-\" + month + \"-\" + date;\n}", "function prettyFormatDate(date) {\n return Utilities.formatDate(new Date(date), \"GMT-7\", \"MM/dd/yy\").toString();\n}", "static formatDate(date) {\n let formattedDate = '';\n\n formattedDate += date.getUTCFullYear();\n formattedDate += '-' + ('0' + (date.getUTCMonth() + 1)).substr(-2);\n formattedDate += '-' + ('0' + date.getUTCDate()).substr(-2);\n\n return formattedDate;\n }", "getFormattedDate(date) {\n const year = date.getFullYear();\n const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');\n const day = (date.getUTCDate()).toString().padStart(2, '0');\n // Logger.log(`Day: ${day}, Month: ${month}, Year:${year}`)\n const dateFormatted = `${year}-${month}-${day}`;\n return dateFormatted;\n }", "function formatted_date()\n{\n var result=\"\";\n var d = new Date();\n var month = (d.getMonth()+1);\n var day = d.getDate();\n if (d.getMonth()+1 < 10){\n \t\tvar month = '0' + (d.getMonth()+1);\n }\n if (d.getDate()+1 < 10){\n \t\tvar day = '0' + d.getDate();\n }\n result += d.getFullYear() +''+ month +''+ day;\n console.log(result);\n return result;\n}", "function setFormatoDate(data) {\n let dd = (\"0\" + (data.getDate())).slice(-2);\n let mm = (\"0\" + (data.getMonth() + 1)).slice(-2);\n let yyyy = data.getFullYear();\n return dd + '/' + mm + '/' + yyyy;\n}", "function getFormattedDate(date) {\n return $filter('date')(date, 'yyyy-MM-dd');\n }", "function formatDateString (date) {\n var month = (date.getMonth() + 1); \n var day = date.getDate();\n if (month < 10) month = '0' + month;\n if (day < 10) day = '0' + day;\n var dateString = date.getFullYear() + '-' + month + '-' + day;\n return dateString;\n }", "function formatDate(date) {\n var formattedDate = date.substr(5, 2) + '/';\n formattedDate += date.substr(8, 2) + '/';\n formattedDate += date.substr(0, 4);\n return formattedDate;\n} //end formatDate" ]
[ "0.80229896", "0.78982013", "0.7876802", "0.7856424", "0.7775405", "0.77482456", "0.7740092", "0.77229714", "0.7717673", "0.7711721", "0.769446", "0.76909953", "0.7690983", "0.76804984", "0.76715106", "0.7670629", "0.76665986", "0.7664738", "0.7658275", "0.7649787", "0.7646211", "0.76447165", "0.7638743", "0.763736", "0.7631055", "0.7624957", "0.76243186", "0.761591", "0.7600514", "0.759434", "0.7590029", "0.75792575", "0.75597423", "0.7555843", "0.75546664", "0.75524753", "0.75524753", "0.75513893", "0.75473064", "0.7546642", "0.754641", "0.75310117", "0.752584", "0.7523719", "0.7523719", "0.7523719", "0.7508412", "0.7505491", "0.75041264", "0.7496785", "0.74914104", "0.74911475", "0.74872094", "0.7481034", "0.7480171", "0.74780744", "0.7474837", "0.74689585", "0.74653244", "0.74641526", "0.7462693", "0.74622947", "0.7456913", "0.7452084", "0.74512845", "0.74503464", "0.74431056", "0.7430092", "0.74247307", "0.7419113", "0.7405647", "0.7404992", "0.74045485", "0.74019086", "0.7399676", "0.73936176", "0.7386569", "0.737719", "0.7371125", "0.7366276", "0.7365216", "0.7362865", "0.7358181", "0.73505056", "0.73460597", "0.73447484", "0.7340298", "0.7339219", "0.73391324", "0.73390865", "0.7326655", "0.7322004", "0.73147064", "0.7298835", "0.72959936", "0.7291373", "0.7288302", "0.7285654", "0.7282875", "0.72822535", "0.7277209" ]
0.0
-1
function to capitalize first letter on each word
function capString(string){ //code found on stackoverflow var string = string.toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); }); return string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "capitalizeFirstLetter(word) {\n return (word.charAt(0).toUpperCase() + word.substring(1));\n }", "function firstWordCapitalize(word){\n let firstCharcter = word[0].toUpperCase();\n return firstCharcter + word.slice(1);\n \n}", "function capitalize(str) {}", "function capitalizeFirst(input) {\n return input\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}", "function titleCase(str) {\r\n var words = str.toLowerCase().split(' ');\r\n var charToCapitalize;\r\n\r\n for (var i = 0; i < words.length; i++) {\r\n charToCapitalize = words[i].charAt(0);\r\n // words[i] = words[i].replace(charToCapitalize, charToCapitalize.toUpperCase()); // works only if first letter is not present elsewhere in word\r\n words[i] = words[i].charAt(0).toUpperCase().concat(words[i].substr(1));\r\n }\r\n\r\n return words.join(' ');\r\n}", "function sc_string_capitalize(s) {\n return s.replace(/\\w+/g, function (w) {\n\t return w.charAt(0).toUpperCase() + w.substr(1).toLowerCase();\n });\n}", "function firstLetterCapital (word) {\n var wordArray = word.split(' ');\n var newWordArray = [];\n for (var i = 0; i < wordArray.length; i++) {\n newWordArray.push(wordArray[i].charAt(0).toUpperCase() + wordArray[i].slice(1));\n }\n return newWordArray.join(' ');\n}", "function titlecase(str){\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // replaces the first char with a CAP letter\n}", "function titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // Replaces the first char with a CAP letter\n}", "function Capitaliser(input) {\n const eachWord = input.split(\" \");\n for (let index = 0; index < eachWord.length; index++) {\n eachWord[index] = eachWord[index][0].toUpperCase() + eachWord[index].substr(1);\n }\n return eachWord.join(\" \");\n}", "function capitalizeAllWords(words){\n return words.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function capitalizeWords(input) {\n\n let wordInput = input.split(' ');\n\n for (let i = 0; i < wordInput.length; i++) {\n var lettersUp = ((wordInput[i])[0]).toUpperCase();\n wordInput[i] = wordInput[i].replace((wordInput[i])[0], lettersUp);\n }\n return console.log(wordInput.join(\" \"));\n}", "function firstLetterCapitalized (word){//function that capitalizes first letter of one word\n var letterOne = word.substring(0,1)//finds first letter\n var capitalizedLetter = letterOne.toUpperCase()//to upper case\n return capitalizedLetter + word.substring(1)//concatenates capitalized first letter and rest of word\n}", "function capitalizeWord(word){\n return word[0].toUpperCase() + word.substr(1);\n}", "function titlecase(str) {\n return str.split(' ').map((word) => word[0].toUpperCase() + word.slice(1)).join(' ');\n}", "function capitalizeFirstLetters(input) {\n array = input.split(' ');\n newArray = [];\n for (let i = 0; i < array.length; i++) {\n if (array[i].length > 0) {\n newArray.push(array[i][0].toUpperCase() + array[i].slice(1));\n } else {\n newArray;\n }\n }\n return newArray.join(' ');\n}", "function LetterCapitalize(str) {\n return str.replace(/\\w\\S*/g, function(txt) {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n}", "function capitalizeFirstLetter(str) {\n let strS=str.split(\" \");\n let strMap= strS.map((a)=>a.slice(0,1).toUpperCase()+a.slice(1));\n return strMap.join()\n}", "function firstLetter(firstWord) {\n let words = firstWord.split(\" \")\n for (let i = 0; i < words.length; i++) {\n words[i] = words[i][0].toUpperCase() + words[i].substr(1);\n }\n return words.join(\" \")\n}", "function LetterCapitalize(str) {\n var strArr = str.split(\" \");\n var newArr = [];\n\n for(var i = 0 ; i < strArr.length ; i++ ){\n\n var FirstLetter = strArr[i].charAt(0).toUpperCase();\n var restOfWord = strArr[i].slice(1);\n\n newArr[i] = FirstLetter + restOfWord;\n\n }\n\n return newArr.join(' ');\n\n}", "function firstLetter(sentence) {\n let text = sentence.split(' ');\n for (let i = 0; i < text.length; i++) {\n text[i] = text[i].charAt(0).toUpperCase() + text[i].substr(1);\n //console.log(text[i].charAt(0));\n }\n return text.join(' ');\n}", "function capitalizeAllWords(string) {\n var splitStr = string.toLowerCase().split(' ');\n \nfor (var i = 0; i < splitStr.length; i++){\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n}\nreturn splitStr.join(' ');\n}", "function LetterCapitalize(str) {\n\nlet words = str.split(' ')\n\nfor ( i = 0 ; i < words.length ; i++) {\n\n words[i] = words[i].substring(0,1).toUpperCase() + words[i].substring(1)\n\n}\n\nwords = words.join(' ')\nreturn words\n\n}", "function LetterCapitalize(str) { \n return str\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}", "capitalize(word){\n let char = word.charAt(0).toUpperCase();\n let remainder = word.slice(1);\n return char + remainder;\n }", "function toTitleCase(str)\n{\nreturn str.replace(/\\w\\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function capitaliseFirstLetters(str) {\r\n var splitStr = str.toLowerCase().split(' ');\r\n for (var i = 0; i < splitStr.length; i++) {\r\n // Assign it back to the array\r\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);\r\n }\r\n // Directly return the joined string\r\n return splitStr.join(' ');\r\n}", "function capitalize_Words(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "capitalizeFirstLetter(str) {\n let pattern = /(^|[-\\s])([a-zа-яё])/g;\n let normalizedName = str.toLowerCase();\n\n normalizedName = normalizedName.replace(pattern, function($2){\n \treturn $2.toUpperCase();\n });\n\n return normalizedName;\n }", "function capitalizeFirstLetter(text) {\n if (typeof text !== 'string') {\n return '';\n }\n return text.charAt(0).toUpperCase() + text.slice(1);\n }", "static capitalize(word){\n let arr;\n arr = word.split(\"\")\n arr[0] = arr[0].toUpperCase()\n return arr.join(\"\")\n }", "function ucFirstAllWords(str) {\n var word = str.split(\" \");\n for (var i = 0; i < word.length; i++) {\n var j = word[i].charAt(0).toUpperCase();\n word[i] = j + word[i].substr(1);\n }\n return word.join(\" \");\n}", "function toTitleCase(str)\n //Make string words start with caps. hello world = Hello World.\n{\n return str.replace(/\\w\\S*/g,\n function(txt){\n return txt.charAt(0).toUpperCase() +\n txt.substr(1).toLowerCase();\n });\n}", "function capitalizeEachWord(str) {\n return str.replace(/\\w\\S*/g, function(txt) {\n if (txt.length >3) {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n }\n else {\n return txt;\n }\n });\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1);});//useto be+ txt.substr(1).toLowerCase()\n}", "function capitalize(s){\n\t\t\treturn s[0].toUpperCase() + s.slice(1);\n\t\t}", "function CapitalizeWord(str)\n {\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function capitalizeWord(word) {\n return word[0].toUpperCase() + word.substr(1);\n}", "function ucFirst(str) {\n\n }", "function capitalizeWord(string){\n var firstLetter = string.charAt(0); // takes first letter\n var goodString = firstLetter.toUpperCase() + string.slice(1); //capitalize and reattach\n return goodString;\n}", "function capitalizeFirstWord(str){\n words = [];\n\n for(let word of str.split(' ')){\n words.push(word[0].toUpperCase() + word.slice(1));\n }\n return words.join(' ');\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function capitalizeWord(word) {\n return word[0].toUpperCase() + word.slice(1);\n}", "function cap_first(s) {\n return s[0].toUpperCase() + s.substring(1); \n}", "function titleCase(str){\n str = str.toLowerCase().split(\" \");\n for(var s = 0; s < str.length; s++){\n str[s] = str[s].charAt(0).toUpperCase() + str[s].slice(1) \n };\n return str.join(\" \");\n}", "function firstLetterCapital(str){\n str = str.toLowerCase().split(' ');\n\n for (var i = 0; i < str.length; i++) {\n\n str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);\n }\n\n return str.join(' ');\n}", "function ucfirst(str,force){\n str=force ? str.toLowerCase() : str;\n return str.replace(/(\\b)([a-zA-Z])/,\n function(firstLetter){\n return firstLetter.toUpperCase();\n });\n }", "function capitalizeEachWord(str) {\n return str.toUpperCase();\n}", "function capitalizeNames(arr) {\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].toLowerCase().substring(1);\n // capital letter concatinates ----> to rest of word .substring(1) returns rest of word\n }\n return arr;\n}", "function firstLetterCapitalized (word){\n var letterOne = word.substring(0,1)\n var capitalizedLetter = letterOne.toUpperCase()\n return capitalizedLetter + word.substring(1)\n}", "function capitalizeWord(string) {\n //I-string of one word\n //O- return the word with first letter in caps\n //C-\n //E-\n let array = string.split(\"\")\n array[0] = array[0].toUpperCase()\n string = array.join(\"\")\n return string\n}", "function LetterCapitalize(str) { \n let words = str.split(' ');\n for (let i = 0; i < words.length; i++) {\n let word = words[i][0].toUpperCase() + words[i].slice(1);\n words[i] = word;\n }\n return words.join(' ');\n}", "function titleCase(txt) {\r\n\r\n var arrTxt = txt.split(' ');\r\n \r\n var newStr = '';\r\n \r\n for (var i = 0; i < arrTxt.length; i++) {\r\n var lower = arrTxt[i].toLowerCase();\r\n newStr += lower.charAt(0).toUpperCase() + lower.slice(1) + ' ';\r\n }\r\n \r\n return newStr.trim();\r\n }", "function capitalizeWord (string) {\n var firstLetter = string[0];\n var restOfWord = string.substring(1); \n return firstLetter.toUpperCase() + restOfWord;\n}", "function applyCapitalLetter(str){\r\n \r\n var arr = str.split(\" \");\r\n for (var i=0; i < arr.length; i++){\r\n arr[i] = arr[i].replace(arr[i][0], arr[i][0].toUpperCase()); \r\n }\r\n return arr.join(\" \");\r\n}", "function titleCase(str) {\n console.log(str.replace(/\\w\\S*/g, (txt) => { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }));\n}", "function capitalizeAllWords(string){\nvar subStrings = string.split(\" \");\nvar upperString = \"\";\nvar finishedString = \"\";\n for(var i = 0; i < subStrings.length; i++){\n if(subStrings[i]) {\n upperString = subStrings[i][0].toUpperCase() + subStrings[i].slice(1) + \" \";\n finishedString += upperString;\n }\n } return finishedString.trim()\n}", "function capitalizeFirstLetter(string) {\n const words = string.split(' ');\n for (let i = 0; i < words.length; i++) {\n words[i] = words[i][0].toUpperCase() + words[i].slice(1);\n };\n\n return words.join(' ');\n}", "function uncapitalize(text) {\n if (!text || typeof text !== \"string\") {\n return '';\n }\n return text.charAt(0).toLowerCase() + text.substr(1);\n }", "function capitalizeWord(word){\n return word.charAt(0).toUpperCase() + word.slice(1);\n}", "function capitalize(text){\n // in: \"some_string\"\n // out: \"Some_string\"\n return text.charAt(0).toUpperCase() + text.slice(1);\n}", "static capitalizeFirstLetter(string){\n return string.charAt(0).toUpperCase() + string.substring(1)\n }", "function capitalize(s){\n return s[0].toUpperCase() + s.slice(1);\n}", "function capitalizeWord(string) {\n return string.replace(string[0], string[0].toUpperCase()); //return string but replace the string[0] with a capital letter\n}", "function capitalize(word) {\n return word.charAt(0).toUpperCase() + word.slice(1);\n}", "function firstLetterUpper(word){\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}", "function titleCase(str) {\n // Mutating str (oh no!) to an array of lowercase words using split() by a space \n str = str.toLowerCase().split(' ');\n // Iterating through str\n for (var i = 0; i < str.length; i++){\n // capitalLetter is first letter of current word -> made uppercase \n capitalLetter = str[i].charAt(0).toUpperCase();\n // replacing the first letter in current word with capitalLetter\n str[i] = str[i].replace(/[a-z]/, capitalLetter);\n }\n // str = str array joined into a single string\n str = str.join('');\n return str;\n }", "function capitalize(word) {\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n }", "function toTitleCase(str) {\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleCase(str) {\n var splitStr = str.toLowerCase().split(' ');\n for (var i = 0; i < splitStr.length; i++) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); \n } \n return splitStr.join(' '); \n }", "function toTitleCase(str){\n\treturn str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleCase(str) {\n //The map() method creates a new array with the results of calling a provided function on every element in the calling array.\n return str.toLowerCase().split(\" \").map(function(word) {\n //The replace() method returns a new string with some or all matches of a pattern replaced by a replacement.\n return word.replace(word[0], word[0].toUpperCase());\n}).join(\" \");\n }", "function toTitleCase(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n }", "static capitalize(string){\n let array = string.split(\"\")\n array[0] = string[0].toUpperCase()\n return array.join(\"\")\n }", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.substring(1);\n}", "function capitalize( s ) {\n // GOTCHA: Assumes it's all-one-word.\n return s[0].toUpperCase() + s.substring(1).toLowerCase();\n}", "function capitalize(word) {\n\treturn word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function capitalize(word) { // capitalizes word\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function upperFirst(str) {\n let splitStr = str.toLowerCase().split(' ');\n for (let i = 0; i < splitStr.length; i++) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); \n }\n return splitStr.join(' '); \n }", "function capitalizeFirstLetter(item) {\n return item.charAt(0).toUpperCase() + item.slice(1);\n}", "function toTitleCase(str){\n return str.replace(/\\w+/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function toTitleCase(str){\n return str.replace(/\\w+/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function toTitleCase(str){\n return str.replace(/\\w+/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function toTitleCase(str){\n return str.replace(/\\w+/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function capitalize() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utInTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Word,\n pat: /\\b(_*\\w)/g, repl: function (_match, p1) { return p1.toUpperCase(); },\n });\n }", "function capitalizeWord(string) {\n str1 = string.charAt(0);\n str1 = str1.toUpperCase();\n for (var i = 1; i < string.length; i++)\n {\n str1 += string[i];\n }\n return str1;\n}", "function titleCase(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function letterCapitalize(str) {\n str = str.split(\" \");\n\n for (var i = 0, x = str.length; i < x; i++) {\n str[i] = str[i][0].toUpperCase() + str[i].substr(1);\n }\n return str.join(\" \");\n}", "function capitalizeFirstLetter(input) {\n return input.charAt(0).toUpperCase() + input.slice(1);\n}", "function toTitleCase(str){\n\t\tif(str.charAt(0)){\n\t\t\treturn str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n\t\t}\n\t}", "function everyWordCapitalized(aPhrase) {\n var becomeAnArray = aPhrase.split(\" \");\n \n for (var i=0; i<becomeAnArray.length; i++){\n var firstChar = becomeAnArray[i].charAt(0);\n var rest = becomeAnArray[i].substring(1);\n \n \n \n firstChar = firstChar.toUpperCase();\n rest = rest.toLowerCase();\n becomeAnArray[i] = firstChar + rest;\n \n }\n \n return becomeAnArray.join(\" \");\n}", "function capitalizeFirst(s) {\n\n return s.substr(0, 1).toUpperCase() + s.substr(1);\n\n}", "function LetterCapitalize(str) {\n var splitString = str.split(' ');\n // console.log(splitString)\n for (var i = 0; i < splitString.length; i++) {\n splitString[i] = splitString[i].charAt(0).toUpperCase() + splitString[i].substring(1);\n // console.log(splitString)\n } \n return splitString.join(' ');\n}", "function titleCases(arg){\n return arg.charAt(0).toUpperCase() + arg.substring(1);\n }", "function toTitleCase(str)\n{\n return str.replace(/\\w\\S*/g, function(txt){\n \treturn txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n}", "function titleCase(s){\n s=s.toLowerCase().trim();\n \n l = s.split(\" \");\n for(i=0; i<l.length; i++){\n l[i] = l[i][0].toUpperCase() + l[i].slice(1);\n };\n s = l.join(\" \");\n return s;\n}" ]
[ "0.83369654", "0.8227217", "0.8150912", "0.81487024", "0.8126337", "0.8121958", "0.8079707", "0.80575496", "0.8043775", "0.8027983", "0.8012551", "0.8011028", "0.80065435", "0.8001606", "0.799241", "0.7973813", "0.7966155", "0.79582417", "0.79556155", "0.79449016", "0.79418707", "0.79209703", "0.79196787", "0.7904216", "0.7899447", "0.78868884", "0.7878777", "0.787809", "0.78778785", "0.78768027", "0.78765357", "0.7872127", "0.78699225", "0.7858968", "0.7856357", "0.7828222", "0.782475", "0.78061354", "0.78041714", "0.7801185", "0.78000003", "0.77971435", "0.7795657", "0.7795657", "0.7795657", "0.7795657", "0.7795657", "0.77929676", "0.77908665", "0.778537", "0.7782217", "0.7780833", "0.7779555", "0.77737105", "0.77736866", "0.7773512", "0.7773021", "0.7761303", "0.77566534", "0.77464175", "0.773915", "0.7735109", "0.77243453", "0.77230155", "0.7719047", "0.7718134", "0.77105707", "0.77094936", "0.77083284", "0.7705364", "0.7703465", "0.7702978", "0.7700572", "0.7699154", "0.7699097", "0.76974964", "0.76895183", "0.7682828", "0.76820016", "0.7680138", "0.7676538", "0.76729107", "0.76660645", "0.7664657", "0.7657347", "0.76551205", "0.76551205", "0.76551205", "0.76551205", "0.765509", "0.7651847", "0.76501036", "0.7644407", "0.76431894", "0.7641716", "0.764147", "0.7633284", "0.7632281", "0.7631282", "0.763087", "0.76289254" ]
0.0
-1
function to calculate wind direction
function formatDirection(degree){ var direction = ''; if(degree >= 337.5 && degree <= 22.5){ direction = 'Northerly'; }else if(degree > 22.5 && degree < 67.5){ direction = 'North Easterly'; }else if(degree >= 67.5 && degree <= 112.5){ direction = 'Easterly'; }else if(degree > 112.5 && degree < 157.5){ direction = 'South Easterly'; }else if(degree >= 157.5 && degree <= 202.5){ direction = 'Southerly'; }else if(degree > 202.5 && degree < 247.5){ direction = 'South Westerly'; }else if(degree >= 247.5 && degree <= 292.5){ direction = 'Westerly'; }else { direction = 'North Westerly'; } return direction; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windDirection(degrees) {\n var directions = {\n 1: { direction: \"N\", values: { min: 348, max: 360 } },\n 2: { direction: \"N\", values: { min: 0, max: 11 } },\n 3: { direction: \"N/NE\", values: { min: 11, max: 33 } },\n 4: { direction: \"NE\", values: { min: 33, max: 56 } },\n 5: { direction: \"E/NE\", values: { min: 56, max: 78 } },\n 6: { direction: \"E\", values: { min: 78, max: 101 } },\n 7: { direction: \"E/SE\", values: { min: 101, max: 123 } },\n 8: { direction: \"SE\", values: { min: 123, max: 146 } },\n 9: { direction: \"S/SE\", values: { min: 146, max: 168 } },\n 10: { direction: \"S\", values: { min: 168, max: 191 } },\n 11: { direction: \"S/SW\", values: { min: 191, max: 213 } },\n 12: { direction: \"SW\", values: { min: 213, max: 236 } },\n 13: { direction: \"W/SW\", values: { min: 236, max: 258 } },\n 14: { direction: \"W\", values: { min: 258, max: 281 } },\n 15: { direction: \"W/NW\", values: { min: 281, max: 303 } },\n 16: { direction: \"NW\", values: { min: 303, max: 326 } },\n 17: { direction: \"N/NW\", values: { min: 326, max: 348 } }\n };\n for (var i = 1; i < 18; i++) {\n if (degrees >= directions[i].values.min && degrees <= directions[i].values.max) {\n return directions[i].direction;\n }\n }\n}", "function calcWindDir(deg) {\n // var deg = weatherApiResponse.wind.deg;\n if (deg <= 22.5 || deg >= 337.501) {\n windDirection = \"N\";\n } else if (deg >= 22.501 && deg <= 67.5) {\n windDirection = \"NE\";\n } else if (deg >= 67.501 && deg <= 112.5) {\n windDirection = \"E\";\n } else if (deg >= 112.501 && deg <= 157.5) {\n windDirection = \"SE\";\n } else if (deg >= 157.501 && deg <= 202.5) {\n windDirection = \"S\";\n } else if (deg >= 202.501 && deg <= 247.5) {\n windDirection = \"SW\";\n } else if (deg >= 247.501 && deg <= 292.5) {\n windDirection = \"W\";\n } else {\n windDirection = \"NW\";\n };\n }", "function getWindDirection(deg){\n var arr = [\"N\",\"NNE\",\"NE\",\"ENE\",\"E\",\"ESE\", \"SE\", \"SSE\",\"S\",\"SSW\",\"SW\",\"WSW\",\"W\",\"WNW\",\"NW\",\"NNW\"];\n var val = Math.floor((deg/22.5)+.5);\n return arr[(val % 16)];\n }", "function toWindDir(windAngle) {\n let idx = Math.floor(windAngle / 22.5 + 0.5);\n let directions = [\n \"N\",\n \"NNE\",\n \"NE\",\n \"ENE\",\n \"E\",\n \"ESE\",\n \"SE\",\n \"SSE\",\n \"S\",\n \"SSW\",\n \"SW\",\n \"WSW\",\n \"W\",\n \"WNW\",\n \"NW\",\n \"NNW\",\n ];\n return directions[idx % 16];\n}", "function windDirection(degree) {\n if (degree <= 25 || degree >= 335 ) {\n return \"N\";\n } else if (degree > 25 && degree <= 65) {\n return \"NE\";\n } else if (degree > 65 && degree <= 115) {\n return \"E\";\n } else if (degree > 115 && degree <= 155) {\n return \"SE\";\n } else if (degree > 155 && degree <= 205) {\n return \"S\";\n } else if (degree > 205 && degree <= 245) {\n return \"SW\";\n } else if (degree > 245 && degree <= 295) {\n return \"W\";\n } else {\n return \"NW\";\n } // end if-else\n} // end windDirection()", "function setWindDirection(d) {\n\n var wd = [];\n\n var westEast = d.uw;\n var southNorth = d.vw;\n\n var absWE = Math.abs(westEast);\n var absSN = Math.abs(southNorth);\n var windForce = Math.sqrt(Math.pow(absWE, 2) + Math.pow(absSN, 2));\n\n if (southNorth > 0) {\n wd.push(SOUTH);\n }\n else if (southNorth < 0) {\n wd.push(NORTH);\n }\n\n if (westEast > 0) {\n wd.push(WEST);\n }\n else if (westEast < 0) {\n wd.push(EAST);\n }\n\n if (wd.length === 0) {\n wd.push(NO_WIND);\n }\n\n d.windDirection = wd.join(\"-\");\n\n if (windForce <= 3) {\n d.windSpeed = SPEED1;\n }\n else if (windForce > 3 && windForce <= 6) {\n d.windSpeed = SPEED2;\n }\n else if (windForce > 6 && windForce <= 9) {\n d.windSpeed = SPEED3;\n }\n else if (windForce > 9 && windForce <= 12) {\n d.windSpeed = SPEED4;\n }\n else if (windForce > 12) {\n d.windSpeed = SPEED5;\n }\n\n if (d.Hs < 1) {\n d.waveHeight = \"0-1\";\n }\n else if (1 < d.Hs && d.Hs < 3.5) {\n d.waveHeight = \"1-3.5\";\n }\n else { d.waveHeight = \"High\"; }\n\n /* \n else if (1.5 < d.Hs && d.Hs < 3) {\n d.waveHeight = \"1-2\";\n }\n else if (3 < d.Hs && d.Hs < 4.5) {\n d.waveHeight = \"3-4.5\";\n }\n else if(4.5 < d.Hs && d.Hs < 6) {\n d.waveHeight = \"4.5-6\";\n }\n else if(6 < d.Hs && d.Hs < 7.5) {\n d.waveHeight = \"6-7.5\";\n }\n else { d.waveHeight = \"High\";}\n\n */\n\n if (d.Tp < 3) {\n d.peakPeriod = \"0-3\";\n }\n else if (3 < d.Tp && d.Tp < 6) {\n d.peakPeriod = \"3-6\";\n }\n else if (6 < d.Tp && d.Tp < 9) {\n d.peakPeriod = \"6-9\";\n }\n else if (9 < d.Tp && d.Tp < 12) {\n d.peakPeriod = \"9-12\";\n }\n else { d.peakPeriod = \"Long\"; }\n\n}", "function evaluateWindDirection(direction) {\n var deg = parseFloat(direction);\n switch(true){\n case (deg<22.5): return \"Nord\";\n case (22.5<deg<67.5): return \"Nord Ost\";\n case (67.5<deg<112.5): return \"Ost\";\n case (112.5<deg<157.5): return \"Süd Ost\";\n case (157.5<deg<202.5): return \"Süd\";\n case (202.5<deg<247.5): return \"Süd West\";\n case (247.5<deg<292.5): return \"West\";\n case (292.5<deg<337.5): return \"Nord West\";\n case (337.5<deg): return \"Nord\";\n }\n}", "decodeWindDir(degrees) {\n if (degrees > 350 && degrees <= 10) {\n return 'North'+' ('+ degrees +')';\n } else if (degrees > 10 && degrees <= 30) {\n return 'North-northeast'+' ('+ degrees +')';\n } else if (degrees > 35 && degrees <= 55) {\n return 'North-east'+' ('+ degrees +')';\n } else if (degrees > 55 && degrees <= 80) {\n return 'Northeast - east'+' ('+ degrees +')';\n } else if (degrees > 80 && degrees <= 100) {\n return 'East'+' ('+ degrees +')';\n } else if (degrees > 100 && degrees <= 125) {\n return 'East-southeast'+' ('+ degrees +')';\n } else if (degrees > 125 && degrees <= 145) {\n return 'South-east'+' ('+ degrees +')';\n } else if (degrees > 130 && degrees <= 150) {\n return 'South-southeast'+' ('+ degrees +')';\n } else if (degrees > 170 && degrees <= 190) {\n return 'South'+' ('+ degrees +')';\n } else if (degrees > 190 && degrees <= 215) {\n return 'South-southwest'+' ('+ degrees +')';\n } else if (degrees > 215 && degrees <= 235) {\n return 'South-west'+' ('+ degrees +')';\n } else if (degrees > 235 && degrees <= 230) {\n return 'West-southwest'+' ('+ degrees +')';\n } else if (degrees > 260 && degrees <= 280) {\n return 'West'+' ('+ degrees +')';\n } else if (degrees > 280 && degrees <= 305) {\n return 'West-northwest'+' ('+ degrees +')';\n } else if (degrees > 305 && degrees <= 325) {\n return 'North-west'+' ('+ degrees +')';\n } else if (degrees > 325 && degrees <= 350) {\n return 'North-northwest'+' ('+ degrees +')';\n }\n }", "getWindDir() {\n var rndWind = vec3.create();\n var change = Math.random() * 0.1\n if(Math.random() > 0.6)\n rndWind[0] += change;\n else\n rndWind[2] += change;\n\n vec3.add(rndWind, rndWind, this.wind);\n return rndWind;\n }", "function direction(data) {\n var direct;\n if (data >= 348.75 && data <= 360) {\n direct = \"North\";\n }\n if (data >= 0 && data <= 11.25){\n direct = \"North\";\n }\n if (data >= 11.25 && data <= 33.75){\n direct = \"North by North East\";\n };\n if (data >= 33.75 && data <= 56.25){\n direct = \"North East\";\n };\n if (data >= 56.25 && data <= 78.75){\n direct = \"East by North East\";\n };\n if (data >= 78.75 && data <= 101.25){\n direct = \"East\";\n };\n if (data >= 101.25 && data <= 123.75){\n direct = \"East by South East\";\n };\n if (data >= 123.75 && data <= 146.25){\n direct = \"South East\";\n };\n if (data >= 146.25 && data <= 168.75){\n direct = \"South by South East\";\n };\n if (data >= 168.75 && data <= 191.25){\n direct = \"South\";\n };\n if (data >= 191.25 && data <= 213.75){\n direct = \"South by South West\";\n };\n if (data >= 213.75 && data <= 236.25){\n direct = \"South West\";\n };\n if (data >= 236.25 && data <= 258.75){\n direct = \"West by South West\";\n };\n if (data >= 258.75 && data <= 281.25){\n direct = \"West\";\n };\n if (data >= 281.25 && data <= 303.75){\n direct = \"West by North West\";\n };\n if (data >= 303.75 && data <= 326.25){\n direct = \"North West\";\n };\n if (data >= 326.25 && data <= 348.75 ){\n direct = \"North by North West\";\n };\n return direct;\n}", "GetDirection()\n {\n //AddStatus(\"Entering GetDirection\");\n let x=this.x;\n if(x==0)x=.00000000001;\n let dir=(Math.atan(this.y/x))/this.toRadian;\n //AddStatus(dir);\n if (x<0)dir+=180;\n if (x>0 && this.y<0)dir+=360;\n //AddStatus(dir);\n return dir;\n }", "function getWindDirectionCompas(weatherData) {\n if (weatherData) {\n var windDirection = consolidated_weather[0].wind_direction_compass;\n // console.log('Wind direction',windDirection)\n return windDirection;\n } else {\n return (\n <>\n <LoopIcon className={classes.rotateIcon} />\n <style>\n {`\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { \n transform: rotate(${windDirection}deg); \n animation-fill-mode: forwards; \n }\n }\n `}\n </style>\n </>\n );\n }\n }", "function _getWinding(points) {\n var x1, y1, x2, y2,\n a = 0,\n i, il;\n for (i = 0, il = points.length-3; i < il; i += 2) {\n x1 = points[i];\n y1 = points[i+1];\n x2 = points[i+2];\n y2 = points[i+3];\n a += x1*y2 - x2*y1;\n }\n return (a/2) > 0 ? _clockwise : _counterClockwise;\n }", "function convertWindDirection(compassDirection) {\n var directions = [\"N\", \"NE\", \"E\", \"SE\", \"S\", \"SW\", \"W\", \"NW\"];\n\n let degreesToName = Math.round(((compassDirection %= 360) < 0 ? compassDirection + 360 : compassDirection) / 45) % 8;\n let windName = directions[degreesToName];\n\n return windName;\n}", "function dir2slope(direction) {\n\n console.log(`Direction is ${direction}`);\n switch ( direction ) {\n case \"Flat\":\n return(0);\n case \"FortyFiveUp\":\n return(45);\n case \"FortyFiveDown\":\n return(-45);\n case \"SingleUp\":\n return(90);\n case \"SingleDown\":\n return(-90);\n case \"DoubleUp\":\n return(90);\n case \"DoubleDown\":\n return(-90);\n default: // undefined\n return(180);\n }\n}", "function applyWindToSpreadTheMoisture() {\n\n }", "get directionToWaypoint()\r\n {\r\n let waypointBearing = this._navPath.waypointBearing(this._position, this._waypointIdx);\r\n let direction = waypointBearing - this._heading; // Returns a number in the interval (-360, +360).\r\n \r\n // Handle out of bounds directions\r\n if (direction <= -180)\r\n {\r\n direction += 360;\r\n }\r\n else if (direction > 180)\r\n {\r\n direction -= 360;\r\n }\r\n \r\n return direction\r\n }", "getWind(data) {\n var windSpeed;\n windSpeed = data.windSpeed * 3.6; // convert m/s to kph\n return windSpeed.toFixed(0) + ' kph';\n }", "get worldSpaceViewDirection$() {\n\t\treturn (this._c.wd || (this._c.wd = SpiderGL.Math.Vec3.normalize$(SpiderGL.Math.Vec3.neg$(SpiderGL.Math.Vec4.to3(SpiderGL.Math.Mat4.row(this.viewMatrixInverse$, 2))))));\n\t}", "function getWaveDirection(d) {\n\n var result2 = [];\n\n var wavedirection = d.Dirm;\n\n if (wavedirection < 40) {\n result2.push(interval1);\n }\n\n else if (wavedirection > 40 && wavedirection < 80) {\n result2.push(interval2);\n }\n\n else if (wavedirection > 80 && wavedirection < 120) {\n result2.push(interval3);\n }\n\n else if (wavedirection > 120 && wavedirection < 160) {\n result2.push(interval4);\n }\n\n else if (wavedirection > 160 && wavedirection < 200) {\n result2.push(interval5);\n }\n\n else if (wavedirection > 200 && wavedirection < 240) {\n result2.push(interval6);\n }\n\n else if (wavedirection > 240 && wavedirection < 280) {\n result2.push(interval7);\n }\n\n else if (wavedirection > 280 && wavedirection < 320) {\n result2.push(interval8);\n }\n\n else result2.push(interval9);\n\n\n return result2;\n\n}", "function windType(data) {\n\n var wind = direction(data);\n var point = surfSpot.point;\n\n // console.log('Wind & Surf Spot wind directions: ' + wind + ' ' + point);\n\n var range = [wind, point];\n\n // console.log('An Array of wind & point direction values: ' + range);\n \n function check() {\n if ((wind - point) === 0) {\n return 'Offshore';\n } else if (\n (range[0] === 0) && (range[1] === 180) ||\n (range[0] === 180) && (range[1] === 0) ||\n (range[0] === 90) && (range[1] === 270) ||\n (range[0] === 270) && (range[1] === 90) ||\n (range[0] === 45) && (range[1] === 225) ||\n (range[0] === 225) && (range[1] === 45) ||\n (range[0] === 135) && (range[1] === 315) ||\n (range[0] === 315) && (range[1] === 135)) {\n return 'Onshore';\n } else {\n return 'Crosswind';\n }\n }\n\n return check();\n }", "function get_direction_from_u_v(u, v) {\n // Meteorological wind direction\n // 90° corresponds to wind from east,\n // 180° from south\n // 270° from west\n // 360° wind from north.\n // 0° is used for no wind.\n if ((u, v) == (0.0, 0.0)) {\n return 0.0\n } else {\n return (180.0 / Math.PI) * Math.atan2(u, v) + 180.0;\n }\n}", "function getWindDirection(weatherData) {\n if (weatherData) {\n var windDirection = consolidated_weather[0].wind_direction.toFixed(0);\n\n return (\n <>\n <NavigationIcon className={classes.rotateIcon} />\n <style>{`\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { \n transform: rotate(${windDirection}deg); \n animation-fill-mode: forwards; \n }\n }\n `}</style>\n </>\n );\n } else {\n return (\n <Container>\n <NavigationIcon className={classes.rotateIcon} />\n <style>{`\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { \n transform: rotate(${windDirection}deg); \n animation-fill-mode: forwards; \n }\n }\n `}</style>\n </Container>\n );\n }\n }", "function direction(value) {\n if (value >= 0 && value < 22.5 || value >=337.5) {\n return 0;\n } else if (value >= 22.5 && value < 67.5) {\n return 45;\n } else if (value >= 67.5 && value < 112.5) {\n return 90;\n } else if (value >= 112.5 && value < 157.5) {\n return 135;\n } else if (value >= 157.5 && value < 202.5) {\n return 180;\n } else if (value >= 202.5 && value < 247.5) {\n return 225;\n } else if (value >= 247.5 && value <292.5) {\n return 270;\n } else if (value >= 292.5 && value <337.5) {\n return 315;\n }\n }", "function getDriftDirection(latA, lonA, latB, lonB) {\n /*\n latA : latitude of the first point\n lonA : longitude of the first point\n latB : latitude of the second point\n lonB : longitude of the second point\n */\n\n // compute direction\n var dphi = Math.log(Math.tan(Math.radians(latB) / 2 + Math.PI / 4) / Math.tan(Math.radians(latA) / 2 + Math.PI / 4));\n var dlon = Math.abs(lonB - lonA)%180;\n var dirRad = Math.atan2(Math.radians(dlon), dphi);\n if(dirRad >= 0) {\n return Math.fixedDecimals(Math.degrees(dirRad), 2);\n } else {\n return Math.fixedDecimals(360 + Math.degrees(dirRad), 2);\n }\n}", "function getWindSpeed(weatherData) {\n if (weatherData) {\n var windSpeed = weatherData[0].wind_direction;\n return windSpeed.toFixed(0);\n }\n }", "function parseWind(windDeg) {\n if (windDeg < 22.5) {return \"N\"}\n if (22.5 <= windDeg < 67.5) {return \"NE\"}\n if (67.5 <= windDeg < 112.5) {return \"E\"}\n if (112.5 <= windDeg < 157.5) {return \"SE\"}\n if (157.5 <= windDeg < 202.5) {return \"S\"}\n if (202.5 <= windDeg < 247.5) {return \"SW\"}\n if (247.5 <= windDeg < 292.5) {return \"W\"}\n if (292.5 <= windDeg < 337.5) {return \"NW\"}\n if (337.5 <= windDeg) {return \"N\"}\n}", "function getWindDirections(data) {\n let results = [];\n\n for (let i = 0; i < data.hourly.length; i++) {\n results.push(convertWindDirection(data.hourly[i].wind_deg));\n }\n\n return results;\n}", "function windChill(t, s) {\n var f = 35.74 + (0.6215 * t) - (35.75 * Math.pow(s, 0.16)) +\n (0.4275 * t * Math.pow(s, 0.16));\n return f;\n}", "function getWind(){\n\treturn JSON.stringify({\n\t\tspeed: Math.floor(Math.random() * 99) + 9,\n\t\tdirection: Math.floor(Math.random() * 359) + 0\n\t});\t\n}", "function Wind() {\n this.mid_time = -100; // Time associated with the middle entry in lists\n this.vx_list = []; // velocity at mid_time - 1, mid_time, mid_time + 1\n this.vy_list = [];\n this.vx = 0;\n this.vy = 0;\n this.ux = 0;\n this.uy = 0;\n this.theta = 0;\n this.speed = 0;\n this.shift_time = 30.0;\n this.typical_velocity = 20;\n}", "function formatVector(wind, units) {\n var d = Math.atan2(-wind[0], -wind[1]) / τ * 360; // calculate into-the-wind cardinal degrees\n\n var wd = Math.round((d + 360) % 360 / 5) * 5; // shift [-180, 180] to [0, 360], and round to nearest 5.\n\n return wd.toFixed(0) + \"° @ \" + formatScalar(wind[2], units);\n }", "function formatVector(wind, units) {\n var d = Math.atan2(-wind[0], -wind[1]) / τ * 360; // calculate into-the-wind cardinal degrees\n var wd = Math.round((d + 360) % 360 / 5) * 5; // shift [-180, 180] to [0, 360], and round to nearest 5.\n return wd.toFixed(0) + \"° @ \" + formatScalar(wind[2], units);\n }", "function forceWinding(region, clockwise){\n\t\t\t// first, see if we're clockwise or counter-clockwise\n\t\t\t// https://en.wikipedia.org/wiki/Shoelace_formula\n\t\t\tvar winding = 0;\n\t\t\tvar last_x = region[region.length - 1][0];\n\t\t\tvar last_y = region[region.length - 1][1];\n\t\t\tvar copy = [];\n\t\t\tfor (var i = 0; i < region.length; i++){\n\t\t\t\tvar curr_x = region[i][0];\n\t\t\t\tvar curr_y = region[i][1];\n\t\t\t\tcopy.push([curr_x, curr_y]); // create a copy while we're at it\n\t\t\t\twinding += curr_y * last_x - curr_x * last_y;\n\t\t\t\tlast_x = curr_x;\n\t\t\t\tlast_y = curr_y;\n\t\t\t}\n\t\t\t// this assumes Cartesian coordinates (Y is positive going up)\n\t\t\tvar isclockwise = winding < 0;\n\t\t\tif (isclockwise !== clockwise)\n\t\t\t\tcopy.reverse();\n\t\t\t// while we're here, the last point must be the first point...\n\t\t\tcopy.push([copy[0][0], copy[0][1]]);\n\t\t\treturn copy;\n\t\t}", "function calcWalkCal(weight, distance){\n return 0.3 * weight * distance;\n}", "function windDial(direction) {\n // Get the wind dial container\n const dial = document.getElementById(\"dial\");\n // Determine the dial class\n switch (direction) {\n case \"North\":\n case \"N\":\n dial.setAttribute(\"class\", \"n\"); //\"n\" is the CSS rule selector\n break;\n case \"NE\":\n case \"NNE\":\n case \"ENE\":\n dial.setAttribute(\"class\", \"ne\");\n break;\n case \"NW\":\n case \"NNW\":\n case \"WNW\":\n dial.setAttribute(\"class\", \"nw\");\n break;\n case \"South\":\n case \"S\":\n dial.setAttribute(\"class\", \"s\");\n break;\n case \"SE\":\n case \"SSE\":\n case \"ESE\":\n dial.setAttribute(\"class\", \"se\");\n break;\n case \"SW\":\n case \"SSW\":\n case \"WSW\":\n dial.setAttribute(\"class\", \"sw\");\n break;\n case \"East\":\n case \"E\":\n dial.setAttribute(\"class\", \"e\");\n break;\n case \"West\":\n case \"W\":\n dial.setAttribute(\"class\", \"w\");\n break;\n }\n}", "function world_change_direction(w, dir) {\n $rt_addContract(w, cd4e49798d42ac5a95f1a8edbd8ed8c01c, \"motion.ts(78,40)\");\n return new DataClasses_1.DataClasses.World(snake_change_direction(w.snake, dir), w.food);\n }", "function getDirection(degrees) {\n if (degrees < 22.5 || degrees >= 337.5 ) {\n return 'N';\n } else if (degrees < 67.5) {\n return 'NE';\n } else if (degrees < 112.5) {\n return 'E';\n } else if (degrees < 157.5) {\n return 'SE';\n } else if (degrees < 202.5) {\n return 'S';\n } else if (degrees < 247.5) {\n return 'SW';\n } else if (degrees < 292.5) {\n return 'W';\n } else {\n return 'NW';\n }\n}", "static createWindDirectionGauge() {\r\n var gauge = new RadialGauge(this.createWindDirectionOptions('windDirectionCanvas'));\r\n LivewindStore.storeGauge('windDirection', gauge);\r\n gauge.draw();\r\n }", "function updateWind(windSpeed, speedUnits, windBearing) {\n let windScale;\n\n function isWindSpeedBelowMph(mphValue) {\n if (speedUnits === 'm/s' && windSpeed < mphValue * 0.447) {\n return true;\n }\n\n if (speedUnits === 'km/h' && windSpeed < mphValue * 1.609) {\n return true;\n }\n\n return speedUnits === 'mph' && windSpeed < mphValue;\n }\n\n // Set the windScale based on the Beaufort Scale\n if (isWindSpeedBelowMph(2)) {\n windScale = 'calm air';\n } else if (isWindSpeedBelowMph(7)) {\n windScale = 'light breeze';\n } else if (isWindSpeedBelowMph(12)) {\n windScale = 'breeze';\n } else if (isWindSpeedBelowMph(25)) {\n windScale = 'wind';\n } else if (isWindSpeedBelowMph(38)) {\n windScale = 'high wind';\n } else if (isWindSpeedBelowMph(46)) {\n windScale = 'gale';\n } else if (isWindSpeedBelowMph(54)) {\n windScale = 'strong gale';\n } else if (isWindSpeedBelowMph(63)) {\n windScale = 'storm';\n } else if (isWindSpeedBelowMph(72)) {\n windScale = 'violent storm';\n } else {\n windScale = 'hurricane force';\n }\n\n const arr = ['North', '<abbr title=\"North-Northeast\">NNE</abbr>', '<abbr title=\"Northeast\">NE</abbr>',\n '<abbr title=\"East-Northeast\">ENE</abbr>', 'East', '<abbr title=\"East-Southeast\">ESE</abbr>',\n '<abbr title=\"Southeast\">SE</abbr>', '<abbr title=\"South-Southeast\">SSE</abbr>', 'South',\n '<abbr title=\"South-Southwest\">SSW</abbr>', '<abbr title=\"Southwest\">SW</abbr>',\n '<abbr title=\"West-Southwest\">WSW</abbr>', 'West', '<abbr title=\"West-Northwest\">WNW</abbr>',\n '<abbr title=\"NorthWest\">NW</abbr>', '<abbr title=\"North-Northwest\">NNW</abbr>',];\n const windBearingDirection = arr[(Math.floor((windBearing / 22.5) + 0.5) % 16)];\n\n return `with a ${Math.round(windSpeed)} ${speedUnits} ${windScale} coming from the <a href=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Compass_Rose_English_North.svg/1000px-Compass_Rose_English_North.svg.png\" target=\"_blank\">${windBearingDirection}</a>`;\n}", "function getWindIndex(windSpeed) {\n if (windSpeed >= 90) {\n return 3;\n } else if (windSpeed >= 60 && windSpeed < 90) {\n return 2;\n } else if (windSpeed >= 30 && windSpeed < 60) {\n return 1;\n } else {\n return 0;\n }\n}", "function getDirection(x, y){\n if (x === 0 && y === 0)\n return null;\n if ( x + y >= 0 && x-y >= 0) {\n return \"r\";\n } else if (x+y < 0 && x-y >= 0) {\n return \"u\";\n } else if (x+y < 0 && x-y < 0) {\n return \"l\";\n } else {\n return \"d\";\n }\n }", "function get_direction(radians, directions) {\r\n\r\n // mathematical constant tau == 2PI\r\n TAU = Math.PI + Math.PI;\r\n\r\n // convert (-PI to PI) radians to (0.0 to 2PI)\r\n positive_radians = radians;\r\n if (positive_radians < 0.0) positive_radians = radians + TAU;\r\n \r\n // convert (0.0 to 2PI) to (0.0 to 1.0)\r\n normalized_direction = positive_radians / TAU; \r\n\r\n // the range of normalized angles that correspond to one facing direction\r\n direction_range = 1.0 / directions;\r\n \r\n // the facing direction is exactly in the middle of this range\r\n // shift it to the beginning of the range so we can map via floor\r\n normalized_direction += direction_range / 2.0;\r\n if (normalized_direction > 1.0) normalized_direction -= 1.0;\r\n \r\n // convert (0.0 to 1.0) to (0 to directions)\r\n return Math.floor(normalized_direction * directions);\r\n \r\n}", "function trackMovement() {\t\n\tif(transform.eulerAngles.y >= 86 && transform.eulerAngles.y <= 94) {\n\t\ttravelDir = \"East\";\n\t}else if(transform.eulerAngles.y >= -4 && transform.eulerAngles.y <= 4) {\n\t\ttravelDir = \"North\";\n\t}else if(transform.eulerAngles.y >= 266 && transform.eulerAngles.y <= 274) {\n\t\ttravelDir = \"West\";\n\t}else if(transform.eulerAngles.y >= 176 && transform.eulerAngles.y <= 184) {\n\t\ttravelDir = \"South\";\n\t}\n}", "function getWindSpeed(city) {\n return city.wind.speed;\n}", "function getDirection(fromx, fromy, tox, toy) {\n // arcus tangens, convert to degrees, add 450 and normalize to 360.\n return fmod(Math.atan2(toy - fromy, tox - fromx) / M_PI * 180.0 + 450.0, 360.0);\n}", "function radians_to_direction(angle) {\n\n if (angle <= (-0.875 * Math.PI) || angle > (0.875 * Math.PI)) {\n return 1;\n }\n else if (angle > (-0.875 * Math.PI) && angle <= (-0.625 * Math.PI)) {\n return 2;\n }\n else if (angle > (-0.625 * Math.PI) && angle <= (-0.375 * Math.PI)) {\n return 3;\n }\n else if (angle > (-0.375 * Math.PI) && angle <= (-0.125 * Math.PI)) {\n return 4;\n } \n else if (angle > (-0.125 * Math.PI) && angle <= (0.125 * Math.PI)) {\n return 5;\n }\n else if (angle > (0.125 * Math.PI) && angle <= (0.375 * Math.PI)) {\n return 6;\n }\n else if (angle > (0.375 * Math.PI) && angle <= (0.625 * Math.PI)) {\n return 7;\n }\n else if (angle > (0.625 * Math.PI) && angle <= (0.875 * Math.PI)) {\n return 0;\n }\n\n}", "getWalkFromDirection(){\n switch(this.getDirection()){\n // Down\n case 0:\n this.getStart().setX(this.getOffset());\n this.getRoot().setX(this.getOffset());\n\n for(let y = 0; y < 3; y ++){\n for(let x = -1; x < 2; x++){\n this.getWalk().setValue(new Vector2f(x + 1, y), y - Math.abs(x) + 1 + ((Math.random() - 0.5) / 2))\n }\n }\n break;\n\n // Up\n case 1:\n this.getStart().setY(this.getOffset());\n this.getRoot().setY(this.getOffset());\n\n for(let y = 0; y < 3; y ++){\n for(let x = -1; x < 2; x++){\n this.getWalk().setValue(new Vector2f(y, x + 1), y - Math.abs(x) + 1 + ((Math.random() - 0.5) / 2))\n }\n }\n break;\n\n // Left\n case 2:\n this.getStart().setX(this.getArea().getX()).setY(this.getOffset());\n this.getRoot().setX(this.getArea().getX()).setY(this.getOffset());\n\n for(let y = 0; y < 3; y ++){\n for(let x = -1; x < 2; x++){\n this.getWalk().setValue(new Vector2f(2 - y, x + 1), y - Math.abs(x) + 1 + ((Math.random() - 0.5) / 2))\n }\n }\n break;\n\n // Right\n case 3:\n this.getStart().setX(this.getOffset()).setY(this.getArea().getY());\n this.getRoot().setX(this.getOffset()).setY(this.getArea().getY());\n\n for(let y = 0; y < 3; y++){\n for(let x = -1; x < 2; x++){\n this.getWalk().setValue(new Vector2f(x + 1, 2 - y), y - Math.abs(x) + 1 + ((Math.random() - 0.5) / 2))\n }\n }\n break;\n }\n }", "function direction(start, end){\n var deltaX = end[0]-start[0];\n var deltaY = end[1]-start[1];\n if(deltaX === 0) return deltaY > 0 ? Math.PI/2 : 3*Math.PI/2;\n if(deltaY === 0) return deltaX > 0 ? 0 : Math.PI;\n var atan = Math.atan(deltaY/deltaX);\n if(atan >= 0){\n return deltaY > 0 ? atan : atan + Math.PI;\n }else{\n return deltaY > 0 ? atan + Math.PI : atan + 2*Math.PI;\n }\n}", "windChill(temp, vol)\n{\n if (temp <= 50 && vol > 3 && vol < 120) \n {\n var w = 35.74 + 0.6215 * temp + (0.4275 * temp - 35.75) * Math.pow(vol, 0.16);//calculate.\n console.log(\"Windchill for temperature \" + temp + \" and wind speed \" + vol + \" is \" + w);\n } \n else \n {\n console.log(\"Wrong temperature or wind speed\");\n }\n}", "static direction(departStop, arriveStop) {\n const depart = caltrainServiceData.southStops.indexOf(departStop);\n const arrive = caltrainServiceData.southStops.indexOf(arriveStop);\n return depart < arrive ? \"South\" : \"North\";\n }", "reverseDirection(direction) {\n if (direction == 'north') {\n return 'south';\n } else if (direction == 'south') {\n return 'north';\n } else if (direction == 'east') {\n return 'west';\n } else {\n return 'east';\n }\n }", "function wswd(wswdStr){\n var wd = parseInt(wswdStr.substring(0, 3), 10);\n var ws = parseInt(wswdStr.substring(3, 5), 10);\n //Strong wind\n if (wd%5 !== 0){\n ws = ws + 100 * (wd%5);\n wd = wd - (wd%5);\n }\n return [ws, wd];\n}", "function getDirection(x1, y1, x2, y2) {\n var dx = x2 - x1;\n var dy = y2 - y1;\n if (dx < 0) {\n if (dy < 0) return 7;\n else if (dy == 0) return 6;\n else return 5;\n }\n else if (dx == 0) {\n if (dy < 0) return 0;\n else if (dy == 0) return -1;\n else return 4;\n }\n else {\n if (dy < 0) return 1;\n else if (dy == 0) return 2;\n else return 3;\n }\n}", "function calculateDirectionToMoveAndUpdatePosition() {\n var NS, EW;\n\n if (TY < LY) {\n NS = 'S';\n TY += 1;\n }\n else if (TY > LY) {\n NS = 'N';\n TY -= 1;\n }\n else {\n NS = '';\n }\n\n if (TX < LX) {\n EW = 'E';\n TX += 1;\n }\n else if (TX > LX) {\n EW = 'W';\n TX -= 1;\n }\n else {\n EW = '';\n }\n\n return NS+EW;\n }", "function calculateDrawingDirection(p1, p2) {\n var deltaY = p1.y - p2.y;\n var deltaX = p1.x - p2.x;\n var angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;\n /*\n ANGLES:\n N 90\n W 0\n E (180, -180)\n S (-90)\n */\n if (angle >= 112 && angle < 157) {\n return 'NE';\n } else if (angle >= 67 && angle < 112) {\n return 'N';\n } else if (angle >= 22 && angle < 67) {\n return 'NW';\n } else if (angle >= -22 && angle < 22) {\n return 'W';\n } else if (angle >= -67 && angle < -22) {\n return 'SW';\n } else if (angle >= -112 && angle < -67) {\n return 'S';\n } else if (angle >= -157 && angle < -112) {\n return 'SE';\n } else {\n return 'E';\n }\n\n return false;\n }", "function windSpeedIn(metersPersecond) {\n return metersPersecond * 2.23694;\n}", "function YGps_get_direction()\n {\n var res; // double;\n if (this._cacheExpiration <= YAPI.GetTickCount()) {\n if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) {\n return Y_DIRECTION_INVALID;\n }\n }\n res = this._direction;\n return res;\n }", "function directionToText( hdg ) {\r\n\tvar half = 45 / 2;\r\n\tif( hdg > (360 - half) || hdg <= (0 + half) ) {\r\n\t\treturn \"North\";\r\n\t}\r\n\telse if( hdg > (0 + half) && hdg <= (90 - half) ) {\r\n\t\treturn \"Northeast\";\r\n\t}\r\n\telse if( hdg > (90 - half) && hdg <= (90 + half) ) {\r\n\t\treturn \"East\";\r\n\t}\r\n\telse if( hdg > (90 + half) && hdg <= (180 - half) ) {\r\n\t\treturn \"Southeast\";\r\n\t}\r\n\telse if( hdg > (180 - half) && hdg <= (180 + half) ) {\r\n\t\treturn \"South\";\r\n\t}\r\n\telse if( hdg > (180 + half) && hdg <= (270 - half) ) {\r\n\t\treturn \"Southwest\";\r\n\t}\r\n\telse if( hdg > (270 - half) && hdg <= (270 + half) ) {\r\n\t\treturn \"West\";\r\n\t}\r\n\telse {\r\n\t\treturn \"Northwest\";\r\n\t}\r\n}", "function getWeather(){\n $.getJSON(api, function(data){\n var windDirectionData = data.current.wind_dir;\n var weatherIcon = data.current.condition.icon;\n var WindDirection = \"\";\n switch (windDirectionData){\n case \"N\":\n WindDirection = \"North\";\n break;\n case \"NbE\":\n WindDirection = \"North by East\";\n break;\n case \"NNE\":\n WindDirection = \"North-northeast\";\n break;\n case \"NEbN\":\n WindDirection = \"Northeast by north\";\n break;\n case \"NE\":\n WindDirection = \"Northeast\";\n break;\n case \"NEbE\":\n WindDirection = \"North\";\n break;\n case \"ENE\":\n WindDirection = \"East-northeast\";\n break;\n case \"EbN\":\n WindDirection = \"East by north\";\n break;\n case \"E\":\n WindDirection = \"East\";\n break;\n case \"EbS\":\n WindDirection = \"East by south\";\n break;\n case \"ESE\":\n WindDirection = \"East-southeast\";\n break;\n case \"SEbE\":\n WindDirection = \"Southeast by east\";\n break;\n case \"SE\":\n WindDirection = \"Southeast\";\n break;\n case \"SEbS\":\n WindDirection = \"Southeast by south\";\n break;\n case \"SSE\":\n WindDirection = \"South-southeast\";\n break;\n case \"SbE\":\n WindDirection = \"Sout by east\";\n break;\n case \"S\":\n WindDirection = \"South\";\n break;\n case \"SbW\":\n WindDirection = \"South by West\";\n break;\n case \"SSW\":\n WindDirection = \"South-southwest\";\n break;\n case \"SWbS\":\n WindDirection = \"Southwest by south\";\n break;\n case \"SW\":\n WindDirection = \"Soutwest\";\n break;\n case \"SWbW\":\n WindDirection = \"Southwest by west\";\n break;\n case \"WSW\":\n WindDirection = \"West-southwest\";\n break;\n case \"WbS\":\n WindDirection = \"West by south\";\n break;\n case \"W\":\n WindDirection = \"West\";\n break;\n case \"WbN\":\n WindDirection = \"West by North\";\n break;\n case \"WNW\":\n WindDirection = \"West-northwest\";\n break;\n case \"NWbW\":\n WindDirection = \"Northwest by west\";\n break;\n case \"NW\":\n WindDirection = \"Nortwest\";\n break;\n case \"NWbN\":\n WindDirection = \"Northwest by north\";\n break;\n case \"NNW\":\n WindDirection = \"North-northwest\";\n break;\n case \"NbW\":\n WindDirection = \"North by west\";\n break;\n }\n\n\n\n document.getElementById(\"pHumidity\").innerHTML = data.current.humidity + \" %\";\n document.getElementById(\"pWindDirection\").innerHTML = WindDirection;\n document.getElementById(\"iWeatherIcon\").src= data.current.condition.icon;\n document.getElementById(\"conditionText\").innerHTML = data.current.condition.text;\n });\n }", "function buildWC(windSpeed, temp) {\n // let feelTemp = document.getElementById('feelTemp');\n\n // Compute the windchill\n let wc = 35.74 + 0.6215 * temp - 35.75 * Math.pow(windSpeed, 0.16) + 0.4275 * temp * Math.pow(windSpeed, 0.16); \n // console.log(wc);\n\n // Round the answer down to integer\n wc = Math.floor(wc);\n\n // If chill is greater than temp, return the temp\n wc = (wc >temp)?temp:wc;\n console.log('WindChill: ' + wc);\n\n return wc;\n // Display the windchill\n \n \n // feelTemp.innerHTML = wc;\n}", "function get_direction() {\n\t\treturn window.get_direction ? window.get_direction() : getComputedStyle(menus_el).direction;\n\t}", "function getCompassDir(direction) {\n\n var compass = '';\n\n switch (true) {\n case direction <= 30:\n compass = 'North';\n break;\n case direction <= 60:\n compass = 'North East';\n break;\n case direction <= 120:\n beaufort = 'East';\n break;\n case direction <= 150:\n compass = 'South East';\n break;\n case direction <= 210:\n compass = 'South';\n break;\n case direction <= 240:\n beaufort = 'South West';\n break;\n case direction <= 300:\n compass = 'West';\n break;\n case direction <= 330:\n compass = 'North West';\n break;\n case direction > 330:\n compass = 'North';\n break;\n }\n return compass;\n}", "function KinkyDungeonGetDirection(dx, dy) {\n\t\n\tvar X = 0;\n\tvar Y = 0;\n\t\n\tif (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5)\n\t\treturn {x:0, y:0, delta:1}\n\t\n\t// Cardinal directions first - up down left right\n\tif (dy > 0 && Math.abs(dx) < Math.abs(dy)/2.61312593) Y = 1\n\telse if (dy < 0 && Math.abs(dx) < Math.abs(dy)/2.61312593) Y = -1\n\telse if (dx > 0 && Math.abs(dy) < Math.abs(dx)/2.61312593) X = 1\n\telse if (dx < 0 && Math.abs(dy) < Math.abs(dx)/2.61312593) X = -1\n\t\n\t// Diagonals\n\telse if (dy > 0 && dx > dy/2.61312593) {Y = 1; X = 1}\n\telse if (dy > 0 && -dx > dy/2.61312593) {Y = 1; X = -1}\n\telse if (dy < 0 && dx > -dy/2.61312593) {Y = -1; X = 1}\n\telse if (dy < 0 && -dx > -dy/2.61312593) {Y = -1; X = -1}\n\t\n\treturn {x:X, y:Y, delta:Math.round(Math.sqrt(X*X+Y*Y)*2)/2} // Delta is always in increments of 0.5\n}", "getDirection() {\n const direction = this._config.direction;\n if (!direction) {\n return 'ltr';\n }\n return typeof direction === 'string' ? direction : direction.value;\n }", "function getDirection(angle) {\n var directions = ['North', 'North-West', 'West', 'South-West', 'South', 'South-East', 'East', 'North-East'];\n return directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8];\n }", "function wrapDirection(direction,directions){\n if (direction<0){\n direction += directions;\n } \n if (direction >= directions){\n direction -= directions;\n }\n return direction;\n}", "function dirToNum(dir) {\r\n\r\n switch (dir) {\r\n case \"W\":\r\n return 2;\r\n case \"NW\":\r\n return 1;\r\n case \"N\":\r\n return 0;\r\n case \"NE\":\r\n return 7;\r\n case \"E\":\r\n return 6;\r\n case \"SE\":\r\n return 5;\r\n case \"S\":\r\n return 4;\r\n case \"SW\":\r\n return 3;\r\n default:\r\n //console.log(\"That isn't a direction..........\");\r\n return -1;\r\n }\r\n\r\n}", "getDirection() {\n return Math.atan2(this.y, this.x);\n }", "function getDirection(p1, p2) {\n var dx = p2.x - p1.x;\n var dy = p2.y - p1.y;\n var v = { x: dx, y: dy };\n var d = getDistance(p1, p2);\n var vn = { x: v.x / d, y: v.y / d };\n return vn;\n }", "function _makeWinding(points, direction) {\n var winding = _getWinding(points);\n if (winding === direction) {\n return points;\n }\n var revPoints = [];\n for (var i = points.length-2; i >= 0; i -= 2) {\n revPoints.push(points[i], points[i+1]);\n }\n return revPoints;\n }", "function get_my_direction() {\n var v, dir;\n\n v = new THREE.Vector3(0,0,-1);\n //v = WORLD.camera.matrixWorld.multiplyVector3(v); // r54\n v.applyMatrix4(WORLD.camera.matrixWorld); // r58\n\n //dir.sub(v).setLength(BULLET_VELOCITY); // r58\n dir = new THREE.Vector3(0,0,0);\n dir.copy(WORLD.player.mesh.position);\n\n //dir.subSelf(v); // r54\n dir.subVectors(dir, v); // r58\n //dir.sub(v);\n\n return dir;\n}", "function direction(x){\n var a= parseInt(x);\n if ((a>=0 && a<45)||a==360){\n return \"Utara\";\n }else if(a>=45&&a<90){\n return \"Timur Laut\";\n }else if(a>=90&&a<135){\n return \"Timur\";\n }else if(a>=135&&a<180){\n return \"Tenggara\";\n }else if(a>=180&&a<225){\n return \"Selatan\";\n }else if(a>=225&&a<270){\n return \"Barat Daya\";\n }else if(a>=270&&a<315){\n return \"Barat\";\n }else if(a>=315&&a<360){\n return \"Barat Laut\";\n }\n }", "static direction(p) {\n const angleX = Point.directionAngleX(p);\n const inverseAngleX = (2 * Math.PI - angleX) % (2 * Math.PI);\n return (inverseAngleX + 0.5 * Math.PI) % (2 * Math.PI);\n }", "toDirectionString() {\n let retStr = new String();\n if (this.magnitude != 3) {\n retStr = this.magnitude.toString();\n }\n retStr += this.direction;\n return retStr;\n }", "toDirectionString() {\n let retStr = new String();\n if (this.magnitude != 3) {\n retStr = this.magnitude.toString();\n }\n retStr += this.direction;\n return retStr;\n }", "function oppDirection(direction) {\n if (direction == 'N') return 'S'\n if (direction == 'E') return 'W'\n if (direction == 'S') return 'N'\n if (direction == 'W') return 'E'\n }", "function direction(up){\n \n directionValue=up;\n\tsetGradient();\n\t\n\t\n}", "GetViewDir(obj) {\n // Get screen coordinates (bottom-left based) for the mouse\n const screen_mouse_pos = this._GetMousePos()\n // Get screen coordinates (bottom-left based) for the weapon holster\n const screen_holster_pos = new Vec2D(\n obj.graphic.parent.worldTransform.tx,\n window.innerHeight - obj.graphic.parent.worldTransform.ty)\n // Get the distance between the two => direction vector\n const distance = Vec2D.Sub(screen_mouse_pos, screen_holster_pos)\n return Vec2D.Div(distance, distance.Magnitude) // normalize\n }", "function popupDirection() {\n var wHeight = $(window).height();\n var wWidth = $(window).width();\n var direction = '';\n \n // determine y direction\n if (mouseY > wHeight*2/3)\n direction = 's';\n else if (mouseY > wHeight/3)\n direction = '';\n else\n direction = 'n';\n \n // determine x direction\n if (mouseX > graphWidth*2/3)\n direction += 'e';\n else if (mouseX > graphWidth/3)\n direction += '';\n else\n direction += 'w'\n \n // have at least 1 direction\n if (direction == '')\n direction = 'w';\n \n return direction;\n}", "function direction(x, y){ \n\tif (((dirX != 0) && (!x)) || ((dirY != 0) && (!y))) { \n\t\tdirX = x;\n\t\tdirY = y;\n\t}\n}", "calculateWindCorrection(course, groundSpeed) {\n const magVar = SimVar.GetSimVarValue(\"MAGVAR\", \"degrees\");\n const currWindDirection = GeoMath.removeMagvar(SimVar.GetSimVarValue(\"AMBIENT WIND DIRECTION\", \"degrees\"), magVar);\n const currWindSpeed = SimVar.GetSimVarValue(\"AMBIENT WIND VELOCITY\", \"knots\");\n\n const currCrosswind = currWindSpeed * (Math.sin((course * Math.PI / 180) - (currWindDirection * Math.PI / 180)));\n const windCorrection = 180 * Math.asin(currCrosswind / groundSpeed) / Math.PI;\n\n return windCorrection;\n }", "function addWind(object) {\nconst wind = object.wind.speed;\nconst mphWind = wind * 2.237;\nreturn `Wind speed(mph): ${Math.round(mphWind)}`;\n}", "rigthAscension(){\n const julDay = this.convertJulianDay();\n const last = this.calcLAST(julDay, this.longitude);\n return last;\n }", "function wind() {\n var roll = dice.d(20);\n if (roll > 17) {\n return \"strong winds\";\n }\n\n if (roll > 11) {\n return \"light winds\";\n }\n\n return \"no wind\";\n}", "function getDirection (from, to) {\n var dx = to[0] - from[0], dy = to[1] - from[1];\n if (dx != 0) {\n return -Math.sign(dx) * 90 - 180/Math.PI * Math.atan(dy/dx);\n } else {\n return 90 + 180/Math.PI * Math.asin(dy);\n }\n }", "get direction() {\n return Vector.unit(this.angle);\n }", "getWindSpeed() {\n this.windService.getWindDetails().subscribe(res => {\n this.windSpeed = +parseFloat(String((res['wind']['speed'] * 18) / 5)).toFixed(2);\n }, error => {\n alert('Error while getting the wind speed.');\n });\n }", "ngOnInit() {\n this.getWindSpeed();\n }", "function reverseDir(direction) {\n switch (direction) {\n case dirEnum.NORTH: return dirEnum.SOUTH;\n case dirEnum.SOUTH: return dirEnum.NORTH;\n case dirEnum.EAST: return dirEnum.WEST;\n case dirEnum.WEST: return dirEnum.EAST;\n default: return -1; \n }\n }", "function getDir(num) {\n const val = parseInt(num / 45 + 0.5)\n const dir = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']\n return dir[val % dir.length]\n}", "get direction() {\n return {\n 37: -1,\n 38: -1,\n 39: 1,\n 40: 1\n };\n }", "function rtod(fradsians)\n{\n return (fradians * 180.0 / Math.PI);\n}", "function mapyst_dirFloorIndex(direction) {\n\treturn direction.end.floorIndex;\n}", "getWindDirectionIconClass(bearing) {\n return `wi wi-wind from-${bearing}-deg`;\n }", "function getRelativeDirection(direction, delta) {\n const directions = ['N', 'E', 'S', 'W']\n return directions[mod((directions.indexOf(direction) + delta), directions.length)]\n}", "function transformDirection(a, b) {\n return options.dir ? 100 - a - b : a;\n } // Updates scope_Locations and scope_Values, updates visual state", "getCardinalStickDirection(vertical, horizontal) {\n let horizontalDir = '';\n let verticalDir = '';\n\n if (applyDeadzone(this.gamepad.axes[vertical], deadzone) > 0)\n verticalDir = 'S';\n if (applyDeadzone(this.gamepad.axes[vertical], deadzone) < 0)\n verticalDir = 'N';\n if (applyDeadzone(this.gamepad.axes[horizontal], deadzone) > 0)\n horizontalDir = 'E';\n if (applyDeadzone(this.gamepad.axes[horizontal], deadzone) < 0)\n horizontalDir = 'W';\n\n return verticalDir + horizontalDir;\n }", "function upDirection() {\n if ((!upPressed && !downPressed) || (upPressed && downPressed)) {\n return undefined;\n } else {\n if (upPressed) {\n return -Math.PI / 2;\n } else {\n return Math.PI / 2;\n }\n }\n}", "function buildWC(speed,temp){\n\nconst feelTemp = document.getElementById('feelTemp')\n\n// Compute the windchill\nlet wc = 35.74 + 0.6215 * temp - 35.75 * Math.pow(speed, 0.16) + 0.4275 * temp * Math.pow(speed, 0.16);\nconsole.log(wc);\n\n// Round the answer down to integer\nwc = Math.floor(wc);\n\n// If chill is greater than temp, return the temp\n wc = (wc > temp)?temp:wc;\n\n // Display the windchill\n console.log(wc);\n feelTemp.innerHTML = wc;\n}", "function roverDirection(directionSymbol) {\n var directionWord = \"\";\n\n switch (directionSymbol) {\n case \"N\":\n directionWord = \"North\";\n break;\n case \"W\":\n directionWord = \"West\";\n break;\n case \"S\":\n directionWord = \"South\";\n break;\n case \"E\":\n directionWord = \"East\";\n break;\n }\n\n return directionWord;\n}" ]
[ "0.79684556", "0.77626467", "0.74703056", "0.7360368", "0.7349593", "0.73072606", "0.7256872", "0.70944744", "0.6855189", "0.6819715", "0.6790993", "0.66338456", "0.6630767", "0.6629049", "0.654573", "0.65243214", "0.64488494", "0.64372087", "0.64254427", "0.6383728", "0.63557553", "0.6354529", "0.6340392", "0.6306623", "0.62811285", "0.6239637", "0.6229292", "0.61938745", "0.6172296", "0.6141968", "0.6120474", "0.61053723", "0.6073134", "0.60637236", "0.605681", "0.60355693", "0.5994203", "0.59796476", "0.59591407", "0.5954889", "0.59349597", "0.5931145", "0.59221715", "0.5913328", "0.59074223", "0.58926105", "0.5880801", "0.5870918", "0.58668184", "0.58658737", "0.58638406", "0.5824149", "0.5812805", "0.58046746", "0.57974565", "0.5793501", "0.5783018", "0.5778891", "0.5775202", "0.5753", "0.5750516", "0.57402164", "0.57398385", "0.5738939", "0.57019573", "0.57011825", "0.5699343", "0.5693884", "0.5693388", "0.5692756", "0.56780434", "0.5667845", "0.56675136", "0.56655574", "0.56440336", "0.56440336", "0.5641007", "0.5639526", "0.56323963", "0.5631415", "0.56275946", "0.56181425", "0.56015027", "0.56008834", "0.5597586", "0.5593264", "0.5589627", "0.55842847", "0.5576968", "0.55707544", "0.55693847", "0.5566695", "0.5562316", "0.5561178", "0.55584353", "0.5553518", "0.5543893", "0.5542479", "0.55391234", "0.55389583", "0.5538434" ]
0.0
-1
_e.bindAll(".iconpluscircle", "click", numBoxPing) _e.bindAll(".iconminuscircleo", "click", numBoxReduce)
function numBoxPing() { var getlocalStorageGoods = JSON.parse(localStorage.getItem('localStorageGoods')) for (var k = 0; k < getlocalStorageGoods.length; k++) { if (this.parentNode.parentNode.parentNode.parentNode.id == getlocalStorageGoods[k].id && this.parentNode.parentNode.parentNode.parentNode.getAttribute("data-preorder") == getlocalStorageGoods[k].preorder) { getlocalStorageGoods[k].amount++ if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].stockamount) { _e.msgBox({ msg: "库存不足!", timeout: 2000, className: "error" }) return } if (this.getAttribute("data-promotionflag") == "3" || this.getAttribute("data-promotionflag") == "1" || this.getAttribute("data-promotionflag") == "4") { if (getlocalStorageGoods[k].amount > Number(getlocalStorageGoods[k].promotion[0].repeatpurchasetimes)) { _e.msgBox({ msg: "不享受优惠!", timeout: 700, className: "info" }) return } } if (this.getAttribute("data-promotionflag") == "2") { if (getlocalStorageGoods[k].amount > Number(getlocalStorageGoods[k].promotion[0].repeatpurchasetimes)) { _e.msgBox({ msg: "不享受优惠!", timeout: 700, className: "info" }) return } if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount <= Number(getlocalStorageGoods[k].promotion[0].reapttimes) - Number(getlocalStorageGoods[k].promotion[0].count)) { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + (Number(getlocalStorageGoods[k].price) * Number(getlocalStorageGoods[k].promotion[0].discount)) / 100) / 100 aaa = (aaa + (Number(getlocalStorageGoods[k].price) * Number(getlocalStorageGoods[k].promotion[0].discount)) / 100) } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } if (getlocalStorageGoods[k].promotion.length != 0) { if (getlocalStorageGoods[k].promotionflag == 2) { if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].promotion[0].reapttimes - getlocalStorageGoods[k].promotion[0].count) { _e.msgBox({ msg: "不享受优惠!", timeout: 2000, className: "error" }) } } } if (getlocalStorageGoods[k].promotionflag == 1 || getlocalStorageGoods[k].promotionflag == 3 || getlocalStorageGoods[k].promotionflag == 4) { if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].promotion[0].reapttimes - getlocalStorageGoods[k].promotion[0].count) { _e.msgBox({ msg: "不享受优惠!", timeout: 2000, className: "error" }) } } } } this.parentNode.childNodes[2].innerHTML = getlocalStorageGoods[k].amount localStorage.setItem('localStorageGoods', JSON.stringify(getlocalStorageGoods)) openCartTips() return } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bindEvents() {\n DOM.plusSign.click(toggleIcon);\n }", "addClickHandlers() {\n //boxes is outside the class you are going to loop over every element of this nodelist...\n boxes.forEach(box => {\n //..then add a event listener on each one\n box.addEventListener('click', e => {\n //then run the following functions\n this.changeNumber(box.dataset.place);\n this.changeColor(box.dataset.place);\n })\n })\n }", "function handleBoxClick() {\n increasePoints();\n increaseSpeed();\n resetPosition();\n }", "numBoxClicked(numBoxRow, numBoxCol, numBoxVal) {\n \tif (this.model.crossOutNum(numBoxRow, numBoxCol, numBoxVal) === true) {\n \t\tthis.view.strikeNum(numBoxRow, numBoxCol);\n \t\t\n \t\tif (this.model.crossOutLockBox(numBoxRow, numBoxCol) === true) {\n \t\t\tthis.view.strikeLockBox(numBoxRow);\n \t\t\tthis.view.disappearDie(numBoxRow);\n \t\t}\n \t\t\n \t\tthis.view.changeButtons(this.model.gamePhase);\n \t\tthis.gameOverCheck();\n \t}\n }", "function BindPlusMinusButtons() {\n $(\"#output_DataToDB\").on(\"click\", \"#plusStart\", function () {\n SelectedStart--;\n UpdateAfterXPathChanged();\n });\n\n $(\"#output_DataToDB\").on(\"click\", \"#minusStart\", function () {\n SelectedStart++;\n UpdateAfterXPathChanged();\n });\n\n $(\"#output_DataToDB\").on(\"click\", \"#plusEnd\", function () {\n SelectedEnd++;\n UpdateAfterXPathChanged();\n });\n\n $(\"#output_DataToDB\").on(\"click\", \"#minusEnd\", function () {\n SelectedEnd--;\n UpdateAfterXPathChanged();\n });\n}", "function addRedandYellowListeners(){\n\t\tconsole.log('setting listeners')\n\t\tfor (var i = $boxes.length-1; i>=0; i--){\n\t\t\tvar $box = $($boxes[i]);\n\t\t\t$box.on('click', addRedorYellow)\n\t\t}\n\t}", "function clickIncrement(ui_element,x) {\n increaseResourceTotalEffect(ui_element,x, x.clickIncrement); \n}", "function clickHandler() {\n // For Operators\n $('#calculator').on('click', '#add', adding);\n $('#calculator').on('click', '#subtract', subtracting);\n $('#calculator').on('click', '#multiply', multiplying);\n $('#calculator').on('click', '#divide', dividing);\n // For posting to server \n $('#calculate').on('click', calculate);\n $('#reset').on('click', launchCalc).on('click', resetResult);\n}", "function bind() {\r\n\t\t$('#validate').on('click', function() {\r\n\t\t\tvalidate();\r\n\t\t});\r\n\t\t\r\n\t\t$('#cheat').on('click', function() {\r\n\t\t\tshowmines();\r\n\t\t});\r\n\t\r\n\t\t$('#reset').on('click', function() {\r\n\t\t\tnewGame();\r\n\t\t});\r\n\t\t\r\n\t\t$('#saveButton').on('click', function() {\r\n\t\t\tsave();\r\n\t\t});\r\n\t\t\r\n\t\tloadButton.on('click', function() {\r\n\t\t\tif (!$(this).hasClass('noload')) load();\r\n\t\t});\r\n\t\t\r\n\t\t//$('#solve').on('click', function() {\r\n\t\t//\tsolve();\r\n\t\t//});\r\n\t}", "function clicked(d,i) {\n\n}", "function clicked(d,i) {\n\n}", "function addClick(ind){\n var elem = shapes[ind];\n elem.addEventListener(\"click\", function(){\n clicked += 1;\n checkOrder(ind);\n\n });\n }", "function enableButtons() {\n for (let i = 0; i < 10; i++) {\n bombNumber[i].addEventListener(\"click\", numButton);\n };\n clearDisplay.addEventListener(\"click\", resetDisplay);\n backspace.addEventListener(\"click\", backspaceButton);\n}", "function addClicks (int1) {\n rockTotal += int1;\n }", "function setupNumberButtons() {\n let buttons = document.querySelectorAll(\".button-operator, .button-number\");\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].addEventListener('click', addToScreen, false);\n }\n}", "function clickControl() {\n $('.cat-click').click(function() {\n \n totalMoney += moneyPerClick;\n MoneyForThisRound += moneyPerClick;\n displayMoney();\n totalClicks += 1; //keep track on how many times has user clicked \n clicksForThisRound += 1; //keep track on how many times has user clicked \n \n $('.cat-click').effect('bounce', {times: 1}, 50);\n \n });\n}", "function addXandOListener(){\n\t// For loop cointing down available spaces\n\t// QUESTION - Should I have come up with counting down more easily? How so? \n\tfor (var i = boxes.length - 1; i >= 0; i--) {\n\t\t// In the for loop, this is listening for \"clicks\" to add an X or O\n\t\tboxes[i].addEventListener(\"click\", addXorO);\n\t}\n}", "function clickEarn(amount) {\n for (i = 0; i < amount; i++) {\n money+=1;\n}\n\t\n update()\n}", "function initialize() {\n let nums = qsa(\".num\");\n for (let i = 0; i<nums.length; i++) {\n //addColorChange(nums[i]);\n nums[i].addEventListener(\"click\", addChar);\n }\n //addColorChange($(\"x\"));\n $(\"x\").addEventListener(\"click\", delChar);\n\n // addColorChange($(\"enter\"));\n $(\"enter1\").addEventListener(\"click\", fetchData);\n }", "function keyboardListener(key) {\n switch (key) {\n case 13:\n $(\"#equals\").trigger(\"click\");\n break;\n case 42:\n $(\"#multiply\").trigger(\"click\");\n break;\n case 43:\n $(\"#add\").trigger(\"click\");\n break;\n case 45:\n $(\"#subtract\").trigger(\"click\");\n break;\n case 46:\n $(\"#decimal\").trigger(\"click\");\n break;\n case 47:\n $(\"#divide\").trigger(\"click\");\n break;\n case 48:\n $(\"#zero\").trigger(\"click\");\n break;\n case 49:\n $(\"#one\").trigger(\"click\");\n break;\n case 50:\n $(\"#two\").trigger(\"click\");\n break;\n case 51:\n $(\"#three\").trigger(\"click\");\n break;\n case 52:\n $(\"#four\").trigger(\"click\");\n break;\n case 53:\n $(\"#five\").trigger(\"click\");\n break;\n case 54:\n $(\"#six\").trigger(\"click\");\n break;\n case 55:\n $(\"#seven\").trigger(\"click\");\n break;\n case 56:\n $(\"#eight\").trigger(\"click\");\n break;\n case 57:\n $(\"#nine\").trigger(\"click\");\n break;\n }\n}", "function bind() {\n $('.rate').blur(update_price);\n $('.qty').blur(update_price);\n }", "function removeRedandYellowListeners(){\n\t\tfor (var i = $boxes.length -1; i>=0;i--){\n\t\t\tvar $box = $($boxes[i]);\n\t\t\t$box.off('click', addRedorYellow);\n\t\t}\n\t}", "function clickedSquare() {\n for(var i = 0; i < squares.length; i++) {\n squares[i].addEventListener(\"click\", function() {\n var square_number = parseInt(this.innerText);\n setSquares(square_number);\n })\n }\n}", "function startUpBindings(){\n $(\"body\").bind(\"click\", function(event){\n oldinterval = GMvariables.interval;\n GMvariables.interval = (GMvariables.interval<=400) ? 400 : (GMvariables.interval - 50);\n\n if((GMvariables.points == 0) || (GMvariables.devil == false)){\n deviElementHide();\n devilLoop();\n GMvariables.points++;\n }\n\n else if(event.target.id == \"clickElement\"){\n GMvariables.points++;\n deviElementHide();\n stopAndRestartDevilLoop()\n }\n else{\n deviElementHide();\n GMvariables.live--;\n stopAndRestartDevilLoop();\n $(\".notification\").show();\n setTimeout(() => {\n $(\".notification\").hide();\n }, 500);\n }\n if(GMvariables.points != 1 ){\n if(oldinterval != GMvariables.interval){\n stopAndRestartDevilLoop();\n }\n }\n\n if(event.target.id == \"restart\"){\n $(\"#restart\").hide();\n $(\"#timer\").text(\"Ahhh here we go again ...\");\n startGameTimer();\n }\n console.log(\"clicked\");\n });\n}", "function events() {\r\n\taddition();\r\n\tcounter();\r\n\tcheckForm();\r\n}", "function whenClicked() {\n $(\"#image-1\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.emeraldValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-2\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.jewelValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-3\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.rubyValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-4\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.topazValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n }", "function handler(){\n switchCounter++;\n if(switchCounter%2===1 && $values.innerText.length<8){\n $values.style.display=\"block\";\n for(j=0;j<=10;j++){\n $number[j].addEventListener(\"click\",numberSelect);\n }\n for(m=0;m<=3;m++){\n $operator[m].addEventListener(\"click\",operation);\n }\n $equals.addEventListener(\"click\",showAnswer);\n $mPositive.addEventListener(\"click\",storeToMemory);\n $mNegative.addEventListener(\"click\",removeFromMemory);\n $mrc.addEventListener(\"click\",storedMemory);\n }\n else{\n $values.style.display=\"none\";\n $values.innerText=0;\n numberIsClicked=false;\n operatorIsClicked=false;\n numberOfOperand=0;\n equalsToIsClicked=false;\n myoperator=\"\";\n }\n}", "bindings() {\n let that = this\n $(`${this.selectors.overlay} .close-icon`).on('click', function () {\n $(that.selectors.overlay).toggleClass(\"minimised\")\n $(`.close-icon > svg`).toggleClass(\"fa-rotate-180\")\n })\n\n this.bindSearch()\n }", "function ClickCounter() {}", "function bindMoveEvents(locs) {\n for (var i=0; i<locs.length; i++) {\n b.cell(locs[i]).DOM().classList.add(\"green\");\n b.cell(locs[i]).on(\"click\", movePiece); \n }\n}", "function bindMoveEvents(locs) {\n for (var i=0; i<locs.length; i++) {\n b.cell(locs[i]).DOM().classList.add(\"green\");\n b.cell(locs[i]).on(\"click\", movePiece); \n }\n}", "function setUpModeButtons(){\n //mode buttons event listeners \n for(var i = 0; i < modeButtons.length; i++){\n modeButtons[i].addEventListener(\"click\", function(){\n modeButtons[0].classList.remove(\"selected\");\n modeButtons[1].classList.remove(\"selected\");\n this.classList.add(\"selected\");\n this.textContent === \"Easy\" ? numSquares = 3 : numSquares = 6;\n reset();\n });\n };\n}", "clicked(x, y) {}", "function plus(){\n zoomOnClick = true;\n}", "function numberPressed() {\n\n //all of my values that I am getting from the button pressing I am storing in an array (inputs[]).\n //the variable totalInt1 is used as a snapshot of what the current index in the array is at that time.\n if($(this).text() == '.'){\n if(inputs[i].includes(\".\")){\n return;\n }\n }\n if(num1 == null) {\n var val = $(this).text();\n inputs[i] += val;\n totalInt1 = inputs[i];\n $(\"#displayScreen p\").text(totalInt1);\n }\n else if(num1 != null && num2 !=null){\n var ogOperator = inputs[inputs.length-3];\n num1 = doMath(num1 , num2 , ogOperator);\n num2 = null;\n ++i;\n ogOperator = operator;\n }\n else if(num2 == null) {\n var val = $(this).text();\n if(inputs[i] == null){\n inputs[i] = \"\";\n }\n inputs[i] += val;\n totalInt2 = inputs[i];\n $(\"#displayScreen p\").text(totalInt2);\n }\n equalFire = false;\n}", "function ceClicked(){\n\t$display.val('');\n\tneedNewNum = true;\n\tnumEntered = false;\n}", "function bind() {\n\t\t\t$('#status').bind('click', actionButton);\n\t\t\t$('#reset').bind('click', resetButton);\n\t\t\t$('#pause').bind('click', function() {\n\t\t\t\tif ($('#pause').hasClass('unpaused')) {\n\t\t\t\t\tlevelService.startPausedTime();\n\t\t\t\t\t$('#pause').removeClass();\n\t\t\t\t\t$('#pause').addClass('paused');\n\t\t\t\t} else {\n\t\t\t\t\tlevelService.endPausedTime();\n\t\t\t\t\t$('#pause').removeClass();\n\t\t\t\t\t$('#pause').addClass('unpaused');\n\t\t\t\t}\n\t\t\t});\n\t\t}", "function initialClickAssignments(){\n let counters= $(\".counter\"); \n for (let i=0; i<counters.length; i++){\n giveClickListenerToBeadCounters(counters[i]); \n }\n}", "handleNumClick(i, e) {\n let numEvent = new CustomEvent('numPress', { 'detail': { 'number': i } });\n let keypad = document.getElementById('keypad');\n keypad.dispatchEvent(numEvent);\n }", "function buttonClickHandler() {\n // a) Tekst op de button veranderen\n GAME_BUTTON_ELEMENT.innerHTML = 'Reset spel';\n\n //b) Speelveld (cellen) klikbaar maken\n for(var celnum = 0; celnum < 9; celnum++) {\n GAME_FIELD_ELEMENT[celnum].onclick = cellClickHandler;\n }\n\n // c) Ronde verhogen en tonen\n current_round = current_round + 1;\n CURRENT_ROUND_ELEMENT.innerHTML = current_round;\n\n} // EINDE FUNCTION buttonClickHandler", "function clickHandler(){\n\tctr++;\n\tclearTimeout(timeoutID);\n\n /*---------------------\n Resets the boxes when a match\n has not been made\n ---------------------*/\n\tif(ctr % 2 !== 0 && his.length > 0){\n\t\this.pop().setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\this.pop().setAttributeNS(null, \"fill\", \"lightgrey\");\n\t}\n\tvar currentBox = this;\n\tcurrentBox.setAttributeNS(null, \"fill\", colors[currentBox.getAttributeNS(null,\"idx\")]);\n\n /*---------------------\n Sets selection equal to\n the box that has been selected first\n ---------------------*/\n\tif(ctr % 2 !== 0){\n\t\tselection = this;\n\t}\n\n /*---------------------\n Handles the second click\n\n First, checks if the same box as selection\n is clicked, does nothing in this case.\n ---------------------*/\n\tif(ctr % 2 === 0){\n\t\tif(selection.getAttributeNS(null,\"idx\") === currentBox.getAttributeNS(null,\"idx\")){\n\t\t\tctr--;\n\t\t}\n\t\telse{\n\t\t\tif(colors[selection.getAttributeNS(null, \"idx\")] === colors[currentBox.getAttributeNS(null, \"idx\")]){\n\t\t\t\tselection.removeEventListener('click', clickHandler, false);\n\t\t\t\tcurrentBox.removeEventListener('click', clickHandler, false);\n\t\t\t\tmatches++; //if a match has been made, removes the listeners for those boxes\n\t\t\t\tif(matches===50){ //Checks the win condition\n\t\t\t\t\talert(\"Congratulations, you've won!\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\this.push(currentBox);\n\t\t\t\this.push(selection);\n\t\t\t\ttimeoutID = setTimeout(function(){\n\t\t\t\t\tcurrentBox.setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\t\t\t\tselection.setAttributeNS(null, \"fill\", \"lightgrey\");\n\t\t\t\t},500);\n\t\t\t}\n\t\t}\n\t}\n}", "handleClick(e, number) {\n console.log(\"clicke\" + e.target);\n this.counter += number;\n }", "function circleClick()\n{\n\t$(\".circle\").click(function(){\n\t\tdeSelectAll();\n\t\t$(this).addClass(\"selected\");\n\t\talert(getPositionIndex(this));\n\t});\n}", "function clickedNum(num) {\n if (state.result !== undefined) {\n clear();\n }\n\n if (state.operation === undefined) {\n state.operandOne = state.operandOne === \"0\" ? num : (state.operandOne + num);\n panel.textContent = state.operandOne;\n } else {\n state.operandTwo += num;\n panel.textContent = state.operandTwo;\n }\n }", "function onNumberClick($event, getNum) {\n $event.preventDefault();\n userAttempt = parseInt(getNum);\n angular.element('.check-btns').css({'pointer-events': 'auto','cursor':'pointer'});\n return false;\n }", "function nodeClicked(d,i) {\n }", "function areaMouseClick(x, e) {\r\n switch(x.alt) {\r\n case \"ac\":\r\n if (e.shiftKey) {\r\n e.preventDefault();\r\n $(\"#screen-row-field1\").contents().remove(); totalTop = 0;\r\n $(\"#screen-row-field2\").contents().remove(); totalMiddle = 0;\r\n $(\"#screen-row-field3\").contents().remove(); totalBottom = 0;\r\n numberUsed = false;\r\n operaterUsedOnce = false;\r\n operaterUsedLast = true;\r\n pressedEquals = false;\r\n currentCalc = [];\r\n }\r\n let dotChecker = $(\"#screen-row-field3\").text()[$(\"#screen-row-field3\").text().length -1];\r\n if (dotChecker == \".\") { deciPressed = false; }\r\n let replaceString = $(\"#screen-row-field3\").text().slice(0, -1);\r\n $(\"#screen-row-field3\").contents().remove();\r\n $(\"#screen-row-field3\").append(replaceString);\r\n if (totalBottom < 1) { totalBottom = 0 } else { totalBottom--; }\r\n console.log(totalBottom);\r\n break;\r\n case \"deci\":\r\n if (!deciPressed) {\r\n deciPressed = true;\r\n $(\"#screen-row-field3\").append(\".\");\r\n totalBottom++;\r\n } else {\r\n alert(\"already used decimal this number\");\r\n }\r\n break;\r\n case \"1\": \r\n case \"2\":\r\n case \"3\":\r\n case \"4\":\r\n case \"5\":\r\n case \"6\":\r\n case \"7\":\r\n case \"8\":\r\n case \"9\":\r\n case \"0\":\r\n /*if (!lengthChecker(totalBottom)) {\r\n $(\"#screen-row-field3\").append(x.alt);\r\n console.log($(\"#screen-row-field3\").html());\r\n totalBottom++;\r\n } old method for making numbers not bleed out*/\r\n if (!pressedEquals) {\r\n //if (newCalc) { $(\"#screen-row-field3\").contents.empty(); newcalc = false; }\r\n $(\"#screen-row-field3\").append(x.alt);\r\n console.log($(\"#screen-row-field3\").html());\r\n totalBottom++;\r\n numberUsed = true;\r\n operaterUsedLast = false;\r\n } else {\r\n alert(\"use an oeprator!\");\r\n }\r\n break;\r\n case \"deci\":\r\n $(\"#screen-row-field1\").append(\"test string\");\r\n break;\r\n case \"divide\":\r\n case \"multiply\":\r\n case \"minus\":\r\n case \"add\":\r\n case \"pct\":\r\n if (numberUsed == true &&\r\n oneAtATime == true) {\r\n oaat();\r\n }\r\n if ((numberUsed == true && operaterUsedLast == false)\r\n || pressedEquals == true) {\r\n let s = $(\"#screen-row-field3\").text();\r\n $(\"#screen-row-field2\").contents().remove();\r\n $(\"#screen-row-field2\").append(s + getSymbol(x.alt));\r\n if (!s ==\"\") { currentCalc.push(s); }\r\n currentCalc.push(getSymbol(x.alt));\r\n totalMiddle = $(\"#screen-row-field2\").text().length;\r\n $(\"#screen-row-field3\").contents().remove();\r\n totalBottom = 0;\r\n operaterUsedLast = true;\r\n operaterUsedOnce = true;\r\n pressedEquals = false;\r\n deciPressed = false;\r\n oneAtATime = true;\r\n } else {\r\n alert(\"Selected a number first\");\r\n }\r\n console.log(\"bottom length:\"+totalBottom+\"-middle length:\"+totalMiddle);\r\n break;\r\n case \"equals\":\r\n oaat();\r\n break;\r\n }\r\n}", "function windowLoaded() {\n//\t//VARIABLES and EVENTS\n\tbar = document.getElementById(\"bar\");\n\t\n\tnum1 = document.getElementById(\"num1\");\n\tnum2 = document.getElementById(\"num2\");\n\tnum3 = document.getElementById(\"num3\");\n\tnum4 = document.getElementById(\"num4\");\n\tnum5 = document.getElementById(\"num5\");\n\tnum6 = document.getElementById(\"num6\");\n\tnum7 = document.getElementById(\"num7\");\n\tnum8 = document.getElementById(\"num8\");\n\tnum9 = document.getElementById(\"num9\");\n\tnum1.onclick = clickButton.bind(event);\n\tnum2.onclick = clickButton.bind(event);\n\tnum3.onclick = clickButton.bind(event);\n\tnum4.onclick = clickButton.bind(event);\n\tnum5.onclick = clickButton.bind(event);\n\tnum6.onclick = clickButton.bind(event);\n\tnum7.onclick = clickButton.bind(event);\n\tnum8.onclick = clickButton.bind(event);\n\tnum9.onclick = clickButton.bind(event);\n\t\n\tplusButton = document.getElementById(\"plus\");\n\tplusButton.onclick = clickButton.bind(event);\n\tminusButton = document.getElementById(\"minus\");\n\tminusButton.onclick = clickButton.bind(event);\n\tequalsButton = document.getElementById(\"equals\");\n\tequalsButton.onclick = Equals.bind();\n\t\n//\t// Always focus the input bar\n\tbar.focus();\n\twindow.onclick = function() {bar.focus()};\n\t// Event on the input bar\n\tbar.addEventListener(\"keydown\", function() {keyPressed(event)});\n}", "function squaresFunctions(squares) {\n squares.addEventListener(\"click\", minesweep); \n squares.addEventListener(\"touchstart\", longPressDown);\n squares.addEventListener(\"touchend\", longPressUp);\n squares.addEventListener(\"click\", counter);\n squares.addEventListener(\"click\", gameOverOne);\n squares.addEventListener(\"click\", gameOverTwo);\n}", "function digitsListener(item, i){\n item.addEventListener('click', function(){\n if(digits[i].textContent==='.'){\n if(!sign && firstNumber.indexOf('.')>-1) return;\n if(sign && secondNumber.indexOf('.')>-1) return;\n }\n if((!firstNumber && digits[i].textContent==='.') ||\n (sign && !secondNumber && digits[i].textContent==='.')) {\n inputPanel.innerHTML+=\"0\";\n }\n inputPanel.innerHTML+=digits[i].textContent;\n if(sign===\"\"){\n firstNumber+=digits[i].textContent;\n }\n else {\n secondNumber+=digits[i].textContent;\n }\n })\n}", "function operations(idbutton) {\n $(idbutton).click(() => {\n contpoint = 0;\n console.log($(idbutton).attr('id'));\n if($(idbutton).attr('id') == 'minus') {\n //Manejo del boton menos para diferenciar entre negativo y menos\n if(entry.val() == \"\") {\n entry.val(\"-\");\n console.log(\"Aqui andamos brother\");\n }\n else {\n console.log(\"Aqui no deberiamos de andar brother\");\n firstoperand = entry.val();\n entry.val(\"\");\n operation.val(firstoperand + idbutton.val());\n operator = idbutton.val();\n }\n } else {\n //Operacion del resto de botones\n firstoperand = entry.val();\n entry.val(\"\");\n operation.val(firstoperand + idbutton.val());\n operator = idbutton.val();\n }\n //Animacion\n $(idbutton).addClass(\"animated pulse\").one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', () => {\n $(idbutton).removeClass(\"animated pulse\");\n });\n });\n}", "function iconsToggle(){\n \ticons += 1;\n \tinitialize();\n }", "function clickPlus(){\n console.log('clicked plus');\n operator = {operator:'+'};\n $('#buttonPlus').addClass('selected');\n $('#buttonSub').removeClass('selected');\n $('#buttonMult').removeClass('selected');\n $('#buttonDivide').removeClass('selected');\n}", "doMath(){\n // console.log(\"pressed: \" + this.icon);\n this.mathTime(this.icon)\n }", "function addListeners5(){\n for (let i = 0; i < pickups.length; i++){\n pickups[i].addEventListener('click', function(evt){\n if (hold == null) {\n camera.innerHTML += '<a-box id=\"js--hold\" class=\"js--pickup js--interact\" color=\"'+ this.getAttribute(\"color\") + '\" height='+ this.getAttribute(\"height\") +' rotation=\"0 0 -90\" position=\"2 -2 -4\" depth=\"0.1\">'+ this.innerHTML + '</a-box>'\n hold = \"box\";\n console.log(\"true\");\n }\n });\n }\n }", "function click_money_incrementation(money, _values) {\r\n data.inventory.money += money * data.inventory.multiplier;\r\n Save();\r\n Attribtion();\r\n update_dom();\r\n}", "function compVSHuman(){\n currentPlayer = O_TEXT;\n setText('turn' , \"Your's turn\");\n boxes.forEach((box,index) =>{\n box.addEventListener('click', boxClickedForComp); \n});\n\n}", "function addOnclickListeners(total) {\n for (var i = 0; i < total; i++) {\n document.querySelectorAll('.answer-block')[i].onclick = showPopUp; // add listener on ans-blocks\n }\n\n document.getElementsByClassName('quest-block__header')[0].onclick = showPopUp; // add listener on header\n\n\n document.getElementById('close-icon').onclick = hidePopUp; // add onclick on close-icon\n document.getElementById('backgr-pop-up').onclick = hidePopUp; // add onclick on backgr\n}", "function bonk(e) {\n //if click did not come from mouse\n if (!e.isTrusted) {\n //exit the function\n return;\n }\n //if clicked, increment score\n score++;\n //immediatel remove the up class so mole goes down\n this.classList.remove('up');\n //update scoreboard\n scoreBoard.textContent = score;\n\n}", "function addXsAndOs(){\n for (var i =0; i<oneBox.length; i++) {\n oneBox[i].square = i;\n oneBox[i].addEventListener('click',function(){\n if (!this.move){\n this.querySelector('img').src = letter;\n this.move = letter;\n //currentPlayer.indexString = true\n if(turn){\n playerX[this.square] = true;\n }else{\n playerO[this.square] = true;\n }\n turnChanger();\n changeTurn();\n winningCombination();\n }\n });\n } \n}", "function bindHandlers() {\n\t\t\t\tnext.add(prev).on('click', cont, function() {\n\t\t\t\t\tif ($(this).hasClass('disabled')) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tactive = $(this).hasClass('next') ? active.next() : $(this).hasClass('prev') ? active.prev() : active;\n\t\t\t\t\tchangePic();\n\t\t\t\t});\n\t\t\t}", "function eltdfInitQuantityButtons() {\n \n $(document).on( 'click', '.eltdf-quantity-minus, .eltdf-quantity-plus', function(e) {\n e.stopPropagation();\n\n var button = $(this),\n inputField = button.siblings('.eltdf-quantity-input'),\n step = parseFloat(inputField.attr('step')),\n max = parseFloat(inputField.attr('max')),\n minus = false,\n inputValue = parseFloat(inputField.val()),\n newInputValue;\n\n if (button.hasClass('eltdf-quantity-minus')) {\n minus = true;\n }\n\n if (minus) {\n newInputValue = inputValue - step;\n if (newInputValue >= 1) {\n inputField.val(newInputValue);\n } else {\n inputField.val(0);\n }\n } else {\n newInputValue = inputValue + step;\n if ( max === undefined ) {\n inputField.val(newInputValue);\n } else {\n if ( newInputValue >= max ) {\n inputField.val(max);\n } else {\n inputField.val(newInputValue);\n }\n }\n }\n\n inputField.trigger( 'change' );\n });\n }", "function makeEvents(i){\n var dotElement = document.getElementById('h5p-image-gallery-dot-'+i);\n dotElement.onclick = function(){\n showContentDot(i);\n }\n}", "function fnNum(a){\r\n\t\tvar bClear = false;\r\n\t\toText.value = \"0\";\r\n\t\tfor(var i=0;i<aNum.length;i++){\r\n\t\t\taNum[i].onclick = function(){\r\n\r\n\t\t\t\t//check the switch\r\n\t\t\t\tif(!bOnOrOffClick) return;\r\n\r\n\t\t\t\t//check the clear \r\n\t\t\t\tif(bClear) {\r\n\t\t\t\t\tbClear = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the dot exist\r\n\t\t\t\tif(oText.value.indexOf(\".\")!=-1){\r\n\t\t\t\t\tif(this.innerHTML ==\".\"){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the operator and input value exist;\r\n\t\t\t\t//input a number and a operator\r\n\t\t\t\tif(oPer.value&&oText.value&&oText1.value ==\"\"){\r\n\t\t\t\t\toText1.value = oText.value;\r\n\t\t\t\t\toText.value = \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar re = /^0\\.{1}\\d+$/;\r\n\t\t\t\tvar re1 = /^([0]\\d+)$/;\r\n\r\n\t\t\t\t//input to display\r\n\t\t\t\toText.value +=this.innerHTML;\r\n\r\n\t\t\t\tif(re.test(oText.value)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(re1.test(oText.value)){\r\n\t\t\t\t\toText.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//add the operator\r\n\t\t\tfor(var j=0;j<aPer.length;j++){\r\n\t\t\t\taPer[j].onclick = function(){\r\n\r\n\t\t\t\t\t//calulator\r\n\t\t\t\t\tif(oPer.value&&oText.value&&oText1.value){\r\n\t\t\t\t\t\tvar n = eval(oText1.value + oPer.value +oText.value);\r\n\t\t\t\t\t\toText1.value = n;\r\n\t\t\t\t\t\toText1.value = \"\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//display the result;\r\n\t\t\t\t\toPer.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//calculator get the result;\r\n\t\t\toDeng.onclick = function(){\r\n\t\t\t\t// add substract multiply divided percent\r\n\t\t\t\tif(oText1.value ==''&&oPer.value ==\"\"&&oText.value==\"\"){\r\n\t\t\t\t\treturn ;\r\n\t\t\t\t}\r\n\t\t\t\tvar n = eval(oText1.value + oPer.value + oText.value);\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toText.value = n;\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t\tbClear = true;\r\n\t\t\t}\r\n\r\n\t\t\t//the rec operation\r\n\t\t\toRec.onclick = function(){\r\n\t\t\t\tvar a = 1/oText.value;\r\n\t\t\t\tif(a==0){\r\n\t\t\t\t\toText1.value = \"无穷大\";\r\n\t\t\t\t}\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\t//sqiuare\r\n\t\t\toSq.onclick = function(){\r\n\t\t\t\tvar a = Math.pow(oText.value,0.5);\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\toZheng.onclick = function(){\r\n\t\t\t\t\toText.value = -oText.value;\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\toClea.onclick = function(){\r\n\t\t\t\toText.value = \"0\";\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function addDropListeners() {\n\t\tfor (var i=$boxes.length-1; i>=0;i--) {\n\t\t\tvar $box = $($boxes[i]);\n\t\t\t$box.on('click', addRedorYellow);\n\t\t}\n\t}", "function gameButtonsLogic() {\n $(\"#bluegem\").click(function () {\n totalScore += bluegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#glovegem\").on(\"click\", function () {\n totalScore += glovegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#orangegem\").on(\"click\", function () {\n totalScore += orangegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#guitargem\").on(\"click\", function () {\n totalScore += guitargem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n })}", "function bind_MathCellClick(appendTo, start, end) {\n for (var i = start; i <= end; i++) {\n $('#math-cell-' + i).unbind('click');\n $('#math-cell-' + i).click(appendFormula(i));\n }\n\n function appendFormula(k) {\n return function() {\n var $txt = $('#' + appendTo);\n var caretPos = $txt[0].selectionStart;\n var textAreaTxt = $txt.val();\n var txtToAdd = mathSymbol[k - 6] + ' ';\n $txt.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos));\n renderEquation();\n }\n }\n\n}", "function addButtonListener() {\n $(\".remove-button\").click(removeItemFromCart);\n $(\".minusButton\").click(removeOneItemFromCart);\n $(\".plusButton\").click(addOneItemToCart);\n}", "function setupEasyHard() {\n for (let i = 0; i < modBtn.length; i++) {\n modBtn[i].addEventListener(\"click\", function () {\n for (let i = 0; i < modBtn.length; i++) {\n modBtn[i].classList.remove(\"selected\");\n }\n\n if (this.textContent === \"Easy\") {\n numSquares = 3;\n } else {\n numSquares = 6;\n }\n reset();\n });\n }\n}", "handleJDotterClick() {}", "function initializeIcons() {\n let deleteIcons = qsa('.deleteBox');\n for (let i = 0; i < deleteIcons.length; i ++) {\n deleteIcons[i].addEventListener('click', deleteTask);\n }\n\n let uncheckedCircle = qsa('.checkCircle');\n for (let i = 0; i < uncheckedCircle.length; i ++) {\n uncheckedCircle[i].addEventListener('click', clickCheckCircle);\n }\n }", "function mousePressed() {\r\n //run the clicked function on a bubble position i stored in the bubbles array. the var i.... = allows\r\n //for selecting any bubble in that array (for every bubble object in positions above and including 0)\r\n for (var i = 0; i < bubbles.length; i++) {\r\n bubbles[i].clicked();\r\n }\r\n\r\n}", "function oneClick() {\n this.innerHTML = player\n if (player === \"x\") {\n player = \"o\"\n }\n\n else if (player === \"o\") {\n player = \"x\"\n }\n $(this).off(\"click\")\n \n // get all possibilities\n\n if (box1.innerHTML !== \" \" && box1.innerHTML === box2.innerHTML && box2.innerHTML === box3.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n } else if (box4.innerHTML !== \" \" && box4.innerHTML === box5.innerHTML && box4.innerHTML === box6.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n playerTwoScore++\n $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n } else if (box7.innerHTML !== \" \" && box7.innerHTML === box8.innerHTML && box7.innerHTML === box9.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n } else if (box1.innerHTML !== \" \" && box1.innerHTML === box4.innerHTML && box1.innerHTML === box7.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n } else if (box1.innerHTML !== \" \" && box1.innerHTML === box4.innerHTML && box1.innerHTML === box7.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n\n } else if (box2.innerHTML !== \" \" && box2.innerHTML === box5.innerHTML && box2.innerHTML === box8.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n\n } else if (box3.innerHTML !== \" \" && box3.innerHTML === box6.innerHTML && box3.innerHTML === box9.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n\n } else if (box1.innerHTML !== \" \" && box1.innerHTML === box5.innerHTML && box1.innerHTML === box9.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n\n } else if (box3.innerHTML !== \" \" && box3.innerHTML === box5.innerHTML && box3.innerHTML === box7.innerHTML) {\n if (player !== \"x\") {\n alert(\"x wins\");\n // playerOneScore++\n // $(\"#playerOne\").html(\"Player One: \" + playerOneScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n } else {\n alert(\"o wins\")\n // playerTwoScore++\n // $(\"#playerTwo\").html(\"Player Two: \" + playerTwoScore)\n for (i = 1; i < 10; i++) {\n box = $(\"#box\" + i)\n box.off(\"click\")\n }\n }\n } if (box1.innerHTML !== \" \" && box2.innerHTML !== \" \" && box3.innerHTML !== \" \" && box4.innerHTML !== \" \"\n && box5.innerHTML !== \" \" && box6.innerHTML !== \" \" && box7.innerHTML !== \" \" && box8.innerHTML !== \" \" && box9.innerHTML !== \" \") {\n alert(\"Tie\")\n \n }\n }", "function addListeners1(){\n for (let i = 0; i < talen.length; i++){\n talen[i].addEventListener('click', function(evt){\n if (hold == null) {\n camera.innerHTML += '<a-box id=\"js--hold\" class=\"js--talen js--interact\" color=\"'+ this.getAttribute(\"color\") + '\" height='+ this.getAttribute(\"height\") +' rotation=\"0 0 90\" position=\"2 -1 -2\" depth=\"0.1\" width=\"0.8\">'+ this.innerHTML + '</a-box>'\n hold = \"box\";\n console.log(\"true\");\n }\n });\n }\n }", "function mouseDown(e) {\n\n var clicks = 1;\n\n //only give the multiplier if manual clicks is already above 200\n if(appView.player.totalClicks() > 200){\n if(lastClicksPerSecond > 8){\n clicks = 6;\n } else if (lastClicksPerSecond > 7){\n clicks = 5;\n } else if (lastClicksPerSecond > 6){\n clicks = 4;\n } else if (lastClicksPerSecond > 5){\n clicks = 3;\n } else if (lastClicksPerSecond > 4){\n clicks = 2;\n } \n }\n\n\n $(\"#clickCover\").removeClass(\"clickAnimationCircle\").addClass(\"clickAnimationCircle\");\n\n showClick(clicks,e);\n appView.player.addPlayerClickData(clicks); \n totalCurrency += clicks;\n\n setTimeout(function () { $('#clickCover').removeClass(\"clickAnimationCircle\"); }, 150);\n\n}", "function addOnclickEvent(buttons){\nfor(let i = 0; i < buttons.length; i++) {\n switch(buttons[i].innerHTML) {\n case \"AC\":\n buttons[i].addEventListener('click', allClear);\n break;\n case \"DEL\":\n buttons[i].addEventListener('click', clearBottomDisplay);\n break;\n case \"0\":\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\":\n case \".\":\n buttons[i].addEventListener('click', displayNumber);\n break;\n case \"+\":\n buttons[i].addEventListener('click', calculateNum);\n break;\n case \"-\":\n buttons[i].addEventListener('click', calculateNum);\n break;\n case \"÷\":\n buttons[i].addEventListener('click', calculateNum);\n break;\n case \"*\":\n buttons[i].addEventListener('click', calculateNum);\n break;\n case \"=\":\n buttons[i].addEventListener('click', getResults);\n break;\n }\n}\n}", "function updateClickHandlers($base) {\n var data = $base.data('slidingtile'),\n emptyRow = data.emptyTile.row,\n emptyCol = data.emptyTile.col;\n \n $base.children('.tile').each(function () {\n var $tile = $(this),\n data = $tile.data('slidingtile');\n \n $tile.off('click');\n \n// An adjacent tile is either one row *or* one column from the empty tile, so\n// we can identify them by taking the absolute values of the row and column\n// displacements and find the sum of these two values. For adjacent tiles, this\n// value will be equal to 1.\n if (Math.abs(data.cPos.row - emptyRow) + Math.abs(data.cPos.col - emptyCol) === 1) {\n $tile.click(function () {\n moveTile($base, $(this));\n });\n }\n });\n }", "function playXandOListener() {\n for (var i = boxes.length - 1; i >= 0; i--) {\n boxes[i].addEventListener('click', playXorO);\n }\n}", "function buttons(idbutton) {\n var value = idbutton.val();\n $(idbutton).click(() => {\n console.log(\"Puntos: \" + contpoint);\n if(entry == null) {\n entry.val(value);\n } else if(entry.val().length >= 12) {\n console.log(\"Esta full\");\n } else if(value == \".\" && contpoint == 0) {\n contpoint++;\n entry.val(entry.val() + value);\n } else if(value == \".\" && contpoint > 0) {\n console.log(\"Hay mas de un punto\");\n }\n else {\n entry.val(entry.val() + value);\n }\n $(idbutton).addClass(\"animated pulse\").one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', () => {\n $(idbutton).removeClass(\"animated pulse\");\n });\n });\n}", "function bindClickEventsToBulbs() {\n \t\tvar bulbsContainer = document.querySelector('#bulbs');\n\t\tvar uiBulbs = bulbsContainer.querySelectorAll('.bulb');\n\t\tvar i = bulbs.length;\n\t\twhile (0 < i) {\n\t\t i--;\n\t\t uiBulbs[i].addEventListener('click', function (uiBulb) {\n\t\t \t\tvar index = uiBulb.currentTarget.getAttribute('index');\n\t\t \t\tvar groupId = Object.keys(groups)[index];\n\t\t \t\ttoggleGroup(groupId, index);\n\t\t\t});\n\t\t}\n }", "function buttonClicks() {\n $(\"#redbutton\").on(\"click\", function () {\n console.log('you clicked red!')\n userNumber = redVal + userNumber;\n $(\"#userNum\").html('User Guess: ' + userNumber);\n });\n\n $(\"#bluebutton\").on(\"click\", function () {\n console.log('you clicked blue!')\n userNumber = blueVal + userNumber;\n $(\"#userNum\").html('User Guess: ' + userNumber);\n });\n\n $(\"#greenbutton\").on(\"click\", function () {\n console.log('you clicked green!')\n userNumber = greenVal + userNumber;\n $(\"#userNum\").html('User Guess: ' + userNumber);\n });\n\n $(\"#yellowbutton\").on(\"click\", function () {\n console.log('you clicked yellow!')\n userNumber = yellowVal + userNumber;\n $(\"#userNum\").html('User Guess: ' + userNumber);\n });\n }", "_spinButtonClickHandler(event) {\n const that = this;\n\n if (that.disabled || that.readonly) {\n return;\n }\n\n let operation;\n\n if (that.$.leftButton.contains(event.target) === that._normalLayout) {\n operation = 'subtract';\n }\n else {\n operation = 'add';\n }\n\n that._valuesHandler.incrementOrDecrement(operation);\n }", "bindEvents() {\n cacheDOM.setButton.addEventListener(\"mousedown\", this.set.bind(this));\n cacheDOM.stopButton.addEventListener(\"mousedown\", this.stop.bind(this));\n cacheDOM.snoozeButton.addEventListener(\"mousedown\", this.snooze.bind(this));\n cacheDOM.minuteInc.addEventListener(\"mousedown\", this.incrementMin.bind(this));\n cacheDOM.minuteDec.addEventListener(\"mousedown\", this.decrementMin.bind(this));\n cacheDOM.hourInc.addEventListener(\"mousedown\", this.incrementHour.bind(this));\n cacheDOM.hourDec.addEventListener(\"mousedown\", this.decrementHour.bind(this));\n }", "bindUi(){\n\t\tthis.closeEl.addEventListener( \"click\", this.onClose.bind( this ), false );\n this.minimizeEl.addEventListener( \"click\", this.onMinimize.bind( this ), false );\n this.maximizeEl.addEventListener( \"click\", this.onMaximize.bind( this ), false );\n this.unmaximizeEl.addEventListener( \"click\", this.onRestore.bind( this ), false );\n\t}", "function clicks(number) {\n apples = apples + number; // adds the 'apples' var to the onclick event in the HTML image input\n document.getElementById('currentTotal').innerHTML = apples; // Updates apple amount\n}", "bindMethods () {\n this.startSelecting = this.startSelecting.bind(this)\n this.stopSelecting = this.stopSelecting.bind(this)\n this.elementMouseOver = this.elementMouseOver.bind(this)\n this.elementClicked = this.elementClicked.bind(this)\n }", "function makeClickable(svg_obj, gridD){\n svg_obj\n .data(gridD)\n .selectAll(\".square\") \n\t.on('click', function(d) {\n d.click ++;\n if ((d.click)%2 == 0 ) { \n d3.select(this).style(\"fill\",\"#fff\");\n d.value = 0;\n }\n\t if ((d.click)%2 == 1 ) { \n d3.select(this).style(\"fill\",\"#000000\");\n d.value = 1;\n } \n }); \n\n return gridD\n}", "function applyJQueryBindings() {\n\n $(\"#irContainer\").on(\"click\", \".cButton\", function () {\n var uuid = $(\".ircolors\").attr('id');\n\n var id = this.id;\n var value = getIrValue(id);\n setAttribValue(uuid, value);\n });\n\n $(\"#clock\").on(\"click\", function () {\n $(\"#buttonholder\").show();\n setTimeout('$(\"#buttonholder\").hide();', 5000);\n });\n\n\n $(\".switchtoggle\").on(\"click\", function () {\n if (!updating) {\n var uuid = $(this).attr(\"id\");\n var state = document.getElementById($(this).attr(\"id\")).winControl.checked;\n setAttribValue(uuid, state);\n } else {\n // code here\n }\n });\n\n $(\".dimmer\").on(\"click\", function () {\n if (!updating) {\n var uuid = $(this).attr(\"id\");\n var value = $(this).val();\n setAttribValue(uuid, value);\n } else {\n // code here\n }\n });\n\n}", "bindMethods() {\n this.startSelecting = this.startSelecting.bind(this);\n this.stopSelecting = this.stopSelecting.bind(this);\n this.elementMouseOver = this.elementMouseOver.bind(this);\n this.elementClicked = this.elementClicked.bind(this);\n }", "function choiceClick(counter) {\n $('#picture .slick-next').trigger('click');\n $('.img-overlay').find('.click-overlay').parent().next().find('.overlay').addClass('click-overlay');\n $('#picture-array .slick-next').trigger('click');\n $('.image_number').html(counter + 1 + ' of 46');\n}", "incrementThree() {\n this.clicksThree++;\n }", "function quanPress(){\r\n quantityButton.hide();\r\n pricesButton.hide();\r\n visButton.hide();\r\n fill(244,24,100);\r\n textSize(20);\r\n text(\"You can click on an icon in order to view its name and quantity.\", 200, 700);\r\n\r\n//cycles through all of the items in the array, and draws a \"graph\" based on the quantity of the item, the quantity of the item = the number of items drawn.\r\n for (var x = 0; x < 18; x++){\r\n for (var g = 0; g < itemQuantity[x]/10000; g++){\r\n img[x] = createImg(\"http://services.runescape.com/m=itemdb_oldschool/1545055248360_obj_big.gif?id=\" + itemID[x]);\r\n//creates an event if one of the items is clicked\r\n img[x].mouseClicked(itemQuanClicked);\r\n img[x].position(x*70,g*1.25);\r\n img[x].size(80,80);\r\n }\r\n }\r\n }", "bindEvents() {\n }", "function quantityControl(){\n const min = document.querySelectorAll('.min');\n const max = document.querySelectorAll('.max');\n min.forEach((inx)=>{\n inx.addEventListener('click',()=>{\n var inputValue = inx.nextElementSibling;\n inputValue.value --;\n disable();\n })\n })\n max.forEach((ma)=>{\n ma.addEventListener('click',()=>{\n var inputValue = ma.previousElementSibling;\n inputValue.value ++;\n disable()\n })\n })\n}", "function addBindings() {\n function clickHandler(e) {\n // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.\n // See: http://jacklmoore.com/notes/click-events/\n if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n launch(this);\n }\n }\n\n if ($box) {\n if (!init) {\n init = true;\n\n // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.\n $next.click(function () {\n publicMethod.next();\n });\n $prev.click(function () {\n publicMethod.prev();\n });\n $close.click(function () {\n publicMethod.close();\n });\n $overlay.click(function () {\n if (settings.get('overlayClose')) {\n publicMethod.close();\n }\n });\n\n // Key Bindings\n $(document).bind('keydown.' + prefix, function (e) {\n var key = e.keyCode;\n if (open && settings.get('escKey') && key === 27) {\n e.preventDefault();\n publicMethod.close();\n }\n if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {\n if (key === 37) {\n e.preventDefault();\n $prev.click();\n } else if (key === 39) {\n e.preventDefault();\n $next.click();\n }\n }\n });\n\n if ($.isFunction($.fn.on)) {\n // For jQuery 1.7+\n $(document).on('click.'+prefix, '.'+boxElement, clickHandler);\n } else {\n // For jQuery 1.3.x -> 1.6.x\n // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.\n // This is not here for jQuery 1.9, it's here for legacy users.\n $('.'+boxElement).live('click.'+prefix, clickHandler);\n }\n }\n return true;\n }\n return false;\n }", "function addEventListenersToSquares(selectSquares) {\n for (let i = 0; i < selectSquares.length; i++){\n selectSquares[i].addEventListener(\"click\", function () {\n\n\n this.classList.add(\"kokos\");\n console.log(\"I'm clicked\");\n })\n }\n }", "function inputNum(evt){\n //have one event on the parent that listens to all the children. The if statement stops the even firing if the parent element is clicked. \n num += evt.target.id;\n screen.value = num;\n}", "function qodefInitQuantityButtons() {\n\t\t$(document).on('click', '.qodef-quantity-minus, .qodef-quantity-plus', function (e) {\n\t\t\te.stopPropagation();\n\t\t\t\n\t\t\tvar button = $(this),\n\t\t\t\tinputField = button.siblings('.qodef-quantity-input'),\n\t\t\t\tstep = parseFloat(inputField.data('step')),\n\t\t\t\tmax = parseFloat(inputField.data('max')),\n\t\t\t\tminus = false,\n\t\t\t\tinputValue = parseFloat(inputField.val()),\n\t\t\t\tnewInputValue;\n\t\t\t\n\t\t\tif (button.hasClass('qodef-quantity-minus')) {\n\t\t\t\tminus = true;\n\t\t\t}\n\t\t\t\n\t\t\tif (minus) {\n\t\t\t\tnewInputValue = inputValue - step;\n\t\t\t\tif (newInputValue >= 1) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tinputField.val(0);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewInputValue = inputValue + step;\n\t\t\t\tif (max === undefined) {\n\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t} else {\n\t\t\t\t\tif (newInputValue >= max) {\n\t\t\t\t\t\tinputField.val(max);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinputField.val(newInputValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tinputField.trigger('change');\n\t\t});\n\t}", "function chitClicked() {\n press(chitNumberOf(this));\n}", "function WC_Adjust_Cart_Quantity() {\n\t \t$( 'body' ).on( 'click', '.quantity .plus', function( e ) {\n\t \t\tvar $input = $( this ).parent().parent().find( 'input' );\n\t \t\t$input.val( parseInt( $input.val() ) + 1 );\n\t \t\t$input.trigger( 'change' );\n\t \t} );\n\t \t$( 'body' ).on( 'click', '.quantity .minus', function( e ) {\n\t \t\tvar $input = $( this ).parent().parent().find( 'input' );\n\t \t\tvar value = parseInt( $input.val() ) - 1;\n\t \t\tif ( value < 1 ) {\n\t \t\t\tvalue = 1;\n\t \t\t}\n\t \t\t$input.val( value );\n\t \t\t$input.trigger( 'change' );\n\t \t} );\n\t }", "function clickHandler(event) {\n //start function is on spinner.js which starts the spinning of the reels\n start();\n // since start function will spin the wheels 3.5s, we set a delay timer for 3.6s so the result won't pop up before the wheel stops. At the mean time, we disable the buttons, so that people can't keep hitting the buttons to spin the machine.\n // after the wheel starts to spin, we disable the 3 wager buttons.\n $('#bet1').attr('disabled',true);\n $('#bet5').attr('disabled',true);\n $('#bet10').attr('disabled',true);\n\n // after the wheels stops, we run the funnction to calculate win/loss credits based on the result. Also enable those wager buttons.\n var wager = event.target.value;\n setTimeout(function (){\n calculateEarnings(wager);\n $('#bet1').attr('disabled',false);\n $('#bet5').attr('disabled',false);\n $('#bet10').attr('disabled',false);\n }, 3600);\n}" ]
[ "0.6820984", "0.65524197", "0.65038896", "0.6407147", "0.6277526", "0.6021303", "0.5917084", "0.586625", "0.5861284", "0.5845981", "0.5845981", "0.5801187", "0.5793981", "0.5792882", "0.5785497", "0.5772975", "0.57663363", "0.5708488", "0.5704229", "0.5692664", "0.56768435", "0.5669009", "0.56612587", "0.5640865", "0.56384325", "0.5637486", "0.56358534", "0.5627012", "0.56243557", "0.5611953", "0.5611953", "0.55905044", "0.5581337", "0.5579054", "0.5578705", "0.5577099", "0.5547762", "0.55466926", "0.5545058", "0.55272317", "0.55265653", "0.55157065", "0.55137944", "0.55087394", "0.55043304", "0.54979986", "0.5493424", "0.54828095", "0.5482788", "0.54808706", "0.5476235", "0.54638225", "0.5461339", "0.545121", "0.5446259", "0.5445505", "0.5445494", "0.54432654", "0.54308766", "0.5428189", "0.5427372", "0.54213995", "0.54188824", "0.54168326", "0.5413945", "0.5408218", "0.540374", "0.54017174", "0.5393593", "0.5388485", "0.5382404", "0.5377562", "0.537738", "0.5375447", "0.53707993", "0.5367692", "0.5364695", "0.5363266", "0.5361949", "0.5361694", "0.53614074", "0.53611815", "0.5357837", "0.53565", "0.53550345", "0.5354043", "0.53536797", "0.53402734", "0.53345853", "0.5333597", "0.5333071", "0.5331704", "0.53306633", "0.53298914", "0.53275555", "0.5326128", "0.53253615", "0.53231955", "0.5322534", "0.53208894", "0.53198516" ]
0.0
-1
remove the task item from the right list
function deleteTask(tasks, uuid) { var i = 0; console.error('tasks', tasks); for (; i < tasks.length; i++) { if (uuid == tasks[i].uuid) { tasks.splice(i, 1); i--; } } return tasks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTask(){\n\t\t$(\".remove\").unbind(\"click\").click(function(){\n\t\t\tvar single = $(this).closest(\"li\");\n\t\t\t\n\t\t\ttoDoList.splice(single.index(), 1);\n\t\t\tsingle.remove();\n\t\t\ttoDoCount();\n\t\t\tnotToDoCount();\n\t\t\taddClear();\n\t\t});\n\t}", "function removeItem() {\n let item = this.parentNode.parentNode;\n let parent = item.parentNode;\n parent.removeChild(item);\n deleteTasks();\n \n}", "removeTask(e) {\n const index = e.target.parentNode.dataset.key;\n this.tasks.removeTask(index);\n this.renderTaskList(this.tasks.tasks);\n this.clearInputs();\n }", "function removeTask(e) {\n\n const elementValue = e.target.parentNode.getElementsByTagName(\"p\")[0].innerHTML;\n \n const tasksArray = Array.from(getLocalStorageTasks());\n\n tasksArray.forEach(task => {\n if (task == elementValue) {\n const filteredArray = tasksArray.filter(item => item != elementValue);\n \n setLocalStorage(filteredArray);\n\n // we need to fetch done tasks from local storage\n // then copy the elements + add the completed one\n // set new array to localStorage complete tasks\n //setCompleteTasksLocalStorage()\n refreshTasks();\n }\n })\n}", "function clearTasks(){\n item.parentNode.removeChild(item);\n }", "function removeTask(e){\n // get the parent list item to remove\n var taskItem = e.target.parentElement;\n taskList.removeChild(taskItem);\n}", "function removeItem () {\n \tvar item = this.parentNode.parentNode; \n \tvar parent = item.parentNode; \n \tvar id = parent.id; \n \tvar value = item.innerText;\n\n \t//update data array - rem0ve from data array \n \tif (id === 'openTasks') {\n\tdata.openTasks.splice(data.openTasks.indexOf(value),1);\n\t} else {\n\tdata.doneTasks.splice(data.openTasks.indexOf(value),1);\n\t} \n\n\tdataObjectUpdated(); //update local storage \n \tparent.removeChild(item); //apply to DOM \n }", "function CompleteTask() \n{ \n var listItem = this.parentNode;\n var ul = listItem.parentNode;\n var tarInd = listItem.querySelector(\"p\");\n\n ul.removeChild(listItem);\n\n taskArr.splice([tarInd.value],1);\n\n console.log(taskArr);\n}", "function removeTask(object) {\n var task_index = Number(object.getAttribute('task_index'));\n let id = Math.abs((tasksList.length - 1) - task_index);\n tasksList = tasksList.filter((val, index) => index != id);\n const finalData = generateTasksList();\n document.getElementById(\"divTasksList\").innerHTML = finalData;\n console.log(tasksList);\n}", "function removeFromLS(taskItem){\r\n // from store in local stroage\r\n let tasks;\r\n if(localStorage.getItem('tasks')===null){\r\n tasks=[];\r\n }\r\n else{\r\n tasks=JSON.parse(localStorage.getItem('tasks'));\r\n }\r\n let li = taskItem;\r\n li.removeChild(li.lastChild); //<a>x</a> ei item ta remove hoa jabe karon ata local stroage a ni\r\n\r\n tasks.forEach(function(task, index){ // local stroage er upore\r\n if(li.textContent.trim()===task){\r\n tasks.splice(index, 1); // task ke remove korbe\r\n }\r\n });\r\n\r\n localStorage.setItem('tasks', JSON.stringify(tasks));\r\n\r\n}", "function taskDeletor(idel) {\n\t\tconst currentTask = tasks.find( el => el.id == idel);\n\t\tlet taskIndex = tasks.indexOf(currentTask);\n\t\ttasks.splice(taskIndex, 1);;\n\t}", "removeTask () {\n\t\tthis.deleter.addEventListener('click', (e) => {\n\t\t\tfetch('/items/'+e.target.parentNode.parentNode.parentNode.childNodes[0].getAttribute('data-task'), {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\t\n\t\t\t})\n\t\t\t.then(res => res.text()) \n\t\t\t.then(res => console.log(res))\n\t\t\t.catch(error => console.error(error));\n\t\t\te.target.parentNode.parentNode.parentNode.remove();\n\t\t\tupdateProgess(numberOfCompletedTasks());\n\t\t});\n\n\t\t// We need to also remove tasks from the backend\n\t}", "function removeFromLs(taskItem) { // jeta remove korchi seta 'taskItem' e asbe '<li>---</li>'\n let tasks;\n if (localStorage.getItem('tasks') === null) {\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n\n let li = taskItem; //jeta remove korchi seta 'taskItem' e asbe,,, '<li>---</li>' eta\n li.removeChild(li.lastChild); //<li>-<a>X</a></li> er <a>x</a> bad pore jabe\n\n tasks.forEach((task, index) => {\n if (li.textContent.trim() === task) {\n tasks.splice(index, 1);\n } \n });\n\n localStorage.setItem('tasks',JSON.stringify(tasks));\n}", "function removeTask(task, taskList) {\n newArr = [];\n for (var i = 0; i < taskList.length; ++i) {\n if (task.eID === taskList[i].eID) {\n newArr = taskList.slice(i, i + 1);\n return newArr;\n }\n }\n}", "removeTask(target) {\n if (!target.classList.contains(\"todo-list__btn-remove\")) return;\n let li = target.parentElement;\n if (li.classList.contains(\"todo-list__item--done\")) {\n let index = [...li.parentElement.children].indexOf(li);\n this.doneTaskArr.splice(index - 1, 1);\n this.taskToLocal(\"doneTask\", this.doneTaskArr);\n li.remove();\n } else {\n let index = [...li.parentElement.children].indexOf(li);\n this.undoneTaskArr.splice(index - 1, 1);\n this.taskToLocal(\"undoneTask\", this.undoneTaskArr);\n li.remove();\n }\n }", "function removeTask(elem) {\n elem.parentNode.parentNode.removeChild(elem.parentNode);\n LIST[elem.id].trash = true;\n}", "doTaskUndone(target) {\n let index = [...target.parentElement.children].indexOf(target);\n this.doneTaskArr.splice(index - 1, 1);\n this.undoneTaskArr.push(target.children[0].value);\n this.taskToLocal(\"undoneTask\", this.undoneTaskArr);\n this.taskToLocal(\"doneTask\", this.doneTaskArr);\n const task = new Task(target.children[0].value);\n this.taskListUnDone.appendChild(task.createUndoneTask());\n target.remove();\n }", "function removeTask(button) {\n let li = button.parentNode;\n /* \n let ul = li.parentNode;\n ul.removeChild(li);\n */\n li.remove();\n}", "function removeTask(e) {\n // Clicking on the delete button causes the removal of that list item\n if (e.target.parentElement.classList.contains('delete-item')){\n e.target.parentElement.parentElement.remove();\n removeLocalStorage(e.target.parentElement.parentElement.textContent);\n // Refresh the list to mirror local storage contents as all duplicates are removed\n getTasks(e);\n }\n e.preventDefault();\n}", "function removeTaskFromLs(taskItem){\n let tasks;\n if(localStorage.getItem('tasks') === null){\n tasks = [];\n }else{\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n\n tasks.forEach((task, index) => {\n if(taskItem.textContent === task){\n tasks.splice(index, 1);\n }\n });\n\n localStorage.setItem('tasks', JSON.stringify(tasks));\n}", "function deleteTask(a,b) {\r\n taskList.splice(a,3)\r\n return taskList;\r\n\r\n }", "function removeFromLS(taskItem) {\r\n //Copy Get Task Function//\r\n let tasks;//All Task Will Be Include//\r\n if (localStorage.getItem('tasks') === null) {\r\n tasks = [];//Checking local Storage If Tasks Exist Or Not//\r\n } else {\r\n tasks = JSON.parse(localStorage.getItem('tasks'));\r\n\r\n }\r\n let li = taskItem;\r\n li.removeChild(li.lastChild);//<a>x</a>\r\n tasks.forEach((task, index) => {\r\n if (li.textContent.trim() === task) {\r\n tasks.splice(index, 1);\r\n }\r\n });\r\n localStorage.setItem('tasks', JSON.stringify(tasks));\r\n}", "function removeTask(event) {\n\n let id = event.target.dataset.id;\n let tareaEliminar = event.target.parentNode;\n console.log(tareaEliminar);\n\n tareaEliminar.parentNode.removeChild(tareaEliminar)\n\n //buscar en el array la posicion\n let posicionBorrar = tasks.findIndex(task => {\n return task.titulo == id\n })\n\n console.log(posicionBorrar);\n tasks.splice(posicionBorrar, 1)\n}", "function removeTask(lnk) {\n\tvar id = lnk.href.match(/task=(\\d+)\\&?/)[1];\n\n\tvar index = findId(id);\n\tif(index != -1) {\n\t\thideCurrentTask();\n\t\t\n\t\tvar new_tasks = [];\n\t\tfor(var i=0; i<tasks.length; i++) {\n\t\t\tif(i != index)//Delete the index'th item\n\t\t\t\tnew_tasks.push(tasks[i]);\n\t\t}\n\t\ttasks = new_tasks;\n\t\t\n\t\tif(!tasks.length) {\n\t\t\t$(\"controls\").innerHTML = t(\"There are no more tasks left\");\n\t\t\t\n\t\t} else {\n\t\t\tvar id = tasks[current_task];\n\t\t\tif(id) $(\"task-\"+id).className = \"active\";\n\t\t}\n\t}\n}", "function deleteTask()\n {\n var child = this.parentNode.parentNode;\n var parent = child.parentNode;\n parent.removeChild(child);\n var id= parent.id;\n var value = child.innerText;\n if (id == \"taskList\")\n {\n obj.taskListArr.splice(obj.taskListArr.indexOf(value), 1);\n }\n else \n {\n obj.taskCompletedArr.splice(obj.taskCompletedArr.indexOf(value), 1);\n } \n dataStorageUpdt();\n }", "function removeItem(event){\n if(event.target.classList.contains('del')){\n var li = event.target.parentElement;\n taskList.removeChild(li);\n }\n}", "function removeTasks() {\n let child = lists.lastElementChild;\n let childs = listOfChecked.lastElementChild;\n while (child) {\n lists.removeChild(child);\n child = lists.lastElementChild;\n }\n while (childs) {\n listOfChecked.removeChild(childs);\n childs = listOfChecked.lastElementChild;\n }\n}", "function deleteTask(e) {\n let index = this.dataset.index;\n let tyList = this.parentElement.parentElement.parentElement;\n if (tyList.getAttribute(\"id\") == \"lists\") {\n tasks.splice(index, 1);\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n render(lists, tasks);\n }\n if (tyList.getAttribute(\"id\") == \"listOfChecked\") {\n tasksChecked.splice(index, 1);\n localStorage.setItem(\"tasksChecked\", JSON.stringify(tasksChecked));\n render(listOfChecked, tasksChecked);\n }\n}", "function removeTask(e) {\n\n\n if (confirm('Are you sure')) {\n e.target.parentElement.parentElement.remove()\n\n\n //Remove from Ls\n removeTaskFromLocalStorage(e.target.parentElement.parentElement)\n }\n\n // tasks.forEach(function (item, index) {\n // if (e.target.closest(\"li\").innerText == item) {\n // tasks.splice(index, 1)\n\n // }\n\n // })\n //.log(e.target.parentElement.parentElement)\n}", "function deleteTask(task) {\n var position = toDoList.indexOf(task);\n if (position > -1) {\n return toDoList.splice(position, 1);\n }\n else {\n console.log(\"task is not in our list!\");\n }\n}", "removeTask(taskId) {\n var temp = this.state.taskArray;\n temp.splice(taskId, 1);\n this.setState({taskArray: temp})\n }", "function removeTask(e) {\n\tupdateSidebar(e);\n\t\n\t//updating task description\n\tupdateTaskDescription(e);\n\t\n\te.target.parentElement.parentNode.removeChild(e.target.parentElement);\n}", "function removeTaskFromLocalStorage(taskItem) {\n console.log(taskItem);\n let tasks;\n if(localStorage.getItem('tasks') === null) {\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n\n let result = tasks.filter(task => taskItem.textContent != task)\n // tasks.forEach(function(task, index) {\n // if(taskItem.textContent === task){\n // tasks.splice(index, 1);\n // }\n // });\n console.log(result);\n localStorage.setItem('tasks', JSON.stringify(tasks));\n}", "function removeItem(e) {\n\n // getting the item to be deleted \n let todoItem = e.target.previousSibling.textContent;\n let idx = allItems.indexOf(todoItem); // looking for item's index in the tasks list\n allItems.splice(idx, 1); // removing the found index from the tasks list\n // console.log(allItems);\n localStorage.setItem(\"tasks\", JSON.stringify(allItems)); // updating the local storage \n list.innerHTML = \"\"; \n show(); \n}", "function removeFromLocStore(taskItem) {\n let allTask;\n if (localStorage.getItem('allTask') === null) {\n allTask = [];\n } else {\n allTask = JSON.parse(localStorage.getItem('allTask'));\n }\n \n let li = taskItem;\n li.removeChild(li.lastChild);\n allTask.forEach((task, index) => {\n if (li.textContent.trim() === task) {\n allTask.splice(index, 1)\n }\n });\n localStorage.setItem('allTask', JSON.stringify(allTask));\n}", "deleteTask(taskId) {\n const newTasks = [];\n this.tasks.forEach((item) => {\n if (item.Id !== taskId) {\n newTasks.push(item);\n }\n });\n this.tasks = newTasks;\n }", "function deleteTask(event)\n{\n //gets button id\n let id = event.target.id;\n\n //gets task position from button id\n let taskPosition = id.replace(/\\D/g,'');\n\n //removes task from task array\n taskArr.splice(taskPosition - 1, 1); \n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites task list\n rewritesList();\n}", "cancelTask(i){\n \n this.$delete(this.taskList, i);\n for (let i = 0; i < this.taskList.length; i++) {\n const element = this.taskList[i];\n this.done.unshift(element);\n }\n console.log(this.done);\n console.log(this.taskList);\n }", "static removeItem(id, e) {\n //if we get the id\n //we only have to search for the pos\n var pos;\n var li;\n var lu = document.getElementById(\"listTask\");\n if(id === undefined || id === null){\n var items = e.parentElement.parentNode.parentElement;\n var li = items.parentElement;\n\n //get the input, it is placed \n //in the 4 position\n var hiddenInput = items.childNodes[2];\n pos = getPositionStored(hiddenInput.value);\n }\n else{\n pos = getPositionStored(id);\n li = lu.childNodes[pos];\n }\n\n if (pos !== -1) {\n storedTask.data.splice(pos, 1);\n //update data in Local Storage\n localStorage.setItem(\"task\", JSON.stringify(storedTask));\n }\n lu.removeChild(li);\n }", "deleteTask(taskId) {\n let newTasks = [];\n this.tasks.forEach(task => {\n if (task.id !== taskId) {\n newTasks.push(task);\n }\n });\n this.tasks = newTasks;\n }", "function removeTask(e) {\n\tif (e.target.parentElement.classList.contains('delete-item')) {\n\t\tif (confirm('Are You Sure?')) {\n\t\t\te.target.parentElement.parentElement.remove();\n\t\t\t/*Ako parentElement ima klasu delete-item onda hocu da...*/\n\n\t\t\t//-Remove from LS-//\n\t\t\tremoveTasksFromLocalStorage(e.target.parentElement.parentElement);//Funkcija za brisanje iz LS\n\t\t}\n\t}\n}", "function deleteTask(currentTask) {\n console.log(\"Delete task\");\n console.log(\"---task to be deleted: \" + currentTask.task);\n\n setTasks(\n tasks.filter((task) => {\n // console.log(\"\")\n return task.id !== currentTask.id;\n })\n );\n }", "function removeTask(e) {\r\n let li = e.target.parentElement.parentElement;\r\n let a = e.target.parentElement;\r\n if (a.classList.contains('delete-item')) {\r\n if (confirm('Are You Sure ?')) {\r\n li.remove();\r\n removeFromLS(li);\r\n }\r\n }\r\n}", "function removeTask(event){\n // Get the index of the task to be removed\n let index = findIndexById(event.target.parentElement.id);\n\n // Confirm if the user wants to remove said task\n if(confirm(`Do you want to remove this task? \"${toDos[index].content}\"`)){\n // Use splice to delete the task object and reorder the array then update local storage\n toDos.splice(index, 1);\n ls.setJSON(key, JSON.stringify(toDos));\n\n // Update the list displayed to the user\n displayList();\n }\n}", "deleteTask(id) {\n var index = this.list.map(i => i.id).indexOf(id);\n this.list.splice(index, 1);\n ls.deleteItem(id);\n }", "function removeTask2(e) {\n console.log(\"yep\");\n if (e.target.parentElement.classList.contains(\"delete-item\")) {\n console.log(\"yep del\");\n e.target.parentElement.parentElement.remove();\n \n }\n}", "function removeTask(e) {\n\te.target.parentElement.parentNode.removeChild(e.target.parentElement);\n}", "function removeTask(e) {\n e.currentTarget.parentNode.remove();\n}", "function removeTask(span, task){\n span.onclick = function(){\n if(task.classList.value === \"checked\"){\n var index = myTaskList.completed.indexOf(task);\n myTaskList.completed.splice(index, 1);\n updateTaskList();\n }\n if(task.classList.value === \"\"){\n var index = myTaskList.incomplete.indexOf(task);\n myTaskList.incomplete.splice(index, 1);\n updateTaskList();\n }\n }\n}", "function removeTask(e) {\n e.parentNode.parentNode.parentNode.removeChild(e.parentNode.parentNode)\n}", "deleteTask(task) {\n const taskArray = [...this.state.tasks];\n const index = taskArray.map(t => t.text).indexOf(task);\n\n taskArray.splice(index, 1);\n\n this.setState({ tasks: taskArray });\n }", "function removeTaskLocalStorage(taskItem){\n let taskArrayItem;\n if(localStorage.getItem('savedTasks') === null){\n taskArrayItem = [];\n } else {\n taskArrayItem = JSON.parse(localStorage.getItem('savedTasks'));\n }\n taskArrayItem.forEach(\n function(taskStored, index){\n if(taskStored.task === taskItem){\n taskArrayItem.splice(index, 1);\n // console.log(taskArrayItem);\n }\n }\n );\n\n localStorage.setItem('savedTasks', JSON.stringify(taskArrayItem));\n}", "function removeDone(){\n for (let i = 0; i < listItem.children.length; i++) {\n if (listItem.children[i] .className === \"done\"){\n listItem.removeChild(listItem.children[i])\n i--\n }\n\n }\n updateToDo()\n}", "deleteFromList(taskID) {\n let deleted = this.taskArr.find(task => task.id == taskID)\n this.taskArr = this.taskArr.filter(value => value != deleted)\n return this.taskArr\n }", "function removeTaskFromLocalStorage(taskItem) {\n // console.log(taskItem.textContent);\n let tasks;\n if (localStorage.getItem(\"tasks\") === null) {\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem(\"tasks\"));\n }\n\n tasks.forEach((task, index) => {\n if (taskItem.textContent === task) {\n tasks.splice(index, 1);\n }\n });\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n}", "function drop(e) {\n\n // Stop the propagation of the event\n e.stopPropagation();\n\n // Check that base element is not the same as the one on which we drop\n if (baseID !== this.id) {\n tasks.splice(this.id, 0, tasks.splice(baseID, 1)[0]);\n\n //console.log(this.id)\n //console.log(\"base: \"+ baseID)\n }\n \n endEdit();\n}", "function deleteTaskFromToDoList(event) {\n event.target.parentElement.remove();\n}", "function deleteTask (e){\n for (var i = 0 ; i< loginUser.tasks.length; i ++){\n if(parseInt(loginUser.tasks[i].id) === parseInt(e.target.getAttribute('data-id'))){\n if(loginUser.tasks[i].status === false){\n taskToDo--;\n $('#countOfTask').text('').text('Task to do: '+ taskToDo);\n }\n loginUser.tasks.splice(i, 1);\n $('#task' + e.target.getAttribute('data-id')).remove();\n collectionOfUser.update(\n {\n id : loginUser.id,\n tasks : loginUser.tasks\n },\n function(user){\n loginUser = user;\n },\n error \n );\n }\n }\n }", "delete(id, item) {\n this.tasks = this.tasks.filter(task => task.id !== id);\n\n localStorage.setItem(this.storageList, JSON.stringify(this.tasks));\n item.remove();\n }", "function removeTaskFromStorage(taskItem){\n let tasks;\n if(localStorage.getItem('tasks') === null){\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n tasks.forEach(function(task, i){\n if(taskItem.textContent === task){\n tasks.splice(i, 1);\n }\n })\n localStorage.setItem('tasks', JSON.stringify(tasks));\n}", "delete() { all = all.filter(task => task.id !== this.id) }", "function removeTaskFromLocalStorage(taskItem) {\n let tasks;\n if(localStorage.getItem('tasks') === null) {\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n\n\n tasks.forEach(function(task, index) {\n if(taskItem.textContent === task) {\n tasks.splice(index, 1);\n\n }\n\n\n });\n\n localStorage.setItem('tasks', JSON.stringify(tasks));\n\n}", "function deleteToDo(itemDataKey) {\n var cleanDataKey = parseInt(itemDataKey)\n for (var i = 0; i < newToDoList.length; i++) {\n if (newToDoList[i].taskId === cleanDataKey) {\n newToDoList.splice(i, 1);\n break;\n }\n }\n}", "deleteTask(taskId) {\n // Create an empty array and store it in a new variable, newTasks\n const newTasks = [];\n\n // Loop over the tasks\n for (let i = 0; i < this.tasks.length; i++) {\n // Get the current task in the loop\n const task = this.tasks[i];\n\n // Check if the task id is not the task id passed in as a parameter\n if (task.id !== taskId) {\n // Push the task to the newTasks array\n newTasks.push(task);\n }\n }\n\n // Set this.tasks to newTasks\n this.tasks = newTasks;\n }", "function removeItem() {\n var item = this.parentNode.parentNode,\n parent = item.parentNode,\n id = parent.id,\n value = item.innerText;\n\n if (id === 'todo') {\n data.todo.splice(data.todo.indexOf(value), 1);\n } else {\n data.completed.splice(data.completed.indexOf(value), 1);\n }\n\n // removes item node\n parent.removeChild(item);\n\n dataObjectUpDated();\n}", "function deleter(ul,li){\n\tul.removeChild(li)\n\n\tif(uncheckedTasks-1 >= 0){\n\t \tuncheckedCountSpan.textContent = uncheckedTasks-1\n\t \tuncheckedTasks = uncheckedTasks-1\n\t}\n\n\telse{\n\t\tuncheckedCountSpan.textContent = 0\n\t}\n\n\titemCountSpan.textContent = numberOfTasks-1\n\tnumberOfTasks = numberOfTasks-1\n}", "function removetaskfromlocalstroage(taskitem){\n // console.log('hay');\n console.log(taskitem);\n console.log(taskitem.textContent);\n\n let tasks;\n if(localStorage.getItem('tasks') === null){\n tasks = [];\n }else{\n tasks = JSON.parse(localStorage.getItem('tasks'));\n }\n\n tasks.forEach((task, index)=>{\n // console.log(task);\n\n if(task === taskitem.textContent){\n\n // where we want to start(index) , where we wnat to end (how many) \n tasks.splice(index,1);\n }\n\n });\n\n // tasks = tasks.filter(task => task !== taskitem.textContent);\n\n localStorage.setItem('tasks', JSON.stringify(tasks));\n\n}", "deleteTask(taskId) {\n // Create an empty array and store it in a new variable, newTasks\n const newTasks = [];\n console.log( `taskId: ${taskId}` );\n\n // Loop over the tasks\n for (let i = 0; i < this.tasks.length; i++) {\n // Get the current task in the loop\n const task = this.tasks[i];\n\n // Check if the task id is not the task id passed in as a parameter\n if (task.id !== taskId) {\n // Push the task to the newTasks array\n newTasks.push(task);\n }\n }\n\n // Set this.tasks to newTasks\n this.tasks = newTasks;\n console.log(this.tasks);\n }", "function removeNewTaskItem(event) {\n if (event.target.className === 'item-delete-button') {\n var itemDataKey = event.target.parentElement.getAttribute('data-key');\n } deleteToDo(itemDataKey);\n var itemToDelete = document.querySelector(`[data-key=\"${itemDataKey}\"]`);\n itemToDelete.remove();\n}", "function remove(){ //removes task from array\n var id = this.getAttribute('id');\n var todos = getTodos();\n todos.splice(id,1);\n todos.pop(task); //removes from array\n localStorage.setItem('todo', JSON.stringify(todos));\n\n show(); //how to display a removed item on screen\n\n return false;\n\n}", "function removeTaskFromLocalStorage(taskItem){\n\n let tasks;\n if(localStorage.getItem('tasks') === null){\n tasks = [];\n }else {\n tasks =JSON.parse(localStorage.getItem('tasks'));\n \n}\n\ntasks.forEach(function(task, index){\n if(taskItem.textContent === task){\n tasks.splice(index, 1);\n }\n })\n localStorage.setItem('tasks', JSON.stringify(tasks));\n}", "function deleteTask() {\n this.parentNode.parentNode.removeChild(this.parentNode);\n }", "function removeTask(e) {\n e.stopPropagation();\n /*\n e.target || this === <i class=\"fas fa-times\"></i>\n e.target.parentElement === <a class=\"delete-item secondary-content\">\n e.target.parentElement.parentElement === <li>\n */\n if(confirm('Are you sure?') === true) { \n\n e.target.parentElement.parentElement.remove(); \n }\n }", "function removeDOMTask(event, list = inbox) {\n \n if (event.target.tagName === 'A') {\n // remover tarea de la lista, (se necesita el índice)\n list.removeTask(getTaskIndex(event), tasksContainerElement); \n }\n}", "function deleteTask(taskListIndex) {\n\n taskList.splice(taskListIndex, 1);\n\n\n listTasks()\n}", "function removeFromLS(taskItem) {\r\n let tasks;\r\n if (localStorage.getItem('tasks') === null) {\r\n tasks = [];\r\n } else {\r\n tasks = JSON.parse(localStorage.getItem('tasks'));\r\n }\r\n\r\n tasks.forEach(function (task, index) {\r\n if (taskItem.textContent === task) {\r\n tasks.splice(index, 1);\r\n }\r\n });\r\n localStorage.setItem('tasks', JSON.stringify(tasks));\r\n}", "deleteTaskById (id) {\n const taskListCopy = [...this.state.tasks];\n let tasksCompleted = this.state.tasksCompleted;\n\n taskListCopy.forEach((taskObj, index) => {\n if(taskObj.id === id) {\n taskListCopy.splice(index, 1);\n tasksCompleted--;\n }\n })\n this.setState( {tasks: taskListCopy, tasksCompleted} );\n }", "function onDoneButtonClick(e) {\n \n const clickedElement=this.parentElement.parentElement.parentElement;\n const clickedId=clickedElement.id;\n\n\n\n const clickedTask=incompletedItems.find(task=>task.id==clickedId);\n console.log(clickedTask);\n\n incompletedItems=incompletedItems.filter((task)=>\n {\n return task.id!==clickedId;\n })\n\n clickedTask.completed=true;\n\n completedItems.push(clickedTask);\n clickedElement.firstElementChild.lastElementChild.removeChild(clickedElement.firstElementChild.lastElementChild.firstElementChild);\n completedSection.appendChild(clickedElement);\n incompleteSection.removeChild(clickedElement);\n\n}", "function removeToDo(element){\r\n element.parentNode.parentNode.removeChild(element.parentNode);\r\n SIDELIST[activeid].list[element.id].trash = true;\r\n}", "function removeTaskFromLocalStorage(taskItem){\n let tasks;\n if(localStorage.getItem(\"tasks\")===null){\n tasks=[];\n }else{\n tasks=JSON.parse(localStorage.getItem(\"tasks\"))\n }\n\n tasks.forEach(function(task,index){\n if(taskItem.textContent===task){\n tasks.splice(index,1)\n }\n })\n localStorage.setItem(\"tasks\",JSON.stringify(tasks))\n }", "function removeTasksFromLocalStorage(taskItem) {\n\t// Provera\n\tlet tasks; \n\tif (localStorage.getItem('tasks') === null) {\n\t\ttasks = [];\t\t\n\t} else {\n\t\ttasks = JSON.parse(localStorage.getItem('tasks'));\n\t}\n\n\ttasks.forEach(function(task, index) {\n\t\t//Sta se tacno proverava(to pozia tasks pa se vraca u removeTasksFromLoca....)\n\t\t// index mi nije jasan....(drugi parametar o forEach)\n\t\tif (taskItem.textContent === task) {\n\t\t\ttasks.splice(index, 1);\n\t\t}\n\t});\n\n\tlocalStorage.setItem('tasks', JSON.stringify(tasks));\n}", "removeCurrentList() {\n let indexOfList = -1;\n for (let i = 0; (i < this.toDoLists.length) && (indexOfList < 0); i++) {\n if (this.toDoLists[i].id === this.currentList.id) {\n indexOfList = i;\n }\n }\n this.toDoLists.splice(indexOfList, 1);\n this.currentList = null;\n this.view.clearItemsList();\n this.view.refreshLists(this.toDoLists);\n }", "function removeItem (){\n //grab the <li> by accessing the parent nodes \n let item = this.parentNode.parentNode; //the <li>\n let parent = item.parentNode; //in order to remove its child <li>\n let id = parent.id; //check id if its 'todo' or 'completed'\n let value = item.innerText;\n\n //if its an item to be completed...\n if(id === 'todo') {\n //remove one item from todo, based on index\n data.todo.splice(data.todo.indexOf(value, 1));\n //else if it was already completed...\n } else {\n //remove one item from completed, based on index\n data.completed.splice(data.completed.indexOf(value, 1));\n }\n\n //update localstorage\n dataObjectUpdated();\n\n //remove it\n parent.removeChild(item);\n\n}", "function deleteTask(event) {\n const taskListItem = this.parentNode.parentNode;\n const keyValue = taskListItem.querySelector('input').dataset.key\n taskListItem.parentNode.removeChild(taskListItem);\n\n\n manageTasksAjax(event, '', keyValue, 'delete')\n}", "function removeTask(Event) {\n //Set animation to fade-out\n Event.path[2].style.animationName = \"fade-out\";\n\n //Remove task from the board after 1.6s\n setTimeout(function() {\n Event.path[2].remove();\n }, 1600);\n\n //Remove task from tasks array\n for (var i = 0; i < tasks.length; i++) {\n if (tasks[i].id == Event.target.id) {\n console.log(\n \"*REMOVED* task id: \" + tasks[i].id + \" task title: \" + tasks[i].title\n );\n tasks.splice(i, 1);\n }\n }\n\n //Update the local storage with the new tasks array\n localStorage.setItem(\"task\", JSON.stringify(tasks));\n}", "function removeTaskFromLocalStorage(taskItem){\n let tasks;\n if(localStorage.getItem('tasks') === null){\n tasks = []\n }else{\n tasks = JSON.parse(localStorage.getItem('tasks'))\n }\n tasks.forEach((task,index)=>{\n if(taskItem.textContent === task){\n tasks.splice(index,1)\n }\n })\n localStorage.setItem('tasks',JSON.stringify(tasks))\n}", "function removeTaskFromLocalStorage(taskItem) {\r\n console.log(taskItem);\r\n\r\n // Check localStorage\r\n let tasks;\r\n\r\n // Check if there are any tasks present in localStorage\r\n if(localStorage.getItem('tasks') === null) {\r\n tasks = [];\r\n } else {\r\n // set the tasks to whatever is in localStorage \r\n //(localStorage only stores strings, therefore we need to do parsing)\r\n tasks = JSON.parse(localStorage.getItem('tasks'));\r\n\r\n }\r\n \r\n\r\n tasks.forEach(function(task, index) {\r\n\r\n // Check if the content of taskItem equals the current task in the iteration\r\n if(taskItem.textContent === task) {\r\n tasks.splice(index, 1);\r\n }\r\n });\r\n\r\n // Set the localStorage again\r\n localStorage.setItem('tasks', JSON.stringify(tasks));\r\n}", "function removeDOMTask (e, list = inbox) {\n\t// Se comprueba que se pulso el enlace (nombre de la etiqueta en mayuscula)\n\tif (e.target.tagName === 'A') {\n\t\t// Remover tarea de la lista (se necesita el indice)\n\t\tlist.removeTask(getTaskIndex(e), taskContainerElement);\n\t}\n\n\t// console.log('remove');\n}", "[actions.removeTask](state, { payload: { id } }) {\n const { byId, allIds } = state;\n const newbyId = _.omit(byId, id);\n const newAllIds = allIds.filter(currentID=>currentID !== id);\n\n return {\n byId: newbyId,\n allIds: newAllIds\n };\n }", "function removeTask(e){\n if (e.target.parentElement.classList.contains('delete-item')){\n if(confirm('u sure, dude?')){\n e.target.parentElement.parentElement.remove(); \n\n //remove from local storage\n removeTaskFromLocalStorage(e.target.parentElement.parentElement);\n }\n }\n}", "function removeTask(e) {\n if (e.target.classList.contains('remove-task')) {\n e.target.parentElement.remove();\n }\n\n //Remove from Storage \n removeTaskLocalStorage(e.target.parentElement.textContent);\n}", "function deleteTasks(){\n\n //loop through task array to remove finished arrays\n for(let i = 0; i < taskArr.length; i++)\n {\n //checks if task is finished\n let isFinished = taskArr[i].finished;\n\n //removes task from task array\n if(isFinished === 1)\n {\n taskArr.splice(i, 1);\n i--;\n };\n \n };\n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites list with new positions and only unfinished tasks\n rewritesList();\n}", "deleteTask(event){\n //console.log(event.target.id);\n const temp = this.state.tasks;\n temp.splice(event.target.id,1);\n const temp2= this.state.dates;\n temp2.splice(event.target.id,1);\n this.setState(\n {\n tasks:temp,\n dates:temp2,\n }\n )\n //console.log(\"AFTER\",this.state.tasks);\n }", "function removeTaskFromList(req, res, next) {\n var generateResponse = Api_Response(req, res, next);\n var taskId = req.params.task_id;\n var listId = req.params.list_id;\n List\n .remove_task(taskId, listId)\n .then(function (list) {\n var activity = new Activity({\n action: 'activityFeed.removeTaskFromList',\n project: list.board.project,\n user: req.user._id,\n node: taskId,\n board: list.board._id,\n boardName: list.board.name,\n list: list._id,\n listName: list.name\n });\n activity.save(function (error) {});\n\n // Send socket.io message.\n socket.removeTaskFromList(taskId, list, req.user._id);\n\n generateResponse(null, list);\n })\n .catch(generateResponse);\n}", "function removeItems() {\n\n // uncompleted items\n for (var i = 0; i < listComponent.selected.length; i++) {\n var itemJson = JSON.parse(listComponent.selected[i].dataset.item);\n\n // Find uncompleted item that matches\n for (var j = 0; j < listComponent.unCompleted.length; j++) {\n if (listComponent.unCompleted[j].content == itemJson.content\n && listComponent.unCompleted[j].timeCreated == itemJson.timeCreated) {\n\n listComponent.unCompleted.splice(j, 1);\n break;\n }\n }\n }\n // completed items\n for (var i = 0; i < listComponent.selectedComplete.length; i++) {\n var itemJson = JSON.parse(listComponent.selectedComplete[i].dataset.item);\n\n // Find completed item that matches\n for (var j = 0; j < listComponent.completed.length; j++) {\n if (listComponent.completed[j].content == itemJson.content\n && listComponent.completed[j].timeCreated == itemJson.timeCreated) {\n\n listComponent.completed.splice(j, 1);\n break;\n }\n }\n }\n listComponent.updateController();\n }", "function deleteTask() {\n const buttonDelete = document.querySelectorAll('.button-delete')\n buttonDelete.forEach(button => {\n button.onclick = function (event) {\n event.path.forEach(el => {\n if (el.classList?.contains(listItemClass)) {\n let id = +el.id\n listTask = listTask.filter(task => {\n if (task.id === id) {\n el.remove()\n return false\n }\n return true\n })\n showInfoNoTask()\n }\n })\n setTaskValue()\n localStorage.setItem('listTask', JSON.stringify(listTask))\n }\n })\n }", "function removeTaskFromLocalStorage(taskItem){\n // Init tasks\n let tasks;\n // Check if tasks is in LS\n if(localStorage.getItem(\"tasks\")===null){\n tasks=[];\n } else {\n tasks = JSON.parse(localStorage.getItem(\"tasks\"));\n }\n // Loop through Tasks and remove the one that matches the task we want removed\n tasks.forEach(function(task, index){\n if(task === taskItem.textContent){\n tasks.splice(index, 1);\n }\n })\n\n // Set the new array to LS\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n}", "function removeTaskFromLocalStorage(taskItem) {\n // console.log(taskItem)\n\n\n // check localStorage\n let tasks\n\n // check if theres already something there\n if(localStorage.getItem('tasks') === null) {\n tasks = [] //if not => then set tasks to empty array\n } else {\n // if there's => then get it and convert it to json\n // because localStorage stores only string\n tasks = JSON.parse(localStorage.getItem('tasks'))\n }\n\n // loop through the data\n tasks.forEach(function(task, index) {\n\n // check if the text of the task matches the one in the ittration\n if(taskItem.textContent === task) {\n // if so, then this is the one to remove\n tasks.splice(index, 1)\n }\n })\n\n\n // after we removed the task => let's set (update) the localstorage\n localStorage.setItem('tasks', JSON.stringify(tasks))\n\n}", "function deleteLS(delItem){\n console.log(\"delete activated\");\n let task;\n if(localStorage.getItem('task') === null)\n {\n task=[];\n }\n else\n {\n task=JSON.parse(localStorage.getItem('task'));\n\n\n }\n\n \n task.forEach(function(tasks,index){\n \n if(delItem.innerHTML === tasks){\n \n\n \n \n task.splice(index,1);\n }\n })\n localStorage.setItem('task',JSON.stringify(task));\n}", "function removeTask(e) {\n if (e.target.parentElement.classList.contains('delete-item')) {\n if (confirm('Are you sure?')) {\n e.target.parentElement.parentElement.remove();\n\n removeTaskFromLocalStorage(Number(e.target.parentElement.parentElement.id.substring(5)))\n }\n }\n}", "function removeItem()\r\n{\r\n\tconst item = this.parentNode.parentNode;\r\n\tconst currentListId = item.parentNode.id;\r\n\tconst text = item.innerText;\r\n\r\n\titem.remove();\r\n\r\n\tif (currentListId === \"todo-list\") \r\n\t{\r\n\t\ttodo.splice(todo.indexOf(text),1);\r\n\t}\r\n\telse\r\n\t{\r\n\t\tcompleted.splice(completed.indexOf(text),1);\r\n\t}\r\n\r\n\tlocalStorage.setItem('todos',JSON.stringify(todo));\r\n\tlocalStorage.setItem('completed',JSON.stringify(completed));\r\n}" ]
[ "0.7536835", "0.7423865", "0.74138796", "0.7353058", "0.73402566", "0.7332698", "0.72632897", "0.7210352", "0.71930885", "0.71805423", "0.7149886", "0.71437", "0.7131697", "0.71261984", "0.71178687", "0.7111676", "0.7039964", "0.7022255", "0.6984162", "0.69814265", "0.69643545", "0.69530725", "0.69326186", "0.6922164", "0.69189084", "0.6910209", "0.68905574", "0.68832237", "0.6882402", "0.687661", "0.6854028", "0.68436825", "0.68053085", "0.6798355", "0.6788014", "0.67860675", "0.6783004", "0.67809683", "0.67709315", "0.6764938", "0.6759639", "0.6750608", "0.673957", "0.6737913", "0.67314976", "0.6716702", "0.66946733", "0.66767794", "0.66707426", "0.665748", "0.6656637", "0.66539204", "0.6640312", "0.6636549", "0.66341484", "0.6623919", "0.66220605", "0.66124046", "0.6611564", "0.66062665", "0.6604528", "0.6604407", "0.6602007", "0.6598003", "0.65858656", "0.6580845", "0.657166", "0.65658265", "0.6563858", "0.6560901", "0.6560666", "0.65592283", "0.655908", "0.6558215", "0.6553532", "0.6551627", "0.6547133", "0.65368146", "0.6536208", "0.65313375", "0.65263546", "0.65213656", "0.65130055", "0.6506022", "0.65044016", "0.65015006", "0.650043", "0.64956087", "0.6483493", "0.64816666", "0.64709854", "0.6463361", "0.64605933", "0.6445361", "0.6426494", "0.642351", "0.64195144", "0.6417406", "0.64153296", "0.64152616", "0.6412332" ]
0.0
-1
Delete the tasks from a specific team by a date range
function deleteTasksByTeamByRange(options, allTasks, myTasks) { var calls = []; Teams.getTasksRange(options) .then(function (tasks) { if(tasks.length == 0) { $rootScope.notifier.error($rootScope.ui.planboard.noTasksFounded); $rootScope.statusBar.off(); } else if (tasks.error) { $rootScope.notifier.error(result.error); } else { angular.forEach(tasks, function (task) { allTasks = deleteTask(allTasks, task.uuid); myTasks = deleteTask(myTasks, task.uuid); calls.push( TeamUp._ ( 'taskDelete', {second: task.uuid}, task ) ); }); $q.all(calls) .then(function (result) { if (result.error) { console.log('failed to remove task ', task); } else { var group = ($scope.section == 'teams') ? $scope.currentTeam : $scope.currentClientGroup; $scope.getTasks( $scope.section, group, moment($scope.timeline.range.start).valueOf(), moment($scope.timeline.range.end).valueOf() ); $rootScope.notifier.success($rootScope.ui.planboard.tasksDeleted(options)); } $rootScope.statusBar.off(); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteTask(taskId) {\n // Create an empty array and store it in a new variable, newTasks\n const newTasks = [];\n\n // Loop over the tasks\n for (let i = 0; i < this.tasks.length; i++) {\n // Get the current task in the loop\n const task = this.tasks[i];\n\n // Check if the task id is not the task id passed in as a parameter\n if (task.id !== taskId) {\n // Push the task to the newTasks array\n newTasks.push(task);\n }\n }\n\n // Set this.tasks to newTasks\n this.tasks = newTasks;\n }", "function deleteTask(tasks, uuid)\n {\n var i = 0;\n console.error('tasks', tasks);\n\n for (; i < tasks.length; i++)\n {\n if (uuid == tasks[i].uuid)\n {\n tasks.splice(i, 1);\n i--;\n }\n }\n return tasks;\n }", "deleteTask(taskId) {\n\t\tconst todos = this.getAndParse('tasks');\n\t\tconst filteredTodos = todos.filter(task => task.id !== taskId);\n\t\tthis.stringifyAndSet(filteredTodos, 'tasks');\n\t}", "deleteTask(taskId) {\n let newTasks = [];\n this.tasks.forEach(task => {\n if (task.id !== taskId) {\n newTasks.push(task);\n }\n });\n this.tasks = newTasks;\n }", "deleteTask(taskId) {\n const newTasks = [];\n this.tasks.forEach((item) => {\n if (item.Id !== taskId) {\n newTasks.push(item);\n }\n });\n this.tasks = newTasks;\n }", "deleteByTaskId(id, callback) {\n try {\n id = new ObjectID(id)\n } catch (err) {\n callback(null)\n }\n collection.deleteMany({task: id}, callback)\n }", "function deleteTask (e){\n for (var i = 0 ; i< loginUser.tasks.length; i ++){\n if(parseInt(loginUser.tasks[i].id) === parseInt(e.target.getAttribute('data-id'))){\n if(loginUser.tasks[i].status === false){\n taskToDo--;\n $('#countOfTask').text('').text('Task to do: '+ taskToDo);\n }\n loginUser.tasks.splice(i, 1);\n $('#task' + e.target.getAttribute('data-id')).remove();\n collectionOfUser.update(\n {\n id : loginUser.id,\n tasks : loginUser.tasks\n },\n function(user){\n loginUser = user;\n },\n error \n );\n }\n }\n }", "deleteAnyPastReservations(bank, branch) {\r\n //Get current day time\r\n var currentDate = new Date();\r\n var month = currentDate.getMonth() + 1;\r\n var day = currentDate.getDate();\r\n var year = currentDate.getFullYear();\r\n\r\n //Get timeframes referrence\r\n var timeFramesRef = database.getDocumentFromCollection(bank, branch).collection('TimeFrames');\r\n\r\n var yearLookup = 'year';\r\n var monthLookup = 'month';\r\n var dayLookup = 'day';\r\n\r\n //Find old timeframes and write a batch do delete them\r\n timeFramesRef.get().then(function (querySnapshot, docId) {\r\n var batch = database.getBatch();\r\n querySnapshot.forEach(doc => {\r\n\r\n if (!(doc.data()[yearLookup] > year) &&\r\n !(doc.data()[yearLookup] == year &&\r\n doc.data()[monthLookup] > month) &&\r\n !(doc.data()[yearLookup] == year &&\r\n doc.data()[monthLookup] == month &&\r\n doc.data()[dayLookup] >= day)) {\r\n batch.delete(doc.ref);\r\n }\r\n });\r\n return batch.commit();\r\n }).catch(err => {\r\n console.log(err.message);\r\n });\r\n }", "deleteTask(taskId) {\n // Create an empty array and store it in a new variable, newTasks\n const newTasks = [];\n console.log( `taskId: ${taskId}` );\n\n // Loop over the tasks\n for (let i = 0; i < this.tasks.length; i++) {\n // Get the current task in the loop\n const task = this.tasks[i];\n\n // Check if the task id is not the task id passed in as a parameter\n if (task.id !== taskId) {\n // Push the task to the newTasks array\n newTasks.push(task);\n }\n }\n\n // Set this.tasks to newTasks\n this.tasks = newTasks;\n console.log(this.tasks);\n }", "function deleteTask(projectid, taskid) {\n data.projects[projectid].tasks.splice(taskid, 1);\n }", "function deleteTask(currentTask) {\n console.log(\"Delete task\");\n console.log(\"---task to be deleted: \" + currentTask.task);\n\n setTasks(\n tasks.filter((task) => {\n // console.log(\"\")\n return task.id !== currentTask.id;\n })\n );\n }", "function deleteTask(event)\n{\n //gets button id\n let id = event.target.id;\n\n //gets task position from button id\n let taskPosition = id.replace(/\\D/g,'');\n\n //removes task from task array\n taskArr.splice(taskPosition - 1, 1); \n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites task list\n rewritesList();\n}", "function deleteTasks(taskId){\n $.ajax({\n url: '/tasks/' + taskId,\n type: 'DELETE',\n success: function(response){\n console.log(response);\n getTasks();\n } // end success\n }); //end ajax\n}", "deleteAllTasks () {\r\n this.eliminatedTask.splice(0, this.eliminatedTask.length);\r\n }", "function deleteTask(a,b) {\r\n taskList.splice(a,3)\r\n return taskList;\r\n\r\n }", "'tasks.remove'(taskId) {\n check(taskId, String);\n\n const task = Tasks.findOne(taskId);\n if (task.private && task.owner !== this.userId) {\n // If the task is private, make sure only the owner can delete it\n throw new Meteor.Error('not-authorized');\n }\n\n Tasks.remove(taskId);\n }", "function deleteTasks(){\n\n //loop through task array to remove finished arrays\n for(let i = 0; i < taskArr.length; i++)\n {\n //checks if task is finished\n let isFinished = taskArr[i].finished;\n\n //removes task from task array\n if(isFinished === 1)\n {\n taskArr.splice(i, 1);\n i--;\n };\n \n };\n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites list with new positions and only unfinished tasks\n rewritesList();\n}", "function deleteTask()\n {\n var child = this.parentNode.parentNode;\n var parent = child.parentNode;\n parent.removeChild(child);\n var id= parent.id;\n var value = child.innerText;\n if (id == \"taskList\")\n {\n obj.taskListArr.splice(obj.taskListArr.indexOf(value), 1);\n }\n else \n {\n obj.taskCompletedArr.splice(obj.taskCompletedArr.indexOf(value), 1);\n } \n dataStorageUpdt();\n }", "static deleteTask(taskId = 0){\n var table_Name = Task.tableName\n const sql = `delete from ${table_Name} WHERE id = ?`\n const params = [taskId]\n console.log(\"Task id \"+taskId)\n return this.repository.databaseLayer.executeSql(sql, params)\n }", "static removeTask(project, task) {\n const qSelector = `#delete-project${project.id}-task${task.id}`\n console.log(qSelector)\n const taskDeleteBtn = document.querySelector(qSelector)\n taskDeleteBtn.addEventListener('click', () => {\n project.removeTask(task);\n DomOutput.loadTaskList(project);\n })\n }", "delete() { all = all.filter(task => task.id !== this.id) }", "removePeriodAndTaskMarker(task){\n let taskElem = task;\n if (taskElem) {\n let taskDays = $('.day[data-task=true]');\n let taskDebut = taskElem.datedebut;\n let taskFin = taskElem.datefin;\n let periodDays = [];\n //On genere un tableau representant la periode de la tache et les cellules concerné\n $.each(taskDays, (i, e) => {\n if ($(e).attr('data-date') >= taskDebut && $(e).attr('data-date') <= taskFin) {\n periodDays.push(e);\n }\n });\n //on verifie si les cellules de la periode on d'autre taches que celle supprimé.\n let emptyDay = periodDays.filter((e) => {\n let date = $(e).attr('data-date');\n let taskPerDay =0;\n $.each(this.tasks, (i, e) => {\n let dateDebut = e.datedebut;\n let dateFin = e.datefin;\n if (date >= dateDebut && date <= dateFin) {\n taskPerDay++\n }\n\n });\n //si aucune date de tache ne correspond a la date de la cellules on la met dans un tableau\n //representant une cellule vide\n if(!taskPerDay)return true;\n });\n //on retire l'attribut;\n $.each(emptyDay,(i,e)=>{\n if($(e).attr('data-task')){\n $(e).removeAttr('data-task');\n }\n });\n $('.period').toggleClass('period');\n }\n }", "'dateDelete'(dateRow){\n let atendences = Atendence.find({date: dateRow._id}).fetch();\n let today = moment().format(\"YYYY-MM-DD\");\n let countDates = Dates.find({date: {$lte: today}, teamId: dateRow.teamId}).fetch();\n countDates = countDates.map((date) => {\n return date._id;\n })\n let count = 0;\n atendences = atendences.map((atendence) => {\n let player = Players.findOne({_id: atendence.player});\n count = Atendence.find({date: {$in: countDates}, player: player._id}).count();\n if((atendence.atend) && (dateRow.date <= today)){\n if((count - 1) > 0){\n playerRelAt = (player.countAtend - 1) / (count - 1) * 100;\n }\n else{\n playerRelAt = 0;\n }\n Players.update({_id: player._id}, {$inc: {\"countAtend\": -1}, $set: {playerRelAt: playerRelAt}});\n }\n else{\n if((count - 1) > 0){\n playerRelAt = (player.countAtend) / (count - 1) * 100;\n }\n else{\n playerRelAt = 0;\n }\n Players.update({_id: player._id}, {$set: {playerRelAt: playerRelAt}});\n }\n });\n Atendence.remove({date: dateRow._id});\n Dates.remove({_id: dateRow._id});\n }", "function deleteTasks() {\n const mutateCursor = getCursorToMutate();\n if (mutateCursor) {\n clickTaskMenu(mutateCursor, 'task-overflow-menu-delete', false);\n } else {\n withUnique(\n openMoreMenu(),\n 'li[data-action-hint=\"multi-select-toolbar-overflow-menu-delete\"]',\n click,\n );\n }\n }", "function tempTaskCheck() {\n var curDate = new Date(); // Initializes date\n var tasksLast = taskList.getLastRow(); // Gets last row of tasks\n var tasks = taskList.getRange(2,5,(tasksLast-1),3).getValues(); // Gets the temp y/n, created, and time to live columns. -1 to account for first row of spreadsheet being populated\n \n for(var i = tasks.length - 1; i >= 0; i--){ // Loops through tasks from the end to the beginning. This is so a row can be deleted without changing position of the rest of the rows compared to the array of tasks\n if(tasks[i][0] == \"Y\"){ // Checks if the task is temp\n // Checks if unix time stamp of right now (should be midnight or close to it if scheduled correctly) is greater than midnight the day the temp task was created, plus the number of days times 86,400, the number of seconds in a day.\n // Dividing by 1000 is used to get seconds as it is initially grabbed in milliseconds \n // Since the created timestamp will be midnight the day it is created, the script adds a day to the time to live so the day created is technically day 1\n if((curDate.getTime()/1000) > ((tasks[i][1].getTime()/1000) + ((tasks[i][2]+1)*86400))){ \n taskList.deleteRow(i+2); // Deletes the position in the array, plus to to account for first row of spreadsheet and arrays starting at 0\n }\n }\n } \n}", "updateAllTasks(){\n const taskField = document.getElementById(\"task-field\")\n let targetTeamId = this.teamId;\n // let teamTasks = Task.all.filter(task => task.teamId === targetTeamId)\n let teamTasks = Task.all.filter(task => task.teamId === targetTeamId).sort(function(a, b){return a.urgency - b.urgency}).sort(function(a, b){return a.dueDate - b.dueDate}).sort(function(a, b){return a.complete - b.complete})\n let taskArr = ''\n // d\n for (const task of teamTasks){\n taskArr += task.createTaskForDom()\n }\n taskField.innerHTML = taskArr;\n document.querySelectorAll(\".complete\").forEach(btn => btn.addEventListener(\"click\", completeStatus));\n document.querySelectorAll(\".delete-tasks\").forEach(btn => btn.addEventListener(\"click\", removeTask));\n }", "deleteFromList(taskID) {\n let deleted = this.taskArr.find(task => task.id == taskID)\n this.taskArr = this.taskArr.filter(value => value != deleted)\n return this.taskArr\n }", "function taskDeletor(idel) {\n\t\tconst currentTask = tasks.find( el => el.id == idel);\n\t\tlet taskIndex = tasks.indexOf(currentTask);\n\t\ttasks.splice(taskIndex, 1);;\n\t}", "function deleteTask(task) {\n var position = toDoList.indexOf(task);\n if (position > -1) {\n return toDoList.splice(position, 1);\n }\n else {\n console.log(\"task is not in our list!\");\n }\n}", "'teamFullRemove'(teamId){\n Atendence.remove({teamId: teamId});\n Dates.remove({teamId: teamId});\n Players.remove({teamId: teamId});\n TrainerTeam.remove({team: teamId});\n Teams.remove({_id: teamId});\n }", "function deleteTask(taskListIndex) {\n\n taskList.splice(taskListIndex, 1);\n\n\n listTasks()\n}", "function removeTask(task, taskList) {\n newArr = [];\n for (var i = 0; i < taskList.length; ++i) {\n if (task.eID === taskList[i].eID) {\n newArr = taskList.slice(i, i + 1);\n return newArr;\n }\n }\n}", "function removeTask(object) {\n var task_index = Number(object.getAttribute('task_index'));\n let id = Math.abs((tasksList.length - 1) - task_index);\n tasksList = tasksList.filter((val, index) => index != id);\n const finalData = generateTasksList();\n document.getElementById(\"divTasksList\").innerHTML = finalData;\n console.log(tasksList);\n}", "function deleteTask(task) {\n const params = new URLSearchParams();\n params.append('id', task.id);\n fetch('/delete-task', {method: 'POST', body: params});\n}", "async deletePersonalSchedule() {\n const personalSchedules = await PersonalSchedule.query().where(\n 'user_id',\n this.id,\n );\n\n if (personalSchedules) {\n await PersonalSchedule.query()\n .delete()\n .where('user_id', this.id);\n }\n\n return personalSchedules;\n }", "static clearDone () {\n withTasks(tasks, (task) => {\n if (task.isPreloaded && task.pDone > task.pTotal - 3) {\n this.remove(task.$id)\n }\n })\n }", "deleteTask(id) {\n var index = this.list.map(i => i.id).indexOf(id);\n this.list.splice(index, 1);\n ls.deleteItem(id);\n }", "function reAssignDates(tasks) {\n \n for (var i = 0; i <= $scope.daysToConsider; i++) {\n var today = Date.today();\n var analysisDate = today.add(i).days();\n //see whether we have lower priority task for the day\n var lowerTasks = getLowerPriorityTasks(analysisDate, tasks);\n //filter out the one with < 10 mins of task duration\n //lowerTasks = filterOutLessDurationTasks(lowerTasks, 10);\n _.each(lowerTasks, function(lowerTask) {\n \n //var totalTime = getTotalTime(analysisDate);\n var totalTaks=getTotalTasks(analysisDate)\n if (totalTaks > $scope.tasksPerDay) {\n lowerTask.dueDate = Date1.parse(lowerTask.dueDate).add(1).days().toString(\"yyyy-MM-dd\");\n }\n \n });\n \n }\n }", "function deleteTask(taskId) {\n console.log('in deleteTask');\n\n $.ajax({\n method: 'DELETE',\n url: `/todo/${taskId}`\n }).then( response => {\n console.log('deleted task', taskId);\n }).catch( error => {\n console.log('delete error', error);\n }); \n\n getTasks();\n}", "function deleteTask(event) {\n\n let idDelete = event.target.getAttribute('data-id')\n\n let keyId = listTask.findIndex(element => {\n if (element.id == idDelete) {\n return element\n }\n })\n\n if (keyId != -1) {\n listTask.splice(keyId, 1)\n saveData()\n }\n\n openModalDel()\n}", "run(args) {\n //console.log(\"%s run: args\", this.name, args);\n const projectId = args.projectId;\n if (!Meteor.userId()) {\n throw new Meteor.Error('Not authorized to remove projects');\n }\n\n const project = Projects.findOne({ '_id': projectId });\n if (project) {\n //console.log(`Removing project '${projectId}'`);\n Tasks.find({ 'projectId': project._id }).forEach(task => {\n let w = WorkRecords.remove({ 'taskId': task._id });\n //console.log(`Removed ${w} work records for task='${task._Id}'`);\n });\n let t = Tasks.remove({ 'projectId': project._id });\n //console.log(`Removed ${t} tasks for project='${project.name}'`);\n }\n return Projects.remove(projectId);\n }", "removeTask(taskId) {\n const dbRef = firebase.database().ref();\n dbRef.child(taskId).remove();\n }", "function del(id){\n\t\t\t$(\"[data-eid=\"+ id +\"]\").each(function(){\n\t\t\t\tvar action = makeJsonFromNode(this);\n\t\t\t\tvar idArr = action.id.split('-');\n\n\t\t\t\t// Find object and reset start/end data\n\t\t\t\tvar p = getObjInArr(experiments[idArr[2]].protocols, 'id', idArr[3]);\n\t\t\t\tvar s = getObjInArr(p.steps, 'id', idArr[4]);\n\t\t\t\tvar a = getObjInArr(s.actions, 'id', action.id);\n\t\t\t\t\n\t\t\t\ta.start = a.end = \n\t\t\t\taction.start = action.end = 0;\n\n\t\t\t\t// Save and remove\n\t\t\t\tsaveAction.enqueue(action);\n\t\t\t\t$('#calendar').fullCalendar(\"removeEvents\", this.getAttribute(\"data-fc-id\"));\n\t\t\t});\n\t\t\t$(\"[data-id=\"+ id +\"]\").removeClass('disabled');\n\t\t}", "function removeSelectedGoals() {\n\t\t\tfor (var i = 0; i < vm.goals.length; i++) {\n\n\t\t\t\t// If the goal is selected \n\t\t\t\tif (vm.goals[i].selected === true) {\n\t\t\t\t\tvar task = vm.goals.splice(i, 1);\n\t\t\t\t\tconsole.log(task[i]);\n\t\t\t\t\ttasks.removeTask(task[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "deleteTask(event){\n //console.log(event.target.id);\n const temp = this.state.tasks;\n temp.splice(event.target.id,1);\n const temp2= this.state.dates;\n temp2.splice(event.target.id,1);\n this.setState(\n {\n tasks:temp,\n dates:temp2,\n }\n )\n //console.log(\"AFTER\",this.state.tasks);\n }", "function del(number) {\n if (number >= list.length) {\n console.log(`\\nInvalid Number\\n`);\n menu()\n } else {\n let task = list[number].task\n list.splice(number, 1);\n console.log(`\\nDeleted ${task}\\n`);\n view();\n }\n}", "function deleteTask(task) {\n var index = myArray.indexOf[task];\n myArray.splice(index, 1);\n return myArray.length;\n}", "function deleteTask(taskId) {\n return TaskModel.remove({_id: taskId});\n }", "function deleteToDo(itemDataKey) {\n var cleanDataKey = parseInt(itemDataKey)\n for (var i = 0; i < newToDoList.length; i++) {\n if (newToDoList[i].taskId === cleanDataKey) {\n newToDoList.splice(i, 1);\n break;\n }\n }\n}", "function deleteTask() {\n const buttonDelete = document.querySelectorAll('.button-delete')\n buttonDelete.forEach(button => {\n button.onclick = function (event) {\n event.path.forEach(el => {\n if (el.classList?.contains(listItemClass)) {\n let id = +el.id\n listTask = listTask.filter(task => {\n if (task.id === id) {\n el.remove()\n return false\n }\n return true\n })\n showInfoNoTask()\n }\n })\n setTaskValue()\n localStorage.setItem('listTask', JSON.stringify(listTask))\n }\n })\n }", "function removeTask(event) {\n\n let id = event.target.dataset.id;\n let tareaEliminar = event.target.parentNode;\n console.log(tareaEliminar);\n\n tareaEliminar.parentNode.removeChild(tareaEliminar)\n\n //buscar en el array la posicion\n let posicionBorrar = tasks.findIndex(task => {\n return task.titulo == id\n })\n\n console.log(posicionBorrar);\n tasks.splice(posicionBorrar, 1)\n}", "function deleteTask(id,deleteIds) {\n const path = location.pathname+\"/\"+deleteIds;\n axios.delete(path)\n .then(res => {\n setTasks(prevNotes => {\n return prevNotes.filter((noteItem, index) => {\n return index !== id;\n });\n });\n })\n .catch(err => {\n console.log(err);\n });\n }", "teamTeamIdProjectProjectIdDelete(incomingOptions, cb) {\n const Rollbar = require('./dist');\n\n let apiInstance = new Rollbar.DefaultApi(); // Number | // Number | // String | Use an account access token with 'write' scope\n /*let teamId = 56;*/ /*let projectId = 56;*/ /*let xRollbarAccessToken = \"xRollbarAccessToken_example\";*/ apiInstance.teamTeamIdProjectProjectIdDelete(\n incomingOptions.teamId,\n incomingOptions.projectId,\n incomingOptions.xRollbarAccessToken,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, data.result, response);\n }\n }\n );\n }", "function deleteTask(taskId){\n var deleteTaskUrl = baseUrl + '/api/call.php?deleteTask=true';\n $.ajax({\n url: deleteTaskUrl,\n data: {taskId: taskId},\n type: 'POST',\n success: function (data) {\n location.reload();\n },\n error: function (tasks) {\n }\n });\n }", "function setupDailyCleanUp() {\n const deleteRule = new schedule.RecurrenceRule();\n deleteRule.dayOfWeek = [0, new schedule.Range(1, 6)];\n deleteRule.hour = 0;\n deleteRule.minute = 1;\n\n schedule.scheduleJob(deleteRule, function() {\n axios\n .post(\n process.env.MONGO_DELETE_ENDPOINT,\n {},\n )\n .then(function(response) {\n console.log('Cleared daily goals for the day.');\n })\n .catch(function(error) {\n console.log(error);\n });\n });\n}", "function remind() {\r\n var OFFSET_ROW = 2;\r\n var OFFSET_COLUMN = 0;\r\n \r\n const ss = SpreadsheetApp.getActiveSpreadsheet();\r\n const sheet = ss.getSheetByName('<SheetName e.g. sheet1>');\r\n //URL\r\n var sheetUrl = ss.getUrl();\r\n var dataRange = sheet.getDataRange();\r\n var tasks = dataRange.offset(OFFSET_ROW, OFFSET_COLUMN).getValues();\r\n const nowDate = Moment.moment().format('YYYY/MM/DD');\r\n //Logger.log(nowDate);\r\n \r\n for ( var i = 0; i < tasks.length; i++ ) {\r\n var task = tasks[i];\r\n Logger.log(task);\r\n //Due Date, 締切\r\n var dueDateTime = Moment.moment(task[6]).format('YYYY/MM/DD hh:');\r\n \r\n if(!dueDateTime){\r\n return;\r\n }\r\n\r\n var dueDate = Moment.moment(task[6]).format('YYYY/MM/DD');\r\n //Logger.log(dueDate);\r\n \r\n //Moment.moment('2017/2/3').isBefore('2017/2/4'); //true\r\n //Moment.moment('2017/2/3 16:55').isSame('2017/2/3 17:00','day'); //true\r\n var isLateToDeadline = Moment.moment(dueDate).isBefore(nowDate);\r\n var isDeadlineDay = Moment.moment(dueDate).isSame(nowDate);\r\n\r\n if ( isLateToDeadline = \"TRUE\" || isDeadlineDay == \"TRUE\" ) {\r\n /*\r\n * No.\t: 0\r\n * Task Category : 1\r\n * Task Name ,Assignee, Slack User Name, Slack User ID, Due Date,\r\n * Status : 7\r\n */\r\n\r\n //No.\r\n var taskNumber = round(task[0]);\r\n //Logger.log(taskNumber);\r\n //Task Category, カテゴリ\r\n var taskCategory = task[1];\r\n //Logger.log(taskCategory);\r\n //Task Name, タスク名\r\n var taskName = task[2]; \r\n //Logger.log(taskName);\r\n //Slack User ID of Assignee, 担当者のslackのプロフィールページからコピペするUser ID\r\n var slackId = task[5]; \r\n //Logger.log(slackId);\r\n //Status, done, doing, or todo???\r\n var status = task[7];\r\n //Logger.log(status)\r\n \r\n if ( 'todo' == status || 'doing' == status ) {\r\n var contents = writeReminders(taskNumber, taskCategory, taskName, slackId, dueDateTime, status, sheetUrl);\r\n sendMessages(contents); \r\n }\r\n }\r\n }\r\n}", "function deleteTask (taskId, callback) {\n var taskKey = datastore.key([\n 'Task',\n taskId\n ]);\n\n datastore.delete(taskKey, function (err) {\n if (err) {\n return callback(err);\n }\n\n console.log('Task %d deleted successfully.', taskId);\n return callback(null);\n });\n}", "async function removeFromGroupCompetitions(groupId, playerIds) {\n // Find all upcoming/ongoing competitions for the group\n const competitionIds = (\n await Competition.findAll({\n attributes: ['id'],\n where: {\n groupId,\n endsAt: { [Op.gt]: new Date() }\n }\n })\n ).map(c => c.id);\n\n await Participation.destroy({ where: { competitionId: competitionIds, playerId: playerIds } });\n}", "function removeTaskData(s,id)\n{\n const tasks = $(\"body\").data().tasks;\n if (s === \"tasklist\")\n {\n delete tasks.active[id];\n }\n else if (s === \"archivelist\")\n {\n delete tasks.archive[id];\n }\n else\n {\n developerError(\"removeTaskData() called with invalid task type\");\n }\n}", "async function deleteFavoriteTeam(user_id, team_id){\r\n await DButils.execQuery(\r\n `DELETE FROM dbo.favoriteTeams \r\n WHERE (user_id = '${user_id}' AND team_id = '${team_id}');`\r\n );\r\n}", "delete_all() {\n Meteor.call('tasks.removeAll');\n }", "function intervalFunc() {\n ticket.find({}, function (err, tickets) {\n if (err) {\n console.log(err);\n }\n else {\n console.log(tickets);\n tickets.forEach(function (Ticket) {\n console.log(Ticket);\n var Difference = Math.abs(new Date().getTime() - Ticket.time.getTime());\n var Hours = Math.ceil(Difference / (1000 * 3600));\n if (Hours > 8) {\n ticket.findByIdAndDelete(Ticket._id, function (err) {\n if (err) console.log(err);\n console.log(\"Successful deletion\");\n });\n\n }\n })\n }\n });\n}", "deleteFromSchedule() {\n let first = Number(document.querySelector('#del-startTime').value.slice(0,2));\n let second = Number(document.querySelector('#del-endTime').value.slice(0,2));\n\n let index = 0;\n let removed_schedule = [...this.state.schedule];\n try{\n if(document.querySelector('#del-startTime').value === \"\" || document.querySelector('#del-endTime').value === \"\"){\n throw 'Fill in specfic time slot to delete'\n }\n // GO through schedule list and remove specify time slot\n removed_schedule.map((time) => {\n if (time[0] === first && time[1] === second) {\n removed_schedule.splice(index, 1);\n this.setState({ schedule: removed_schedule });\n } else {\n index++;\n }\n })\n } catch (error){\n console.error(error)\n }\n }", "function deleteTask(event) {\n const taskListItem = this.parentNode.parentNode;\n const keyValue = taskListItem.querySelector('input').dataset.key\n taskListItem.parentNode.removeChild(taskListItem);\n\n\n manageTasksAjax(event, '', keyValue, 'delete')\n}", "function deleteTask(id){\n API.deleteTask(id)\n .then(()=>{\n getTasks();\n }).catch();\n }", "deleteTaskWithId(folderId) {\n console.log('FOLDER ID ================== ', folderId);\n let realm = new Realm({schema: [TaskSchema, SubTaskSchema, NotesSchema]});\n realm.write(() => {\n const folder = realm.objects('TASK').filtered('id == $0', folderId);\n const files = realm.objects('SUBTASK').filtered('taskId == $0', folderId);\n realm.delete(folder);\n realm.delete(files);\n });\n }", "async doctorsScheduleEventDrop(event) {\n if (event === null)\n throw new ValidationException(\"Debe seleccionar el evento a eliminar\");\n\n // const token = Token.load();\n // const authorization = await token.authorization();\n\n return axios.delete(\n `${config.API_LOCATION}/eliminar/agenda/hora/${event.id}`\n );\n }", "function deleteTask(e){\n const taskID = document.getElementById('id').value;\n http\n .delete(`http://localhost:3000/Tasks/${taskID}`)\n .then(task=>{\n //clearing field\n ui.clearFiled();\n //showing message\n ui.showAlertMessage('Task deleted','alert alert-warning');\n //getting task\n getTasks();\n })\n}", "deleteTrainingDate(payload) {\n return this.request.delete('delete-training-date', _objectSpread({}, payload));\n }", "function findAppointmentAndRemove() {\n Appointment.find({}, function (err, appointments) {\n if (err) {\n console.log(err)\n } else {\n appointments.forEach(appointment => {\n // console.log(appointment.type)\n if (appointment.type === 'appointment' || appointment.type === 'request') {\n var today = new Date();\n today.setHours(today.getHours() - 3);\n var dd = String(today.getDate()).padStart(2, '0');\n var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!\n var yyyy = today.getFullYear();\n var ss = today.getSeconds();\n var min = today.getMinutes();\n var hh = today.getHours();\n\n today = mm + '/' + dd + '/' + yyyy + ' ' + hh + \":\" + min + \":\" + ss;\n\n var appointmentDate = Date.parse(appointment.timestamp)\n var todayMinusThreeHours = Date.parse(today)\n\n if (appointmentDate < todayMinusThreeHours) {\n appointment.remove()\n }\n }\n })\n }\n })\n}", "teamDelete(incomingOptions, cb) {\n const Rollbar = require('./dist');\n\n let apiInstance = new Rollbar.DefaultApi(); // String | Use an account access token with 'write' scope\n /*let xRollbarAccessToken = \"xRollbarAccessToken_example\";*/ apiInstance.teamDelete(\n incomingOptions.xRollbarAccessToken,\n (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, data.result, response);\n }\n }\n );\n }", "function deleteTask(id) {\n const updatedTasks = tasks.filter((task) => task.taskId !== id);\n setTasks(updatedTasks);\n }", "function deleteTask(id){\r\n // Remove from DOM\r\n let item = document.getElementById(id);\r\n item.remove();\r\n\r\n // Remove from backend\r\n let dataSend = \"deleteTask=exec&id=\" + id;\r\n return apiReq(dataSend, 3);\r\n}", "function deleteTask(id) {\n $.ajax({\n method: \"DELETE\",\n url: \"/api/task/\"+id\n })\n .then(function() {\n viewData();\n });\n }", "delete_old() {\n var start_of_day = moment().startOf('day').format('X');\n\n _.forEach(this.score, (events, email) => {\n this.score[email] = _.filter(events, (event) => {\n return event.time > start_of_day;\n })\n });\n }", "deleteTask(taskId, callback) {\n\n var result, response;\n\n this.db.deleteItem({ TableName: this.tableName, Key: { taskId: taskId } }, function (err, data) {\n if (err) {\n callback(err, null);\n } else {\n response = {\n statusCode: 200,\n body: JSON.stringify({\n message: \"task \" + taskId + \" has been deleted.\"\n }),\n };\n callback(null, response);\n }\n });\n }", "function deleteTask(self){\n clearInterval(timeVar);\n var neededId = getNeededId(self);\n $.ajax({\n url: $SCRIPT_ROOT + '/delete',\n data: {'id': neededId},\n type: 'POST',\n success: function(response){ returnToBeginning(neededId); },\n error: function(response){ handleResponseFromServer(response); }\n });\n}", "deleteSubtask(event) {\n\n let idToDelete = event.target.name;\n let subtasks = this.subtasks;\n let subtaskIndex;\n let recordIdToDelete;\n\n this.processing = true;\n\n for (let i = 0; i < subtasks.length; i++) {\n if (idToDelete === subtasks[i].id) {\n subtaskIndex = i;\n }\n }\n\n recordIdToDelete = subtasks[subtaskIndex].recordId;\n\n deleteSubtask({recordId: recordIdToDelete})\n .then(result => {\n if (result) {\n subtasks.splice(subtaskIndex, 1);\n } else {\n }\n })\n .catch(error => console.log(error))\n .finally(() => this.processing = false);\n this.subtasks = event.target.querySelector(refreshSubtaskList);\n }", "function deleteTask($scope, todoToDelete) {\n $http.delete(`/todos/${todoToDelete._id}`).success(response => {\n getLists($scope);\n });\n }", "function deleteEvent(eventId){\n\n $('#confirmAction').modal('hide');\n\n\tvar indexOfJSON = getEventJSONIndex(eventId);\n\tvar events = flashTeamsJSON[\"events\"];\n\t\t\n\tevents.splice(indexOfJSON, 1);\n //console.log(\"event deleted from json\");\n \n //stores the ids of all of the interactions to erase\n var intersToDel = [];\n \n for (var i = 0; i < flashTeamsJSON[\"interactions\"].length; i++) {\n var inter = flashTeamsJSON[\"interactions\"][i];\n if (inter.event1 == eventId || inter.event2 == eventId) {\n intersToDel.push(inter.id);\n //console.log(\"# of intersToDel: \" + intersToDel.length);\n }\n }\n \n for (var i = 0; i < intersToDel.length; i++) {\n // take it out of interactions array\n var intId = intersToDel[i];\n var indexOfJSON = getIntJSONIndex(intId);\n flashTeamsJSON[\"interactions\"].splice(indexOfJSON, 1);\n\n // remove from timeline\n \tdeleteInteraction(intId);\n }\n\n removeTask(eventId);\n \n updateStatus(false);\n}", "function deleteTask(e) {\n let index = this.dataset.index;\n let tyList = this.parentElement.parentElement.parentElement;\n if (tyList.getAttribute(\"id\") == \"lists\") {\n tasks.splice(index, 1);\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n render(lists, tasks);\n }\n if (tyList.getAttribute(\"id\") == \"listOfChecked\") {\n tasksChecked.splice(index, 1);\n localStorage.setItem(\"tasksChecked\", JSON.stringify(tasksChecked));\n render(listOfChecked, tasksChecked);\n }\n}", "static async removeTask(id) {\n let result = await Task.findOneAndDelete({id}).exec()\n return result\n }", "async function delet_me(){\n const match = await DButils.execQuery(\n `select match_id from dbo.matches WHERE \n home_team = 1 and out_team = 3 AND league_id = 1 and season_name = '2021-2022'`\n );\n await DButils.execQuery(\n `delete from dbo.matches where match_id = '${match[0].match_id}'`\n );\n}", "deleteTask(task) {\n const deleteItem = task.key;\n const deleteRef = firebase.database().ref(`${this.props.userId}/${deleteItem}`);\n deleteRef.remove();\n }", "function deleteTask() {\n this.parentNode.parentNode.removeChild(this.parentNode);\n }", "function taskWasDeleted(data) {\n var task = $(\".task-wrapper[data-task='\" + data.taskId + \"']\");\n\n task.animate({\n height: 0,\n width: 0,\n opacity: 0,\n padding: 0,\n margin: 0\n }, 500, function() {\n task.remove();\n })\n }", "deleteTask(task) {\n let containerCard = this.get('taskCard');\n let parentFunc = this.get('deleteTask');\n return parentFunc(task, containerCard);\n }", "static async searchTask(restriction) {\n /**\n * 1. Search in `TR` by group id\n * 2. Search in `Task` by type\n * 3. Delete shielded tasks\n */\n // let tr_where, task_where;\n restriction = checkParamsAndConvert(restriction, ['range', 'type'])\n console.log(restriction)\n let task_ids = await models.TeamTask.findAll({\n where: {\n team_id: restriction.range,\n isolate: false\n },\n attributes: ['task_id'],\n raw: true\n });\n\n console.log(task_ids)\n\n task_ids = task_ids.map((item) => {\n return item.task_id\n });\n\n console.log(task_ids)\n\n\n if (task_ids.length == 0) {\n // No task can be found, then reutrn []\n return [];\n } \n \n // 这里可以搜出来所有符合Query要求的任务\n let time = sd.format(new Date(), 'YYYY-MM-DD HH:mm:ss');\n let tasks = await models.Task.findAll({\n where: {\n task_id: {\n [Op.or]: task_ids\n },\n type: restriction.type,\n endtime: {\n [Op.gt]: time\n }\n },\n include: [{\n association: models.Task.belongsTo(models.User, {foreignKey: 'publisher'}),\n attributes: ['username', 'avatar']\n }, {\n association: models.Task.hasMany(models.TR, {foreignKey: 'task_id'}),\n }]\n });\n\n\n // [[sequelize.fn('COUNT', sequelize.col('hats')), 'no_hats']]\n // find tasks that not be shield be the user. using piu table\n // 奇奇怪怪的屏蔽,回头看情况再写吧……\n return tasks;\n }", "removeTask () {\n\t\tthis.deleter.addEventListener('click', (e) => {\n\t\t\tfetch('/items/'+e.target.parentNode.parentNode.parentNode.childNodes[0].getAttribute('data-task'), {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\t\n\t\t\t})\n\t\t\t.then(res => res.text()) \n\t\t\t.then(res => console.log(res))\n\t\t\t.catch(error => console.error(error));\n\t\t\te.target.parentNode.parentNode.parentNode.remove();\n\t\t\tupdateProgess(numberOfCompletedTasks());\n\t\t});\n\n\t\t// We need to also remove tasks from the backend\n\t}", "function deleteTask(del){\n\t$.delete(\"http:localhost:8080/deleteTask\",\n\t\tdel,\n\t\tfunction(data, status){\n\t\t});\n}", "function deleteDate(target) {\n var dateId = target.attr('data-dateId');\n //CRUD call to mongo api\n $.ajax({\n url: \"https://thawing-sea-85558.herokuapp.com/profile/\" + dateId,\n method: 'DELETE',\n headers: {\n 'Authorization': 'Bearer ' + localStorage.getItem('idToken')\n }\n }).done(function (response) {\n loadDates();\n }).fail(function (jqXHR, textStatus, errorThrown) {\n console.log(errorThrown);\n })\n}", "function deletePlanner() {\n endDay = moment().hours()\n\n if(endDay >= 20) {\n window.localStorage.clear(); \n }\n}", "function deleteAppointment() {\n\n transition(\"DELETING\", true)\n \n // Async call to initiate cancel appointment\n props.cancelInterview(props.id).then((response) => {\n\n transition(\"EMPTY\")\n }).catch((err) => {\n\n transition(\"ERROR_DELETE\", true);\n });\n }", "deleteTask(task) {\n this.setState({\n toDo: this.state.toDo.filter((e, i) => {\n return i !== task;\n })\n });\n }", "doTaskUndone(target) {\n let index = [...target.parentElement.children].indexOf(target);\n this.doneTaskArr.splice(index - 1, 1);\n this.undoneTaskArr.push(target.children[0].value);\n this.taskToLocal(\"undoneTask\", this.undoneTaskArr);\n this.taskToLocal(\"doneTask\", this.doneTaskArr);\n const task = new Task(target.children[0].value);\n this.taskListUnDone.appendChild(task.createUndoneTask());\n target.remove();\n }", "function deleteTask(worker, taskId) {\n if (taskId) {\n datastore.deleteTask(taskId);\n worker.port.emit(\"TaskDeleted\", taskId);\n }\n}", "function pruneArchive (days) {\n if (days && days !== 0) {\n tasks.taskList.forEach((task) => {\n if (task.TaskStack === 'stack-archive' && task.UpdateTimestamp < Date.now() - (86400000 * days)) {\n tasks.deleteTask(task.TaskId)\n }\n })\n }\n}", "removeTask(e) {\n const index = e.target.parentNode.dataset.key;\n this.tasks.removeTask(index);\n this.renderTaskList(this.tasks.tasks);\n this.clearInputs();\n }", "function deleteTeam(req, res) {\n Team.deleteMany({_id: req.params.id}, (err, result) => {\n if (err) {\n res.json({\n message: 'Test - No teams were found with given Id. Try again.',\n });\n } else {\n switch (result.n) {\n case 1:\n res.json({\n message: 'Team successfully deleted!',\n result\n });\n break;\n case 0:\n res.json({\n message: 'Postmam - No teams were found with given Id. Try again.',\n result\n });\n break;\n default:\n res.json({\n message: 'Something gone wrong. Check the result.',\n result\n });\n break;\n };\n };\n });\n}", "function deleteSelection() {\n tempSelectedDates.forEach(function (e) {\n dateRangeChart.dispatchAction({\n type: 'downplay',\n dataIndex: e[1],\n seriesIndex: e[2]\n });\n });\n tempSelectedDates = new Set([]);\n //update the selection date list\n var $ul = createSelectionUl(tempSelectedDates);\n $(\"#daysSelectedList\").empty().append($ul);\n }" ]
[ "0.6183778", "0.6146677", "0.6114453", "0.6088318", "0.6052065", "0.58599496", "0.57875973", "0.5784129", "0.5782057", "0.5766821", "0.571558", "0.571338", "0.5693251", "0.5689389", "0.56837016", "0.56749547", "0.5636516", "0.55587596", "0.5543796", "0.55289215", "0.5527656", "0.55228126", "0.5516992", "0.5507025", "0.55027294", "0.5475447", "0.5465702", "0.54342246", "0.54181826", "0.54159963", "0.5401597", "0.5395428", "0.5377475", "0.5376109", "0.5359242", "0.53569007", "0.53536785", "0.53507257", "0.53503186", "0.5343916", "0.534319", "0.53340966", "0.53333294", "0.53303784", "0.5324857", "0.5321313", "0.5320011", "0.53192043", "0.5315548", "0.52979344", "0.52908933", "0.52895164", "0.5283819", "0.5278682", "0.5273403", "0.52668864", "0.5229356", "0.5219775", "0.5218727", "0.5213153", "0.5209499", "0.5202681", "0.5198994", "0.5197888", "0.5197365", "0.5191448", "0.5182885", "0.51778877", "0.51594704", "0.5158761", "0.51511663", "0.5148332", "0.51428854", "0.51282585", "0.51264596", "0.51237375", "0.5120374", "0.51158077", "0.51124054", "0.51098573", "0.51068836", "0.5105551", "0.5101081", "0.5098303", "0.509478", "0.5092432", "0.50921524", "0.50887096", "0.50864226", "0.50854504", "0.50803113", "0.5079888", "0.50782627", "0.5077242", "0.506911", "0.5053984", "0.5052216", "0.5051907", "0.5050881", "0.5049721" ]
0.7921611
0
Selects students whose last name starts with given string
function getStudentLastName(req, res, mysql, context, complete) { var sql = "SELECT Students.student_id AS id, Students.first_name AS fname, Students.last_name AS lname, Students.gpa AS gpa, Majors.name AS major FROM Students JOIN Majors ON Students.major_id = Majors.major_id WHERE Students.last_name LIKE " + mysql.pool.escape(req.params.s + '%') + "ORDER BY Students.last_name;" mysql.pool.query(sql, function(error, results, fields) { if (error) { res.write(JSON.stringify(error)); res.end(); } context.students = results; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStudentsFirstNameBeforeLastName(students) {\n var studentsWhoseFirstNameBeforeLastName = _.filter(students, function(student) {\n return student.firstName.toLowerCase() < student.lastName.toLowerCase();\n });\n return studentsWhoseFirstNameBeforeLastName;\n}", "function matchName(firstName, lastName, texts) {\n var combinedName = S(firstName).trim() + S(lastName).trim();\n if (combinedName.length < 5) {\n return null; //too short\n } else {\n if (\n findText(combinedName, texts) ||\n findText(S(firstName + ' ' + lastName).trim(), texts)\n || (findText(firstName, texts) && findText(lastName, texts))\n ) {\n return 'firstAndLast';\n }\n \n else\n if (findText(firstName, texts)) {\n return 'firstOnly';\n } else if (findText(lastName, texts)) {\n return 'lastOnly';\n } else {\n return null;\n }\n }\n}", "function filterStudents(searchString) {\n let newData = [];\n for (let i = 0; i < data.length; i++) {\n const name = `${data[i].name.first} ${data[i].name.last}`\n if (name.toLowerCase().includes(searchString.value.toLowerCase())) {\n newData.push(data[i]);\n }\n }\n return newData;\n}", "function getFirstName1(fullName) {\n return fullName.split(\" \")[0];\n}", "function surnameStarts(myName) {\n\tfor (var i = 0; i <= myName.length - 1; i++) {\n\t\tif (myName[i] == \" \") {\n\t\t\treturn console.log(myName.slice(i, myName.length));\n\t\t}\n\t}\n}", "function surnameStarts(myName) {\n\tfor (var i = 0; i <= myName.length - 1; i++) {\n\t\tif (myName[i] == \" \") {\n\t\t\treturn console.log(myName.slice(0, i));\n\t\t}\n\t}\n}", "function myFirstLastNameLetters(name){\n\tvar position = name.indexOf(\"B\");;\n\tvar lastName = name.substr(position);\n\tconsole.log(name.substr(0,1) + \".\" + lastName.substr(0,1));\n}", "function surnameStarts(myName) {\n\n\tvar separated = myName.split(' ');\n\n\tseparated[0] = \"Mr.\";\n\treturn console.log('Hello ' + separated[0] + separated[1]);\n\n}", "function search(lastName) {\n contactsLength = contacts.length;\n for (var i = 0; i < contactsLength; i++) {\n if (lastName === lastName) {\n printPerson(contacts[i]);\n }\n }\n}", "function nameStartsWith(name, search) {\r\n if (search === '')\r\n return true;\r\n\r\n var Regex = /[ _-]+/;\r\n var names = name.split(Regex);\r\n\r\n //do any of the names in the array start with the search string\r\n return names.some(function (name) {\r\n return name.toLowerCase().indexOf(search.toLowerCase()) === 0;\r\n });\r\n }", "function getFirstName(fullname){\n let firstName = fullname.trim();\n // If fullname includes a space, firstname is what comes before that first space\n if (fullname.includes(\" \")) {\n firstName = firstName.substring(0, firstName.indexOf(\" \"));\n firstName = firstName.substring(0,1).toUpperCase() + firstName.substring(1).toLowerCase();\n } else {\n // if fullname only has one name - no space\n firstName = firstName;\n }\n return firstName;\n}", "function getNewFirstName() {\n return firstName.substring(0,3) + lastName.substring(0,2).toLowerCase();\n}", "function extractFirstName(nameString)\n{\n const nameList=nameString.split(' ');\n return nameList[0].toLowerCase();\n}", "function checkSingleName(fullname, lastname, letters){\r\n\tvar result = false;\r\n\tvar re = new RegExp('^'+letters);\r\n\r\n\r\n\tif(fullname.toLowerCase().match(re) != null || lastname.toLowerCase().match(re) != null){\r\n\t\t\tresult = true;\r\n\t\t\treturn result;\r\n\t}\r\n\r\n\treturn result;\r\n}", "function search(lastName) {\n var contactsLength = contacts.length;\n for (var i = 0; i < contactsLength; i++) {\n if (lastName === contacts[i].lastName) {\n printPerson(contacts[i]);\n }\n }\n}", "function search(lastName) {\n var contactsLength = contacts.length;\n for (var i = 0; i < contactsLength; i++) {\n if (lastName === contacts[i].lastName) {\n printPerson(contacts[i]);\n }\n }\n}", "function searchingFor(term){\n return function(x){\n return x.first_name.toLowerCase().includes(term.toLowerCase()) || !term;\n };\n}", "function startsWithS(str) { return str[0].toLowerCase() === 's'; }", "getFirstName() {}", "function startsWithString(array,string){\n var list=[];\n for(var i=0;i<array.length;i++){\n if(array[i].name.startsWith(string))\n list.push(array[i]);\n }\n return list;\n\n}", "function nameSearch() {\r\n searchName = myInput.value.toLowerCase();\r\n listStudent = [];\r\n\r\n // Conditional to check for \"no results\" cases\r\n\r\n if (searchName.length > 0 && listStudent.length === 0) {\r\n listStudent.length = 0;\r\n document.querySelector(\r\n \".student-list\"\r\n ).innerHTML = `<li class=\"student-item cf\"><div><h3> Sorry, no matches </h3></div></li>`;\r\n addPagination(listStudent);\r\n }\r\n\r\n // Loop to check if input corresponds to a student name from the list.\r\n // Could have been done with a for loop or other method like includes, or searching of index\r\n\r\n Array.from(list).forEach(function (student) {\r\n if (\r\n student.name.first.toLowerCase().match(searchName) ||\r\n student.name.last.toLowerCase().match(searchName)\r\n ) {\r\n listStudent.push(student);\r\n showPage(listStudent, 1);\r\n }\r\n });\r\n addPagination(listStudent);\r\n }", "function checkNameSubstring(employee) {\n\t\tconst fullName = `${employee.name.first} ${employee.name.last}`\n\t\tconst query = filterInput.value;\n\t\treturn fullName.includes(query);\n\t}", "function search(lastName) {\n var contactsLength = contacts.length;\n for (var i = 0; i < contactsLength; i++) {\n if(contacts[i].lastName === lastName) {\n printPerson(contacts[i]);\n }\n } \n}", "function search(lastName) {\n var contactsLength = contacts.length;\n for (var i = 0; i < contactsLength; i++) {\n if(contacts[i].lastName === lastName) {\n printPerson(contacts[i]);\n }\n } \n}", "function inName() {\n\tvar str = $('#name')[0].innerText;\n\tvar nameParts = str.split(' ');\n\tvar lastPart = nameParts.length - 1;\n\t// Initial cap for first name\n\tnameParts[0] = str.slice(0,1).toUpperCase() +\n\t\tnameParts[0].slice(1).toLowerCase();\n\t// All caps for last name\n\tnameParts[lastPart] = nameParts[lastPart].toUpperCase();\n\treturn nameParts.join(' ');\n}", "function starts_with(str, prefix) {\n\t\treturn str.lastIndexOf(prefix, 0) === 0;\n\t}", "getStudentName(reverse = false) {\n let name = API.LMSGetValue(\"cmi.core.student_name\");\n let parts;\n if (!reverse)\n if (name.indexOf(\",\") !== -1) {\n parts = name.split(\",\");\n name = `${parts[1]}${parts[0]}`;\n }\n\n\n return name;\n }", "function getFirstName(fullName){\n //Steve Rogers\n //Split Function\n fullName = fullName.split(\" \"); //Split whenever there is split in fullname\n return fullName[0];\n //[\"Steve\", \"Rogers\"]; this will happen after split\n}", "function rdfPerson(fullname) {\n var nameInit = fullname.charAt(0); // prendo l'iniziale del nome\n var surname = fullname.substr(fullname.indexOf(\" \"));\n\n var firstSurname = \"\";\n var secondSurname = \"\";\n\n // primo, secondo e terzo spazio nel cognome\n var first = 0, second = 0, third = 0;\n\n // ciclo per individuare gli ultimi due spazi nel cognome\n do {\n second = surname.indexOf(\" \", first + 1);\n if (second == -1) {\n firstSurname = surname.substr(first + 1);\n } else {\n third = surname.indexOf(\" \", second + 1);\n if (third == -1) {\n secondSurname = surname.substr(second + 1);\n firstSurname = surname.substr(first + 1, second - first - 1);\n } else {\n first = second;\n }\n }\n } while (firstSurname == \"\");\n \n return ((nameInit + \"-\" + firstSurname + secondSurname)).toLowerCase();\n}", "function startsWith(input, value) {}", "function validateFullName(val) {\n var first_name, last_name, split_index;\n split_index = val.indexOf(\" \");\n if (split_index == -1) {\n return false;\n }\n first_name = val.substr(0,split_index);\n last_name = val.substr(split_index + 1);\n return validateSingleName(first_name) && validateSingleName(last_name);\n}", "function splitFirstName(name) {\n\t// cat ho ra la: cat trong ho va ten tinh tu dau cho den khoang\n\t// trong dau tien\n\tvar firstSpace = name.indexOf(' ');\n\tvar firstName = name.substring(0, firstSpace);\n\treturn firstName;\n}", "function myFullName() {\n return myFirstName('Srujan');\n }", "async function getUsersByLastName(lastName) {\n const query = usersCollection.where('last_name', '==', lastName);\n return query.get();\n}", "function stripStartingFiller(collegeName) {\n if (collegeName.match(/^The .*/)) {\n return stripStartingFiller(collegeName.slice(4));\n }\n if (collegeName.match(/^College .*/)) {\n return stripStartingFiller(collegeName.slice(8));\n }\n if (collegeName.match(/^of .*/)) {\n return stripStartingFiller(collegeName.slice(3));\n }\n if (collegeName.match(/^School .*/)) {\n return stripStartingFiller(collegeName.slice(7));\n }\n return collegeName;\n}", "function fullName(first, last){\r\n var name = first + \"\" + last;\r\n return name;\r\n}", "function studentMatchesSearch( student, searchFilter ) {\n str = searchFilter.toLowerCase();\n name = student.querySelector('h3').textContent.toLowerCase();\n email = student.querySelector('.email').textContent.toLowerCase();\n return ( name.indexOf(str) !== -1 || email.indexOf(str) !== -1 );\n }", "function removeMiddleName(string) {\n\n let arrayString = string.split(\" \");\n let first = arrayString[0];\n let last = arrayString[arrayString.length-1];\n let firstLast = first +\" \" + last;\n \n if (arrayString.length === 1){\n return first;\n }\n else{\n return firstLast;\n }\n \n }", "function parseProfName(profName) {\n profName = profName.replace(/ [A-Z]$/g, \"\"); // Remove the middle initial if there is one\n let middleAndLastName = profName.substr(0, profName.indexOf(\", \"));\n let firstName = profName.substr(profName.indexOf(\", \") + 2);\n return firstName + \" \" + middleAndLastName;\n}", "function getSchoolStartingWith(schoolName) {\n let schoolRef = db.collection('schools');\n let slen = schoolName.length;\n let ubound = schoolName.substring(0, slen-1) +\n String.fromCharCode(schoolName.charCodeAt(slen-1) + 1);\n let schoolDoc = schoolRef.where('name', '>=', schoolName).where('name', '<', ubound)\n .get().then(snapshot => {\n if (snapshot.empty) {\n return [];\n }\n var schools = [];\n snapshot.forEach(doc => {\n schools.push(doc.data());\n });\n return schools;\n })\n return schoolDoc;\n}", "startsWith(t){}", "function firstValid() {\n if (\n firstName.value !== null &&\n firstName.value.length >= 2 &&\n firstName.value.match(regexLetter)\n ) {\n return true;\n } else {\n return false;\n }\n}", "function beginsWithCharacter(username){\n return /^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/.test(username);\n}", "function getLastName(fullName) {\n var comp = fullName.split(\" \");\n\n if (comp.length == 1) {\n return comp[0]; //Case for Doe\n } else if (comp.length == 2) {\n return comp[1]; //case for John Doe\n } else if (comp.length == 3) {\n return comp[2]; //case for John M. Doe\n }\n}", "function inName() {\n\tnames = bio.name.split(\" \");\n\tfirstName = names[0].slice(0,1).toUpperCase() + names[0].slice(1).toLowerCase();\n\tlastName = names[1].toUpperCase()\n\tfullName = firstName + \" \" + lastName\n return fullName\n}", "function search (firstName){\n // declare a for loop that loops through the `family` array\n for (var i = 0; i < family.length; i++){\n\n // declare an if statement, which will be `true` only if the name we pass in the argument matches a name in our objects\n if (family[i].lastName === lastName) {\n return printFamily(family[i]);\n } \n }\n}", "function getFirstName() {\n\tvar name = getName()\n\n\tvar firstname = name.split(\" \")\n\n\treturn firstname[0]\n}", "function getLastName(fullname){\n let lastName = fullname.trim();\n lastName = lastName.substring(lastName.lastIndexOf(\" \")+1);\n lastName = lastName.substring(0,1).toUpperCase() + lastName.substring(1).toLowerCase();\n // If fullname contains -, make first character uppercase\n if (fullname.includes(\"-\")){\n let lastNames = lastName.split(\"-\");\n lastNames[1] = lastNames[1].substring(0,1).toUpperCase() + lastNames[1].substring(1).toLowerCase();\n lastName = lastNames.join('-');\n }\n return lastName;\n}", "function createStartsWithFilter(startsWith) {\n // YOUR CODE BELOW HERE //\n //Create a function expression with the argument of string that tests whether string[0] (first letter of string) is === startsWith character when \n //forced to uppercase or is === startsWith character when forced to lowercase\n var startsWithExpression = function(string) {\n if (string[0] === startsWith.toUpperCase() || string[0] === startsWith.toLowerCase()) {\n return true;\n } else {\n return false;\n }\n }\n //Return the startsWithExpression\n return startsWithExpression;\n // YOUR CODE ABOVE HERE //\n}", "function checkLastname() {\n\tvar lname = document.getElementById(\"lastname\").value;\n\tvar lnameCheck = new RegExp(/([a-z]|[A-Z])/g);\n\t\n if (lname == \"\"){\n\t} else {\n\t\tif(lname.length > 1 && lnameCheck.test(lname)) { \n\t\t\treturn true;\n\t\t} else {\n\t\t\talert(\"Not a name!\");\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function findNamesBeginningWith(names, char) {\n if (!names) throw new Error(\"names is required\");\n if (!char) throw new Error(\"char is required\");\n\n return names.filter(n => n[0] === char);\n}", "function allLetterMiddle()\n { \n var uname = document.registration.middlename;\n var letters = /^[A-Za-z]+$/;\n if(uname.value.match(letters))\n {\n // Focus goes to next field i.e. Address.\n document.registration.lastname.focus();\n return true;\n }\n else\n {\n alert('Middlename must have alphabet characters only');\n uname.focus();\n\n return false;\n }\n }", "function firstName(v) {\n return v.toLowerCase().replace(/\\b\\w+\\b/g, cnvrt); \n function cnvrt() {\n if (arguments[arguments.length -2] == 0)\n return arguments[0].replace(/^[a-z]/, cnvrt2);\n else if (/^(do|dos|da|das|de)$/.test(arguments[0]) )\n return arguments[0];\n else\n return arguments[0].replace(/^[a-z]/, cnvrt2);\n } \n function cnvrt2() {\n return arguments[0].toUpperCase();\n }\n}", "function checkFirstname() {\n\tvar fname = document.getElementById(\"firstname\").value;\n\tvar fnameCheck = new RegExp(/([a-z]|[A-Z])/g);\n\t\n if (fname == \"\"){\n\t} else {\n\t\tif(fname.length > 1 && fnameCheck.test(fname)) { \n\t\t\treturn true;\n\t\t} else {\n\t\t\talert(\"Not a name!\");\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function getFirstAndLastName( fullName ) {\n let employee = fullName.split(\" \");\n if(employee.length == 2) {\n return employee;\n }\n//\n const last_name = employee[employee.length-1];\n let first_name = \" \";\n for(let i=0; i<employee.length-1; i++) {\n first_name = first_name + employee[i] + \" \";\n }\n return [first_name.trim(), last_name];\n}", "function createStartsWithFilter(startsWith) {\n // YOUR CODE BELOW HERE //\n return function (str){\n // Testing wether the first index of a given string is the same as starstWith no matter if lower case or uppercase.\n if(str[0].toUpperCase() === startsWith || str[0].toLowerCase() === startsWith){\n return true;\n } else {\n return false;\n }\n };\n \n \n \n // YOUR CODE ABOVE HERE //\n}", "getStudentDetailByName(name) {\n let selectedStudent = studentsFullList.filter(student => student.name.toLowerCase().includes(name.toLowerCase()));\n if (selectedStudent.length == 0) {\n console.log(`No result found`);\n } \n return selectedStudent;\n }", "function startsWith(str, prefix)\n{\n return (str.substr(0, prefix.length) == prefix);\n}", "function search(lastName){\nvar contactsLength = contacts.length;\nfor (var i = 0; i < contactsLength; i++) {\nif(lastName == contacts[i].lastName) {\nprintPerson(contacts[i]);\n}\nelse{\nconsole.log(\"Nope\");\n }\n }\n}", "function getNewLastName() {\n return momMaidenName.substring(0,1) + cityBorn.substring(0,2).toLowerCase();\n}", "function lastNameValidation(){\n let $lastname = $('#lastname').val();\n var lastnameRegExp = new RegExp(\"^[a-zA-Z]+$\");\n if(!lastnameRegExp.test($lastname)){\n alert(`\"${$('#lastname').val()}\" is not a valid last name. Please insert alphabet characters only.`);\n $('#lastname').focus(); \n }\n return true;\n console.log($lastname);\n }", "function startswith (string, prefix)\n{\n\treturn string.indexOf(prefix) == 0;\n}", "function lastName (theLastName) {\n return nameIntro + firstName + \" \" + theLastName;\n }", "function lastName(theLastName) {\n return nameIntro + firstName + \" \" theLastName;\n }", "function fullName2(first, last) {\n return first + \" \" + last;\n}", "function validate_newFirstName(fname)\n{\n if (fname === null || fname === '') {\n index = index + 1;\n errorsList[index] = 'First name required';\n return false;\n }\n else if (!fname.match(nameRegExp)) {\n index = index + 1;\n errorsList[index] = 'Invalid first name';\n return false;\n } else {\n return true;\n }\n}", "function getMidddelName(fullname){\n let middleName = fullname.trim();\n middleName = middleName.split(\" \");\n // If fullname includes \"\", ignore that name and make middlename none\n if (fullname.includes(' \"')) {\n middleName = \"\"; \n } else if (middleName.length > 2) { // if fullname is longer than 2, make second name middlename\n middleName = middleName[1];\n middleName = middleName.substring(0,1).toUpperCase() + middleName.substring(1).toLowerCase();\n } else{\n middleName = \"\";\n }\n return middleName;\n}", "function showLastName(name){\n\tvar array = name.split(\" \");\n\tconsole.log(\"My lastname is \" + array[1]);\n}", "function checkDublicates(fname,lname) {\n\tvar getFirstName=document.querySelectorAll(\".employeeFirstName\");\n\tvar getLastName=document.querySelectorAll(\".employeeLastName\");\n\tfor (var i = 0; i < getFirstName.length; i++) {\n\t\tvar valueFn=getFirstName[i].textContent;\n\t\tvar valueLn=getLastName[i].textContent;\n\t\tif((valueFn.toLowerCase()==fname.toLowerCase()) &&\n\t\t (valueLn.toLowerCase()==lname.toLowerCase())) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function ful_name() {\n let data=document.getElementById('fname').value;\n let fulname = data.indexOf(\"'' ''\");\n if (fulname >=2 ) {\n \n \n console.log(fulname);\n \n }else{\n alert('Enter your firstname and lastname');\n }\n }", "function lastName (lastName) {\n return nameIntro + firstName + \" \" + lastName;\n }", "function getMusicianName(musician, middle = false) {\n\t\treturn musician.firstname + (middle ? ' ' + musician.middlename : '') + (' ' + musician.lastname);\n\t}", "function lastName() {\n return lastName.dinkins;\n}", "function middleName(mid) {\n return (mid);\n}", "function LastName(lname) {\n var message = document.getElementsByClassName(\"error-message\");\n var letters = /^[A-Za-z]+$/;\n if (lname == \"\" || lname.match(letters)) {\n text = \"\";\n message[1].innerHTML = text;\n return true;\n } else {\n text = \"Last name should contain only letters\";\n message[1].innerHTML = text;\n return false;\n }\n}", "function getFirstName(pattern,gender,rank) {\n\n\t\tif (gender) {\n\t\t\treturn moduloElement(pattern.femaleNames,rank);\n\t\t} else {\n\t\t\treturn moduloElement(pattern.maleNames,rank);\n\t\t}\n\n\t}", "function searchList(allStudents) {\n if (currentFilter.length === 0 || currentFilter === \"\" || currentFilter === null) {\n return allStudents;\n } else {\n const list = allStudents.filter((student) => {\n if (\n student.firstName.toLowerCase().includes(currentFilter.toLowerCase()) ||\n (student.middleName !== null && student.middleName.toLowerCase().includes(currentFilter.toLowerCase())) ||\n (student.nickName !== null && student.nickName.toLowerCase().includes(currentFilter.toLowerCase())) ||\n (student.lastName !== null && student.lastName.toLowerCase().includes(currentFilter.toLowerCase()))\n ) {\n return true;\n } else {\n return false;\n }\n });\n console.log(list);\n return list;\n }\n}", "function startsWith(x, y, bool){\n return bool ? x.toUpperCase().startsWith(y.toUpperCase()) : x.toString().startsWith(y);\n }", "function searchByName(people) {\n let firstName = promptFor(\"What is the person's first name?\", chars);\n let lastName = promptFor(\"What is the person's last name?\", chars);\n\n let foundPerson = people.filter(function (person) {\n if (person.firstName.toLowerCase() === firstName.toLowerCase() && person.lastName.toLowerCase() === lastName.toLowerCase()) {\n return true;\n } else {\n return false;\n }\n });\n return foundPerson;\n}", "function startsWith(src, str) {\n return src.slice(0, str.length) === str\n }", "function lastName(theLastName) {\n return nameIntro + firstName + \" \" + theLastName;\n }", "getSurname(name) {\n return name.substr(name.indexOf(\" \") + 1);\n }", "function Student(firstName, middleInital, lastName) {\n this.firstName = firstName;\n this.middleInital = middleInital;\n this.lastName = lastName;\n this.fullName = firstName + \" \"\n + middleInital + \" \"\n + lastName;\n }", "function createStartsWithFilter(startsWith) {\n // YOUR CODE BELOW HERE //\n return Starting => Starting.charAt(0).toLowerCase() === startsWith.toLowerCase();\n}", "function startsWith(src, str) {\n return src.slice(0, str.length) === str\n}", "function createStartsWithFilter(startsWith) {\n // YOUR CODE BELOW HERE //\n // return a function that test if a string starts with the starts with char\n // need to add a parameter of string in return function\n return function(str){\n if(str[0].toLowerCase() === startsWith.toLowerCase()){\n return true;\n } else{\n return false;\n }\n }\n \n \n // YOUR CODE ABOVE HERE //\n}", "function searchByName(people){\n let firstName = promptFor(\"What is the person's first name?\", firstNameValidation, people);\n let lastName = promptFor(\"What is the person's last name?\", lastNameValidation, people);\n\n let foundPerson = people.filter(function(potentialMatch){\n if(potentialMatch.firstName === firstName && potentialMatch.lastName === lastName){\n return true;\n }\n else{\n return false;\n }\n })\n return foundPerson[0];\n}", "function lastName (theLastName) {\n return nameIntro + firstName + \" \" + theLastName;\n }", "function lastName (theLastName) {\n return nameIntro + firstName + \" \" + theLastName;\n }", "function inName(name) {\n\tname = name.replace(/[^a-zA-Z ]/g, \"\");\n\n\tvar finalName;\n\t//trim() removes white spaces before & after names Not in between names\n\tname = name.trim();\n name = name.toLowerCase();\n var n = name.indexOf(\" \");\n \n name = name.charAt(0).toUpperCase() + name.slice(1);\n var firstname = name.slice(0, n);\n var lastname = name.slice(n+1);\n lastname = lastname.toUpperCase();\n finalName = firstname + \" \" + lastname;\n \t//don't use replaceWith() as this will change the class to default.\n\t$('#name').text(finalName);\n\n}", "function getMemberName(array) {\r\n var middleName = array.middle_name || \"\";\r\n var fullName = array.first_name + \" \" + middleName + \" \" + array.last_name;\r\n return fullName;\r\n }", "function queryUserName(name){\n var results = users.filter(function(o){\n if(o.name.toLowerCase().indexOf(name.toLowerCase()) > - 1){\n return o;\n }\n });\n showUserResults(results);\n}", "function searchByName(people){\n let firstNameInput = promptFor(\"What is the person's first name?\", autoValid);\n let lastNameInput = promptFor(\"What is the person's last name?\", autoValid);\n\n \n let firstName = firstNameInput.charAt(0).toUpperCase() + firstNameInput.slice(1);\n let lastName = lastNameInput.charAt(0).toUpperCase() + lastNameInput.slice(1);\n\n let foundPerson = people.filter(function(potentialMatch){\n if(potentialMatch.firstName === firstName && potentialMatch.lastName === lastName){\n return true;\n }\n else{\n return false;\n }\n })\n // TODO: find the person single person object using the name they entered.\n return foundPerson;\n}", "static findByFullName(name) {\n const firstSpace = name.indexOf(' ');\n const firstName = name.split(' ')[0];\n const lastName = firstSpace === -1 ? '' : name.substring(firstSpace + 1);\n return this.findOne({ firstName, lastName });\n }", "function startsWith (substr) {\n\treturn this.lastIndexOf(substr, 0) === 0\n}", "getLastName() {}", "function Student(firstName, middleInitial, lastName) {\n this.firstName = firstName;\n this.middleInitial = middleInitial;\n this.lastName = lastName;\n this.fullName = firstName + \" \" + middleInitial + \" \" + lastName;\n }", "function nameDivider(fullName) {\n return(fullName.split(\" \")[0]);\n}", "function strStartsWith(str, prefix)\n{\n if(typeof str != \"string\")\n {\n return false;\n }\n return str.indexOf(prefix) === 0;\n}", "function startsWith(str, start) {\n var tr = str;\n\n if (tr.toLowerCase().startsWith(start)) {\n tr = str + 'pe';\n }\n\n return tr;\n}" ]
[ "0.68215805", "0.6281996", "0.60791564", "0.6056427", "0.6049755", "0.6038427", "0.6008068", "0.59941834", "0.59336984", "0.5910771", "0.5884608", "0.58817637", "0.5863166", "0.58549756", "0.5838958", "0.5838958", "0.5836742", "0.5831606", "0.58065706", "0.57824296", "0.5753278", "0.5752902", "0.56736743", "0.56736743", "0.5623482", "0.56086147", "0.5586863", "0.55680925", "0.5567345", "0.5564027", "0.55576205", "0.55469054", "0.553275", "0.55221957", "0.5511669", "0.5492713", "0.54893875", "0.547962", "0.5460097", "0.54587173", "0.54531", "0.5451912", "0.54514474", "0.5449843", "0.5440271", "0.5424152", "0.5422149", "0.5418153", "0.54177386", "0.5415413", "0.53986967", "0.53951174", "0.5390699", "0.537766", "0.53726053", "0.5355057", "0.5352845", "0.53391916", "0.53287673", "0.53264385", "0.53136826", "0.5313276", "0.531191", "0.53106844", "0.5309864", "0.5308716", "0.5303253", "0.5302949", "0.52996504", "0.52906126", "0.5290239", "0.5284579", "0.527813", "0.5274286", "0.5272117", "0.5269615", "0.5253805", "0.52447873", "0.5231818", "0.5223751", "0.52216315", "0.5220849", "0.52173114", "0.5210968", "0.5208526", "0.5200019", "0.51977766", "0.51947176", "0.51947176", "0.5193903", "0.5189195", "0.5188289", "0.51875263", "0.51853573", "0.5185133", "0.51825756", "0.51813173", "0.5180662", "0.51689667", "0.5166637" ]
0.54390603
45
Change blank values to Null
function checkNull(inserts) { for (i = 0; i < inserts.length; i++) { if (inserts[i] == '') { inserts[i] = null } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNullIfBlank(obj) {\r\n if (isBlank(obj.value)) {\r\n obj.value = \"\";\r\n }\r\n }", "function convertEmptyToNull(row) {\n for(let key in row) {\n if (row[key] === EMPTY_VALUE) {\n row[key] = undefined;\n }\n }\n}", "function convertNullFieldsToEmptyStrings(item){\n\t\t\tif(item.lineItem == undefined) item.lineItem='';\n\t\t\tif(item.expDate == undefined) item.expDate='';\n\t\t\tif(item.expTypeCode == undefined) item.expTypeCode='';\n\t\t\tif(item.dollarAmount == undefined) item.dollarAmount='';\n\t\t}", "function setBlankIfNull(value){\n return value == null ? \"\" : value;\n }", "function removeNullData(data){\n\tfor (var i = 0; i < data.length; i++){\n\t\tif (data[i].PATIENT_ID == null){\n\t\t\tdata[i].PATIENT_ID = \"All\";\n\t\t}\n\t\tif (data[i].TEST_TYPE == null){\n\t\t\tdata[i].TEST_TYPE = \"All\";\n\t\t}\n\t\tif (data[i].DATSTR == null){\n\t\t\tdata[i].DATSTR = \"All\";\n\t\t}\t\t\n\t}\n\treturn data;\n}", "function replaceNull(data) {\n data.forEach(obj => {\n for (let key in obj) {\n (obj[key] === null) ? (obj[key] = '*') : (false);\n }\n })\n return data;\n}", "function nullify(array) {\n for (key in array) {\n if (array[key] == \"\") {\n array[key] = null;\n }\n }\n}", "function nullify(array) {\n for (key in array) {\n if (array[key] == \"\") {\n array[key] = null;\n }\n }\n}", "function nullify(array) {\n for (key in array) {\n if (array[key] == \"\") {\n array[key] = null;\n }\n }\n}", "set removeNullAttributes(val) { this._removeNulls = typeof val === 'boolean' ? val : true }", "function blankAddress(){\n $('#c_addr_1').val(null);\n $('#c_addr_2').val(null);\n $('#c_addr_3').val(null);\n }", "function function_setnull(fieldname){\n var result = '';\n return result;\n}", "function checkNull(inserts) {\r\n for (i = 0; i < inserts.length; i++) {\r\n if (inserts[i] == '') {\r\n inserts[i] = null\r\n }\r\n }\r\n }", "function setNullCellsTo0(table) {\n var numCols = table.getNumberOfColumns();\n var numRows = table.getNumberOfRows();\n for (col = 1; col < numCols; col++) {\n for (row = 0; row < numRows; row++) {\n if (table.getValue(row, col) === null) {\n table.setValue(row, col, 0);\n }\n }\n }\n }", "function isNull(val) {\n return val || \"\"\n}", "function purgeEmptyFields(obj) {\n Object.keys(obj).forEach(key => {\n const val = obj[key];\n if (val === '' || val === false || val === undefined || val === null) {\n delete obj[key];\n }\n });\n return obj;\n}", "function replaceNull(value) {\r\n\treturn (value === null || value === \"null\") ? \"\" : value;\r\n}", "function statusRemoveNull(val) {\n\t\t\tif (typeof (val) != undefined && val != '' && !isNaN(val)) {\n\t\t\t\treturn val;\n\t\t\t} else {\n\t\t\t\treturn '--';\n\t\t\t}\n\t\t}", "function emptyFields(that){\r\n var source_id = $(that).attr('id');\r\n //list of fields to be emptied should given coma seperated\r\n var empty_to_fields = ($('#'+source_id).attr('empty_fields')).split(',');\r\n \r\n //setting all value blank\r\n for(var i=0 ; i< empty_to_fields.length ; i++){\r\n $('#'+empty_to_fields[i]).val('');\r\n }\r\n}", "function _nullCoerce() {\n return '';\n}", "function correctNull(object) {\n for (var key in object) {\n if (object[key] == \"null\") {\n object[key] = null;\n }\n }\n return object\n}", "function NullFilter() {\n\t\t}", "removeEmptyVals(data) {\n return data.filter(val => {\n return !!val;\n });\n }", "function changeNAtoEmpty(data) {\n for (let key of Object.keys(data)) {\n if (typeof(data[key]) === 'string') {\n const test = data[key].toLowerCase()\n .trim()\n .replace(/\\.$/, \"\"); // trailing period\n if (test === 'n/a' || \n test === 'na' ||\n test === 'none'||\n test === 'not available'||\n test === 'not applicable') {\n data[key] = ''\n }\n }\n }\n\n return data;\n}", "function nospaces(t){\n\t\tif(t.value.match(/\\s/g)){\n\t\t\tt.value = t.value.replace(/\\s/g,'');\n\t\t}\n\t}", "set None(value) {}", "set None(value) {}", "set None(value) {}", "set None(value) {}", "function replaceNull(state) {\n let temp = {};\n\n for (let key in state) {\n if (state[key] === null) temp[key] = \"null\";else temp[key] = state[key];\n }\n\n return temp;\n }", "function dash2null(value){return (/^\\s*-+\\s*$/g.test(value))?'':value}", "trim_values(obj, filter = null) {\n return this.walk_values(obj, filter, function(val) {\n return typeof(val) === \"string\" ? val.replace(/^\\s+|\\s+$/g, '') : val;\n }); \n }", "function verifUndefined(){\n if($scope.adress===undefined){\n $scope.adress=\"\";\n }\n if($scope.codeP===undefined){\n $scope.codeP=\"\";\n }\n if($scope.ville===undefined){\n $scope.ville=\"\";\n }\n if($scope.montant===undefined){\n $scope.montant=0;\n }\n }", "function trimNulls(str) {\n return str.replace(/\\0/g, '');\n}", "function replaceJSONNull(val)\n{\n return (val == null ? \"\" : val);\n}", "function clean(val) { \n if(val !== null) {\n return val.trim();\n }\n return '';\n}", "function _nullAllProperties(obj) {\n _.forEach(obj, (value, key) => {\n if (_.isObject(value)) {\n _nullAllProperties(value);\n obj[key] = value;\n }\n else {\n obj[key] = null;\n }\n });\n}", "function emptyFields() {\n document.getElementById(\"title\").value = null;\n document.getElementById(\"urgency\").value = \"High Urgency\";\n document.getElementById(\"importance\").value = \"High Importance\";\n document.getElementById(\"date\").value = null;\n document.getElementById(\"description\").value = null;\n}", "function gmaps_remove_empty_values(obj) {\n for(var key in obj) {\n\n // value is empty string\n if(obj[key] === '') {\n delete obj[key];\n }\n\n // value is array with only emtpy strings\n if(obj[key] instanceof Array) {\n var empty = true;\n for(var i = 0; i < obj[key].length; i++) {\n if(obj[key][i] !== '') {\n empty = false;\n break;\n }\n }\n\n if(empty)\n delete obj[key];\n }\n\n // value is object with only empty strings or arrays of empty strings\n if(typeof obj[key] === \"object\") {\n obj[key] = gmaps_remove_empty_values(obj[key]);\n\n var hasKeys = false;\n for(var objKey in obj[key]) {\n hasKeys = true;\n break;\n }\n\n if(!hasKeys)\n delete obj[key];\n }\n }\n\n return obj;\n}", "function isNull(campo)\n\t{\n\tif($(campo) != undefined)\n\t\t{\n\t\treturn ($(campo).value==\"\")?true:false;\n\t\t}\t\n\t}", "function emptyExtraFields(fieldsToEmpty){\n if(fieldsToEmpty){\n Array.from(fieldsToEmpty.split(',')).forEach(function(selector){\n let fields = document.querySelectorAll(selector);\n Array.from(fields).forEach(function(field){\n if(field){\n field.value = '';\n }\n });\n });\n Array.from(document.querySelectorAll('[data-click-bind]')).forEach(function(binding){\n renderState(binding);\n });\n }\n }", "function clean(obj) {\n for (var propName in obj) { \n if (obj[propName] === null || obj[propName] === undefined || obj[propName] === \"\") {\n delete obj[propName];\n }\n }\n }", "function clean(obj) {\n for (var propName in obj) { \n if (obj[propName] === null || obj[propName] === undefined || obj[propName] === \"\") {\n delete obj[propName];\n }\n }\n }", "function trimTrailingNulls(parameters){while(isNull(parameters[parameters.length-1])){parameters.pop();}return parameters;}", "function emptyField(event){\n\t\tvar thisObj = $(this);\n\t\tvar currVal=thisObj.val();\n\t\t\n\t\tif (currVal == thisObj.data(\"defaultValue\")){\n\t\t\tthisObj.val(\"\");\n\t\t}\n\t}", "function resetZeroValues() {\n for (i = 0; i < self.flowCategories.length; i++) {\n if (self.flowCategories[i].item_amount === 0) {\n self.flowCategories[i].item_amount = null;\n }\n }\n } // end resetZeroValues", "handleEmptyValue() {\n if (!this.get('value') || this.get('value') === '') {\n this.set('value', 'Empty');\n }\n }", "function orBlank(v) {\n return v === undefined ? '' : v;\n}", "function orBlank(v) {\n return v === undefined ? '' : v;\n}", "function fixDeformedData(data) {\n Object.keys(data).forEach(function (key) {\n if (data[key] === \"\") {\n data[key] = \"0\";\n }\n });\n return data;\n}", "get removeNullAttributes() { return this._removeNulls }", "_ensureNoNulls(object) {\n Object.keys(object).forEach(key => {\n if (object[key] && typeof object[key] === 'object') this._ensureNoNulls(object[key])\n else if (object[key] == null) delete object[key]\n })\n }", "clearValues(){\n\t\t\tthis.addedName = '';\n\t\t\tthis.addedPrice = 0;\n\t\t\tthis.commission = 0;\n\t\t\tthis.totalContractValue = 0;\n\t\t\t\n\t\t}", "function swapNulltoUnkown(array) {\n for (let i = 0; i < array.length; i++) {\n for (const member in array[i]) {\n if (array[i][member] === null) {\n array[i][member] = 'unknown';\n }\n }\n }\n }", "function trimNull(array){\n for(var i = 0; i<array.length; i++) {\n if(array[i] == null) {\n array.splice(i--, 1);\n }\n }\n // console.log('Trimmed array: ');\n // console.log(array)\n }", "function correctPlistBlanks(obj) {\n for (const key in obj) {\n const val = obj[key];\n if (!val) obj[key] = \"\";\n }\n\n return obj;\n }", "function isNull(val){return(val==null);}", "function isemptyornull(value)\n {\n return !(typeof value === \"string\" && value.length > 0);\n }", "async replace_missing(missing=\"\") {\n this.df = this.df.map(row => {\n let temp = row\n for (const [key, value] of Object.entries(row)) {\n if (value == missing) row[key] = null\n }\n return temp\n })\n }", "function remove_blanks(group, value_to_remove) {\n return {\n all: function() {\n return group.all().filter(function(d) {\n return d.key !== value_to_remove;\n });\n }\n };\n}", "function esNull(valor){\n\tif(valor === \"null\" || valor === undefined || valor === null){\n\t\treturn '';\n\t}\n\treturn valor;\n}", "function emptyField(event){\n\t\tvar thisObj = $(this);\n\t\tvar currVal=thisObj.val();\n\t\tif (currVal == thisObj.data(\"orgVal\")){\n\t\t\tthisObj.val(\"\");\n\t\t\tthisObj.parent().removeClass(\"g_search_default\");\n\t\t}\n\t}", "function toNullable(ma) {\n return isNone(ma) ? null : ma.value;\n}", "function compact(ary) {\n\tlet ary1 = []\n\tfor (let i = 0; i < ary.length; i++){\n\t\tif (ary[i] != null){\n\t\t\tary1.push(ary[i])\n\t\t}\n\t}\n\treturn ary1\n}", "setNullSeriesToZeroValues(series) {\n let w = this.w\n for (let sl = 0; sl < series.length; sl++) {\n if (series[sl].length === 0) {\n for (let j = 0; j < series[w.globals.maxValsInArrayIndex].length; j++) {\n series[sl].push(0)\n }\n }\n }\n return series\n }", "_unset(){\r\n this.currentOperator = '';\r\n this.currentValue = '';\r\n if ( this.columns.length > 1 ){\r\n this.currentField = '';\r\n }\r\n }", "clearFields(){\n this.description.value = \"\"\n this.amount.value = \"\"\n this.date.value = \"\"\n }", "function correctPlistBlanks (obj) {\n for (var key in obj) {\n var val = obj[key]\n if (!val) obj[key] = ''\n }\n\n return obj\n }", "function CleanFields() {\n $scope.Empleados = null;\n $scope.Message = \"\";\n $scope.Empleado = \"\";\n $scope.Empleados = \"\";\n $scope.ClassActive = \"\";\n $scope.SelectedNroDocumento = \"\";\n $scope.SelectedNombre = \"\";\n $scope.SelectedSalarioMensual = \"\";\n $scope.TransaccionesEmpleado = \"\";\n }", "reset() {\n const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);\n const values = unifyColumnValues(this._getColumnVisibleValues());\n const items = intersectValues(values, values, defaultBlankCellValue);\n\n this.getMultipleSelectElement().setItems(items);\n super.reset();\n this.getMultipleSelectElement().setValue(values);\n\n const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();\n\n if (selectedColumn !== null) {\n this.getMultipleSelectElement().setLocale(this.hot.getCellMeta(0, selectedColumn.visualIndex).locale);\n }\n }", "function cleanArray(arr) {\n var len = arr.length,\n i;\n\n for (i = 0; i < len; i++) {\n if (arr[i] && typeof arr[i] != \"undefined\") {\n arr.push(arr[i]); // copy non-empty values to the end of the array\n }\n }\n\n arr.splice(0, len); // cut the array and leave only the non-empty values\n\n return arr;\n }", "_setNullValue(oldValue) {\n const that = this;\n\n if (oldValue === undefined) {\n oldValue = that._cloneValue();\n }\n\n if (that.nullable) {\n that._value = null;\n that.value = null;\n that._highlightedTimePart = undefined;\n\n that.$.input.value = '';\n\n if (oldValue !== null) {\n if (that.opened) {\n if (!that._calendarInitiatedChange) {\n const oldContext = that.$.calendarDropDown.context;\n\n that.$.calendarDropDown.context = that.$.calendarDropDown;\n that.$.calendarDropDown._clearSelection(true);\n that.$.calendarDropDown.context = oldContext;\n }\n\n if (that._defaultFooterTemplateApplied) {\n that._hourElement.value = '';\n that._ampmElement.value = '';\n that._minuteElement.value = '';\n }\n\n that._toSync = false;\n }\n else {\n that._toSync = true;\n }\n\n that.$.fireEvent('change', { 'oldValue': oldValue.toTimeZone(that._inputTimeZone), 'value': null });\n }\n\n that._disableSpinButtons();\n }\n else {\n that._validateValue(that._now(), oldValue);\n }\n }", "function clear() {\n toValue.value = '';\n}", "function addNullDistanceToRecords(records) {\n const dummDistanceRecords = records.map((record) => {\n record.distance = null;\n return record;\n });\n return dummDistanceRecords;\n}", "function makingInputEmpty(input){\n input.value = \"\";\n}", "function ResetCompanyFieldValues(){\n\t\t\t\n\t\t\tCompanyData.CompanyID2_FieldValue=\"NONE\";//\n\t\t\tCompanyData.CompanyEmail_FieldValue=\"NONE\";//\n\t\t\tCompanyData.CompanyPhone_FieldValue=\"NONE\";//\n\t\t\tCompanyData.Address_FieldValue=\"NONE\";//\t\t\n\t\t}", "function clearText(field){\n\n if (field.defaultValue == field.value) field.value = '';\n else if (field.value == '') field.value = field.defaultValue;\n\n}", "function isNullorEmpty(strVal) {\n return (strVal == null || strVal == '' || strVal == 'null' || strVal ==\n undefined || strVal == 'undefined' || strVal == '- None -' ||\n strVal ==\n '0');\n }", "function isNullorEmpty(strVal) {\n return (strVal == null || strVal == '' || strVal == 'null' || strVal ==\n undefined || strVal == 'undefined' || strVal == '- None -' ||\n strVal ==\n '0');\n }", "function resetValues(){\n // variable that defines the amount of inputs there are\n const lengthOfId = document.querySelectorAll('input').length;\n // for loop to go through every input possible based on it's length\n for (let i = 0; i < lengthOfId; i++){\n // with every loop, the selected input will become null\n document.querySelectorAll('input')[i].value = null;\n }\n}", "getEmptyFields() {\n return this.fields.filter((field) => this._data[field] === '');\n }", "function isNull(value, notTrim) {\n if (value == null) {\n return true;\n } else if (typeof (value) == \"string\") {\n value = notTrim == true ? $.trim(value) : value;\n if (value == \"\") {\n return true;\n }\n }\n return false;\n }", "function convertNullToZero(results) {\n results.forEach((row) => {\n // get keys of all columns expect case_date\n let nullableColumns = _.rest(Object.keys(row));\n\n // assign 0 if \"NULL\"\n nullableColumns.forEach((col) => {\n if (row[col] === 'NULL') {\n row[col] = 0;\n }\n });\n });\n return results;\n}", "function isNullish(value) {\n\t return value === null || value === undefined || value !== value;\n\t}", "function getNotNullData(data) {\n return Object.keys(data).reduce((res, key) => {\n const value = data[key];\n if (value !== undefined && value !== null) {\n res[key] = value;\n }\n return res;\n }, {});\n}", "function di_safevalue(val)\n{\n if(val==undefined || val=='' || val==null)\n return '';\n else\n return val; \n}", "function Common_removeEmptyStrings(obj){\n\t switch(typeof obj){\n\t\t case 'object':\n\t\t\t for(let key in obj){\n\t\t\t\t obj[key] = Common_removeEmptyStrings(obj[key]);\n\t\t\t }\n\t\t\tbreak;\n\t\t case 'string':\n\t\t\t if(obj.length <= 0){\n\t\t\t\t obj = null;\n\t\t\t }\n\t\t\tbreak;\n\t }\n\n\t return obj;\n}", "function compact(arr) {\n\t return filter(arr, function(val){\n\t return (val != null);\n\t });\n\t }", "function ResetPatientFieldValues(){\t\t\t\n\t\t\t\n\t\t\tPatientData.PatientID_FieldValue=\"NONE\";//\n\t\t\tPatientData.Forename_FieldValue=\"NONE\";//\n PatientData.MiddleName_FieldValue=\"NONE\";//\n\t\t\tPatientData.FirstSurname_FieldValue=\"NONE\";//\n\t\t\tPatientData.SecondSurname_FieldValue=\"NONE\";//\n\t\t\tPatientData.PatientPhone_FieldValue=\"NONE\";//\n\t\t\tPatientData.PatientEmail_FieldValue=\"NONE\";//\n\t\t\tPatientData.CompanyID_FieldValue=\"NONE\";//\n\t\t\tPatientData.Site_FieldValue=\"NONE\";\n\t\t\tPatientData.Department_FieldValue=\"NONE\";\n\t\t\tPatientData.BirthDate_FieldValue=\"NONE\";\n\t\t\tPatientData.JoinDate_FieldValue=\"NONE\";\n\t\t\tPatientData.Gender_FieldValue=\"NONE\";\n\t\t\tPatientData.PatientAddress_FieldValue=\"NONE\";\t\t\t\n\t\t\tPatientData['Income_FieldValue']=\"NONE\";\t\n\t\t}", "function _Removevalues(){\n\t\tduplacoordsT1=[];\n\t\tcoordsfetchT1=[];\n\t\ttimestampsT1=[];\n\t\tduplacoordsT2=[];\n\t\tcoordsfetchT2=[];\n\t\ttimestampsT2=[];\n\n\t\tlet cleanStart = document.getElementById(\"Start\");\n\t\tlet cleanFinish = document.getElementById(\"Finish\");\n\t\t\n\t\tcleanStart.value = \"\"\n\t\tcleanFinish.value = \"\"\n}", "function attrNull() {\n this.removeAttribute(name);\n }", "'empty'(filter) {\n return new FilterBindValues(` and ${filter.cell} is null `, []);\n }", "function filterFalsy (arr) {\n var newArray = [];\n var j = 0;\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] !== 0 && arr[i] !== \"\" && arr[i] !== null && arr[i] !== undefined && arr[i] !== NaN && arr[i] !== false){\n newArray[j] = arr[i];\n j++;\n }\n }return newArray;\n}", "function isBlank(val) {\r\n if (val == null) { return true; }\r\n for (var i=0; i < val.length; i++) {\r\n if ((val.charAt(i) != ' ') && (val.charAt(i) != \"\\t\") && (val.charAt(i) != \"\\n\")) { return false; }\r\n }\r\n return true;\r\n }", "function clearFields() {\n employeeId.value = \"\";\n firstName.value = \"\";\n lastName.value = \"\";\n address.value = \"\";\n emailId.value = \"\";\n}", "function emptyFields() {\n $(\"#name\").val(\"\");\n $(\"#profile-input\").val(\"\");\n $(\"#email-input\").val(\"\");\n $(\"#password-input\").val(\"\");\n $(\"#number-input\").val(\"\");\n $(\"#fav-food\").val(\"\");\n $(\"#event-types\").val(\"\");\n $(\"#zipcode\").val(\"\");\n $(\"#radius\").val(\"\");\n }", "function clearFields() {\n movie_name.value = '';\n release_date.value = '';\n movie_banner.value = '';\n description.value = '';\n}", "static isBlank(obj) {\n return obj === undefined || obj === null;\n }", "function checkValue(value){\n\tif(value == \"\" || value == \"null\" || value == null || value == undefined){\n\t\tvalue = \"\";\n\t}\n\treturn value;\n}", "function removeEmptyString(data){\n var ans = [];\n for(var i = 0; i < data.length; i++)\n if(data[i] != '')\n ans.push(data[i]);\n return ans;\n }" ]
[ "0.7699135", "0.73013365", "0.72626925", "0.70652324", "0.68414974", "0.6729144", "0.6695384", "0.6695384", "0.6695384", "0.6634962", "0.64586866", "0.6433121", "0.6426585", "0.6391421", "0.6328056", "0.6251073", "0.62502986", "0.62433225", "0.6242669", "0.6215686", "0.62143", "0.6191428", "0.61884856", "0.6104831", "0.6049786", "0.6034553", "0.6034553", "0.6034553", "0.6034553", "0.6008611", "0.60074246", "0.59599304", "0.5955419", "0.5952952", "0.59443945", "0.5940716", "0.5938563", "0.593628", "0.58941865", "0.586323", "0.5832876", "0.5820844", "0.5820844", "0.5820255", "0.58062685", "0.5804804", "0.5803908", "0.5798501", "0.5798501", "0.57973075", "0.5765401", "0.5765194", "0.5725584", "0.5720653", "0.5672913", "0.56662387", "0.5665707", "0.56625086", "0.5662421", "0.5639454", "0.5630229", "0.5619089", "0.5598396", "0.55964774", "0.5587842", "0.55782205", "0.5565281", "0.5561699", "0.5560045", "0.55598027", "0.5558498", "0.5550402", "0.55479664", "0.55471796", "0.55460984", "0.5543738", "0.5533181", "0.5528415", "0.5520371", "0.55172205", "0.5512499", "0.5512136", "0.551124", "0.55029446", "0.55029243", "0.5492729", "0.54910296", "0.5485403", "0.5485379", "0.548509", "0.54839593", "0.54829514", "0.54782087", "0.5467794", "0.5464824", "0.545474", "0.5451873", "0.54480416", "0.5441914", "0.5436301" ]
0.64454305
11
When the animation ends, we clean the classes and resolve the Promise
function handleAnimationEnd(event) { event.stopPropagation(); node.classList.remove(`${prefix}animated`, animationName); resolve('Animation ended'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd() {\n\t\t\t\t\t\t\telement.off(css3AnimationEvents, onAnimationProgress);\n\t\t\t\t\t\t\t$$jqLite.removeClass(element, activeClassName);\n\t\t\t\t\t\t\t$$jqLite.removeClass(element, pendingClassName);\n\t\t\t\t\t\t\tif (staggerTimeout) {\n\t\t\t\t\t\t\t\t$timeout.cancel(staggerTimeout);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tanimateClose(element, className);\n\t\t\t\t\t\t\tvar node = extractElementNode(element);\n\t\t\t\t\t\t\tfor (var i in appliedStyles) {\n\t\t\t\t\t\t\t\tnode.style.removeProperty(appliedStyles[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "function finish() {\n if (!isIn) element.hide();\n reset();\n if (cb) cb.apply(element);\n } // Resets transitions and removes motion-specific classes", "OnAnimationEnd() {\n // Remove the container containing the delete animations\n if (this._deleteContainer) {\n this.removeChild(this._deleteContainer);\n this._deleteContainer = null;\n }\n\n // Clean up the old container used by black box updates\n if (this._oldContainer) {\n this.removeChild(this._oldContainer);\n this._oldContainer = null;\n }\n\n // Restore event listeners\n this.EventManager.addListeners(this);\n\n // Restore visual effects on node with keyboard focus\n this._processInitialFocus(true);\n\n // Process the highlightedCategories\n this._processInitialHighlighting();\n\n if (!this.AnimationStopped) this.RenderComplete();\n\n // Reset animation flags\n this.Animation = null;\n this.AnimationStopped = false;\n }", "function handleAnimationEnd() {\r\n node.classList.remove(`${prefix}animated`, animationName);\r\n node.removeEventListener('animationend', handleAnimationEnd);\r\n\r\n resolve('Animation ended');\r\n }", "function handleAnimationEnd() {\n node.classList.remove(`${prefix}animated`, animationName);\n node.removeEventListener('animationend', handleAnimationEnd);\n\n resolve('Animation ended');\n }", "_onAnimationEnd() {\n // Clean up the old container. This is done after the animation to avoid garbage\n // collection during the animation and because the black box updates need it.\n if (this._oldContainer) {\n this._oldContainer.removeFromParent();\n this._oldContainer.destroy();\n this._oldContainer = null;\n }\n\n if (this._delContainer) {\n this._delContainer.removeFromParent();\n this._delContainer.destroy();\n this._delContainer = null;\n }\n\n // Fire ready event saying animation is finished.\n if (!this.AnimationStopped) this.RenderComplete();\n\n // Restore event listeners\n this.EventManager.addListeners(this);\n\n // Reset animation flags\n this.Animation = null;\n this.AnimationStopped = false;\n }", "function finish() {\n// if (--finished == 0) {\n if (!isFinished) {\n isFinished = true;\n Physics.there.style(self.from.getContainerBodyId(), {\n opacity: 0\n });\n\n self.dfd.resolve();\n }\n }", "function circle_animated() {\n // console.log(\"Worked\");\n circle.removeAttribute('class');\n path.removeAttribute('class');\n }", "OnAnimationEnd() {\n // If the animation is complete (and not stopped), then rerender to restore any flourishes hidden during animation.\n if (!this.AnimationStopped) {\n this._container.removeChildren();\n\n // Finally, re-layout and render the component\n var availSpace = new Rectangle(0, 0, this.Width, this.Height);\n this.Layout(availSpace);\n this.Render(this._container, availSpace);\n\n // Reselect the nodes using the selection handler's state\n var selectedNodes = this._selectionHandler ? this._selectionHandler.getSelection() : [];\n for (var i = 0; i < selectedNodes.length; i++) selectedNodes[i].setSelected(true);\n }\n\n // : Force full angle extent in case the display animation didn't complete\n if (this._angleExtent < 2 * Math.PI) this._animateAngleExtent(2 * Math.PI);\n\n // Delegate to the superclass to clear common things\n super.OnAnimationEnd();\n }", "clearAnims(){\n document.querySelectorAll('.activated, .sequence').forEach( el => {\n el.classList.remove('activated', 'sequence');\n })\n }", "function finishAllAnimations() {\n runningAnimations.forEach(function (animation) {\n animation.finishNow();\n });\n clearTimeout(fadeInTimer);\n clearTimeout(animateHeightTimer);\n clearTimeout(animationsCompleteTimer);\n runningAnimations.length = 0;\n }", "handleAnimationEnd() {\n clearTimeout(this.animEndLatchTimer_);\n this.animEndLatchTimer_ = setTimeout(() => {\n this.adapter_.removeClass(this.currentAnimationClass_);\n this.adapter_.deregisterAnimationEndHandler(this.animEndHandler_);\n }, numbers$1.ANIM_END_LATCH_MS);\n }", "endAll() {\n this.animations.forEach((anim) => anim.onEnd());\n this.animations = [];\n }", "function AnimComplete() {\n // Add timer to mark sure at end place\n setTimeout(function () {\n VariableModule(that);\n va.$capLast.css('visibility', '');\n va.$capInner.css('height', '');\n }, 10);\n }", "function loadAnimationComplete() {\n circleLoader.hide();\n\n // Fade out the black background\n TweenMax.to(preloadBg, 0.3, { opacity : 0, onComplete : bgAnimationComplete } );\n }", "function _onAnimationEnd () {\n clearTimeout(transitionEndTimeout);\n $target.off(events);\n animationEnded();\n deferred.resolve();\n }", "function _finish(){\n logger.logEvent({'msg': 'animation finished'});\n if(logHeartbeat){\n clearInterval(logHeartbeat);\n }\n $('#finished-bg').fadeIn();\n if(currentMusicObj){\n __musicFade(currentMusicObj, false,1/(2000/MUSIC_ANIMATION_INTERVAL), false); //Fadeout animation for 2 seconds\n }\n for(var i=0; i<animationFinishObserver.length; i++){\n animationFinishObserver[i]();\n }\n _stopAllQueues();\n\n //Change pause button to replay\n var button = $('#play-toggle');\n button.removeClass('icon-pause');\n button.addClass('icon-repeat');\n button.unbind('click');\n button.bind('click', function(){location.reload();});\n\n for(var i = 0; i< currentAnimation.length; i++){ //Stop active animations (i.e. background)\n for(var j = 0; j<currentAnimation[i].length; j++){\n var node = currentAnimation[i][j];\n if('animation' in node){\n var _animation = node['animation'];\n if('object' in _animation){\n var _obj=_animation['object'];\n if(_obj){\n _obj.stop();\n }\n }\n }\n }\n }\n }", "function finishAnimations() {\n var stepsRemaining = Maze.executionInfo.stepsRemaining();\n\n // allow time for additional pause if we're completely done\n var waitTime = (stepsRemaining ? 0 : 1000);\n\n // run after all animations\n timeoutList.setTimeout(function () {\n if (stepsRemaining) {\n stepButton.removeAttribute('disabled');\n } else {\n Maze.animating_ = false;\n if (studioApp().isUsingBlockly()) {\n // reenable toolbox\n Blockly.mainBlockSpaceEditor.setEnableToolbox(true);\n }\n // If stepping and we failed, we want to retain highlighting until\n // clicking reset. Otherwise we can clear highlighting/disabled\n // blocks now\n if (!singleStep || Maze.result === ResultType.SUCCESS) {\n reenableCachedBlockStates();\n studioApp().clearHighlighting();\n }\n displayFeedback();\n }\n }, waitTime);\n }", "onAnimationEnd() {\n\n }", "function stopLoaderAnimation() {\n console.log(\"loader ended\");\n animation_container.classList.remove(\"loader-container\");\n animation.classList.remove(\"loader\");\n}", "function endCardAnimation() {\n\t$(\".computer-card\").removeClass(\"animated-card\");\n\tanimating = false;\n\tif (!training && disabled) {\n\t\tenableButtons();\n\t}\n}", "notifyAnimationEnd() {}", "function animationComplete() {\n\t\t\t\t\t\tself._setHashTag();\n\t\t\t\t\t\tself.active = false;\n\t\t\t\t\t\tself._resetAutoPlay(true, self.settings.autoPlayDelay);\n\t\t\t\t\t}", "function detectAnimation() {\n for (let i = 0; i <= shownCards.length - 1; i++) {\n card1.addEventListener('webkitAnimationEnd', removeclasses);\n card1.addEventListener('animationend', removeclasses)\n }\n }", "onComplete() {\n this.stopAudio();\n if (this.chains > 0) {\n this.chains--;\n }\n if (this.debug) {\n console.log('Animation completed chains left: ', this.chains);\n }\n if (this.destroyOnComplete && this.chains === 0) {\n if (this.destroyDelay > 0) {\n if (this.debug) {\n console.log(`Wall will be removed after ${ this.destroyDelay } seconds`);\n }\n setTimeout(() => {\n this.disposeWall();\n }, this.destroyDelay * 1000);\n } else {\n this.disposeWall();\n }\n }\n }", "function handleAnimationEnd(event) {\n event.stopPropagation();\n node.classList.remove(`${prefix}animated`, animationName);\n node.classList.remove(`animate__faster`);\n resolve('Animation ended');\n }", "function handleAnimationEnd(event) {\n event.stopPropagation();\n node.classList.remove(`${prefix}animated`, animationName);\n resolve('Animation ended');\n }", "attached() {\n const that = this;\n\n super.attached();\n\n if (!that.isCompleted) {\n return;\n }\n\n that.$.removeClass('right');\n that.$.removeClass('left');\n that.$.removeClass('top');\n that.$.removeClass('bottom');\n that.$.removeClass('animate');\n }", "function handleAnimationEnd(event) {\n event.stopPropagation();\n node.classList.remove(`${prefix}animated`, animationName);\n resolve('Animation ended');\n }", "function animationManager () {\n for (var i = tasks.length; i--;) {\n if (tasks[i].step() == false) {\n // remove animation tasks\n logToScreen(\"remove animation\");\n tasks.splice(i, 1);\n }\n }\n }", "function finished(ev) {\n if ( ev && ev.target !== element[0]) return;\n\n if ( ev ) $timeout.cancel(timer);\n element.off($mdConstant.CSS.TRANSITIONEND, finished);\n\n // Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n resolve();\n\n }", "handleShakeAnimationEnd_() {\n const {LABEL_SHAKE} = MDCFloatingLabelFoundation.cssClasses;\n this.adapter_.removeClass(LABEL_SHAKE);\n }", "handleShakeAnimationEnd_() {\n const {LABEL_SHAKE} = MDCFloatingLabelFoundation.cssClasses;\n this.adapter_.removeClass(LABEL_SHAKE);\n }", "function finished(ev){if(ev&&ev.target!==element[0])return;if(ev)$timeout.cancel(timer);element.off($mdConstant.CSS.TRANSITIONEND,finished);// Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n\tresolve();}", "function complete() {\n $archive.removeClass(\"processing\");\n Y.log('complete');\n }", "function removeAnimations() {\n images.forEach((element) => {\n element.classList.remove('animation');\n })\n}", "async wait() {\n this.waitingAnimationFinish = true;\n await Utils.delay(1000);\n this.waitingAnimationFinish = false;\n }", "handleAnimation (callback) {\n let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';\n $('.card').addClass('animated fadeOutDown').one(animationEnd, function() {\n $('.card').removeClass('animated fadeOutDown ');\n callback(true);\n\n $('.card').addClass('animated fadeInRight').one(animationEnd, function() {\n $('.card').removeClass('animated fadeInRight ');\n \n });\n \n });\n }", "function complete() {\n $archive.removeClass(\"processing\");\n Y.log('complete');\n }", "function complete() {\n $archive.removeClass(\"processing\");\n Y.log('complete');\n }", "function finished(ev) {\n if (ev && ev.target !== element[0]) return;\n\n if (ev) $timeout.cancel(timer);\n element.off($mdConstant.CSS.TRANSITIONEND, finished);\n\n // Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n resolve();\n\n }", "function finished(ev) {\n if ( ev && ev.target !== element[0]) return;\n\n if ( ev ) $timeout.cancel(timer);\n element.off($mdConstant.CSS.TRANSITIONEND, finished);\n\n // Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n resolve();\n\n }", "function finished(ev) {\n if ( ev && ev.target !== element[0]) return;\n\n if ( ev ) $timeout.cancel(timer);\n element.off($mdConstant.CSS.TRANSITIONEND, finished);\n\n // Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n resolve();\n\n }", "function finished(ev) {\n if ( ev && ev.target !== element[0]) return;\n\n if ( ev ) $timeout.cancel(timer);\n element.off($mdConstant.CSS.TRANSITIONEND, finished);\n\n // Never reject since ngAnimate may cause timeouts due missed transitionEnd events\n resolve();\n\n }", "updateAnimations() {\n this.animations.forEach((animation, index) => {\n if (animation.finished) {\n this.animations.splice(index, 1);\n }\n });\n }", "static complete() {\n\t\tconsole.log('Animation.complete()')\n\t\tVelvet.capture.adComplete()\n\n\t}", "function onEnd(cancelled) {\n element.off(css3AnimationEvents, onAnimationProgress);\n element.removeClass(activeClassName);\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "_onFinishedEvent() {\n this._finished += 1;\n\n if (this._finished === this._babylonNumAnimations) {\n this._looped = 0;\n this._finished = 0;\n\n // Pause the animations\n this._babylonAnimatables.forEach(animatable => {\n animatable.speedRatio = 0;\n });\n\n this._promises.play.resolve();\n\n // Stop evaluating interpolators if they have already completed\n if (!this.weightPending && !this.timeScalePending) {\n this._paused = true;\n }\n }\n }", "function removeAnimationClass() {\n var active = document.querySelector('.activated');\n active.addEventListener(\"animationend\", removeAnimation, false);\n function removeAnimation() {\n $('.activated').removeClass('activated');\n }\n }", "function handleAnimationEnd(event) {\n\t\tevent.stopPropagation();\n\t\tnode.classList.remove(`${prefix}animated`, animationName);\n\t\tresolve('Animation ended');\n\t}", "function handleAnimationEnd(event) {\n event.stopPropagation();\n if(animationName !== event.animationName)\n {\n //ended other animation => ignore it callback now\n //console.error(animationName);\n //console.error(event);\n\n log('Animation end '+event.animationName+'; Expected: '+animationName );\n return;\n }\n\n node.classList.remove(animationName);\n\n log('Animation ended '+animationName );\n resolve('Animation ended '+animation);\n }", "exit() {\n if (!this._destroyed) {\n this._animationState = 'hidden';\n this._changeDetectorRef.markForCheck();\n }\n }", "function animcompleted() {\n\t\t\t\t\t\t}", "_onEndAnim() {\n if (this._indicator) {\n this._indicator.getParent().removeChild(this._indicator);\n this._indicator = null;\n }\n }", "function onEnd(cancelled) {\n element.off(css3AnimationEvents, onAnimationProgress);\n element.removeClass(activeClassName);\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd(cancelled) {\n element.off(css3AnimationEvents, onAnimationProgress);\n element.removeClass(activeClassName);\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "function onEnd(cancelled) {\n element.off(css3AnimationEvents, onAnimationProgress);\n element.removeClass(activeClassName);\n animateClose(element, className);\n var node = extractElementNode(element);\n for (var i in appliedStyles) {\n node.style.removeProperty(appliedStyles[i]);\n }\n }", "OnAnimationEnd() {\n // Before the animation, the treemap nodes will remove their bevels and selection\n // effects. If the animation is complete (and not stopped), then rerender to restore.\n if (!this.AnimationStopped) {\n this._container.removeChildren();\n\n // Finally, re-layout and render the component\n var availSpace = new Rectangle(0, 0, this.Width, this.Height);\n this.Layout(availSpace);\n this.Render(this._container);\n\n // Reselect the nodes using the selection handler's state\n this.ReselectNodes();\n }\n\n // Delegate to the superclass to clear common things\n super.OnAnimationEnd();\n }", "function clonedAnimationDone(){\n // scroll body\n anime({\n targets: \"html, body\",\n scrollTop: 0,\n easing: easingSwing, // swing\n duration: 150\n });\n\n // fadeOut oldContainer\n anime({\n targets: this.oldContainer,\n opacity : .5,\n easing: easingSwing, // swing\n duration: 300\n })\n\n // show new Container\n anime({\n targets: $newContainer.get(0),\n opacity: 1,\n easing: easingSwing, // swing\n duration: 300,\n complete: function(anim) {\n triggerBody()\n _this.done();\n }\n });\n\n $newContainer.addClass('one-team-anim')\n }", "reset() {\n if(!this.finishedAnimating) {\n return false;\n }\n\n const svg = this.shadowRoot.querySelector(\"svg\");\n\n svg.classList.remove(\"animate\");\n\n this.finishedAnimating = false;\n return true;\n }", "fadeOut() {\n const self = this;\n // \"Unload\" Animation - onComplete callback\n TweenMax.to($(this.oldContainer), 0.4, {\n opacity: 0,\n onComplete: () => {\n this.fadeIn();\n }\n });\n }", "complete() {\n if (this.element.renderTransform) {\n this.refreshTransforms();\n this.element.renderTransform.reset();\n }\n }", "pauseAnimation() {\n for (var key in this.animations) {\n if (this.animations.hasOwnProperty(key)) {\n this.animations[key].setFinished(true);\n }\n }\n }", "handleAnimationEnd() {\n this.isAnimating = false;\n this.index = (this.index + 1) % this.greetings.length;\n\n setTimeout(() => this.updateGreeting(), 500);\n }", "function animationCompleted()\n{\n // Remove the tick event listener.\n TweenMax.ticker.removeEventListener(\"tick\");\n\n // Reenable the test button.\n animationTest.disabled = false;\n}", "animationReadyToClose() {\n if (this.animationEnabled()) {\n // set default view visible before content transition for close runs\n if (this.getDefaultTabElement()) {\n const eleC = this.getDefaultTabElement() ? this.getDefaultTabElement().querySelector(ANIMATION_CLASS) :\n this.getDefaultTabElement().querySelector(ANIMATION_CLASS);\n if (eleC) {\n eleC.style.position = 'unset';\n eleC.classList.remove('hide');\n }\n }\n }\n }", "doBlink() {\n this.eyeMask.classList.add('close');\n\n this.eyeMask.getElementsByTagName('g')[0].addEventListener('transitionend', (event) => {\n setTimeout(() => {\n this.eyeMask.classList.remove('close');\n }, 20);\n }, { once: true });\n }", "function deletesCandyAnimation(){\n disableCandyEvents();\n $('img.delete').effect('pulsate', 400);\n $('img.delete').animate({\n opacity: '0'\n }, {\n duration:300\n })\n .animate({\n opacity:'0'\n }, {\n duration:400,\n complete: function(){\n deletesCandy()\n .then(checkBoardPromise)\n .catch(showPromise);\n },\n queue: true\n });\n}", "function _sh_switch_workspace_tween_completed( ){\n\tTweener.removeTweens( this );\n}", "function animateRemoval() {\n return $animateCss(element, {addClass: '_md-leave'}).start();\n }", "function fireInitialAnimations() {\n $mdUtil.nextTick(function() {\n $animate.addClass($element, 'md-noop');\n });\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: '_md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: '_md-leave'}).start();\n }", "function disappearAnimation(){\n $(this).addClass(\"imgAnimate\");\n $(this).one(\"webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend\", function(){\n toSearchBox();\n $(this).remove();\n addSearchBox()\n //$(\"#searchBarSeven\").toggleClass(\"searchBarSevenExtend\");\n\n\n })\n}", "function bgAnimationComplete() {\n preloadBg.hide();\n\n site = new Site();\n site.init();\n }", "exitElements(){\n this.itemg.exit()\n .transition(this.transition)\n .style(\"opacity\", 0)\n .remove();\n }", "onAnimationEnd(event) {\n if (event.animationName === 'b-ripple-expand') {\n this.hide();\n }\n }", "function resetAnimation() {\n $(\"#win-display\").removeClass('animated bounceInDown');\n $(\"#lose-display\").removeClass('animated bounceInDown');\n $(\".gameBanner\").removeClass('animated bounceInDown');\n $(\".target-number\").removeClass('animated rotateInDownRight');\n $(\".total-number\").removeClass('animated rotateInDownLeft');\n}", "playAnimation() {\n for (var key in this.animations) {\n if (this.animations.hasOwnProperty(key)) {\n this.animations[key].setFinished(false);\n }\n }\n }", "onAnimationEnd(event) {\n if (event.animationName === 'b-ripple-expand') {\n this.hide();\n }\n }", "function blacklistAnimationDone() {\n tiles.splice(lastBlacklistedIndex, 1);\n removeNode(lastBlacklistedTile.elem);\n updateTileVisibility(numTilesShown);\n isBlacklisting = false;\n tilesContainer.classList.remove(CLASSES.HIDE_BLACKLIST_BUTTON);\n lastBlacklistedTile.elem.removeEventListener(\n 'webkitTransitionEnd', blacklistAnimationDone);\n}", "__onAnimationHandler() {\n\n this._overflowClass = '';\n this._circleClass = '';\n this._labelClass = '';\n this._rectangleClass = '';\n }", "function setEndAnimation() {\r\n\t\t\tinAnimation = false;\r\n\t\t}", "finish() {\n window.setTimeout(\n this.displayAbsorptionTexts.bind(this),\n absorptionDuration\n );\n const lastStep = this.measurementHistory.length - 1;\n window.setTimeout(\n this.displayMeasurementTexts.bind(this, lastStep),\n this.animationStepDuration\n );\n window.setTimeout(\n this.finishCallback.bind(this),\n this.absorptionDuration\n );\n window.setTimeout(\n () => {this.board.animationExists = false;},\n this.absorptionDuration\n );\n // Make text groups disappear\n window.setTimeout(\n this.removeTexts.bind(this),\n absorptionDuration + absorptionTextDuration\n );\n }", "onAnimationEnd(event) {\n if (event.animationName === 'b-ripple-expand') {\n this.hide();\n }\n }", "function finishAnimations() {\n if (transition == null)\n throw new Error('Transition was already finished or never started.');\n\n for (const anim of document.getAnimations())\n anim.finish();\n}", "deathAnimation(){\n let $entity = $(`[data-name='${this.data.entity.name}']`);\n $entity.pauseKeyframe();\n $entity.resetKeyframe();\n $entity.css(\"background-image\",\"url('./static/images/smoke_effect.png')\")\n .css(\"background-size\",\"100% 100%\")\n .animate({\n opacity: 0.0,\n top: `${this.data.pos.y-15}px`\n }, 2000, \n ()=>{$(`[data-name='${this.data.entity.name}']`).remove()} );\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function animateRemoval() {\n return $animateCss(element, {addClass: 'md-leave'}).start();\n }", "function getResult(userChoiceIndex) {\n // After the end of animation,the following piece of code will be executed\n //This code can be replaced with the 'animationend' event but i got error in this code so i did this to override the bug.\n setTimeout(() => {\n let randomIndex = getRandomNumber();\n images[1].childNodes[1].classList = `fas ${userOptions.images[randomIndex]}`;\n removeAnimations();\n displayResult(userChoiceIndex, randomIndex);\n addClickEvents();\n }, 2000);\n\n}", "function frameAnimationEnd() {\n f.animatedFrames = f.animatedFrames || 0;\n f.animatedFrames++;\n if(f.animatedFrames == f.frameItems.length){\n f.finished = true;\n f.o.cbFinished.call(f);\n }\n \n }", "function fadeOutMainMenu(){\n\n\n\tconst animationTiming = 800;\n\n\treturn new Promise((res,rej)=>{\n\t\t$('.mainMenu').css({\n\t\t\ttransition : `transform ${animationTiming}ms ease`,\n\t\t\ttransform : 'scale(.0001) rotate(15deg)'\n\t\t});\n\t\tsetTimeout(res,animationTiming);\n\t});\n\n\n}" ]
[ "0.7152717", "0.7152717", "0.7152717", "0.71292853", "0.6968512", "0.6957535", "0.694036", "0.6877351", "0.6868623", "0.67361623", "0.66968536", "0.663338", "0.6600601", "0.64365", "0.6423742", "0.64029455", "0.63439643", "0.6340242", "0.63223475", "0.631843", "0.6305752", "0.6297887", "0.6253041", "0.62529415", "0.6250344", "0.62494934", "0.6227566", "0.6223553", "0.62229395", "0.621811", "0.6193911", "0.6189347", "0.617478", "0.61701494", "0.6167731", "0.6139296", "0.6139296", "0.6134038", "0.6130159", "0.612874", "0.61264634", "0.6124671", "0.6124299", "0.6124299", "0.61152905", "0.61149275", "0.61108315", "0.61108315", "0.6108019", "0.6105252", "0.6086945", "0.60857546", "0.6075435", "0.6071312", "0.60676557", "0.6060181", "0.6052025", "0.60440874", "0.6039274", "0.6039274", "0.6039274", "0.6035323", "0.6019889", "0.6016931", "0.6014965", "0.6008803", "0.6005487", "0.60034215", "0.5999154", "0.59931797", "0.59923965", "0.5980912", "0.59535784", "0.5945743", "0.5942074", "0.5941007", "0.5941007", "0.59344065", "0.5931999", "0.59218764", "0.59149855", "0.59126276", "0.5909601", "0.5903294", "0.5901142", "0.58993775", "0.5898574", "0.5894162", "0.5881254", "0.58777833", "0.5867734", "0.5865712", "0.5865712", "0.5865712", "0.5865712", "0.5865712", "0.5865712", "0.5839581", "0.5831519", "0.5825075" ]
0.6225465
27
Returns the unique dates determined by the accompanying comparison function
function uniqueDates(dates, compareFn) { var d = dates.concat(); // n-squared. can probably be better here. (_.union? _.merge?) for (var i = 0; i < d.length; ++i) { for (var j = i + 1; j < d.length; ++j) { if (compareFn(d[i], d[j]) === 0) { // remove the jth element from the array as it can be considered duplicate d.splice(j--, 1); } } } return d; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSortedUniqueDate(bookings) {\n let uniqueDate = [];\n for (let i = 0; i < bookings.length -1; i++) {\n if(!uniqueDate.includes(bookings[i].date.substring(5,10))){\n uniqueDate.push(bookings[i].date.substring(5,10))\n }\n }\n const sortedUniqueDate= uniqueDate.sort()\n return sortedUniqueDate\n}", "function getAllDates(data){\n\tlet dateArray =[];\n\tdata.forEach(function(element){\n \t\tlet date = element._id.date;\n \t\tif (!dateArray.some(function(ele){\n \t\t\treturn ele ===date;\n \t\t})){\n \t\tdateArray.push(date);\n \t\t}\n\t});\n\treturn dateArray.sort();\n}", "nextPickupDates (intsArr, isRecycling = false) {\n var arr = []\n var date = null\n var isHoliday = false\n _.each(intsArr, (int, index) => {\n date = Schedule.nextDayOfWeek(int)\n isHoliday = Schedule.isHoliday(date, isRecycling)\n arr.push({ date, isHoliday })\n\n while (isHoliday) {\n int = (index + 1 === intsArr.length) ? intsArr[0] : intsArr[index + 1] // jump to next day in intsArr\n date = Schedule.nextDayOfWeek(int, date)\n isHoliday = Schedule.isHoliday(date, isRecycling)\n arr.push({ date, isHoliday })\n }\n })\n return _.chain(arr).sortBy(x => x.date.valueOf()).uniq(x => x.date.valueOf(), true).value()\n }", "function compareDates(date1, date2)\r\n{\r\n if(date1 < date2)\r\n return -1;\r\n else if(date1 > date2)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function getSalesDays() {\n\t\t\treturn new Promise ((resolve, reject)=> {\n\t\t\t\tdb.findMany(Sales, {}, 'date', function(result) {\n\t\t\t\t\tvar uniqueDates = [];\n\t\t\t\t\tvar unique = 1;\n\n\t\t\t\t\tfor (var i=0; i<result.length; i++) {\n\t\t\t\t\t\tvar date = new Date (result[i].date);\n\t\t\t\t\t\tvar unique = 1;\n\t\t\t\t\t\tdate.setHours(0,0,0,0);\n\n\t\t\t\t\t\t//checks if the date is new/unique, -1 means that it's not in the array\n\t\t\t\t\t\tfor (var j=0; j < uniqueDates.length; j++) {\n\t\t\t\t\t\t\tvar arrayDate = new Date (uniqueDates[j]);\n\t\t\t\t\t\t\tarrayDate.setHours(0,0,0,0);\n\t\t\t\t\t\t\t//console.log(\"date: \" + date + \", array date: \" + arrayDate);\n\t\t\t\t\t\t\t//console.log(uniqueDates);\n\t\t\t\t\t\t\tif (!(date > arrayDate || date < arrayDate)) {\n\t\t\t\t\t\t\t\tunique = 0;\n\t\t\t\t\t\t\t\t//console.log(\"not unique\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (unique == 1)\n\t\t\t\t\t\t\tuniqueDates.push(date)\n\n\t\t\t\t\t\t//console.log(uniqueDates);\n\t\t\t\t\t}\n\t\t\t\t\tresolve (uniqueDates)\n\t\t\t\t})\n\t\t\t})\n\t\t}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function groupByDates(dates) {\n let parseDate = function (input) {\n var parts = input.match(/(\\d+)/g);\n return new Date(parts[0], parts[1] - 1, parts[2], 0); // months are 0-based\n };\n let sortedArray = Array.from(dates).sort();\n let dateArray = [];\n sortedArray.map(e => dateArray.push(parseDate(e[0])));\n let selection_by_range = [];\n let aux_selector = [];\n for (let i = 0; i < dateArray.length; i++) {\n aux_selector.push(sortedArray[i]);\n let next_day = new Date(dateArray[i]);\n next_day.setDate(dateArray[i].getDate() + 1);\n const index = dateArray.findIndex(function (x) {\n return x.toISOString().slice(0, 10) === next_day.toISOString().slice(0, 10);\n });\n if (index === -1) {\n selection_by_range.push(aux_selector);\n aux_selector = [];\n }\n }\n return selection_by_range\n}", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "get dates() {\n const { from, to, query, timeRegistrations } = this.store;\n let dates = [];\n if (query) {\n dates = [...new Set(timeRegistrations.map(r => r.date))].sort((a, b) => a < b);\n } else {\n let days = differenceInDays(to, from) + 1;\n for (let i = 0; i < days; i++) {\n let date = new Date(from);\n date.setDate(date.getDate() + i);\n dates.push(date);\n }\n }\n return dates;\n }", "function getUniqueBillsByDate(listOfBillsWithTitle) {\n var billsById = {};\n var listOfUniqueBills = [];\n \n //In the billsById object, create a propriety by billId and that propriety receive as value an array of objects(each bill with this id) \n listOfBillsWithTitle.filter(function(bill) {\n billsById[bill.billId] = billsById[bill.billId] || [];\n billsById[bill.billId].push(bill);\n });\n \n /*In the object, each propriety name is the billId and \n its value is an array of all the votes about this bill. \n We compare their date to keep only the latest vote.\n */\n for (var bill in billsById) {\n var latestBill = billsById[bill].reduce(function(prev, next) {\n var x = new Date(prev.dateOfVote);\n var y = new Date(next.dateOfVote);\n if (x < y) {\n return next;\n }\n else {\n return prev;\n }\n });\n \n listOfUniqueBills.push(latestBill);\n }\n return listOfUniqueBills;\n}", "_getValidDates(dateOrDates) {\n let result = [];\n\n function validate(date) {\n if (date instanceof Date) {\n return date;\n }\n else if (JQX.Utilities.DateTime && date instanceof JQX.Utilities.DateTime) {\n return date.toDate();\n }\n else if (typeof (date) === 'string') {\n if (date.trim() === 'new Date()' || date.trim() === 'new JQX.Utilities.DateTime()') {\n return new Date();\n }\n\n let regex = /(\\d+[,-.\\/]{1}\\s*\\d+[,-.\\/]{1}\\s*\\d+)/;\n\n const parseDateString = () => {\n date = date.replace(/[,-.\\/]/g, ',').split(',');\n if (date.length > 2) {\n date = new Date(parseInt(date[0]), parseInt(date[1]) - 1, parseInt(date[2]));\n }\n else {\n return new Date();\n }\n\n return date;\n }\n\n if (regex.test(date)) {\n date = regex.exec(date)[0].replace(/[,-.\\/]/g, ',').split(',');\n if (date) {\n return new Date(parseInt(date[0]), parseInt(date[1]) - 1, parseInt(date[2]));\n }\n else {\n return parseDateString();\n }\n }\n else {\n return parseDateString();\n\n }\n }\n }\n\n if (dateOrDates === undefined) {\n return null;\n }\n\n if (Array.isArray(dateOrDates)) {\n for (let i = 0; i < dateOrDates.length; i++) {\n result.push(validate(dateOrDates[i]));\n }\n }\n else {\n result.push(validate(dateOrDates));\n }\n\n result = result.filter(date => date && date.toDateString() !== 'Invalid Date'); //remove invalid dates\n result.map(date => date.setHours(0, 0, 0, 0)); //reset time, important for date comparing\n\n return result;\n }", "function Datepush(){\n\tdebugger;\n\tdateDate1=[];\n\t$(\".Date\").each(function(){\n\t\tif($(this).val()!=''){\n\t\t\tvar date = moment($(this).val(), \"DD-MM-YYYY\").toDate();\n\t\t\tvar currentDate=$(this).val();\n\t\t\tdateDate1.push(date);\n\t\t}\n\t});\t\t \n\tvar sorted = dateDate1.sort(sortDates);\n\tvar minDate = sorted[0];\n\tvar maxDate = sorted[sorted.length-1];\n\t//printing dates\n\t$(\"#fromDate1\").text(minDate.getDate()+\"-\"+(minDate.getMonth()+1)+\"-\"+minDate.getFullYear());\n\t$(\"#toDate1\").text(maxDate.getDate()+\"-\"+(maxDate.getMonth()+1)+\"-\"+maxDate.getFullYear());\n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function sortDates(a, b){\n\treturn a.getTime() - b.getTime();\n}", "sortDates(unsortedDates) {\n let sortedDays = [];\n let days = [];\n\n for (var day in unsortedDates) {\n days.push(day);\n }\n\n sortedDays = days.sort(function(a, b) {\n return new Date(a.value).getDate() - new Date(b.value).getDate();\n });\n return sortedDays;\n }", "function compareDates$static(d1/*:Date*/, d2/*:Date*/)/*:Number*/ {\n if (d1 === d2) {\n return 0;\n }\n\n if (d1 && d2) {\n var time1/*:Number*/ = d1.getTime();\n var time2/*:Number*/ = d2.getTime();\n if (time1 === time2) {\n return 0;\n } else if (time1 > time2) {\n return 1;\n }\n return -1;\n }\n\n if (!d1) {\n return 1;\n }\n\n if (!d2) {\n return -1;\n }\n }", "function compareDates(a,b) {\n if(a.attributes.date.isBefore(b.attributes.date)) {return -1;}\n if(b.attributes.date.isBefore(a.attributes.date)) {return 1;}\n return 0;\n}", "viewAccentDatesFromSelected(selectedUniqueItems) {\n let dateArray = [];\n if (selectedUniqueItems) {\n\t for (let catName of Object.keys(selectedUniqueItems)) {\n\t for (let displayStr of Object.keys(selectedUniqueItems[catName])) {\n\t dateArray = dateArray.concat(selectedUniqueItems[catName][displayStr].reduce((acc, res) => { acc.push(res.itemDate); return acc; }, []));\n\t }\n\t }\n }\n\n return uniqueBy(dateArray, elt => elt);\n }", "function getUniqueDateFromColumn(data, rowNum, columnNum){\n var col = columnNum - 1 ; // choose the column you want to use as data source (0 indexed, it works at array level)\n //var data = sheet.getDataRange().getValues();// get all data\n\n var newdata = new Array();\n for(var row = rowNum - 1; row < data.length; row++){\n var duplicate = false;\n for(j in newdata){\n //Logger.log(data[row][col]);\n //Logger.log(j);\n if(Date.parse(data[row][col]) == Date.parse(newdata[j])){\n duplicate = true;\n }\n }\n if(!duplicate){\n newdata.push(data[row][col]);\n }\n }\n return newdata;\n}", "function availableDate() {\n let dates = [];\n Object.values(tdata).forEach(value => {\n let date = value.datetime;\n if (dates.indexOf(date) !== -1) {\n }\n else {\n dates.push(date);\n } \n });\n return dates;\n}", "function noDupsByDate(bookmarks) {\n var noDups = [];\n for (var i = 0; i < bookmarks.length; i += 1) {\n var seen = false;\n for (var j = i + 1; j < bookmarks.length; j += 1) {\n if (bookmarks[i].url === bookmarks[j].url) {\n seen = true;\n }\n }\n if (!seen) {\n noDups.push(bookmarks[i]);\n }\n }\n return noDups;\n}", "function getDates (){\n\t\t\t\t\tvar dates = [];\n\t\t\t\t\tscope.data.coauthors.forEach(function(author){\n\t\t\t\t\t\tauthor.dates.forEach(function(date){\n\t\t\t\t\t\t\tif(dates.length === 0){\n\t\t\t\t\t\t\t\tdates.push({ label: date, \n\t\t\t\t\t\t\t\t\tvalue: date, \n\t\t\t\t\t\t\t\t\tfilterLabel: 'Date CoAuthored: ',\n\t\t\t\t\t\t\t\t\tfilterType: 'date'\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfor(var i =0; i < dates.length; i++){\n\t\t\t\t\t\t\t\t\tif(dates[i].value === date) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdates.push({ label: date, value: date, filterLabel: 'Date CoAuthored: ', filterType: 'date'});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\treturn dates;\n\t\t\t\t}", "sortFitness(response, dates) {\n let startJ = 1;\n for (var i = 0; i < response.data.length; i++) {\n let currentRide = response.data[i];\n let currentKj = response.data[i].kilojoules;\n let d = response.data[i].start_date_local.slice(0,10)+'T07:00:00Z';\n let currentRideDate = new Date(d).toString().slice(4,15);\n\n for (var j = startJ-1; j < dates.length; j++) {\n let currentDate = dates[j].formattedDate;\n if (currentRideDate === currentDate) {\n currentRide.formattedDate = currentRideDate;\n dates[j] = currentRide;\n dates[j].kilojoules = currentKj;\n break;\n }\n ++startJ;\n }\n }\n return dates;\n }", "function parseByDate(models) {\n var tempShared = [];\n var initial_time = new Date(models[models.length - 1].attributes.date);\n for (var i = models.length - 1; i >= 0; i--) {\n var compare_against = new Date(models[i].attributes.date);\n if(initial_time.getFullYear() == compare_against.getFullYear()) {\n if (initial_time.getMonth() == compare_against.getMonth()) {\n if (initial_time.getDate() == compare_against.getDate()) {\n // console.log(models[i]);\n tempShared.push([compare_against, models[i].attributes]);\n models.splice(i, 1);\n };\n };\n };\n };\n crime_by_date.push(tempShared);\n if (models.length > 0) {\n parseByDate(models);\n }\n else {\n // console.log(crime_by_date);\n };\n}", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "createDatesArray() {\n let timeAgoISO = moment().utc().subtract(180, 'days').format();\n let date1 = new Date();\n let date2 = new Date(timeAgoISO);\n let day;\n let datesBetween = [];\n\n while(date2 < date1) {\n let formattedDate = date1.toString().split('').slice(4, 15).join('');\n datesBetween.push({\n formattedDate: formattedDate,\n fitLine: 0,\n kilojoules: 0,\n });\n day = date1.getDate()\n date1 = new Date(date1.setDate(--day));\n }\n\n return datesBetween.reverse();\n }", "function trimDays(totDays) {\n var uniqueDays = [];\n\n $.each(totDays, function(i, el) {\n if ($.inArray(el, uniqueDays) === -1) uniqueDays.push(el);\n });\n return uniqueDays;\n\n }", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function compareDate(dos, rd) {\n\n }", "function compareDates (date1, date2)\n{\n newDate1 = new Date(date1);\n newDate1.setHours(0,0,0,0);\n newDate2 = new Date(date2);\n newDate2.setHours(0,0,0,0);\n var t1 = newDate1.getTime();\n var t2 = newDate2.getTime();\n if (t1 === t2) return 0;\n else if (t1 > t2) return 1;\n else return -1;\n}", "groupByDate(xs) {\n return xs.reduce(function(groups, item) {\n const val = moment(item.scannedDate).format(\"YYYY-MM-DD\");\n groups[val] = groups[val] || [];\n groups[val].push(item);\n return groups;\n }, {});\n }", "function byDate(a, b) {\n return a.date - b.date;\n}", "function compDate() {\n\tvar d = Date();\n\td = d.split(\" \");\n\tvar months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\tfor (i in months) {\n\t\tif (d[1] === months[i]) {\n\t\t\tvar m = Number(i) < 9 ? \"0\" + (Number(i) + 1) : Number(i) + 1;\n\t\t}\n\t}\n\tvar minD = d[3] + \"-\" + m + \"-\" + d[2];\n\tvar compD = m + \"-\" + d[2] + \"-\" + d[3];\n\treturn [compD, minD];\n}", "_getAllDatesByData(data) {\n // Get the start and end date\n let startDate = '';\n let endDate = '';\n $.each(data, function (index, item) {\n $.each(item.status, function (date, value) {\n if (startDate === '' && endDate === '') {\n startDate = date;\n endDate = date;\n return true;\n }\n if (date < startDate) {\n startDate = date;\n }\n else if (date > endDate) {\n endDate = date;\n }\n });\n });\n\n // Get dates between the two dates\n startDate = new Date(startDate);\n endDate = new Date(endDate);\n let dateArray = [];\n let currentDate = startDate;\n while (currentDate <= endDate) {\n dateArray.push(currentDate.toISOString().substring(0, 10));\n currentDate.setDate(currentDate.getDate() + 1);\n }\n return dateArray;\n }", "function listByDates(date, list) {\n incomingDate=moment(date).format('YYYY-MM-DD')\n let datearray = [];\n return new Promise((resolve, reject) => {\n list.forEach(element => { //filter list according to date comparison\n // console.log(moment(element.createdDate, \"YYYY-MM-DD\"))\n let dbdate = moment(element.date, \"YYYY-MM-DD\");\n // console.log(moment(inputdate).isSame(dbdate,'date'))\n if (moment(incomingDate).isSame(dbdate, 'date')) {\n datearray.push(element);\n }\n })\n resolve(datearray)\n })\n}", "function newDates(low, high){\n let tempArray = [];\n for(var i=0; i<datesProvided.length; i++){\n if ((i>=low) && (i<=high)){\n tempArray.push(datesProvided[i]);\n }\n }\n return tempArray;\n}", "function compareDate(a, b) {\r\n if (a.date > b.date) return 1;\r\n if (b.date > a.date) return -1;\r\n return 0;\r\n}", "function compareSortDates(first, second)\n{\n return first.eventSD - second.eventSD;\n}", "function compareDates(a, b)\n{\n var x=new Date(a.Date);\n var y=new Date(b.Date);\n \n console.log(\"hello we are hee\");\t\n\n console.log(x);\n console.log(y);\t\n\n if(x>y)\n {\n console.log(1);\n return 1;\n\n }\n else\n {\n console.log(-1);\t \n return -1;\n }\n}", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function cmpDate(dat1, dat2) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1) || !isDate(dat2)) {\r\n alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = (new Date(dat2.substring(6, 10), dat2.substring(0, 2) - 1, dat2.substring(3, 5))).getTime();\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "function compareDateFunction(date1,date2){\r\n\tvar leftDate;\r\n\tvar rightDate;\r\n\tif(typeof(date1) == \"object\"){\r\n\t\tleftDate = date1;\r\n\t}else{\r\n\t\tleftDate = convertStr2Date(date1);\r\n\t}\r\n\tif(typeof(date2) == \"object\"){\r\n\t\trightDate = date2;\r\n\t}else{\r\n\t\trightDate = convertStr2Date(date2);\r\n\t}\r\n\treturn compareDate(leftDate,rightDate,0);\r\n}", "function createDatesArray(feedingData) {\n let datesArray = [];\n for (i = 0; i <= 7; i++) {\n let countingDate = (new Date(today));\n countingDate = (new Date(countingDate.setDate(today.getDate() - i)));\n let fromDate = (new Date(countingDate.setHours(0, 0, 0, 0))).toISOString();\n let toDate = (new Date(countingDate.setHours(23, 59, 59))).toISOString();\n\n const forToday = feedingData.filter(function (x, i) {\n return (x.timestamp > fromDate && x.timestamp < toDate);\n });\n if (forToday.length > 0) datesArray.push(forToday);\n }\n return datesArray;\n }", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function test_dates(pattern , expected_dates, callback) {\n\tvar r = new Recurrence(pattern);\n\texpected_dates = _.map(expected_dates, function(d) { return Date.parse(d); });\n\tvar generated = r.generate();\n\n\tif (expected_dates.length !== generated.length) return callback('Invalid number of results');\n\n\tfor (var i = 0; i < generated.length; i++) {\n\t\tvar expected = moment(expected_dates[i]),\n\t\t\trealised = generated[i];\t\t\n\t\tif (expected.valueOf() !== realised.valueOf()) {\n\t\t\treturn callback(expected_dates[i] + ' does not match generated date ' + generated[i]);\n\t\t}\n\t}\n\treturn callback();\n}", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function groupDuplicates(elementsArray, dupeArray, uniqueArray) {\n let arrLength = elementsArray.length;\n\n for(var i = 1; i < arrLength; i++) {\n\n let date = elementsArray[i].getElementsByClassName('date')[0].innerText;\n let price = elementsArray[i].getElementsByClassName('money')[0].innerText;\n\n//TODO assign this differently. On 4.12 it is adding the first matched pair for each dupe it finds.\n\n let matchingPair = scanForDuplicates(uniqueArray, date, price)\n\n if( matchingPair.length > 0 ) {\n\n matchingPair.push(elementsArray[i]);\n dupeArray.push(matchingPair);\n } else {\n uniqueArray.push(elementsArray[i])\n }\n }\n}", "function date_checker() {\n // If date is new, added to date_tracker array\n date_only = DateTime.substr(0, 10);\n if (!date_tracker.includes(date_only)) {\n date_tracker.push(date_only);\n\n // Completes auto_transfers before CSV input transactions if date_only is new\n amendment_check(false);\n }\n }", "function getDates(data) {\n var dates = [];\n for (val in data) {\n dates.push(data[val].date);\n }\n\n // Sort Dates in Ascending Order (Oldest --> Newest). Replaces in place, yay!. \n dates.sort(function(a,b) { \n return new Date(a).getTime() - new Date(b).getTime() \n });\n\n return dates;\n }", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "function createElapsedDatesArray() {\n\tvar startDate = (dateSplitter(allDrinks[0].startTime));\n\tvar currentDate = new Date();\n\tvar allDates = [startDate];\n\twhile(true) {\n\n\t\tvar previousDate = allDates[allDates.length -1];\n\t\tvar dateToAdd = new Date(previousDate.getTime() + 24 * 60 * 60 * 1000);\n\n\t\t//Compare dateToAdd to current date; add to array if it is less than current date\n\t\tif (dateToAdd < currentDate) {\n\t\t\tallDates.push(dateToAdd);\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn allDates;\n\n}", "function comparisonByDate(dateA, dateB) {\n var c = new Date(dateA.date);\n var d = new Date(dateB.date);\n return c - d;\n }", "function removeConflictDates(eventDates) {\n var toRemoveIndex = [];\n \n //Removes the empty values\n eventDates = eventDates.filter(function(eventDate) {\n \treturn eventDate !== \"\";\n });\n\n toRemoveIndex = getIndexToRemove(getSingleItemsIndex(eventDates), eventDates);\n\n //Removes the recurrence dates which are in conflict with single dates\n for (var i = toRemoveIndex.length - 1; i >= 0; i--) {\n eventDates.splice(toRemoveIndex[i], 1);\n }\n \n //Removes the duplicated dates\n var finalDates = resetTimeStamp(eventDates).filter(function (elem, index, self) {\n return index === self.indexOf(elem);\n });\n\n return finalDates;\n}", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "generateEquityArr(){\n let dates = this.trades.map(d => new Date(d.openDate));\n let minDate = new Date(Math.min.apply(null,dates)); \n \n let equityArr = this.trades\n .reduce( (acc, trade, idx, arr) => { \n let equityObj = {\n equity : Number(trade.PNL) + acc[idx].equity,\n date : trade.closeDate\n } \n acc.push(equityObj); \n return acc;\n }, \n [{ equity: this.equity, date: minDate } ]); \n return equityArr;\n }", "function compareDates(mixDataInicial, mixDataFinal)\n{\n var dataInicial = getObject(mixDataInicial);\n var dataFinal = getObject(mixDataFinal);\n if ((empty(dataInicial)) || (empty(dataFinal)))\n return false;\n return compareDatesValues(dataInicial.value, dataFinal.value);\n}", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function dieselBetweenDates(startDate, endDate, list) {\n let datearray = [];\n return new Promise((resolve, reject) => {\n list.forEach(element => { //filter list according to date comparison\n // console.log(moment(element.createdDate, \"YYYY-MM-DD\"))\n let dbdate = moment(element.date, \"YYYY-MM-DD\");\n // console.log(moment(inputdate).isSame(dbdate,'date'))\n if (moment(startDate).isSame(endDate, 'date')) {\n if (moment(startDate).isSame(dbdate, 'date')) {\n datearray.push(element);\n }\n }\n else {\n if (moment(dbdate).isBetween(startDate, endDate, null, '[]')) {\n console.log('date matched')\n datearray.push(element);\n // console.log(montharray)\n }\n }\n\n })\n resolve(datearray)\n })\n}", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDashedDates(date1, date2) {\n console.log(date1);\n console.log(date2);\n date1 = date1.split('-');\n date2 = date2.split('-');\n console.log(date1);\n console.log(date2);\n for (let i = 0; i < date1.length; i++) {\n if (parseInt(date1[i]) < parseInt(date2[i])) {\n return true;\n } else if (parseInt(date1[i]) > parseInt(date2[i])) {\n return false;\n }\n }\n return true;\n}", "function getDaysArray (start, end) {\n for(var dt=new Date(start); dt<=end; dt.setDate(dt.getDate()+1)){\n groundTruthCopy.push({date: new Date(dt), y: -999});\n }\n }", "splitEvents(){\n const { events } = this.props;\n const { days } = this.state;\n const sortedEvents = events.sort((firstEvent, secondEvent) => {\n const firstStartDate = moment(firstEvent.startDate);\n const secondStartDate = moment(secondEvent.startDate);\n\n if(firstStartDate.isBefore(secondStartDate)) {\n return -1;\n } else if (firstStartDate.isSame(secondStartDate)) {\n return 0;\n } else {\n return 1;\n }\n });\n\n // what if the dates are out of range?\n // i should be able to query the dates out of the BE\n // for now we can assume within range\n const result = [...Array(7)].map(el => new Array());\n sortedEvents.forEach((event) => {\n const startDate = moment(event.startDate);\n\n days.forEach((day, idx) => {\n if(startDate.isBetween(day.startMoment, day.endMoment)) {\n result[idx].push(event);\n }\n });\n });\n\n return result;\n }", "function getNextPalindromeDate(date) {\n debugger;\n var nextDate = getNextDate(date);\n var ctr = 0;\n\n while (1) {\n ctr++;\n var nextdateStr = convertDateToString(nextDate);\n var nextdateList = getDateInAllFormats(nextdateStr);\n var nextresultList = checkPalindromeForAllDateFormats(nextdateList);\n\n for (let i = 0; i < nextresultList.length; i++) {\n if (nextresultList[i]) {\n return [ctr, nextDate];\n }\n }\n nextDate = getNextDate(nextDate);\n }\n}", "getAllInBetweenDates(sStartDate, sEndDate) {\n let aDates = [];\n //to avoid modifying the original date\n const oStartDate = new Date(sStartDate);\n const oEndDate = new Date(sEndDate);\n while (oStartDate <= oEndDate) {\n aDates = [...aDates, new Date(oStartDate)];\n oStartDate.setDate(oStartDate.getDate() + 1)\n }\n return aDates;\n }", "FindDate() {\n var dates = [];\n\n dates.push(new Date(\"2019/06/25\"));\n dates.push(new Date(\"2019/06/26\"));\n dates.push(new Date(\"2019/06/27\"));\n dates.push(new Date(\"2019/06/28\"));\n\n var getDate = new Date(Math.max.apply(null, dates));\n var maximumDate = new Date(Math.max.apply(null, dates));\n var minimumDate = new Date(Math.min.apply(null, dates));\n }", "function compareDatesWithFunction(d1, d2, fnC) {\n var c1 = fnC(d1);\n var c2 = fnC(d2);\n if (c1 > c2) return 1;\n if (c1 < c2) return -1;\n return 0;\n }", "getUnique(arr, comp) {\n const unique = arr\n //store the comparison values in array\n .map(e => e[comp])\n\n // store the keys of the unique objects\n .map((e, i, final) => final.indexOf(e) === i && i)\n\n // eliminate the dead keys & store unique objects\n .filter(e => arr[e])\n\n .map(e => arr[e]);\n\n return unique;\n }", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "function main() {\n // OBTIAN AN ARRAY OF START AND END DATES\n var startDate = findStartAndEndDate()[0];\n var endDate = findStartAndEndDate()[1];\n // var start = formatDate(findStartAndEndDate()[0]);\n // var end = formatDate();\n\n var listOfDates = [];\n listOfDates.push(formatDate(startDate));\n\n var year = parseInt(startDate.split(\"-\")[0]);\n var month = parseInt(startDate.split(\"-\")[1]);\n var date = parseInt(startDate.split(\"-\")[2]);\n\n do {\n var nextDate = findNdaysAfter(year, month, date, 1);\n year = parseInt(nextDate.split(\"-\")[0]);\n month = parseInt(nextDate.split(\"-\")[1]);\n date = parseInt(nextDate.split(\"-\")[2]);\n listOfDates.push(formatDate(nextDate));\n } while (nextDate != endDate);\n //console.log(listOfDates);\n // return listOfDates;\n module.exports = listOfDates;\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function sortDates(){\n\n\n function swap(x,y){\n let tx=dates[x];\n dates[x]=dates[y];\n dates[y]=tx;\n }\n\n for (let i=0;i<dates.length;i++){\n let m1=parseInt(dates[i].date.slice(0,dates[i].date.indexOf('.')));\n let d1=parseInt(dates[i].date.slice(dates[i].date.indexOf('.')+1,dates[i].date.indexOf('.',dates[i].date.indexOf('.')+1)));\n for (let j=i;j<dates.length;j++){\n let m2=parseInt(dates[j].date.slice(0,dates[j].date.indexOf('.')));\n let d2=parseInt(dates[j].date.slice(dates[j].date.indexOf('.')+1,dates[j].date.indexOf('.',dates[j].date.indexOf('.')+1)));\n if ((m2<m1)||m1==m2&&d2<d1){\n swap(i,j);\n m1=parseInt(dates[i].date.slice(0,dates[i].date.indexOf('.')));\n d1=parseInt(dates[i].date.slice(dates[i].date.indexOf('.')+1,dates[i].date.indexOf('.',dates[i].date.indexOf('.')+1)));\n }\n }\n }\n injectData();\n\n }", "generateWeeks(){\n let returnarray = [];\n\n // Return today's date and time\n let currentTime = new Date();\n\n // returns the year (four digits)\n let current_year = currentTime.getFullYear();\n\n if(!(this.props.data.annotations === undefined)){\n this.props.data.annotations.forEach(function(e){\n let dateparts = e.createdAt.split(\"T\")[0].split(\"-\");\n let nicedate = dateparts[1]+'/'+dateparts[2]+'/'+dateparts[0];\n let annotweek = currentWeekNumber(nicedate);\n\n if(!returnarray.includes(annotweek) && parseInt(current_year) === parseInt(dateparts[0])){\n returnarray.push(annotweek)\n }\n })\n }\n return returnarray.sort()\n }", "function buildUniqueTheaterArray(showtimes) {\n let uniqueTheaterArray = [];\n let prevTheater;\n\n showtimes.forEach(function (showtime) {\n if (showtime !== prevTheater) {\n uniqueTheaterArray.push(showtime);\n }\n prevTheater = showtime;\n })\n return uniqueTheaterArray;\n\n}", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function get_dates(){\n\t//resets the arrays to empty them, in order to refill them from scratch\n\tdates=[];\n\tdates_id=[];\n\t//gets the expiring dates from the html in the SQL format and the IDs of their HTML elements\n\tvar sql_dates=document.querySelectorAll(\".date\");\n\tsql_dates.forEach(function(element, index){\n\t\tdates.push(element.innerHTML.split(' '));\n\t\tdates_id.push(element.classList[0])\n\t})\n\t//transforms the displayed SQL format into javascript format\n\tdates.forEach(function(element, index){\n\t\t//transforms the month from String format into two-digits format\n\t\telement[1]=get_month(element[1]);\n\t\t//removes the ','\n\t\telement[2]=element[2].replace(\",\", \"\");\n\t\t//replaces the 'h' by ':'\n\t\telement[3]=element[3].replace(\"h\", \":\");\n\t\t//concatenates all dates elements into one string according to the javascript format\n\t\tvar x=element[1]+\"/\"+element[0]+\"/\"+element[2]+\" \"+element[3]+\":00\";\n\t\tdates[index]=x;\n\t});\n\n}", "function arrangeArrays(arr) {\n let sortDays = arr.split(',').sort((a, b) => a - b);\n let eliminateDuplicates = [];\n for (let i = 0; i < sortDays.length; i++) {\n if (eliminateDuplicates.indexOf(sortDays[i]) === -1) {\n eliminateDuplicates.push(sortDays[i]);\n }\n }\n return eliminateDuplicates;\n } // End getUsersBookedDays() > arrangeArrays() ", "function dateComparator(date1, date2) {\n\t\t\tvar date1Number = monthToComparableNumber(date1);\n\t\t\tvar date2Number = monthToComparableNumber(date2);\n\n\t\t\tif (date1Number===null && date2Number===null) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (date1Number===null) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (date2Number===null) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\treturn date1Number - date2Number;\n\t\t}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "getAllPrsByDate(openDate, pullRequests) {\n const prsByDate = [];\n // using moment(string, format) allows us pass in dates in different formats\n const prOpenDate = moment.utc(openDate, ['MM-DD-YYYY\", \"YYYY-MM-DD']);\n pullRequests.forEach((pr) => {\n // To limit granularity to a unit other than millisecond, we can pass in a second parameter\n // Passing in month will check month and year. Passing in day will check day, month, and year\n if (moment.utc(pr.created_at).isSame(prOpenDate, 'day')) {\n prsByDate.push(pr);\n }\n });\n\n console.log(`Returning all (${prsByDate.length}) PR's Opened on: ${prOpenDate}`);\n return prsByDate;\n }", "function checkDates(date){\n if (dateInputInt === 0){\n return true;\n }\n else {\n if (dateCond === 'equalsdate'){\n return date === dateInputInt;\n }\n else if (dateCond === 'greaterthan'){\n return date > dateInputInt;\n }\n else if (dateCond === 'lessthan'){\n return date < dateInputInt;\n }\n }\n }", "function validateCCHITDates(root, count, errorId, tsId) {\r\n\t\r\n\tvar date2Obj = new Date();\r\n\tvar j = 0;\r\n\tvar date1Id = $(root+':Fieldques'+tsId+j);\r\n\t\r\n\twhile(date1Id) {\r\n\t\tvar date1Obj = new Date(date1Id.value);\r\n\t\tvar warningText = errorId+j;\r\n\t\t\r\n\t\tif (date2Obj > date1Obj) {\r\n\t\t\t$(warningText).style.display = \"block\";\r\n\t\t} \r\n\t\telse {\r\n\t\t\t$(warningText).style.display = \"none\";\r\n\t\t}\r\n\t\t\r\n\t\tj++;\r\n\t\tvar date1Id = $(root+':Fieldques'+tsId+j);\r\n\t}\r\n}", "_getDays(date, datePool) {\n const datesCount = datePool.length;\n let days = [];\n\n if (datesCount > 0) {\n for (let d = 0; d < datesCount; d++) {\n if (datePool[d].getFullYear() === date.getFullYear() && datePool[d].getMonth() === date.getMonth()) {\n days.push(datePool[d].getDate());\n }\n }\n }\n\n return days;\n }", "function yearComparator(auto1, auto2){\n return auto2.year - auto1.year;\n}", "function groupDate({creationDate: date}) {\n if(_isYoungerThanA('day', date)) {\n return 'today';\n }\n if(_isYoungerThanA('week', date)) {\n return 'week';\n }\n if(_isYoungerThanA('month', date)) {\n return 'month';\n }\n return 'before';\n}", "function getIndexToRemove(singleItemArray, dates) {\n var indexToRemove = [];\n \n for (var i = 0; i < singleItemArray.length; i++) {\n var dateString = createDateString(dates[singleItemArray[i]]);\n for (var j = dates.length - 1; j >= 0; j--) {\n if (j !== singleItemArray[i]) {\n var dateStringToCompare = createDateString(dates[j]);\n if (dateString === dateStringToCompare) {\n indexToRemove.push(j);\n }\n }\n }\n }\n return indexToRemove.sort();\n}", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }" ]
[ "0.63693047", "0.62496966", "0.6195258", "0.6165936", "0.60871106", "0.59565145", "0.58595645", "0.58589715", "0.5834164", "0.5825121", "0.58009577", "0.57928205", "0.57762784", "0.57596713", "0.5755276", "0.5740565", "0.5691843", "0.56712985", "0.5655792", "0.56167334", "0.56129134", "0.5607491", "0.55812687", "0.55693305", "0.5566904", "0.5554476", "0.5553217", "0.5551927", "0.5550771", "0.5544486", "0.5543666", "0.5540956", "0.5531711", "0.55168104", "0.54995114", "0.5497849", "0.54975384", "0.5493814", "0.5458596", "0.54558337", "0.54532194", "0.5448869", "0.5448709", "0.5438587", "0.5438587", "0.54268646", "0.54212433", "0.54048026", "0.53729475", "0.5364146", "0.536165", "0.536012", "0.53497183", "0.5348123", "0.5345377", "0.5344092", "0.5330211", "0.5326929", "0.5318082", "0.53145254", "0.5301313", "0.5299605", "0.5298555", "0.52955365", "0.5290295", "0.5280496", "0.52777904", "0.5275338", "0.5257402", "0.52558184", "0.52341425", "0.5232752", "0.5230633", "0.5230086", "0.5221629", "0.52180296", "0.52156925", "0.52141315", "0.520178", "0.51967573", "0.5182889", "0.5179048", "0.51675993", "0.51606864", "0.51603484", "0.5159669", "0.51571906", "0.51571906", "0.51571906", "0.51571906", "0.51571906", "0.5155028", "0.5151348", "0.5151134", "0.51439583", "0.51424783", "0.5137372", "0.5136663", "0.5134723", "0.5134723" ]
0.77713454
0
Compares two dates with the help of the provided comparator function
function compareDatesWithFunction(d1, d2, fnC) { var c1 = fnC(d1); var c2 = fnC(d2); if (c1 > c2) return 1; if (c1 < c2) return -1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "function dateComparator(date1, date2) {\n\t\t\tvar date1Number = monthToComparableNumber(date1);\n\t\t\tvar date2Number = monthToComparableNumber(date2);\n\n\t\t\tif (date1Number===null && date2Number===null) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (date1Number===null) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (date2Number===null) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\treturn date1Number - date2Number;\n\t\t}", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "function compareDateFunction(date1,date2){\r\n\tvar leftDate;\r\n\tvar rightDate;\r\n\tif(typeof(date1) == \"object\"){\r\n\t\tleftDate = date1;\r\n\t}else{\r\n\t\tleftDate = convertStr2Date(date1);\r\n\t}\r\n\tif(typeof(date2) == \"object\"){\r\n\t\trightDate = date2;\r\n\t}else{\r\n\t\trightDate = convertStr2Date(date2);\r\n\t}\r\n\treturn compareDate(leftDate,rightDate,0);\r\n}", "function compareDate(a, b) {\r\n if (a.date > b.date) return 1;\r\n if (b.date > a.date) return -1;\r\n return 0;\r\n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function sortByDate(a, b) {\n let comparison = 0;\n\n // -------------------------------------------------------------JavaScript - Conditional Statments Ex. 3||\n if (a.getDate >= b.date) {\n comparison = 1;\n } else if (a.date <= b.date) {\n comparison = -1;\n }\n return comparison;\n}", "function compareDates(date1, date2)\r\n{\r\n if(date1 < date2)\r\n return -1;\r\n else if(date1 > date2)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function compare(a,b) {\n if (a.orderDate < b.orderDate)\n return -1;\n if (a.orderDate > b.orderDate)\n return 1;\n return 0;\n}", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function sortHelper(a, b){\n // Compare the 2 dates\n return a.start < b.start ? -1 : 1;\n}", "function comparisonByDate(dateA, dateB) {\n var c = new Date(dateA.date);\n var d = new Date(dateB.date);\n return c - d;\n }", "function sortDates(a, b){\n\treturn a.getTime() - b.getTime();\n}", "function compareDate(fromDate, toDate) {\r\r\tvar dt1 = parseInt(fromDate.substring(0, 2), 10);\r\r\tvar mon1 = parseInt(fromDate.substring(3, 5), 10);\r\r\tvar yr1 = parseInt(fromDate.substring(6, 10), 10);\r\r\tvar dt2 = parseInt(toDate.substring(0, 2), 10);\r\r\tvar mon2 = parseInt(toDate.substring(3, 5), 10);\r\r\tvar yr2 = parseInt(toDate.substring(6, 10), 10);\r\r\tvar date1 = new Date(yr1, mon1, dt1);\r\r\tvar date2 = new Date(yr2, mon2, dt2);\r\r\tif (date1 > date2) {\r\r\t\treturn 1;\r\r\t} else {\r\r\t\tif (date1 < date2) {\r\r\t\t\treturn -1;\r\r\t\t} else {\r\r\t\t\treturn 0;\r\r\t\t}\r\r\t}\r\r}", "function compareDates(a, b)\n{\n var x=new Date(a.Date);\n var y=new Date(b.Date);\n \n console.log(\"hello we are hee\");\t\n\n console.log(x);\n console.log(y);\t\n\n if(x>y)\n {\n console.log(1);\n return 1;\n\n }\n else\n {\n console.log(-1);\t \n return -1;\n }\n}", "function compare(a,b) {\n if (a.dateOfEvent > b.dateOfEvent)\n return -1;\n if (a.dateOfEvent < b.dateOfEvent)\n return 1;\n return 0;\n }", "function compareDate(dos, rd) {\n\n }", "function compareSortDates(first, second)\n{\n return first.eventSD - second.eventSD;\n}", "function compare(a, b) {\n const dateA = a.date;\n const dateB = b.date;\n\n let comparison = 0;\n if (dateA > dateB) {\n comparison = 1;\n } else if (dateA < dateB) {\n comparison = -1;\n }\n return comparison * -1;\n }", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function sortByDateAscending(a, b) {\n // Dates will be cast to numbers automagically:\n return a.date - b.date;\n }", "function compareDates(a,b) {\n if(a.attributes.date.isBefore(b.attributes.date)) {return -1;}\n if(b.attributes.date.isBefore(a.attributes.date)) {return 1;}\n return 0;\n}", "function cmpDate(dat1, dat2) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1) || !isDate(dat2)) {\r\n alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = (new Date(dat2.substring(6, 10), dat2.substring(0, 2) - 1, dat2.substring(3, 5))).getTime();\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function compare(a,b) {\n\t\t\t\tif (new Date(a.date) < new Date(b.date))\n\t\t\t\t\treturn 1;\n\t\t\t\tif (new Date(a.date) > new Date(b.date))\n\t\t\t\t \treturn -1;\n\t\t\t\treturn 0;\n\t\t\t}", "function compareByDateDESC(a, b) {\n\tif (!('date' in a)) {\n\t\treturn 1;\n\t}\n\tif (!('date' in b)) {\n\t\treturn -1;\n\t}\n\t\n\tif (parseInt(a.date) < parseInt(b.date)) {\n\t\treturn 1;\n\t}\n\tif (parseInt(a.date) > parseInt(b.date)) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function DateCompare(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 > _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function compareDates(value1, value2, sortDirection, format, strict) {\n let diff = 0;\n if (value1 === null || value1 === '' || !moment$1(value1, format, strict).isValid()) {\n diff = -1;\n }\n else if (value2 === null || value2 === '' || !moment$1(value2, format, strict).isValid()) {\n diff = 1;\n }\n else {\n const date1 = moment$1(value1, format, strict);\n const date2 = moment$1(value2, format, strict);\n diff = parseInt(date1.format('X'), 10) - parseInt(date2.format('X'), 10);\n }\n return sortDirection * (diff === 0 ? 0 : (diff > 0 ? 1 : -1));\n}", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "function sortDate(a, b) {\n\t//getTime provides an equal value for h,min,s: the current time\n return new Date(a.date).getTime() - new Date(b.date).getTime();\n}", "function sortByDate(a, b){\nvar aDate = a.date;\nvar bDate = b.date; \nreturn ((aDate > bDate) ? -1 : ((aDate < bDate) ? 1 : 0));\n}", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function byDate(a, b) {\n return a.date - b.date;\n}", "function eventsComparator(event1, event2){\n\tvar date1 = new Date(event1);\n\tvar date2 = new Date(event2);\n\treturn (date1 == date2) ? 0 : (date1 > date2) ? 1 : -1;\n}", "function compareDate(inputDate1, inputDate2) {\r\n if(!inputDate1 || !inputDate2) {\r\n return -1;\r\n }\r\n\tvar date1 = inputDate1.split('-');\r\n\tvar date2 = inputDate2.split('-');\r\n\t\r\n\tif(date1.length != 3 || date2.length != 3 ) { //checks if dates are valid\r\n\t\treturn -1;\r\n\t}\r\n\tif(date1[0] < date2[0]) {\r\n\t\treturn 1;\r\n\t}\r\n\tif(date1[0] == date2[0]) {\r\n\t\tif(date1[1] < date2[1]) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif(date1[1] == date2[1]) {\r\n\t\t\tif(date1[2] <= date2[2]) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function HijridateCompare(date1, date2) {\n //\n if (date1.split('/').length < 3 || date2.split('/').length < 3)\n return -2;\n if (parseInt(date1.split('/')[2]) > parseInt(date2.split('/')[2]))\n return 1;\n else if (parseInt(date1.split('/')[2]) < parseInt(date2.split('/')[2]))\n return -1;\n else if (parseInt(date1.split('/')[1]) > parseInt(date2.split('/')[1]))\n return 1;\n else if (parseInt(date1.split('/')[1]) < parseInt(date2.split('/')[1]))\n return -1;\n else if (parseInt(date1.split('/')[0]) > parseInt(date2.split('/')[0]))\n return 1;\n else if (parseInt(date1.split('/')[0]) < parseInt(date2.split('/')[0]))\n return -1;\n else return 0;\n}", "function compareDates (date1, date2)\n{\n newDate1 = new Date(date1);\n newDate1.setHours(0,0,0,0);\n newDate2 = new Date(date2);\n newDate2.setHours(0,0,0,0);\n var t1 = newDate1.getTime();\n var t2 = newDate2.getTime();\n if (t1 === t2) return 0;\n else if (t1 > t2) return 1;\n else return -1;\n}", "function compareDates(date1, dateformat1, date2, dateformat2) {\n var d1 = getDateFromFormat(date1, dateformat1);\n var d2 = getDateFromFormat(date2, dateformat2);\n if (d1 == 0 || d2 == 0) {\n return -1;\n } else if (d1 > d2) {\n return 1;\n }\n return 0;\n}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function dateSort(val1, val2){\n\treturn simpleSort(Date.parse(val1), Date.parse(val2));\n}", "function compareDateObject(date1, date2){\r\n if(date1 == null) return false;\r\n if(date2 == null) return false;\r\n\r\n var date1Long = date1.getTime();\r\n var date2Long = date2.getTime();\r\n\r\n if(date1Long - date2Long > 0) return '>';\r\n if(date1Long - date2Long == 0) return '=';\r\n if(date1Long - date2Long < 0) return '<';\r\n else\r\n return '';\r\n}", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function date_asc(a,b){\nif (new Date(a.released)>new Date(b.released))\n return -1;\nif (new Date(a.released)<new Date(b.released))\n return 1;\nreturn 0\n}", "function date_greater_than (date1, date2)\n{\n //Dates should be in the format Month(maxlength=3) Day(num minlength=2), Year hour(minlength=2):minute(minlength=2)(24h time)\n //Eg Apr 03 2020 23:59\n //the function caller is asking \"is date1 greater than date2?\" and gets a boolean in return\n\n let months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n\n //Compares the years\n if (parseInt(date1.substr(7, 4)) > parseInt(date2.substr(7, 4))) return true\n else if (parseInt(date1.substr(7, 4)) < parseInt(date2.substr(7, 4))) return false\n else //the elses are for if both values are the same\n {\n //Compares the months\n if (months.indexOf(date1.substr(0, 3)) > months.indexOf(date2.substr(0, 3))) return true\n else if (months.indexOf(date1.substr(0, 3)) < months.indexOf(date2.substr(0, 3))) return false\n else\n {\n //Compares the days\n if (parseInt(date1.substr(4, 2)) > parseInt(date2.substr(4, 2))) return true\n if (parseInt(date1.substr(4, 2)) < parseInt(date2.substr(4, 2))) return false\n else\n {\n //Compares the hours\n if (parseInt(date1.substr(12, 2)) > parseInt(date2.substr(12, 2))) return true\n else if (parseInt(date1.substr(12, 2)) < parseInt(date2.substr(12, 2))) return false\n else\n {\n //Compares minutes\n if (parseInt(date1.substr(15, 2)) > parseInt(date2.substr(15, 2))) return true\n else return false\n }\n }\n }\n }\n}", "function by_datetime( a, b ) {\n\n const a_date = moment( a.day.split(' - ')[1], 'MM/DD/YYYY');\n const b_date = moment( b.day.split(' - ')[1], 'MM/DD/YYYY');\n\n if ( b_date.isAfter( a_date ) ) {\n return -1;\n } else if ( b_date.isBefore( a_date ) ) {\n return 1;\n } else {\n return 0;\n }\n\n}", "function compararFecha(fecha, fecha2) {\n var xMonth = fecha.substring(3, 5);\n var xDay = fecha.substring(0, 2);\n var xYear = fecha.substring(6, 10);\n var yMonth = fecha2.substring(3, 5);\n var yDay = fecha2.substring(0, 2);\n var yYear = fecha2.substring(6, 10);\n if (xYear > yYear) {\n return 1;\n }\n else {\n if (xYear == yYear) {\n if (xMonth > yMonth) {\n return 1;\n }\n else {\n if (xMonth == yMonth) {\n if (xDay == yDay) {\n return 0;\n } else {\n if (xDay > yDay)\n return 1;\n else\n return -1;\n }\n }\n else\n return -1;\n }\n }\n else\n return -1;\n }\n}", "function compare(left, right, option) {\n var leftDate = ensureDate(left),\n rightDate = ensureDate(right);\n if (!leftDate || !rightDate) return null;\n\n if (option === 'date' || option === 'd') {\n leftDate = ensureDate(formatDate(leftDate, true));\n rightDate = ensureDate(formatDate(rightDate, true));\n }\n return leftDate.getTime() - rightDate.getTime();\n}", "function compare(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n return 1;\n return 0;\n }", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year > auto2.year) {\n return true;\n } else {\n return false;\n }\n}", "function SP_CompareDates(firstDate, secondDate) {\n\tif (arguments.length === 2) {\n\t\tvar date1 = SP_Trim(document.getElementById(firstDate).value),\n\t\t\tdate2 = SP_Trim(document.getElementById(secondDate).value),\n\t\t\tdiff = \"\";\n\t\t\n\t\tif (SP_Trim(date1) != \"\" && SP_Trim(date2) != \"\") {\n\t\t\tif (languageSelect && languageSelect !== \"en_us\") {\n\t\t\t\tvar enteredDate1 = date1.split('-'),\n\t\t\t\t\tenteredDate2 = date2.split('-');\n\t\t\t\t\n\t\t\t\tswitch (dateFormat) {\n\t\t\t\t\tcase \"dd-mmm-yyyy\":\n\t\t\t\t\t\tdate1 = new Date(enteredDate1[2], SP_GetMonthNumber(enteredDate1[1]), enteredDate1[0]);\n\t\t\t\t\t\tdate2 = new Date(enteredDate2[2], SP_GetMonthNumber(enteredDate2[1]), enteredDate2[0]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"yyyy-mm-dd\":\n\t\t\t\t\t\tdate1 = new Date(enteredDate1[0], enteredDate1[1], enteredDate1[2]);\n\t\t\t\t\t\tdate2 = new Date(enteredDate2[0], enteredDate2[1], enteredDate2[2]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdate1 = new Date(date1.replace(/-/g,' '));\n\t\t\t\tdate2 = new Date(date2.replace(/-/g,' '));\n\t\t\t}\n\t\t\n\t\t\tdiff = date1 - date2;\n\t\t\tdiff = diff > 0 ? 1 : diff < 0 ? -1 : 0;\n\t\t}\n\n\t\treturn diff;\n\t}\n}", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function compareChargeDate(a, b){\n if(a.scheduledSubmitDate < b.scheduledSubmitDate) {\n\t\treturn -1;\n\t} else if(a.scheduledSubmitDate > b.scheduledSubmitDate) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}", "function compareDate(fromDate, toDate){\r\n\t// check both value is there or not\r\n\t// in else it will return true its due to date field validation is done on form level\r\n\tif (toDate != '' && fromDate != ''){\r\n\t\t// extract day month and year from both of date\r\n\t\tvar fromDay = fromDate.substring(0, 2);\r\n\t\tvar toDay = toDate.substring(0, 2);\r\n\t\tvar fromMon = eval(fromDate.substring(3, 5)-1);\r\n\t\tvar toMon = eval(toDate.substring(3, 5)-1);\r\n\t\tvar fromYear = fromDate.substring(6, 10);\r\n\t\tvar toYear = toDate.substring(6, 10);\r\n\r\n\t\t// convert both date in date object\r\n\t\tvar fromDt = new Date(fromYear, fromMon, fromDay);\r\n\t\tvar toDt = new Date(toYear, toMon, toDay); \r\n\r\n\t\t// compare both date \r\n\t\t// if fromDt is greater than toDt return false else true\r\n\t\tif (fromDt > toDt) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}else{\r\n\t\treturn true;\r\n\t}\r\n}", "function compareFunc(a, b) {\n return a - b;\n }", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year < auto2.year) {\n \treturn true;\n }\n else {\n \treturn false;\n }\n}", "function yearComparator( auto1, auto2){\r\n if(auto1.year >= auto2.year){\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}", "function compare(a, b) {\n // Use toUpperCase() to ignore character casing\n const timeA = new Date(a[1].created);\n const timeB = new Date(b[1].created);\n\n console.log(a, '--', b)\n\n let comparison = 0;\n if (timeA > timeB) {\n comparison = 1;\n } else if (timeA < timeB) {\n comparison = -1;\n }\n return comparison * -1;\n}", "function sortFunc(a, b) {\n var aDate = new Date(a.time);\n var bDate = new Date(b.time);\n\n if (aDate > bDate) {\n return -1;\n } else if (aDate < bDate) {\n return 1;\n } else {\n return 0;\n }\n }", "function sort_by_date(a, b) {\n return new Date(b.date_published).getTime() - new Date(a.date_published).getTime();\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function less(a,b) {\r\n return a.date < b.date;\r\n}", "function compare(a,b) {\n if (a.announcementDate > b.announcementDate)\n return -1;\n if (a.announcementDate < b.announcementDate)\n return 1;\n return 0;\n }", "function cmp(a, b) {\n let yearA = a[0].years[0]\n let yearB = b[0].years[0]\n return (yearB > yearA) ? 1 : ((yearB < yearA) ? -1 : 0)\n }", "function compareDates$static(d1/*:Date*/, d2/*:Date*/)/*:Number*/ {\n if (d1 === d2) {\n return 0;\n }\n\n if (d1 && d2) {\n var time1/*:Number*/ = d1.getTime();\n var time2/*:Number*/ = d2.getTime();\n if (time1 === time2) {\n return 0;\n } else if (time1 > time2) {\n return 1;\n }\n return -1;\n }\n\n if (!d1) {\n return 1;\n }\n\n if (!d2) {\n return -1;\n }\n }", "function compareDatePart(date1, date2) {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function yearComparator( auto1, auto2){\r\n\r\n if (auto1.year > auto2.year){\r\n return false;\r\n }else if(auto1.year < auto2.year){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n }", "function customComparator(actual, expected) {\n // console.debug('act, expect', actual, expected);\n // console.debug('type act', typeof actual);\n\n var isBeforeActivated = expected.before;\n var isAfterActivated = expected.after;\n var isLower = expected.lower;\n var isHigher = expected.higher;\n var higherLimit;\n var lowerLimit;\n var itemDate;\n var queryDate;\n\n\n if (ng.isObject(expected)) {\n\n //date range\n if (expected.before || expected.after) {\n try {\n if (isBeforeActivated) {\n higherLimit = expected.before;\n\n itemDate = new Date(actual);\n queryDate = new Date(higherLimit);\n\n if (itemDate > queryDate) {\n return false;\n }\n }\n\n if (isAfterActivated) {\n lowerLimit = expected.after;\n\n\n itemDate = new Date(actual);\n queryDate = new Date(lowerLimit);\n\n if (itemDate < queryDate) {\n return false;\n }\n }\n\n return true;\n } catch (e) {\n return false;\n }\n\n } else if (isLower || isHigher) {\n //number range\n if (isLower) {\n higherLimit = expected.lower;\n\n if (actual > higherLimit) {\n return false;\n }\n }\n\n if (isHigher) {\n lowerLimit = expected.higher;\n if (actual < lowerLimit) {\n return false;\n }\n }\n\n return true;\n }\n //etc\n\n return true;\n\n }\n return standardComparator(actual, expected);\n }", "function compareDashedDates(date1, date2) {\n console.log(date1);\n console.log(date2);\n date1 = date1.split('-');\n date2 = date2.split('-');\n console.log(date1);\n console.log(date2);\n for (let i = 0; i < date1.length; i++) {\n if (parseInt(date1[i]) < parseInt(date2[i])) {\n return true;\n } else if (parseInt(date1[i]) > parseInt(date2[i])) {\n return false;\n }\n }\n return true;\n}", "function compare(a, b) {\n var date2 = new Date(parseInt(a.created_time) * 1000),\n date1 = new Date(parseInt(b.created_time) * 1000);\n\n if (date1 < date2)\n return -1;\n if (date1 > date2)\n return 1;\n return 0;\n }", "function Date$prototype$lte(other) {\n return lte (this.valueOf (), other.valueOf ());\n }", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "function compare(a, b) {\n if (a.timeStamp > b.timeStamp) {\n return -1;\n }\n if (a.timeStamp < b.timeStamp) {\n return 1;\n }\n\n return 0;\n }", "function compare(a, b) {\n if (a.timeStamp > b.timeStamp) {\n return -1;\n }\n if (a.timeStamp < b.timeStamp) {\n return 1;\n }\n\n return 0;\n }", "function yearComparator(auto1, auto2){\n return auto2.year - auto1.year;\n}", "function Date$prototype$lte(other) {\n return lte(this.valueOf(), other.valueOf());\n }", "function yearComparator(student1, student2) {\n var one_year = student1.yearInSchool\n var two_year = student2.yearInSchool\n if (one_year > two_year) {\n return true;\n } else {\n return false;\n }\n}", "function compareDate(date1, date2) {\n\n //Hours equal\n if (date1.getHours() == date2.getHours()) {\n\n //Check minutes\n if (date1.getMinutes() == date2.getMinutes()) {\n return 0;\n } else {\n if (date1.getMinutes() > date2.getMinutes()) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n\n //Hours not equal\n else {\n if (date1.getHours() > date2.getHours()) {\n return 1;\n } else {\n return -1;\n }\n }\n}", "function compareEarliestFn(a, b) {\n const workA = a.deadline;\n const workB = b.deadline;\n\n let comparison = 0;\n if (workA > workB) {\n comparison = 1;\n } else if (workA < workB) {\n comparison = -1;\n }\n return comparison;\n}" ]
[ "0.73501474", "0.7120855", "0.70249486", "0.70114815", "0.6975558", "0.69590884", "0.6923796", "0.6900942", "0.689917", "0.68973756", "0.68314284", "0.68014747", "0.6645342", "0.6622629", "0.6592738", "0.65926725", "0.6576781", "0.6573856", "0.6554653", "0.65489477", "0.65375435", "0.65065855", "0.64956987", "0.64830315", "0.64773995", "0.6472955", "0.6443351", "0.6443351", "0.6441235", "0.6434403", "0.64299434", "0.64263135", "0.64027345", "0.6378975", "0.6356664", "0.63550746", "0.63418585", "0.6340684", "0.63209176", "0.6266894", "0.62642354", "0.624295", "0.6218911", "0.6201163", "0.61711913", "0.61644375", "0.6161616", "0.61442035", "0.6136747", "0.6124182", "0.6122587", "0.6122587", "0.6105584", "0.61053944", "0.6043871", "0.60285723", "0.6015315", "0.60102254", "0.60021716", "0.59978163", "0.59576845", "0.5943359", "0.5929745", "0.5928963", "0.5928963", "0.5923805", "0.58768344", "0.5875524", "0.58631957", "0.5855397", "0.5854566", "0.58475715", "0.58365893", "0.5827728", "0.5818448", "0.58177966", "0.5815607", "0.5813964", "0.58137417", "0.5810299", "0.5796078", "0.5796078", "0.5796078", "0.5796078", "0.5796078", "0.5796065", "0.5796035", "0.5781181", "0.57774985", "0.577361", "0.576545", "0.57645595", "0.5760267", "0.57544464", "0.57544464", "0.57380235", "0.57196695", "0.57123566", "0.5697495", "0.5693216" ]
0.7148702
1
Compares if dates appear in the same logical quarter
function compareQuarters(d1, d2) { var m1 = d1.getMonth(); var m2 = d2.getMonth(); var q1 = (Math.floor(m1 / 3) * 3); var q2 = (Math.floor(m2 / 3) * 3); if (q1 > q2) return 1; if (q1 < q2) return -1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareQuarterYears(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareQuarters(d1, d2);\n }\n return r;\n }", "function getCurrentQuarter(){\n let startDate = new Date()\n let endDate = new Date()\n let month = endDate.getMonth()\n let mod = month % 3 \n // Aktuelles Quartal Berechnung Beispiel März: month = 2, mod: 2 % 3 = 2 , Aktuelles Quartal = Monat 2 - mod 2 = 0 (0 = Januar bis Heute)\n startDate.setFullYear(endDate.getFullYear(), month - mod, 1)\n startDate.setHours(0,0,0,0)\n endDate.setHours(23,59,59,0)\n dates[0] = startDate\n dates[1] = endDate\n return dates\n}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "testCase1_3() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), 0);\n if (Number(_tc1) == Number(new Date(\"2016-09-03\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "function calculateQuarterlyPerf(qrts) {\n qrts.map(function (qtr, index) {\n let compQuarter = qrts.find(\n (q) => q.name == getComparativeQuarterName(qtr)\n );\n if (isDefined(compQuarter)) {\n if (compQuarter.eps.eps != 0) {\n qtr.eps.negativeCompQtr = false;\n qtr.eps.negativeTurnaround = false;\n qtr.eps.perf = calculatePercentChange(\n qtr.eps.eps,\n compQuarter.eps.eps\n );\n if (qtr.eps.eps < 0 && compQuarter.eps.eps) {\n qtr.eps.negativeCompQtr = true;\n } else if (compQuarter.eps.eps < 0) {\n qtr.eps.negativeTurnaround = true;\n }\n }\n if (isAbleToCalculateQtrRevChange(qtr, compQuarter)) {\n qtr.rev.perf = calculatePercentChange(\n qtr.rev.rev,\n compQuarter.rev.rev\n );\n }\n }\n });\n}", "function isSame(date1, date2, period){\n if (period) {\n date1 = startOf(date1, period);\n date2 = startOf(date2, period);\n }\n return Number(date1) === Number(date2);\n }", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function compareDates(mixDataInicial, mixDataFinal)\n{\n var dataInicial = getObject(mixDataInicial);\n var dataFinal = getObject(mixDataFinal);\n if ((empty(dataInicial)) || (empty(dataFinal)))\n return false;\n return compareDatesValues(dataInicial.value, dataFinal.value);\n}", "function calendar_helper_dateEquals(date1, date2){\n if (date1.getFullYear() == date2.getFullYear())\n if (date1.getMonth() == date2.getMonth())\n if (date1.getDate() == date2.getDate())\n return true;\n return false;\n}", "getNextQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth() + 3,\n lastMonth = startMonth + 2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "function sameDate(d1, d2) {\n return d1.getMonth === d2.getMonth && d1.getFullYear() === d2.getFullYear();\n}", "Q (date) {\n return Math.ceil((date.getMonth() + 1) / 3)\n }", "testCase1_1() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), -2);\n if (Number(_tc1) == Number(new Date(\"2016-09-01\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "getCurrentQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth(),\n lastMonth = startMonth+2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "static getQuarterStartMonth () { \n let nowMonth = new Date().getMonth();\n var quarterStartMonth = 0; \n if(nowMonth<3){ \n quarterStartMonth = 0; \n } \n if(2<nowMonth && nowMonth<6){ \n quarterStartMonth = 3; \n } \n if(5<nowMonth && nowMonth<9){ \n quarterStartMonth = 6; \n } \n if(nowMonth>8){ \n quarterStartMonth = 9; \n } \n return quarterStartMonth; \n }", "testCase1_2() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), 2);\n if (Number(_tc1) == Number(new Date(\"2016-09-05\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date1) !== Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date2) || Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date1) !== Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date1) !== Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date2) || Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date1) !== Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date2);\n }\n\n return date1 !== date2;\n}", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function compareDate(dos, rd) {\n\n }", "static isSameDate(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n && dateA.getDate() === dateB.getDate()\n );\n }", "function findFYQ(date) {\n let year = date.substring(0,4)\n let month = date.substring(5,7)\n let quarter = Math.floor(month / 3) + 1\n return `${year} Q${quarter}`\n }", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "getPreviousQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth() - 3,\n lastMonth = startMonth + 2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function isDateWithinSameDay(date1, date2) {\n return date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear();\n }", "function dateValid(dateArray, dateToCheck) {\n return dateArray.join() === [dateToCheck.getMonth()+1, dateToCheck.getDate(), dateToCheck.getFullYear()].join()\n}", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function _isNextYear(d1, d2) {\n return d2.getFullYear() - d1.getFullYear() === 1;\n }", "function isSameDate(date1, date2) {\n return (date1 instanceof Date && date2 instanceof Date && date1.getDay()==date2.getDay() && date1.getMonth()==date2.getMonth() && date1.getFullYear()==date2.getFullYear());\n}", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "function isChangedDate(prev, next) {\n return !dateComparator(prev, next);\n}", "function compareDay(day1, day2){\n return day1.getFullYear() === day2.getFullYear() &&\n day1.getMonth() === day2.getMonth() &&\n day1.getDate() === day2.getDate();\n}", "sameDay(d1, d2) {\n return d1.getFullYear() === d2.getFullYear() &&\n d1.getMonth() === d2.getMonth() &&\n d1.getDate() === d2.getDate();\n }", "quarterBefore(quarters){\n if(! quarters) return this;\n this.subtractQuarters(quarters);\n return this;\n }", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function sameYearAndMonth(d1, d2) {\n\treturn (\n\t\td1.getFullYear() == d2.getFullYear() &&\n\t\td1.getMonth() == d2.getMonth()\n\t);\n}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "async function checkDateMatchCurrentSeason(datetimeObj){\n const current_season_date = await getCurrentSeasonDate()\n return current_season_date[0] == datetimeObj.getFullYear() || datetimeObj.getFullYear() == current_season_date[1] \n}", "isSameWeek(date) {\n const universalDate = new UniversalDate(date);\n return universalDate.year === this.year && universalDate.week === this.week;\n }", "function getStartOfPreviousQuarter(baseDate) {\n\n var startOfPreviousQuarter = null;\n\n switch(baseDate.getMonth()) {\n case 0:\n case 1:\n case 2:\n startOfPreviousQuarter = new Date(baseDate.getFullYear() - 1, 9, 1);\n break;\n case 3:\n case 4:\n case 5:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 0, 1);\n break;\n case 6:\n case 7:\n case 8:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 3, 1);\n break;\n case 9:\n case 10:\n case 11:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 6, 1);\n break;\n }\n\n return startOfPreviousQuarter;\n}", "function libraryFine(d1, m1, y1, d2, m2, y2) {\n // I would start off comparing the years...\n // if the year it was returned is greater than the due date year, return 10,000.\n if(y1 > y2){\n return 10000\n // else if the year is equal to the due date year...\n } else if(y1 === y2){\n // we check if the month is greater than the due date month..\n if(m1 > m2){\n // we check if the day it was returned is greater or equal than the due date day, and also if the year it was returned is greater than the due date year.\n if(d1 >= d2 && y1 > y2){\n // if it is, we return 10,000..\n return 10000\n // otherwise, it has not been more than a year so... \n } else {\n // we subtract the returned month minus the due date month..\n let result = Math.abs(m1 - m2)\n // and we return the multiplication of the result times 500.\n return 500 * result\n }\n // else if the month is returned is less than the due date month, we return 0.\n } else if(m1 < m2){\n return 0\n }\n // if the day is greater than the due date day...\n if(d1 > d2){\n // we subtract the returned day minus the due date day..\n let result = Math.abs(d1 - d2)\n // and return the result times 15.\n return 15 * result\n }\n }\n // if none of this returns anything, there might be an edge case that it was not returned late, so we still need to return 0.\n return 0\n}", "function CompararDatas (dataInicial, dataFinal) {\n if (dataInicial.length !== 10 || dataFinal.length !== 10) {\n return true\n }\n const d1 = new Date(dataInicial)\n const d2 = new Date(dataFinal)\n return d1 > d2\n}", "isSameYear(date) {\n const universalDate = new UniversalDate(date);\n return universalDate.year === this.year;\n }", "quarterAfter(quarters){\n if(! quarters) return this;\n this.addQuarters(quarters);\n return this;\n }", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function isSameDate(inDate) {\n const dates = Date().split(' ');\n const localDates = inDate.split(' ');\n if (localDates[0] === dates[1] &&\n localDates[1] === dates[2] &&\n localDates[2] === dates[3]) {\n return true;\n }\n return false;\n }", "Qo (date) {\n return getOrdinal(this.Q(date))\n }", "function compareDatesValues(strDataInicial, strDataFinal)\n{\n if ((empty(strDataInicial)) || (empty(strDataFinal)))\n return false;\n if ((strDataInicial.length < 10) || (strDataFinal.length < 10))\n return false;\n if (convertDate(strDataInicial, 'YmdHis') > convertDate(strDataFinal, 'YmdHis')) {\n alertDialog('A data inicial deve ser sempre menor ou igual a data final.', 'Validação', 250, 150);\n return false;\n }\n return true;\n}", "function checkDates(date){\n if (dateInputInt === 0){\n return true;\n }\n else {\n if (dateCond === 'equalsdate'){\n return date === dateInputInt;\n }\n else if (dateCond === 'greaterthan'){\n return date > dateInputInt;\n }\n else if (dateCond === 'lessthan'){\n return date < dateInputInt;\n }\n }\n }", "function compareDatePart(date1, date2) {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}", "compareTo (other) {\n // first criterion: day\n if (this.day < other.day) {\n return -1\n } else if (this.day > other.day) {\n return 1\n }\n // day equals\n\n // second criterion: finished\n if (this.finished && !other.finished) {\n return -1\n } else if (!this.finished && other.finished) {\n return 1\n }\n // finished equals\n\n // third criterion: dayOrder\n if (this.dayOrder > other.dayOrder) {\n return 1\n } else if (this.dayOrder < other.dayOrder) {\n return -1\n }\n\n // all criterions equaled\n return 0\n }", "function compareFuture(sender, args)\n{\n args.IsValid = true;\n\n var todaypart = getDatePart(new Date().format(\"dd/MM/yyyy\"));\n var datepart = getDatePart(args.Value);\n\n var today = new Date(todaypart[2], (todaypart[1] - 1), todaypart[0]);\n var date = new Date(datepart[2], (datepart[1] - 1), datepart[0]);\n\n if (date >= today) {\n args.IsValid = true;\n }\n else\n {\n args.IsValid = false;\n }\n\n return args.IsValid;\n}", "function isOverloaded(projectIds) {\n const empProjects = projects.filter(el => projectIds.includes(el.id));\n const projectsWithEndDate = empProjects.map(el => calculateProjectEndDate(el));\n let counter = 0;\n for (let i = 0; i < projectsWithEndDate.length - 1; i++) {\n for (let j = 1; j < projectsWithEndDate.length; j++) {\n if (\n (projectsWithEndDate[j].startDate >= projectsWithEndDate[i].startDate &&\n projectsWithEndDate[j].startDate <= projectsWithEndDate[i].endDate) ||\n (projectsWithEndDate[j].endDate >= projectsWithEndDate[i].startDate &&\n projectsWithEndDate[j].endDate <= projectsWithEndDate[i].endDate)\n ) {\n counter++;\n if (counter == 3) {\n return true;\n }\n }\n }\n }\n return false;\n}", "function checkChange(dateOne, dateTwo, unit, utc) {\n dateOne = new Date(dateOne.getTime());\n dateTwo = new Date(dateTwo.getTime());\n var timeZoneOffset1 = 0;\n var timeZoneOffset2 = 0;\n if (!utc && unit != \"millisecond\") {\n timeZoneOffset1 = dateOne.getTimezoneOffset();\n dateOne.setUTCMinutes(dateOne.getUTCMinutes() - timeZoneOffset1);\n timeZoneOffset2 = dateTwo.getTimezoneOffset();\n dateTwo.setUTCMinutes(dateTwo.getUTCMinutes() - timeZoneOffset2);\n }\n var changed = false;\n switch (unit) {\n case \"year\":\n if (dateOne.getUTCFullYear() != dateTwo.getUTCFullYear()) {\n changed = true;\n }\n break;\n case \"month\":\n if (dateOne.getUTCFullYear() != dateTwo.getUTCFullYear()) {\n changed = true;\n }\n else if (dateOne.getUTCMonth() != dateTwo.getUTCMonth()) {\n changed = true;\n }\n break;\n case \"day\":\n if (dateOne.getUTCMonth() != dateTwo.getUTCMonth()) {\n changed = true;\n }\n else if (dateOne.getUTCDate() != dateTwo.getUTCDate()) {\n changed = true;\n }\n break;\n case \"hour\":\n if (dateOne.getUTCHours() != dateTwo.getUTCHours()) {\n changed = true;\n }\n break;\n case \"minute\":\n if (dateOne.getUTCMinutes() != dateTwo.getUTCMinutes()) {\n changed = true;\n }\n break;\n case \"second\":\n if (dateOne.getUTCSeconds() != dateTwo.getUTCSeconds()) {\n changed = true;\n }\n break;\n case \"millisecond\":\n if (dateOne.getTime() != dateTwo.getTime()) {\n changed = true;\n }\n break;\n }\n if (changed) {\n return true;\n }\n var nextUnit = getNextUnit(unit);\n if (nextUnit) {\n dateOne.setUTCMinutes(dateOne.getUTCMinutes() + timeZoneOffset1);\n dateTwo.setUTCMinutes(dateTwo.getUTCMinutes() + timeZoneOffset2);\n return checkChange(dateOne, dateTwo, nextUnit, utc);\n }\n else {\n return false;\n }\n}", "function compareDashedDates(date1, date2) {\n console.log(date1);\n console.log(date2);\n date1 = date1.split('-');\n date2 = date2.split('-');\n console.log(date1);\n console.log(date2);\n for (let i = 0; i < date1.length; i++) {\n if (parseInt(date1[i]) < parseInt(date2[i])) {\n return true;\n } else if (parseInt(date1[i]) > parseInt(date2[i])) {\n return false;\n }\n }\n return true;\n}", "function active_project(end_date) {\n var cur_date = new Date();\n end_date = new Date(end_date);\n\n if (cur_date <= end_date) {\n return 1;\n }\n\n return 0;\n}", "function isEqual(d1, d2) {\n if (d1 === d2) {\n return true;\n } else if (Math.abs(Date.parse(d1) - Date.parse(d2)) <= 1000) {\n return true;\n } else { \n return false;\n }\n}", "function isAfter (date1, date2) {\n if (date1.getFullYear() > date2.getFullYear()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() > date2.getMonth()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() >= date2.getMonth() && date1.getDate() >= date2.getDate()) return true\n else return false\n}", "get hasValidDates() {\n const {\n startDateMS,\n endDateMS\n } = this;\n return !startDateMS || !endDateMS || endDateMS - startDateMS >= 0;\n }", "function dataSalesPerQuarter(obj) {\n for (var i = 0; i < obj.length; i++) {\n var formattedData = moment(obj[i].date, \"DD/MM/YYYY\");\n var currentQuarter = \"Q\"+formattedData.quarter();\n console.log(\"currentQuarter: \" + currentQuarter);\n var employeeSale = obj[i].amount;\n quarter[currentQuarter] += employeeSale;\n }\n labelQuarterSales = Object.keys(quarter);\n dataQuarterSales = Object.values(quarter);\n}", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function Date$prototype$equals(other) {\n return equals(this.valueOf(), other.valueOf());\n }", "isSameDay(date) {\n const universalDate = new UniversalDate(date);\n return universalDate.year === this.year && universalDate.week === this.week && universalDate.dayOfWeek === this.dayOfWeek;\n }", "function Date$prototype$equals(other) {\n return equals (this.valueOf (), other.valueOf ());\n }", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "function isDateProfilesEqual(p0, p1) {\n return rangesEqual(p0.validRange, p1.validRange) && rangesEqual(p0.activeRange, p1.activeRange) && rangesEqual(p0.renderRange, p1.renderRange) && durationsEqual(p0.minTime, p1.minTime) && durationsEqual(p0.maxTime, p1.maxTime);\n /*\n TODO: compare more?\n currentRange: DateRange\n currentRangeUnit: string\n isRangeAllDay: boolean\n isValid: boolean\n dateIncrement: Duration\n */\n }", "function _isNextMonth(d1, d2) {\n if (_isSameYear(d1, d2)) {\n return d2.getMonth() - d1.getMonth() === 1;\n } else if (_isNextYear(d1, d2)) {\n return d1.getMonth() === 11 && d2.getMonth() === 0;\n }\n return false;\n }", "function costruttoreDatiQuarter(array) {\n var objIntermedio = {};\n var dataPC = [];\n for (var i = 0; i < array.length; i++) {\n var oggettoSingolo = array[i];\n var giornoVendita = oggettoSingolo.date;\n var quarterVendita = moment(giornoVendita, \"DD-MM-YYYY\").quarter(); // ottengo i numeri dei quadrimestri\n if (objIntermedio[quarterVendita] === undefined) {\n objIntermedio[quarterVendita] = 0;\n }\n objIntermedio[quarterVendita] += parseInt(oggettoSingolo.amount);\n }\n for (var key in objIntermedio) {\n dataPC.push(objIntermedio[key]);\n }\n return dataPC;\n}", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "function compareDateDetail(partsIndex, date1, date2) {\n let r = 0;\n for (let i = partsIndex; r === 0 && i >= 0; i -= 1) {\n const a = date1[`get${parts[i][0]}`]();\n const b = date2[`get${parts[i][0]}`]();\n r = compare(a, b);\n }\n\n return r;\n }", "function verificaDatas(dtInicial, dtFinal, hrInicial, hrFinal) {\n\n var dtini = dtInicial;\n var dtfim = dtFinal;\n var hrini = hrInicial;\n var hrfim = hrFinal;\n\n if ((dtini == '') && (dtfim == '') && (hrini == '') && (hrfim == '')) {\n return false;\n }\n\n datInicio = new Date(dtini.substring(6, 10), dtini.substring(3, 5), dtini.substring(0, 2));\n datInicio.setMonth(datInicio.getMonth() - 1);\n\n datInicio.setHours(hrini.substring(0, 2));\n datInicio.setMinutes(hrini.substring(5, 2).replace(':', ''));\n\n datFim = new Date(dtfim.substring(6, 10), dtfim.substring(3, 5), dtfim.substring(0, 2));\n\n datFim.setMonth(datFim.getMonth() - 1);\n\n datFim.setHours(hrfim.substring(0, 2));\n datFim.setMinutes(hrfim.substring(5, 2).replace(':', ''));\n\n if (datInicio <= datFim) {\n return true;\n } else {\n return false;\n }\n}", "function isDateProfilesEqual(p0, p1) {\n return rangesEqual(p0.validRange, p1.validRange) &&\n rangesEqual(p0.activeRange, p1.activeRange) &&\n rangesEqual(p0.renderRange, p1.renderRange) &&\n durationsEqual(p0.minTime, p1.minTime) &&\n durationsEqual(p0.maxTime, p1.maxTime);\n /*\n TODO: compare more?\n currentRange: DateRange\n currentRangeUnit: string\n isRangeAllDay: boolean\n isValid: boolean\n dateIncrement: Duration\n */\n }", "function isDateProfilesEqual(p0, p1) {\n return rangesEqual(p0.validRange, p1.validRange) &&\n rangesEqual(p0.activeRange, p1.activeRange) &&\n rangesEqual(p0.renderRange, p1.renderRange) &&\n durationsEqual(p0.minTime, p1.minTime) &&\n durationsEqual(p0.maxTime, p1.maxTime);\n /*\n TODO: compare more?\n currentRange: DateRange\n currentRangeUnit: string\n isRangeAllDay: boolean\n isValid: boolean\n dateIncrement: Duration\n */\n }", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function checkDecreasing(numericDates) {\n var datesByYear = groupArrayByValueAtIndex$1(numericDates, 2);\n var results = datesByYear.map(function (dates) {\n var daysFirst = dates.slice(1).some(function (date, i) {\n var _dates$i = _slicedToArray(dates[i], 1),\n first1 = _dates$i[0];\n\n var _date = _slicedToArray(date, 1),\n first2 = _date[0];\n\n return isNegative$1(first2 - first1);\n });\n\n if (daysFirst) {\n return true;\n }\n\n var daysSecond = dates.slice(1).some(function (date, i) {\n var _dates$i2 = _slicedToArray(dates[i], 2),\n second1 = _dates$i2[1];\n\n var _date2 = _slicedToArray(date, 2),\n second2 = _date2[1];\n\n return isNegative$1(second2 - second1);\n });\n\n if (daysSecond) {\n return false;\n }\n\n return null;\n });\n var anyTrue = results.some(function (value) {\n return value === true;\n });\n\n if (anyTrue) {\n return true;\n }\n\n var anyFalse = results.some(function (value) {\n return value === false;\n });\n\n if (anyFalse) {\n return false;\n }\n\n return null;\n }", "function isSameDay( lhs, rhs ) {\n if ( lhs === undefined || rhs === undefined ) {\n return false;\n } else {\n var normalizedDate = new Date( rhs );\n normalizedDate.setHours( 0, 0, 0, 0 );\n return lhs.getTime() === normalizedDate.getTime();\n }\n }", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "function _isSameYear(d1, d2) {\n return d1.getFullYear() === d2.getFullYear();\n }", "function FiveFieldTimeIsEqual(arrA, arrB) {\n \tfor (var i=0; i<arrA.length; i++) {\n \t\tif (arrA[i]!=arrB[i]) return false;\n \t}\n \treturn true;\n}" ]
[ "0.69359875", "0.61757916", "0.6020083", "0.60103697", "0.59846246", "0.58858174", "0.5853647", "0.5846302", "0.5828677", "0.58286446", "0.5808071", "0.57497674", "0.5706315", "0.56884485", "0.5653579", "0.56431323", "0.56376064", "0.5606512", "0.5584658", "0.55477524", "0.55320585", "0.55124015", "0.55124015", "0.5508306", "0.5497128", "0.54911083", "0.5481893", "0.54643047", "0.5462198", "0.5450383", "0.5450383", "0.54348016", "0.5406802", "0.5406802", "0.5406802", "0.5406802", "0.54002565", "0.5391816", "0.53738683", "0.53738683", "0.53616846", "0.5339295", "0.5338048", "0.5333566", "0.5333566", "0.5280858", "0.52776855", "0.5267053", "0.5249851", "0.52489215", "0.5248903", "0.5246123", "0.52357364", "0.52357364", "0.52357364", "0.52168906", "0.52168906", "0.52155036", "0.51719797", "0.51693165", "0.51678675", "0.5165096", "0.5129945", "0.512879", "0.5115557", "0.5109211", "0.51085865", "0.5108183", "0.50827885", "0.50775623", "0.5073798", "0.50512064", "0.504736", "0.50416666", "0.50400233", "0.5037436", "0.50351346", "0.5030726", "0.50145453", "0.50029755", "0.50021344", "0.49954435", "0.499378", "0.49883258", "0.49720106", "0.496842", "0.49665514", "0.49589193", "0.49549598", "0.49490616", "0.49428385", "0.49332592", "0.49332592", "0.49301913", "0.49236274", "0.4922728", "0.49223706", "0.492003", "0.49194935", "0.4912554" ]
0.703043
0
Compares one date with another disregarding the year component
function compareDayMonths(d1, d2) { var r = compareMonths(d1, d2); if (r === 0) { r = compareDays(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function yearBefore(d1, d2) {\n return d1.getFullYear() < d2.getFullYear();\n }", "function _isSameYear(d1, d2) {\n return d1.getFullYear() === d2.getFullYear();\n }", "function compare(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n return 1;\n return 0;\n }", "function compareYear(a, b) {\r\n if (a.YEAR < b.YEAR)\r\n return -1;\r\n else if (a.YEAR > b.YEAR)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function isWithinYear(date1, date2) {\n\t\tvar year1 = parseInt(date1[0]);\n\t\tvar year2 = parseInt(date2[0]);\n\t\tvar month1 = parseInt(date1[1]);\n\t\tvar month2 = parseInt(date2[1]);\n\t\tvar day1 = parseInt(date1[2]);\n\t\tvar day2 = parseInt(date2[2]);\n\t\tif (year1 === year2) {\n\t\t\treturn true;\n\t\t} else if (year2 === year1 + 1 && (month2 < month1) || (month2 === month1 && day2 < day1)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function compareYears(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n return 1;\n return 0;\n }", "isSameYear(date1, data2) {\n\t\treturn Moment(date1).isSame(data2, 'year');\n\t}", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "isSameYear(date) {\n const universalDate = new UniversalDate(date);\n return universalDate.year === this.year;\n }", "function yearComparator( auto1, auto2){\r\n if(auto1.year >= auto2.year){\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function yearComparator(auto1, auto2){\n return auto2.year - auto1.year;\n}", "function _isNextYear(d1, d2) {\n return d2.getFullYear() - d1.getFullYear() === 1;\n }", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function filterYear(d) {\r\n return (d.year === yearcompare)\r\n }", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "function calendar_helper_dateEquals(date1, date2){\n if (date1.getFullYear() == date2.getFullYear())\n if (date1.getMonth() == date2.getMonth())\n if (date1.getDate() == date2.getDate())\n return true;\n return false;\n}", "function compareDate(fromDate, toDate) {\r\r\tvar dt1 = parseInt(fromDate.substring(0, 2), 10);\r\r\tvar mon1 = parseInt(fromDate.substring(3, 5), 10);\r\r\tvar yr1 = parseInt(fromDate.substring(6, 10), 10);\r\r\tvar dt2 = parseInt(toDate.substring(0, 2), 10);\r\r\tvar mon2 = parseInt(toDate.substring(3, 5), 10);\r\r\tvar yr2 = parseInt(toDate.substring(6, 10), 10);\r\r\tvar date1 = new Date(yr1, mon1, dt1);\r\r\tvar date2 = new Date(yr2, mon2, dt2);\r\r\tif (date1 > date2) {\r\r\t\treturn 1;\r\r\t} else {\r\r\t\tif (date1 < date2) {\r\r\t\t\treturn -1;\r\r\t\t} else {\r\r\t\t\treturn 0;\r\r\t\t}\r\r\t}\r\r}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function yearComparator( auto1, auto2){\r\n\r\n if (auto1.year > auto2.year){\r\n return false;\r\n }else if(auto1.year < auto2.year){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n}", "yearChangeRequiresMapping(year1, year2) {\n if (year1 === \"2017\") return year2 !== \"2017\";\n if (year2 === \"2017\") return year1 !== \"2017\";\n return false;\n }", "function cmp(a, b) {\n let yearA = a[0].years[0]\n let yearB = b[0].years[0]\n return (yearB > yearA) ? 1 : ((yearB < yearA) ? -1 : 0)\n }", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year < auto2.year) {\n \treturn true;\n }\n else {\n \treturn false;\n }\n}", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "function sameDate(d1, d2) {\n return d1.getMonth === d2.getMonth && d1.getFullYear() === d2.getFullYear();\n}", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "static isSameDate(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n && dateA.getDate() === dateB.getDate()\n );\n }", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year > auto2.year) {\n return true;\n } else {\n return false;\n }\n}", "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function isYear(t) {\n return +t === +(new Date(t.getFullYear(), 0, 1, 0, 0, 0));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "static isSameYearMonth(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n );\n }", "before(other) {\n if (!other) {\n return false;\n }\n if (this.year === other.year) {\n if (this.month === other.month) {\n return this.day === other.day ? false : this.day < other.day;\n }\n else {\n return this.month < other.month;\n }\n }\n else {\n return this.year < other.year;\n }\n }", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function yearComparator(student1, student2) {\n var one_year = student1.yearInSchool\n var two_year = student2.yearInSchool\n if (one_year > two_year) {\n return true;\n } else {\n return false;\n }\n}", "function _isPrevYear(d1, d2) {\n return _isNextYear(d2, d1);\n }", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function isBefore (date1, date2) {\n if (date1.getFullYear() < date2.getFullYear()) return true\n else if (date1.getFullYear() <= date2.getFullYear() && date1.getMonth() < date2.getMonth()) return true\n else if (date1.getFullYear() <= date2.getFullYear() && date1.getMonth() <= date2.getMonth() && date1.getDate() <= date2.getDate()) return true\n else return false\n}", "function sameYearAndMonth(d1, d2) {\n\treturn (\n\t\td1.getFullYear() == d2.getFullYear() &&\n\t\td1.getMonth() == d2.getMonth()\n\t);\n}", "function compareMonthAndYear(firstMonthAndYear, secondMonthAndYear) {\n var firstMonth = firstMonthAndYear.getMonth();\n var firstYear = firstMonthAndYear.getYear();\n var secondMonth = secondMonthAndYear.getMonth();\n var secondYear = secondMonthAndYear.getYear();\n if (firstYear === secondYear) {\n return firstMonth - secondMonth;\n }\n else {\n return firstYear - secondYear;\n }\n}", "function compareDate(a, b) {\r\n if (a.date > b.date) return 1;\r\n if (b.date > a.date) return -1;\r\n return 0;\r\n}", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "function comparisonByDate(dateA, dateB) {\n var c = new Date(dateA.date);\n var d = new Date(dateB.date);\n return c - d;\n }", "function compararFecha(fecha, fecha2) {\n var xMonth = fecha.substring(3, 5);\n var xDay = fecha.substring(0, 2);\n var xYear = fecha.substring(6, 10);\n var yMonth = fecha2.substring(3, 5);\n var yDay = fecha2.substring(0, 2);\n var yYear = fecha2.substring(6, 10);\n if (xYear > yYear) {\n return 1;\n }\n else {\n if (xYear == yYear) {\n if (xMonth > yMonth) {\n return 1;\n }\n else {\n if (xMonth == yMonth) {\n if (xDay == yDay) {\n return 0;\n } else {\n if (xDay > yDay)\n return 1;\n else\n return -1;\n }\n }\n else\n return -1;\n }\n }\n else\n return -1;\n }\n}", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "function CheckDate(theYear, startYear, feet) {\n if (theYear > startYear)\n return true;\n else return false;\n}", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "function compareDate(dos, rd) {\n\n }", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function dateChecker(date1, date2 = new Date()) {\n var date1 = new Date(Date.parse(date1));\n var date2 = new Date(Date.parse(date2));\n var ageTime = date2.getTime() - date1.getTime();\n\n if (ageTime < 0) {\n return false; //date2 is before date1\n } else {\n return true;\n }\n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function compareDate(fromDate, toDate){\r\n\t// check both value is there or not\r\n\t// in else it will return true its due to date field validation is done on form level\r\n\tif (toDate != '' && fromDate != ''){\r\n\t\t// extract day month and year from both of date\r\n\t\tvar fromDay = fromDate.substring(0, 2);\r\n\t\tvar toDay = toDate.substring(0, 2);\r\n\t\tvar fromMon = eval(fromDate.substring(3, 5)-1);\r\n\t\tvar toMon = eval(toDate.substring(3, 5)-1);\r\n\t\tvar fromYear = fromDate.substring(6, 10);\r\n\t\tvar toYear = toDate.substring(6, 10);\r\n\r\n\t\t// convert both date in date object\r\n\t\tvar fromDt = new Date(fromYear, fromMon, fromDay);\r\n\t\tvar toDt = new Date(toYear, toMon, toDay); \r\n\r\n\t\t// compare both date \r\n\t\t// if fromDt is greater than toDt return false else true\r\n\t\tif (fromDt > toDt) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}else{\r\n\t\treturn true;\r\n\t}\r\n}", "function compare(a, b) {\n const dateA = a.date;\n const dateB = b.date;\n\n let comparison = 0;\n if (dateA > dateB) {\n comparison = 1;\n } else if (dateA < dateB) {\n comparison = -1;\n }\n return comparison * -1;\n }", "function sortByDate(a, b) {\n let comparison = 0;\n\n // -------------------------------------------------------------JavaScript - Conditional Statments Ex. 3||\n if (a.getDate >= b.date) {\n comparison = 1;\n } else if (a.date <= b.date) {\n comparison = -1;\n }\n return comparison;\n}", "function DateCompare(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 > _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function isAfter (date1, date2) {\n if (date1.getFullYear() > date2.getFullYear()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() > date2.getMonth()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() >= date2.getMonth() && date1.getDate() >= date2.getDate()) return true\n else return false\n}", "function checkDate() {\r\n var date = document.getElementById(\"date\").value;\r\n newDate = new Date(date);\r\n var year = newDate.getFullYear();\r\n\r\n if(year == 2020)\r\n {\r\n return false;\r\n }else\r\n {\r\n return true;\r\n }\r\n}", "function compareDates(a,b) {\n if(a.attributes.date.isBefore(b.attributes.date)) {return -1;}\n if(b.attributes.date.isBefore(a.attributes.date)) {return 1;}\n return 0;\n}", "function compareDay(day1, day2){\n return day1.getFullYear() === day2.getFullYear() &&\n day1.getMonth() === day2.getMonth() &&\n day1.getDate() === day2.getDate();\n}", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function compareMonthYears(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n }\n return r;\n }", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDateFunction(date1,date2){\r\n\tvar leftDate;\r\n\tvar rightDate;\r\n\tif(typeof(date1) == \"object\"){\r\n\t\tleftDate = date1;\r\n\t}else{\r\n\t\tleftDate = convertStr2Date(date1);\r\n\t}\r\n\tif(typeof(date2) == \"object\"){\r\n\t\trightDate = date2;\r\n\t}else{\r\n\t\trightDate = convertStr2Date(date2);\r\n\t}\r\n\treturn compareDate(leftDate,rightDate,0);\r\n}", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "function compare(a,b) {\n\t\t\t\tif (new Date(a.date) < new Date(b.date))\n\t\t\t\t\treturn 1;\n\t\t\t\tif (new Date(a.date) > new Date(b.date))\n\t\t\t\t \treturn -1;\n\t\t\t\treturn 0;\n\t\t\t}", "function date_asc(a,b){\nif (new Date(a.released)>new Date(b.released))\n return -1;\nif (new Date(a.released)<new Date(b.released))\n return 1;\nreturn 0\n}", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function compareDates(date1, date2)\r\n{\r\n if(date1 < date2)\r\n return -1;\r\n else if(date1 > date2)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function validateDOBAge(year) {\n var currentDate = new Date();\n if (currentDate.getFullYear() - year >= 16 && currentDate.getFullYear() - year <= 70) {\n return true;\n }\n else {\n return false;\n }\n }", "function compareDates(a, b)\n{\n var x=new Date(a.Date);\n var y=new Date(b.Date);\n \n console.log(\"hello we are hee\");\t\n\n console.log(x);\n console.log(y);\t\n\n if(x>y)\n {\n console.log(1);\n return 1;\n\n }\n else\n {\n console.log(-1);\t \n return -1;\n }\n}", "function libraryFine(d1, m1, y1, d2, m2, y2) {\n // I would start off comparing the years...\n // if the year it was returned is greater than the due date year, return 10,000.\n if(y1 > y2){\n return 10000\n // else if the year is equal to the due date year...\n } else if(y1 === y2){\n // we check if the month is greater than the due date month..\n if(m1 > m2){\n // we check if the day it was returned is greater or equal than the due date day, and also if the year it was returned is greater than the due date year.\n if(d1 >= d2 && y1 > y2){\n // if it is, we return 10,000..\n return 10000\n // otherwise, it has not been more than a year so... \n } else {\n // we subtract the returned month minus the due date month..\n let result = Math.abs(m1 - m2)\n // and we return the multiplication of the result times 500.\n return 500 * result\n }\n // else if the month is returned is less than the due date month, we return 0.\n } else if(m1 < m2){\n return 0\n }\n // if the day is greater than the due date day...\n if(d1 > d2){\n // we subtract the returned day minus the due date day..\n let result = Math.abs(d1 - d2)\n // and return the result times 15.\n return 15 * result\n }\n }\n // if none of this returns anything, there might be an edge case that it was not returned late, so we still need to return 0.\n return 0\n}", "function date_diff(x,y)\n{\n var x_year = x.substr(0,4);\n var x_month = x.substr(5,2);\n \n var y_year = y.substr(0,4);\n var y_month = y.substr(5,2);\n \n var year_diff = (+x_year - +y_year) * 12;\n var month_diff = +x_month - +y_month;\n \n return (year_diff + month_diff);\n}", "isLeapYear() {\n return this.dateObject.year % 4 === 0;\n }", "function sorterenyear(a, b) {\r\n return d3.ascending(year(a), year(b));\r\n}", "function cmpDate(dat1, dat2) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1) || !isDate(dat2)) {\r\n alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = (new Date(dat2.substring(6, 10), dat2.substring(0, 2) - 1, dat2.substring(3, 5))).getTime();\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function isDateWithinSameDay(date1, date2) {\n return date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear();\n }", "function date_desc(a,b){\nif (new Date(a.released)>new Date(b.released))\n return 1;\nif (new Date(a.released)<new Date(b.released))\n return -1;\nreturn 0\n}", "sameDay(d1, d2) {\n return d1.getFullYear() === d2.getFullYear() &&\n d1.getMonth() === d2.getMonth() &&\n d1.getDate() === d2.getDate();\n }", "function isSame(date1, date2, period){\n if (period) {\n date1 = startOf(date1, period);\n date2 = startOf(date2, period);\n }\n return Number(date1) === Number(date2);\n }", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}", "function compareLocalAsc(dateLeft, dateRight) {\n var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();\n\n if (diff < 0) {\n return -1;\n } else if (diff > 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}" ]
[ "0.75182384", "0.73213875", "0.72410834", "0.7218506", "0.70963746", "0.7042112", "0.6990564", "0.6975954", "0.6975954", "0.69589436", "0.6949617", "0.68140596", "0.6785169", "0.67357045", "0.67141765", "0.6707754", "0.6691076", "0.66772175", "0.6664204", "0.6663058", "0.6641696", "0.6636161", "0.66335386", "0.6583755", "0.65807635", "0.6555778", "0.65309614", "0.6516875", "0.65121245", "0.64696664", "0.6467328", "0.6461841", "0.6450455", "0.6409687", "0.6408191", "0.6404097", "0.6402509", "0.640187", "0.640187", "0.63836884", "0.6367362", "0.6337819", "0.63275534", "0.63168526", "0.630759", "0.63030136", "0.63006294", "0.6289151", "0.6288582", "0.6280524", "0.6244622", "0.6203133", "0.620009", "0.61945325", "0.61945325", "0.61945325", "0.6188051", "0.6184706", "0.61619747", "0.61532706", "0.6149333", "0.61417294", "0.6130621", "0.61052746", "0.6083916", "0.60732365", "0.6064485", "0.6059877", "0.6052425", "0.6046669", "0.6045673", "0.6029778", "0.5975771", "0.5975771", "0.59723914", "0.5961575", "0.5961575", "0.59430945", "0.5917518", "0.58891696", "0.58891696", "0.587666", "0.58758175", "0.58726066", "0.58638734", "0.584281", "0.58202386", "0.5814165", "0.5809922", "0.5797229", "0.5780567", "0.5763735", "0.57519007", "0.57363474", "0.5735217", "0.57185686", "0.57185686", "0.57185686", "0.57185686", "0.57185686", "0.57185686" ]
0.0
-1
Compares one date with another disregarding the date component
function compareMonthYears(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareMonths(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function compareDate(a, b) {\r\n if (a.date > b.date) return 1;\r\n if (b.date > a.date) return -1;\r\n return 0;\r\n}", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function comparisonByDate(dateA, dateB) {\n var c = new Date(dateA.date);\n var d = new Date(dateB.date);\n return c - d;\n }", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function compareDate(fromDate, toDate) {\r\r\tvar dt1 = parseInt(fromDate.substring(0, 2), 10);\r\r\tvar mon1 = parseInt(fromDate.substring(3, 5), 10);\r\r\tvar yr1 = parseInt(fromDate.substring(6, 10), 10);\r\r\tvar dt2 = parseInt(toDate.substring(0, 2), 10);\r\r\tvar mon2 = parseInt(toDate.substring(3, 5), 10);\r\r\tvar yr2 = parseInt(toDate.substring(6, 10), 10);\r\r\tvar date1 = new Date(yr1, mon1, dt1);\r\r\tvar date2 = new Date(yr2, mon2, dt2);\r\r\tif (date1 > date2) {\r\r\t\treturn 1;\r\r\t} else {\r\r\t\tif (date1 < date2) {\r\r\t\t\treturn -1;\r\r\t\t} else {\r\r\t\t\treturn 0;\r\r\t\t}\r\r\t}\r\r}", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "function compareDate(dos, rd) {\n\n }", "function compareDates (date1, date2)\n{\n newDate1 = new Date(date1);\n newDate1.setHours(0,0,0,0);\n newDate2 = new Date(date2);\n newDate2.setHours(0,0,0,0);\n var t1 = newDate1.getTime();\n var t2 = newDate2.getTime();\n if (t1 === t2) return 0;\n else if (t1 > t2) return 1;\n else return -1;\n}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "function compareDates(date1, date2)\r\n{\r\n if(date1 < date2)\r\n return -1;\r\n else if(date1 > date2)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "function compareDateFunction(date1,date2){\r\n\tvar leftDate;\r\n\tvar rightDate;\r\n\tif(typeof(date1) == \"object\"){\r\n\t\tleftDate = date1;\r\n\t}else{\r\n\t\tleftDate = convertStr2Date(date1);\r\n\t}\r\n\tif(typeof(date2) == \"object\"){\r\n\t\trightDate = date2;\r\n\t}else{\r\n\t\trightDate = convertStr2Date(date2);\r\n\t}\r\n\treturn compareDate(leftDate,rightDate,0);\r\n}", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a,b) {\n if(a.attributes.date.isBefore(b.attributes.date)) {return -1;}\n if(b.attributes.date.isBefore(a.attributes.date)) {return 1;}\n return 0;\n}", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function compare(a,b) {\n\t\t\t\tif (new Date(a.date) < new Date(b.date))\n\t\t\t\t\treturn 1;\n\t\t\t\tif (new Date(a.date) > new Date(b.date))\n\t\t\t\t \treturn -1;\n\t\t\t\treturn 0;\n\t\t\t}", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "function compareDate(fromDate, toDate){\r\n\t// check both value is there or not\r\n\t// in else it will return true its due to date field validation is done on form level\r\n\tif (toDate != '' && fromDate != ''){\r\n\t\t// extract day month and year from both of date\r\n\t\tvar fromDay = fromDate.substring(0, 2);\r\n\t\tvar toDay = toDate.substring(0, 2);\r\n\t\tvar fromMon = eval(fromDate.substring(3, 5)-1);\r\n\t\tvar toMon = eval(toDate.substring(3, 5)-1);\r\n\t\tvar fromYear = fromDate.substring(6, 10);\r\n\t\tvar toYear = toDate.substring(6, 10);\r\n\r\n\t\t// convert both date in date object\r\n\t\tvar fromDt = new Date(fromYear, fromMon, fromDay);\r\n\t\tvar toDt = new Date(toYear, toMon, toDay); \r\n\r\n\t\t// compare both date \r\n\t\t// if fromDt is greater than toDt return false else true\r\n\t\tif (fromDt > toDt) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}else{\r\n\t\treturn true;\r\n\t}\r\n}", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "function compareDates(a, b)\n{\n var x=new Date(a.Date);\n var y=new Date(b.Date);\n \n console.log(\"hello we are hee\");\t\n\n console.log(x);\n console.log(y);\t\n\n if(x>y)\n {\n console.log(1);\n return 1;\n\n }\n else\n {\n console.log(-1);\t \n return -1;\n }\n}", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function compareDateObject(date1, date2){\r\n if(date1 == null) return false;\r\n if(date2 == null) return false;\r\n\r\n var date1Long = date1.getTime();\r\n var date2Long = date2.getTime();\r\n\r\n if(date1Long - date2Long > 0) return '>';\r\n if(date1Long - date2Long == 0) return '=';\r\n if(date1Long - date2Long < 0) return '<';\r\n else\r\n return '';\r\n}", "static isSameDate(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n && dateA.getDate() === dateB.getDate()\n );\n }", "function compare(a, b) {\n const dateA = a.date;\n const dateB = b.date;\n\n let comparison = 0;\n if (dateA > dateB) {\n comparison = 1;\n } else if (dateA < dateB) {\n comparison = -1;\n }\n return comparison * -1;\n }", "function sortByDate(a, b) {\n let comparison = 0;\n\n // -------------------------------------------------------------JavaScript - Conditional Statments Ex. 3||\n if (a.getDate >= b.date) {\n comparison = 1;\n } else if (a.date <= b.date) {\n comparison = -1;\n }\n return comparison;\n}", "function DateCompare(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 > _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function calendar_helper_dateEquals(date1, date2){\n if (date1.getFullYear() == date2.getFullYear())\n if (date1.getMonth() == date2.getMonth())\n if (date1.getDate() == date2.getDate())\n return true;\n return false;\n}", "function cmpDate(dat1, dat2) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1) || !isDate(dat2)) {\r\n alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = (new Date(dat2.substring(6, 10), dat2.substring(0, 2) - 1, dat2.substring(3, 5))).getTime();\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function dateChecker(date1, date2 = new Date()) {\n var date1 = new Date(Date.parse(date1));\n var date2 = new Date(Date.parse(date2));\n var ageTime = date2.getTime() - date1.getTime();\n\n if (ageTime < 0) {\n return false; //date2 is before date1\n } else {\n return true;\n }\n}", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n }", "function compareChargeDate(a, b){\n if(a.scheduledSubmitDate < b.scheduledSubmitDate) {\n\t\treturn -1;\n\t} else if(a.scheduledSubmitDate > b.scheduledSubmitDate) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "function byDate(a, b) {\n return a.date - b.date;\n}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function compareDay(day1, day2){\n return day1.getFullYear() === day2.getFullYear() &&\n day1.getMonth() === day2.getMonth() &&\n day1.getDate() === day2.getDate();\n}", "function compareDate(date1, date2) {\n let dateparts1 = date1.split('-');\n let dateparts2 = date2.split('-');\n let newdate1 = new Date(dateparts1[0], dateparts1[1] - 1, dateparts1[2]);\n let newdate2 = new Date(dateparts2[0], dateparts2[1] - 1, dateparts2[2]);\n return Math.ceil((newdate2 - newdate1) / (1000 * 3600 * 24)) + 1;\n}", "function compare(a,b) {\n if (a.dateOfEvent > b.dateOfEvent)\n return -1;\n if (a.dateOfEvent < b.dateOfEvent)\n return 1;\n return 0;\n }", "function compareByDateDESC(a, b) {\n\tif (!('date' in a)) {\n\t\treturn 1;\n\t}\n\tif (!('date' in b)) {\n\t\treturn -1;\n\t}\n\t\n\tif (parseInt(a.date) < parseInt(b.date)) {\n\t\treturn 1;\n\t}\n\tif (parseInt(a.date) > parseInt(b.date)) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function compareDates(date1, dateformat1, date2, dateformat2) {\n var d1 = getDateFromFormat(date1, dateformat1);\n var d2 = getDateFromFormat(date2, dateformat2);\n if (d1 == 0 || d2 == 0) {\n return -1;\n } else if (d1 > d2) {\n return 1;\n }\n return 0;\n}", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "function sortDate(a, b) {\n\t//getTime provides an equal value for h,min,s: the current time\n return new Date(a.date).getTime() - new Date(b.date).getTime();\n}", "function compareDatePart(date1, date2) {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function compareDate(inputDate1, inputDate2) {\r\n if(!inputDate1 || !inputDate2) {\r\n return -1;\r\n }\r\n\tvar date1 = inputDate1.split('-');\r\n\tvar date2 = inputDate2.split('-');\r\n\t\r\n\tif(date1.length != 3 || date2.length != 3 ) { //checks if dates are valid\r\n\t\treturn -1;\r\n\t}\r\n\tif(date1[0] < date2[0]) {\r\n\t\treturn 1;\r\n\t}\r\n\tif(date1[0] == date2[0]) {\r\n\t\tif(date1[1] < date2[1]) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif(date1[1] == date2[1]) {\r\n\t\t\tif(date1[2] <= date2[2]) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}", "function isDateWithinSameDay(date1, date2) {\n return date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear();\n }", "function Date$prototype$equals(other) {\n return equals(this.valueOf(), other.valueOf());\n }", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "before(other) {\n if (!other) {\n return false;\n }\n if (this.year === other.year) {\n if (this.month === other.month) {\n return this.day === other.day ? false : this.day < other.day;\n }\n else {\n return this.month < other.month;\n }\n }\n else {\n return this.year < other.year;\n }\n }", "function Date$prototype$equals(other) {\n return equals (this.valueOf (), other.valueOf ());\n }", "function isSameDate(date1, date2) {\n return (date1 instanceof Date && date2 instanceof Date && date1.getDay()==date2.getDay() && date1.getMonth()==date2.getMonth() && date1.getFullYear()==date2.getFullYear());\n}", "function compare(a,b) {\n if (a.orderDate < b.orderDate)\n return -1;\n if (a.orderDate > b.orderDate)\n return 1;\n return 0;\n}", "function isStringDate2Greater(date1,date2)\r\n{\r\n // date1 and date2 are strings\r\n //This function checks if date2 is later than date1\r\n //If the second date is null then it sets date2 to current date and checks if first date is later than the current date\r\n var sd=date1;\r\n if (date1 == \"\") return false;\r\n else if (date2 == \"\") return false;\r\n else\r\n {\r\n var ed=date2;\r\n var End= new Date(changeDateFormat(ed));\r\n }\r\n var Start= new Date(changeDateFormat(sd));\r\n var diff=End-Start;\r\n if (diff>=0) return true;\r\n else\r\n {\r\n// alert(msg);\t\r\n return false;\r\n }\r\n}", "function compareDates$static(d1/*:Date*/, d2/*:Date*/)/*:Number*/ {\n if (d1 === d2) {\n return 0;\n }\n\n if (d1 && d2) {\n var time1/*:Number*/ = d1.getTime();\n var time2/*:Number*/ = d2.getTime();\n if (time1 === time2) {\n return 0;\n } else if (time1 > time2) {\n return 1;\n }\n return -1;\n }\n\n if (!d1) {\n return 1;\n }\n\n if (!d2) {\n return -1;\n }\n }", "function compareDatesValues(strDataInicial, strDataFinal)\n{\n if ((empty(strDataInicial)) || (empty(strDataFinal)))\n return false;\n if ((strDataInicial.length < 10) || (strDataFinal.length < 10))\n return false;\n if (convertDate(strDataInicial, 'YmdHis') > convertDate(strDataFinal, 'YmdHis')) {\n alertDialog('A data inicial deve ser sempre menor ou igual a data final.', 'Validação', 250, 150);\n return false;\n }\n return true;\n}", "function compareDashedDates(date1, date2) {\n console.log(date1);\n console.log(date2);\n date1 = date1.split('-');\n date2 = date2.split('-');\n console.log(date1);\n console.log(date2);\n for (let i = 0; i < date1.length; i++) {\n if (parseInt(date1[i]) < parseInt(date2[i])) {\n return true;\n } else if (parseInt(date1[i]) > parseInt(date2[i])) {\n return false;\n }\n }\n return true;\n}", "function compareDates(mixDataInicial, mixDataFinal)\n{\n var dataInicial = getObject(mixDataInicial);\n var dataFinal = getObject(mixDataFinal);\n if ((empty(dataInicial)) || (empty(dataFinal)))\n return false;\n return compareDatesValues(dataInicial.value, dataFinal.value);\n}", "function by_datetime( a, b ) {\n\n const a_date = moment( a.day.split(' - ')[1], 'MM/DD/YYYY');\n const b_date = moment( b.day.split(' - ')[1], 'MM/DD/YYYY');\n\n if ( b_date.isAfter( a_date ) ) {\n return -1;\n } else if ( b_date.isBefore( a_date ) ) {\n return 1;\n } else {\n return 0;\n }\n\n}", "function dateComparator(date1, date2) {\n\t\t\tvar date1Number = monthToComparableNumber(date1);\n\t\t\tvar date2Number = monthToComparableNumber(date2);\n\n\t\t\tif (date1Number===null && date2Number===null) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tif (date1Number===null) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\tif (date2Number===null) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\treturn date1Number - date2Number;\n\t\t}", "function less(a,b) {\r\n return a.date < b.date;\r\n}", "function sortDates(a, b){\n\treturn a.getTime() - b.getTime();\n}", "function sameDate(d1, d2) {\n return d1.getMonth === d2.getMonth && d1.getFullYear() === d2.getFullYear();\n}", "function compararFecha(fecha, fecha2) {\n var xMonth = fecha.substring(3, 5);\n var xDay = fecha.substring(0, 2);\n var xYear = fecha.substring(6, 10);\n var yMonth = fecha2.substring(3, 5);\n var yDay = fecha2.substring(0, 2);\n var yYear = fecha2.substring(6, 10);\n if (xYear > yYear) {\n return 1;\n }\n else {\n if (xYear == yYear) {\n if (xMonth > yMonth) {\n return 1;\n }\n else {\n if (xMonth == yMonth) {\n if (xDay == yDay) {\n return 0;\n } else {\n if (xDay > yDay)\n return 1;\n else\n return -1;\n }\n }\n else\n return -1;\n }\n }\n else\n return -1;\n }\n}", "checkIfDelay(date1,date2){\n a = new Date(date1);\n b = new Date(date2);\n\n if(b > a){\n return true\n }else{\n return false\n }\n\n }", "sameDay(d1, d2) {\n return d1.getFullYear() === d2.getFullYear() &&\n d1.getMonth() === d2.getMonth() &&\n d1.getDate() === d2.getDate();\n }", "function cmpCurrentDate(dat1,datInMsec) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1)) {\r\n // alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n \r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = datInMsec;\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function isSame(date1, date2, period){\n if (period) {\n date1 = startOf(date1, period);\n date2 = startOf(date2, period);\n }\n return Number(date1) === Number(date2);\n }", "function sortByDateAscending(a, b) {\n // Dates will be cast to numbers automagically:\n return a.date - b.date;\n }", "function compareDate(s1, flag){\t\r\n\t\t s1 = s1.replace(/-/g, \"/\");\r\n\t\t s1 = new Date(s1);\r\n\t\t var currentDate = new Date();\r\n\t\t \r\n\t\t var strYear = currentDate.getYear();\r\n\t\t\tvar strMonth= currentDate.getMonth() + 1;\r\n\t\t\tvar strDay = currentDate.getDate();\r\n\t\t\tvar strDate = strYear + \"/\" + strMonth + \"/\" + strDay;\t\t \r\n\t\t s2 = new Date(strDate);\r\n\t\t \r\n\t\t var times = s1.getTime() - s2.getTime();\r\n\t\t if(flag == 0){\r\n\t\t \treturn times;\r\n\t\t }\r\n\t\t else{\r\n\t\t \tvar days = times / (1000 * 60 * 60 * 24);\r\n\t\t \treturn days;\r\n\t\t }\r\n\t }", "function date_asc(a,b){\nif (new Date(a.released)>new Date(b.released))\n return -1;\nif (new Date(a.released)<new Date(b.released))\n return 1;\nreturn 0\n}", "intersectsDate(other) {\n var _this = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n if (!this.shallowIntersectsDate(date)) return null;\n if (!this.on) return this;\n const range = this.findShallowIntersectingRange(this, date);\n let result = false;\n this.iterateDatesInRange(range, function (state) {\n if (_this.matchesDay(state.day)) {\n result = result || date.matchesDay(state.day);\n state.finished = result;\n }\n });\n return result;\n }" ]
[ "0.74821424", "0.7444953", "0.7418697", "0.7403151", "0.73120826", "0.72947305", "0.72802866", "0.71944666", "0.7190712", "0.7171819", "0.71715015", "0.7123507", "0.71179384", "0.7114633", "0.7094997", "0.7060516", "0.7027555", "0.70127356", "0.7008603", "0.7008603", "0.7008603", "0.69965965", "0.6980796", "0.69789934", "0.69789934", "0.6962107", "0.696015", "0.6939987", "0.6907567", "0.6907452", "0.6903283", "0.6893547", "0.6893547", "0.6859902", "0.685136", "0.6849153", "0.6835254", "0.68244433", "0.6800032", "0.67908597", "0.67872685", "0.67872685", "0.67828405", "0.67810374", "0.6772948", "0.67691845", "0.6767708", "0.67593193", "0.6734767", "0.67026997", "0.66911584", "0.66897696", "0.6688659", "0.6688659", "0.6688659", "0.6688659", "0.6688659", "0.66824025", "0.66757536", "0.6662866", "0.6659373", "0.6641956", "0.6635452", "0.662203", "0.6608686", "0.6593872", "0.65835357", "0.65673935", "0.65673935", "0.6563582", "0.65575", "0.6546151", "0.6546151", "0.65404856", "0.6498236", "0.64872265", "0.6482151", "0.6482151", "0.64813566", "0.64791703", "0.64559686", "0.6444095", "0.6440496", "0.6408788", "0.63971406", "0.63947475", "0.6368581", "0.6351567", "0.6341576", "0.6337619", "0.63322234", "0.63320047", "0.63284385", "0.63233715", "0.6322547", "0.631338", "0.62999344", "0.6291171", "0.6281428", "0.6256059", "0.6253632" ]
0.0
-1
Compares one date with another if they are the same quarter of the same year
function compareQuarterYears(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareQuarters(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareQuarters(d1, d2) {\n var m1 = d1.getMonth();\n var m2 = d2.getMonth();\n var q1 = (Math.floor(m1 / 3) * 3);\n var q2 = (Math.floor(m2 / 3) * 3);\n if (q1 > q2) return 1;\n if (q1 < q2) return -1;\n return 0;\n }", "function _isNextYear(d1, d2) {\n return d2.getFullYear() - d1.getFullYear() === 1;\n }", "function yearBefore(d1, d2) {\n return d1.getFullYear() < d2.getFullYear();\n }", "function _isSameYear(d1, d2) {\n return d1.getFullYear() === d2.getFullYear();\n }", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "function sameDate(d1, d2) {\n return d1.getMonth === d2.getMonth && d1.getFullYear() === d2.getFullYear();\n}", "function isWithinYear(date1, date2) {\n\t\tvar year1 = parseInt(date1[0]);\n\t\tvar year2 = parseInt(date2[0]);\n\t\tvar month1 = parseInt(date1[1]);\n\t\tvar month2 = parseInt(date2[1]);\n\t\tvar day1 = parseInt(date1[2]);\n\t\tvar day2 = parseInt(date2[2]);\n\t\tif (year1 === year2) {\n\t\t\treturn true;\n\t\t} else if (year2 === year1 + 1 && (month2 < month1) || (month2 === month1 && day2 < day1)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "isSameYear(date) {\n const universalDate = new UniversalDate(date);\n return universalDate.year === this.year;\n }", "function calendar_helper_dateEquals(date1, date2){\n if (date1.getFullYear() == date2.getFullYear())\n if (date1.getMonth() == date2.getMonth())\n if (date1.getDate() == date2.getDate())\n return true;\n return false;\n}", "function compareYear(a, b) {\r\n if (a.YEAR < b.YEAR)\r\n return -1;\r\n else if (a.YEAR > b.YEAR)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function myFunction(date1, date2) {\n return (\n date1.getYear() === date2.getYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate()\n );\n}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function libraryFine(d1, m1, y1, d2, m2, y2) {\n // I would start off comparing the years...\n // if the year it was returned is greater than the due date year, return 10,000.\n if(y1 > y2){\n return 10000\n // else if the year is equal to the due date year...\n } else if(y1 === y2){\n // we check if the month is greater than the due date month..\n if(m1 > m2){\n // we check if the day it was returned is greater or equal than the due date day, and also if the year it was returned is greater than the due date year.\n if(d1 >= d2 && y1 > y2){\n // if it is, we return 10,000..\n return 10000\n // otherwise, it has not been more than a year so... \n } else {\n // we subtract the returned month minus the due date month..\n let result = Math.abs(m1 - m2)\n // and we return the multiplication of the result times 500.\n return 500 * result\n }\n // else if the month is returned is less than the due date month, we return 0.\n } else if(m1 < m2){\n return 0\n }\n // if the day is greater than the due date day...\n if(d1 > d2){\n // we subtract the returned day minus the due date day..\n let result = Math.abs(d1 - d2)\n // and return the result times 15.\n return 15 * result\n }\n }\n // if none of this returns anything, there might be an edge case that it was not returned late, so we still need to return 0.\n return 0\n}", "function _isPrevYear(d1, d2) {\n return _isNextYear(d2, d1);\n }", "function sameYearAndMonth(d1, d2) {\n\treturn (\n\t\td1.getFullYear() == d2.getFullYear() &&\n\t\td1.getMonth() == d2.getMonth()\n\t);\n}", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "_hasSameMonthAndYear(d1, d2) {\n return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n }", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "function yearComparator( auto1, auto2){\r\n if(auto1.year >= auto2.year){\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}", "function getCurrentQuarter(){\n let startDate = new Date()\n let endDate = new Date()\n let month = endDate.getMonth()\n let mod = month % 3 \n // Aktuelles Quartal Berechnung Beispiel März: month = 2, mod: 2 % 3 = 2 , Aktuelles Quartal = Monat 2 - mod 2 = 0 (0 = Januar bis Heute)\n startDate.setFullYear(endDate.getFullYear(), month - mod, 1)\n startDate.setHours(0,0,0,0)\n endDate.setHours(23,59,59,0)\n dates[0] = startDate\n dates[1] = endDate\n return dates\n}", "static isSameDate(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n && dateA.getDate() === dateB.getDate()\n );\n }", "function compareYears(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n return 1;\n return 0;\n }", "isSameYear(date1, data2) {\n\t\treturn Moment(date1).isSame(data2, 'year');\n\t}", "function compareDates(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n if (r === 0) {\n r = compareDays(d1, d2);\n }\n }\n return r;\n }", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function compare(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n return 1;\n return 0;\n }", "function isSame(date1, date2, period){\n if (period) {\n date1 = startOf(date1, period);\n date2 = startOf(date2, period);\n }\n return Number(date1) === Number(date2);\n }", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "function isAfter (date1, date2) {\n if (date1.getFullYear() > date2.getFullYear()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() > date2.getMonth()) return true\n else if (date1.getFullYear() >= date2.getFullYear() && date1.getMonth() >= date2.getMonth() && date1.getDate() >= date2.getDate()) return true\n else return false\n}", "function yearComparator( auto1, auto2){\r\n\r\n if (auto1.year > auto2.year){\r\n return false;\r\n }else if(auto1.year < auto2.year){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n}", "function yearComparator(auto1, auto2){\n return auto2.year - auto1.year;\n}", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year < auto2.year) {\n \treturn true;\n }\n else {\n \treturn false;\n }\n}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function yearComparator( auto1, auto2){\n /* your code here*/\n if (auto1.year > auto2.year) {\n return true;\n } else {\n return false;\n }\n}", "function compareMonthYears(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareMonths(d1, d2);\n }\n return r;\n }", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function compare(a, b) {\n\tif (a.year < b.year) {\n\t\treturn 1;\n\t}\n\tif (a.year > b.year) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function isYear(t) {\n return +t === +(new Date(t.getFullYear(), 0, 1, 0, 0, 0));\n }", "function isBefore (date1, date2) {\n if (date1.getFullYear() < date2.getFullYear()) return true\n else if (date1.getFullYear() <= date2.getFullYear() && date1.getMonth() < date2.getMonth()) return true\n else if (date1.getFullYear() <= date2.getFullYear() && date1.getMonth() <= date2.getMonth() && date1.getDate() <= date2.getDate()) return true\n else return false\n}", "static isSameYearMonth(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n );\n }", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date1) !== Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date2) || Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date1) !== Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date1) !== Object(date_fns_getMonth__WEBPACK_IMPORTED_MODULE_23__[\"default\"])(date2) || Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date1) !== Object(date_fns_getYear__WEBPACK_IMPORTED_MODULE_24__[\"default\"])(date2);\n }\n\n return date1 !== date2;\n}", "function isDateWithinSameDay(date1, date2) {\n return date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear();\n }", "sameDay(d1, d2) {\n return d1.getFullYear() === d2.getFullYear() &&\n d1.getMonth() === d2.getMonth() &&\n d1.getDate() === d2.getDate();\n }", "function compareDay(day1, day2){\n return day1.getFullYear() === day2.getFullYear() &&\n day1.getMonth() === day2.getMonth() &&\n day1.getDate() === day2.getDate();\n}", "function yearComparator(student1, student2) {\n var one_year = student1.yearInSchool\n var two_year = student2.yearInSchool\n if (one_year > two_year) {\n return true;\n } else {\n return false;\n }\n}", "function CheckDate(theYear, startYear, feet) {\n if (theYear > startYear)\n return true;\n else return false;\n}", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "function isSameDate(date1, date2) {\n return (date1 instanceof Date && date2 instanceof Date && date1.getDay()==date2.getDay() && date1.getMonth()==date2.getMonth() && date1.getFullYear()==date2.getFullYear());\n}", "function compareDate(dos, rd) {\n\n }", "getNextQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth() + 3,\n lastMonth = startMonth + 2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "function findFYQ(date) {\n let year = date.substring(0,4)\n let month = date.substring(5,7)\n let quarter = Math.floor(month / 3) + 1\n return `${year} Q${quarter}`\n }", "function cmp(a, b) {\n let yearA = a[0].years[0]\n let yearB = b[0].years[0]\n return (yearB > yearA) ? 1 : ((yearB < yearA) ? -1 : 0)\n }", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function hasPreSelectionChanged(date1, date2) {\n if (date1 && date2) {\n return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);\n }\n\n return date1 !== date2;\n}", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function compareDate(fromDate, toDate) {\r\r\tvar dt1 = parseInt(fromDate.substring(0, 2), 10);\r\r\tvar mon1 = parseInt(fromDate.substring(3, 5), 10);\r\r\tvar yr1 = parseInt(fromDate.substring(6, 10), 10);\r\r\tvar dt2 = parseInt(toDate.substring(0, 2), 10);\r\r\tvar mon2 = parseInt(toDate.substring(3, 5), 10);\r\r\tvar yr2 = parseInt(toDate.substring(6, 10), 10);\r\r\tvar date1 = new Date(yr1, mon1, dt1);\r\r\tvar date2 = new Date(yr2, mon2, dt2);\r\r\tif (date1 > date2) {\r\r\t\treturn 1;\r\r\t} else {\r\r\t\tif (date1 < date2) {\r\r\t\t\treturn -1;\r\r\t\t} else {\r\r\t\t\treturn 0;\r\r\t\t}\r\r\t}\r\r}", "function filterYear(d) {\r\n return (d.year === yearcompare)\r\n }", "getCurrentQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth(),\n lastMonth = startMonth+2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "function compareMonthAndYear(firstMonthAndYear, secondMonthAndYear) {\n var firstMonth = firstMonthAndYear.getMonth();\n var firstYear = firstMonthAndYear.getYear();\n var secondMonth = secondMonthAndYear.getMonth();\n var secondYear = secondMonthAndYear.getYear();\n if (firstYear === secondYear) {\n return firstMonth - secondMonth;\n }\n else {\n return firstYear - secondYear;\n }\n}", "testCase1_3() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), 0);\n if (Number(_tc1) == Number(new Date(\"2016-09-03\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "function dateValid(dateArray, dateToCheck) {\n return dateArray.join() === [dateToCheck.getMonth()+1, dateToCheck.getDate(), dateToCheck.getFullYear()].join()\n}", "async function checkDateMatchCurrentSeason(datetimeObj){\n const current_season_date = await getCurrentSeasonDate()\n return current_season_date[0] == datetimeObj.getFullYear() || datetimeObj.getFullYear() == current_season_date[1] \n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "function Date$prototype$equals(other) {\n return equals (this.valueOf (), other.valueOf ());\n }", "getPreviousQuarter (format) {\n try {\n format = format || 'yyyy-MM-dd';\n let date = new Date(),\n curYear = date.getFullYear(),\n startMonth = getQuarterStartMonth() - 3,\n lastMonth = startMonth + 2,\n lastDate = new Date();\n lastDate.setMonth(lastMonth+1);\n lastDate.setDate(0);\n let firstDay = Timer.formatDate(new Date(curYear, startMonth, 1, 0, 0, 0), format),\n lasetDay = Timer.formatDate(new Date(curYear, lastMonth, lastDate.getDate(), 23, 59, 59), format);\n return {firstDay, lasetDay};\n } catch (error) {\n throw error;\n }\n }", "before(other) {\n if (!other) {\n return false;\n }\n if (this.year === other.year) {\n if (this.month === other.month) {\n return this.day === other.day ? false : this.day < other.day;\n }\n else {\n return this.month < other.month;\n }\n }\n else {\n return this.year < other.year;\n }\n }", "function Date$prototype$equals(other) {\n return equals(this.valueOf(), other.valueOf());\n }", "Q (date) {\n return Math.ceil((date.getMonth() + 1) / 3)\n }", "testCase1_2() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), 2);\n if (Number(_tc1) == Number(new Date(\"2016-09-05\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function compareDates(mixDataInicial, mixDataFinal)\n{\n var dataInicial = getObject(mixDataInicial);\n var dataFinal = getObject(mixDataFinal);\n if ((empty(dataInicial)) || (empty(dataFinal)))\n return false;\n return compareDatesValues(dataInicial.value, dataFinal.value);\n}", "function fillAnnual(quarterlyData, annualData) {\n if (quarterlyData.length == 0) {\n return;\n }\n let year = getLatestQtrYear(quarterlyData);\n while (true) {\n let yearItem = new Year(year, year, 0, 0);\n let qtrs4Year = 0;\n\n // find all quarters for given year\n quarterlyData.forEach(function (qtr) {\n if (qtr.name.indexOf(year.toString()) > -1) {\n if (isDefined(qtr.eps.eps)) yearItem.eps += qtr.eps.eps;\n if (isDefined(qtr.rev.rev)) yearItem.rev += qtr.rev.rev;\n ++qtrs4Year;\n }\n });\n\n if (qtrs4Year == 0) {\n break;\n }\n\n if (qtrs4Year == 4) {\n yearItem.eps = +yearItem.eps.toFixed(2);\n yearItem.rev = +yearItem.rev.toFixed(1);\n yearItem.qtrs4Year = qtrs4Year;\n annualData.unshift(yearItem);\n }\n --year;\n }\n}", "yearChangeRequiresMapping(year1, year2) {\n if (year1 === \"2017\") return year2 !== \"2017\";\n if (year2 === \"2017\") return year1 !== \"2017\";\n return false;\n }", "function setTheYear() {\n if ( currentMonth >= 2 ) { // Check if it's past March\n console.log('Month - greater than or equal to 2');\n if ( currentMonth == 2 ) {\n console.log('Month - Equal to 2');\n if ( currentDay == 1 ) {\n console.log('The first!');\n start.setYear(currentYear - 1);\n end.setYear(currentYear);\n } else {\n console.log('After the first');\n start.setYear(currentYear);\n end.setYear(currentYear + 1);\n }\n } else {\n console.log('Month - greater than 2');\n start.setYear(currentYear);\n end.setYear(currentYear + 1);\n }\n } else {\n console.log('Month - less than 2');\n start.setYear(currentYear - 1);\n end.setYear(currentYear);\n }\n deferCheckDate.resolve();\n }", "function validateDOBAge(year) {\n var currentDate = new Date();\n if (currentDate.getFullYear() - year >= 16 && currentDate.getFullYear() - year <= 70) {\n return true;\n }\n else {\n return false;\n }\n }", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "function compararFecha(fecha, fecha2) {\n var xMonth = fecha.substring(3, 5);\n var xDay = fecha.substring(0, 2);\n var xYear = fecha.substring(6, 10);\n var yMonth = fecha2.substring(3, 5);\n var yDay = fecha2.substring(0, 2);\n var yYear = fecha2.substring(6, 10);\n if (xYear > yYear) {\n return 1;\n }\n else {\n if (xYear == yYear) {\n if (xMonth > yMonth) {\n return 1;\n }\n else {\n if (xMonth == yMonth) {\n if (xDay == yDay) {\n return 0;\n } else {\n if (xDay > yDay)\n return 1;\n else\n return -1;\n }\n }\n else\n return -1;\n }\n }\n else\n return -1;\n }\n}", "function isSameMonth ( dt, dt2 ) {\n\t\treturn dt.getMonth() === dt2.getMonth() && dt.getFullYear() === dt2.getFullYear();\n\t}", "function validatePeriod(x,y){\r\n var sd=x.value;\r\n var yy=sd.substr(0,4);\r\n var mm=sd.substr(5,2);\r\n var dd=sd.substr(8,2);\r\n var sdobj = new Date(yy,mm,dd);\r\n\r\n var ed=y.value;\r\n var yy=ed.substr(0,4);\r\n var mm=ed.substr(5,2);\r\n var dd=ed.substr(8,2);\r\n var edobj = new Date(yy,mm,dd);\r\n\r\n if(sdobj<edobj) \r\n return true;\r\n else\r\n return false;\r\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "equals(other) {\n return other != null && this.year === other.year && this.month === other.month && this.day === other.day;\n }", "function isEqual(d1, d2) {\n if (d1 === d2) {\n return true;\n } else if (Math.abs(Date.parse(d1) - Date.parse(d2)) <= 1000) {\n return true;\n } else { \n return false;\n }\n}", "testCase1_1() {\n let _verdict = false;\n let _tc1 = this._helperModule.calculateNewDateBasedOnPivotDate(new Date(\"2016-09-03\"), -2);\n if (Number(_tc1) == Number(new Date(\"2016-09-01\"))) {\n // passed the test\n _verdict = true;\n }\n\n return _verdict;\n }", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function _isNextMonth(d1, d2) {\n if (_isSameYear(d1, d2)) {\n return d2.getMonth() - d1.getMonth() === 1;\n } else if (_isNextYear(d1, d2)) {\n return d1.getMonth() === 11 && d2.getMonth() === 0;\n }\n return false;\n }", "function isSameMonth(a, b) {\n return a.getFullYear() === b.getFullYear() && b.getMonth() === a.getMonth();\n}", "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function validateYear(yr)\n {\n var valid = true;\n if(isNaN(yr))\n {\n valid=false;\n }\n else\n {\n var num = parseInt(yr);\n var d = new Date();\n if((num > (d.getFullYear()+5)) || (num < d.getFullYear()))\n {\n valid = false;\n }\n\n }\n return valid;\n\n }", "function getStartOfPreviousQuarter(baseDate) {\n\n var startOfPreviousQuarter = null;\n\n switch(baseDate.getMonth()) {\n case 0:\n case 1:\n case 2:\n startOfPreviousQuarter = new Date(baseDate.getFullYear() - 1, 9, 1);\n break;\n case 3:\n case 4:\n case 5:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 0, 1);\n break;\n case 6:\n case 7:\n case 8:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 3, 1);\n break;\n case 9:\n case 10:\n case 11:\n startOfPreviousQuarter = new Date(baseDate.getFullYear(), 6, 1);\n break;\n }\n\n return startOfPreviousQuarter;\n}", "function chkDurationYear(fromYear, toYear){\n\tif((fromYear.selectedIndex >= 0) && (toYear.selectedIndex >= 0)){\n\t\tif(fromYear.selectedIndex > toYear.selectedIndex){\n\t\t\ttoYear.selectedIndex = fromYear.selectedIndex;\n\t\t}\n\t}\n}" ]
[ "0.7048928", "0.6692871", "0.66361976", "0.65389264", "0.63547534", "0.63365585", "0.62701106", "0.6159095", "0.6129432", "0.6115656", "0.6101225", "0.60819244", "0.6069449", "0.6043508", "0.60178137", "0.5967939", "0.5959819", "0.5959819", "0.5906313", "0.5900762", "0.58990455", "0.5895712", "0.5892894", "0.58747345", "0.5871526", "0.58344406", "0.58292574", "0.58135235", "0.5785598", "0.5775745", "0.5746216", "0.5730547", "0.57144374", "0.57089823", "0.57013446", "0.5665628", "0.56517196", "0.5651508", "0.5648808", "0.56103015", "0.56103015", "0.55964744", "0.55803", "0.5573611", "0.55583316", "0.55583316", "0.5532567", "0.55126446", "0.5512032", "0.54684776", "0.5442221", "0.54363453", "0.54363453", "0.54363453", "0.5426072", "0.5420957", "0.54125434", "0.5397677", "0.53929836", "0.53863424", "0.53863424", "0.53863424", "0.53863424", "0.5378765", "0.53646374", "0.53644764", "0.53629744", "0.53575546", "0.5356919", "0.5345492", "0.5334749", "0.5333614", "0.53233886", "0.53211933", "0.5320086", "0.5313313", "0.5311139", "0.5275517", "0.52724904", "0.5271434", "0.5257209", "0.5247953", "0.5228985", "0.5214459", "0.52108204", "0.52035975", "0.52033556", "0.518872", "0.518698", "0.518698", "0.5183562", "0.51735055", "0.5173368", "0.5165188", "0.516096", "0.5159432", "0.5151186", "0.5132472", "0.5122169", "0.511463" ]
0.7781297
0
Compares one date with another disregarding all components less granular than the day
function compareDates(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareMonths(d1, d2); if (r === 0) { r = compareDays(d1, d2); } } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function comparisonByDate(dateA, dateB) {\n var c = new Date(dateA.date);\n var d = new Date(dateB.date);\n return c - d;\n }", "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "function compareDatesWH(date1, date2){\n var comp = DATES_EQUALS; // Son iguales\n if(date1.getFullYear() < date2.getFullYear()){\n comp = DATES_LOWER; // Date 1 es menor que date 2\n }\n else if(date1.getFullYear() > date2.getFullYear()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() < date2.getMonth()){\n comp = DATES_LOWER;\n }\n else if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() > date2.getMonth()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() < date2.getDate()){\n comp = DATES_LOWER;\n }\n else{\n if(date1.getFullYear() == date2.getFullYear() && date1.getMonth() == date2.getMonth() && date1.getDate() > date2.getDate()){\n comp = DATES_HIGHER; // Date 1 es mayor que Date 2\n }\n }\n }\n }\n return comp;\n }", "function compareDates (date1, date2)\n{\n newDate1 = new Date(date1);\n newDate1.setHours(0,0,0,0);\n newDate2 = new Date(date2);\n newDate2.setHours(0,0,0,0);\n var t1 = newDate1.getTime();\n var t2 = newDate2.getTime();\n if (t1 === t2) return 0;\n else if (t1 > t2) return 1;\n else return -1;\n}", "compareDate(a, b) {\n if (a.startDate < b.startDate) return -1\n if (a.startDate > b.startDate) return 1\n else return 0\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDate(a, b) {\r\n if (a.date > b.date) return 1;\r\n if (b.date > a.date) return -1;\r\n return 0;\r\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "dateShallowIncludesDate(date1, date2) {\n // First date is simple date\n if (date1.isDate) {\n if (date2.isDate) {\n return date1.dateTime === date2.dateTime;\n }\n\n if (!date2.startTime || !date2.endTime) {\n return false;\n }\n\n return date1.dateTime === date2.startTime && date1.dateTime === date2.endTime;\n } // Second date is simple date and first is date range\n\n\n if (date2.isDate) {\n if (date1.start && date2.date < date1.start) {\n return false;\n }\n\n if (date1.end && date2.date > date1.end) {\n return false;\n }\n\n return true;\n } // Both dates are date ranges\n\n\n if (date1.start && (!date2.start || date2.start < date1.start)) {\n return false;\n }\n\n if (date1.end && (!date2.end || date2.end > date1.end)) {\n return false;\n }\n\n return true;\n }", "function CompareDate(date1, date2)\n{\n var std_format = date1.split(\"-\"); \n s_dt= new Date(std_format[1]+\"-\"+std_format[0]+\"-\"+std_format[2]);\n var etd_format = date2.split(\"-\"); \n e_dt= new Date(etd_format[1]+\"-\"+etd_format[0]+\"-\"+etd_format[2]);\n if(s_dt>e_dt)\n return true;\n else \n return false;\n}", "function compareDate(dos, rd) {\n\n }", "function compare_dates(fecha, fecha2) \r\n { \r\n\t\r\n var xMonth=fecha.substring(3, 5); \r\n var xDay=fecha.substring(0, 2); \r\n var xYear=fecha.substring(6,10); \r\n var yMonth=fecha2.substring(3,5);\r\n var yDay=fecha2.substring(0, 2);\r\n var yYear=fecha2.substring(6,10); \r\n \r\n if (xYear > yYear){ \r\n return(true); \r\n }else{ \r\n if (xYear == yYear){ \r\n\t if (xMonth > yMonth){ \r\n\t \t\treturn(true); \r\n\t }else{ \r\n\t\t if (xMonth == yMonth){ \r\n\t\t if (xDay> yDay) \r\n\t\t return(true); \r\n\t\t else \r\n\t\t return(false); \r\n\t\t }else{\r\n\t\t \t return(false); \r\n\t\t } \r\n\t } \r\n }else{\r\n \t return(false); \r\n } \r\n \r\n } \r\n}", "function cmpDate(dat1, dat2) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1) || !isDate(dat2)) {\r\n alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = (new Date(dat2.substring(6, 10), dat2.substring(0, 2) - 1, dat2.substring(3, 5))).getTime();\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function compareDate(fromDate, toDate) {\r\r\tvar dt1 = parseInt(fromDate.substring(0, 2), 10);\r\r\tvar mon1 = parseInt(fromDate.substring(3, 5), 10);\r\r\tvar yr1 = parseInt(fromDate.substring(6, 10), 10);\r\r\tvar dt2 = parseInt(toDate.substring(0, 2), 10);\r\r\tvar mon2 = parseInt(toDate.substring(3, 5), 10);\r\r\tvar yr2 = parseInt(toDate.substring(6, 10), 10);\r\r\tvar date1 = new Date(yr1, mon1, dt1);\r\r\tvar date2 = new Date(yr2, mon2, dt2);\r\r\tif (date1 > date2) {\r\r\t\treturn 1;\r\r\t} else {\r\r\t\tif (date1 < date2) {\r\r\t\t\treturn -1;\r\r\t\t} else {\r\r\t\t\treturn 0;\r\r\t\t}\r\r\t}\r\r}", "function compareDates(date1, date2) {\n if (!date1 && !date2) {\n return true;\n }\n else if (!date1 || !date2) {\n return false;\n }\n else {\n return (date1.getFullYear() === date2.getFullYear() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getDate() === date2.getDate());\n }\n}", "function compareDates(a,b) {\n if(a.attributes.date.isBefore(b.attributes.date)) {return -1;}\n if(b.attributes.date.isBefore(a.attributes.date)) {return 1;}\n return 0;\n}", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "shallowIntersectsDate(other) {\n return this.dateShallowIntersectsDate(this, other.isDate ? other : new dateInfo_DateInfo(other, this.opts));\n }", "function compareDates(a, b)\n{\n var x=new Date(a.Date);\n var y=new Date(b.Date);\n \n console.log(\"hello we are hee\");\t\n\n console.log(x);\n console.log(y);\t\n\n if(x>y)\n {\n console.log(1);\n return 1;\n\n }\n else\n {\n console.log(-1);\t \n return -1;\n }\n}", "function dateChecker(date1, date2 = new Date()) {\n var date1 = new Date(Date.parse(date1));\n var date2 = new Date(Date.parse(date2));\n var ageTime = date2.getTime() - date1.getTime();\n\n if (ageTime < 0) {\n return false; //date2 is before date1\n } else {\n return true;\n }\n}", "function compareDates(date1, date2)\r\n{\r\n if(date1 < date2)\r\n return -1;\r\n else if(date1 > date2)\r\n return 1;\r\n else\r\n return 0;\r\n}", "function compareChargeDate(a, b){\n if(a.scheduledSubmitDate < b.scheduledSubmitDate) {\n\t\treturn -1;\n\t} else if(a.scheduledSubmitDate > b.scheduledSubmitDate) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "includesDate(other) {\n var _this2 = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.findShallowIntersectingRange(this, date);\n let result = true;\n this.iterateDatesInRange(range, function (state) {\n if (_this2.matchesDay(state.day)) {\n result = result && date.matchesDay(state.day);\n state.finished = !result;\n }\n });\n return result;\n }", "function CheckDateDifference(lowDate, highDate, comparison) {\n\t lowDateSplit = lowDate.split('/');\n\t highDateSplit = highDate.split('/');\n\n\t date1 = new Date();\n\t date2 = new Date();\n\n\t date1.setDate(lowDateSplit[0]);\n\t date1.setMonth(lowDateSplit[1] - 1);\n\t date1.setYear(lowDateSplit[2]);\n\n\t date2.setDate(highDateSplit[0]);\n\t date2.setMonth(highDateSplit[1] - 1);\n\t date2.setYear(highDateSplit[2]);\n\n\t if(comparison == \"eq\") {\n\t\t if(date1.getTime() == date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"lt\") {\n\t\t if(date1.getTime() < date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"gt\") {\n\t\t if(date1.getTime() > date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"le\") {\n\t\t if(date1.getTime() <= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n\t else if(comparison == \"ge\") {\n\t\t if(date1.getTime() >= date2.getTime()) {\n\t\t\t return true;\n\t\t }\n\t\t else {\n\t\t\t return false;\n\t\t }\n\t }\n}", "static compare(date1, date2) {\n let d1 = this.reverseGregorian(date1);\n let d2 = this.reverseGregorian(date2);\n\n return d1.localeCompare(d2);\n }", "sameDate(dateA, dateB) {\n return ((dateA.getDate() === dateB.getDate()) && (dateA.getMonth() === dateB.getMonth()) && (dateA.getFullYear() === dateB.getFullYear()));\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "sameDate(first, second) {\n if (first && second) {\n let firstValid = this.isValid(first);\n let secondValid = this.isValid(second);\n if (firstValid && secondValid) {\n return !this.compareDate(first, second);\n }\n return firstValid == secondValid;\n }\n return first == second;\n }", "function isDateWithinSameDay(date1, date2) {\n return date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear();\n }", "function compareDate(date1, date2) {\n let dateparts1 = date1.split('-');\n let dateparts2 = date2.split('-');\n let newdate1 = new Date(dateparts1[0], dateparts1[1] - 1, dateparts1[2]);\n let newdate2 = new Date(dateparts2[0], dateparts2[1] - 1, dateparts2[2]);\n return Math.ceil((newdate2 - newdate1) / (1000 * 3600 * 24)) + 1;\n}", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "dateShallowIntersectsDate(date1, date2) {\n if (date1.isDate) {\n return date2.isDate ? date1.dateTime === date2.dateTime : this.dateShallowIncludesDate(date2, date1);\n }\n\n if (date2.isDate) {\n return this.dateShallowIncludesDate(date1, date2);\n } // Both ranges\n\n\n if (date1.start && date2.end && date1.start > date2.end) {\n return false;\n }\n\n if (date1.end && date2.start && date1.end < date2.start) {\n return false;\n }\n\n return true;\n }", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function compareDates$static(d1/*:Date*/, d2/*:Date*/)/*:Number*/ {\n if (d1 === d2) {\n return 0;\n }\n\n if (d1 && d2) {\n var time1/*:Number*/ = d1.getTime();\n var time2/*:Number*/ = d2.getTime();\n if (time1 === time2) {\n return 0;\n } else if (time1 > time2) {\n return 1;\n }\n return -1;\n }\n\n if (!d1) {\n return 1;\n }\n\n if (!d2) {\n return -1;\n }\n }", "function compareDates(date_One, date_Two) {\n if (date_One.getFullYear() > date_Two.getFullYear())\n return 1;\n else if (date_One.getFullYear() < date_Two.getFullYear())\n return -1;\n else {\n if (date_One.getMonth() > date_Two.getMonth())\n return 1;\n else if (date_One.getMonth() < date_Two.getMonth())\n return -1;\n else {\n if (date_One.getDate() > date_Two.getDate())\n return 1;\n else if (date_One.getDate() < date_Two.getDate())\n return -1;\n else\n return 0;\n }\n }\n}", "function compare(a, b) {\n const dateA = a.date;\n const dateB = b.date;\n\n let comparison = 0;\n if (dateA > dateB) {\n comparison = 1;\n } else if (dateA < dateB) {\n comparison = -1;\n }\n return comparison * -1;\n }", "function compare(a,b) {\n\t\t\t\tif (new Date(a.date) < new Date(b.date))\n\t\t\t\t\treturn 1;\n\t\t\t\tif (new Date(a.date) > new Date(b.date))\n\t\t\t\t \treturn -1;\n\t\t\t\treturn 0;\n\t\t\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function compareDates(a, b) {\n\t\tif (b.transaction_date < a.transaction_date) {\n\t\t\treturn -1\n\t\t}\n\t\tif (b.transaction_date > a.transaction_date) {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}", "function _biggerThanToday(_Date2) {\n vDate1 = _getCurrentDate().split(\"-\")\n\t vDate2 = _Date2.value.split(\"-\")\n\n\t _Year1 = parseInt(vDate1[0]-0)\n\t _Month1 = parseInt(vDate1[1]-0)\n\t _Day1 = parseInt(vDate1[2]-0)\n\n\t _Year2 = parseInt(vDate2[0]-0)\n\t _Month2 = parseInt(vDate2[1]-0)\n\t _Day2 = parseInt(vDate2[2]-0)\n\n if (_Year1 > _Year2) {\n\t return false\n\t }\n\n\t if ((_Year1 == _Year2) && (_Month1 > _Month2)) {\n\t return false\n\t }\n\n\t if ((_Year1 == _Year2) && (_Month1 == _Month2) && (_Day1 >= _Day2)) {\n\t return false\n\t }\n\n\t return true\n\n}", "function compareDay(day1, day2){\n return day1.getFullYear() === day2.getFullYear() &&\n day1.getMonth() === day2.getMonth() &&\n day1.getDate() === day2.getDate();\n}", "function sortByDate(a, b) {\n let comparison = 0;\n\n // -------------------------------------------------------------JavaScript - Conditional Statments Ex. 3||\n if (a.getDate >= b.date) {\n comparison = 1;\n } else if (a.date <= b.date) {\n comparison = -1;\n }\n return comparison;\n}", "function byDate(a, b) {\n return a.date - b.date;\n}", "function sameDate(d0, d1) {\n\treturn d0.getFullYear() == d1.getFullYear() && d0.getMonth() == d1.getMonth() && d0.getDate() == d1.getDate();\n}", "function compareDates(ymd1,ymd2){\n\t// parse\n\tvar y1 = parseInt(ymd1.slice(0,4));\n\tvar m1 = parseInt(ymd1.slice(5,7));\n\tvar d1 = parseInt(ymd1.slice(8,10));\n\tvar y2 = parseInt(ymd2.slice(0,4));\n\tvar m2 = parseInt(ymd2.slice(5,7));\n\tvar d2 = parseInt(ymd2.slice(8,10));\n\t// compare years\n\tif(y1 > y2){\n\t\treturn 1\n\t} else if (y1 < y2) {\n\t\treturn -1\n\t} else {\n\t\t// compare months\n\t\tif(m1 > m2){\n\t\t\treturn 1\n\t\t} else if (m1 < m2) {\n\t\t\treturn -1 \n\t\t} else {\n\t\t\t// compare days\n\t\t\tif(d1 > d2){\n\t\t\t\treturn 1\n\t\t\t} else if (d1 < d2) {\n\t\t\t\treturn -1\n\t\t\t} else {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t}\n\t}\n}", "function dateCompare(date1, date2) {\n\t\tif (date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear()) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t}", "function soft_compare_dates(lowDate,MsgLowDate,highDate,MsgHighDate)\n{\t//controllo la validit� della prima data\n\tvar bStop = 0;\t\n\t\n\tif (!controlla_data_sys(lowDate,lowDate + 'Y',lowDate + 'M',lowDate + 'D',MsgLowDate))\n\t{\t//controllo la validit� della seconda data\n\t\tif (!controlla_data_sys(highDate,highDate + 'Y',highDate + 'M',highDate + 'D',MsgHighDate))\n\t\t{\t//Costruisco le date in modo che siano nello stesso formato e con la stessa lunghezza\n\t\t\t//aaaammgg facendo 2 chiamate alla funzione build_extended_date\n\t\t\tvar lower = build_extended_date(lowDate);\n\t\t\tvar higher = build_extended_date(highDate);\n\t\t\t\n\t\t\t//A questo punto controllo che le date non siano ne vuote ne uguali alla stringa 'NDNDND'\n\t\t\tif ((!(lower.length == 0)) && (!(higher.length == 0)) && (!(lower.toUpperCase() == 'NDNDND')) && (!(higher.toUpperCase() == 'NDNDND')))\n\t\t\t{\n\t\t\t\t//higher non deve essere posteriore a lower\n\t\t\t\tif\t(higher < lower)\n\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tvar strMsg = 'Attenzione: ' + MsgLowDate + ' ( '+ format_msg_date(document.forms[0].elements[lowDate].value) + ' )';\n\t\t\t\t\tstrMsg = strMsg + ' dovrebbe essere precedente a ' + MsgHighDate;\n\t\t\t\t\tstrMsg = strMsg + ' ( ' + format_msg_date(document.forms[0].elements[highDate].value) + ' )';\n\t\t\t\t\tstrMsg = strMsg + \".\\nPremere OK per continuare, Annulla per modificare \" + MsgHighDate + \".\";\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t//if (window.confirm ('Attenzione: ' + MsgLowDate + '\\nnon dovrebbe essere posteriore a ' + MsgHighDate + \".\\nPremere OK per continuare, Annulla per modificare \" + MsgLowDate))\n\t\t\t\t\tif (window.confirm (strMsg))\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.forms[0].elements[highDate + 'D'].focus();\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\t\t\t\t\n\t\t\t\t//alert ('Attenzione: ' + MsgLowDate + ' oppure\\n ' + MsgHighDate + ' non � valutabile');\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//alert ('Attenzione: ' + MsgHighDate + ' non � valida');\n\t\t\t//document.forms[0].elements[highDate + 'D'].focus();\n\t\t\treturn 1;\n\t\t}\n\t}\n\telse\n\t{\n\t\t//alert ('Attenzione: ' + MsgLowDate + ' non � valida');\n\t\t//document.forms[0].elements[lowDate + 'D'].focus();\n\t\treturn 1;\n\t}\n}", "intersectsDate(other) {\n var _this = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n if (!this.shallowIntersectsDate(date)) return null;\n if (!this.on) return this;\n const range = this.findShallowIntersectingRange(this, date);\n let result = false;\n this.iterateDatesInRange(range, function (state) {\n if (_this.matchesDay(state.day)) {\n result = result || date.matchesDay(state.day);\n state.finished = result;\n }\n });\n return result;\n }", "intersectsDate(other) {\n var _this = this;\n\n const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts);\n if (!this.shallowIntersectsDate(date)) return null;\n if (!this.on) return this;\n const range = this.findShallowIntersectingRange(this, date);\n let result = false;\n this.iterateDatesInRange(range, function (state) {\n if (_this.matchesDay(state.day)) {\n result = result || date.matchesDay(state.day);\n state.finished = result;\n }\n });\n return result;\n }", "function compareDateFunction(date1,date2){\r\n\tvar leftDate;\r\n\tvar rightDate;\r\n\tif(typeof(date1) == \"object\"){\r\n\t\tleftDate = date1;\r\n\t}else{\r\n\t\tleftDate = convertStr2Date(date1);\r\n\t}\r\n\tif(typeof(date2) == \"object\"){\r\n\t\trightDate = date2;\r\n\t}else{\r\n\t\trightDate = convertStr2Date(date2);\r\n\t}\r\n\treturn compareDate(leftDate,rightDate,0);\r\n}", "static isSameDate(dateA, dateB) {\n return (\n dateA.getFullYear() === dateB.getFullYear()\n && dateA.getMonth() === dateB.getMonth()\n && dateA.getDate() === dateB.getDate()\n );\n }", "function compareDatePart(date1, date2) {\n return getDatePartHashValue(date1) - getDatePartHashValue(date2);\n}", "function isSameDay(a, b) {\n return a.getDate() === b.getDate() && Math.abs(b.getTime() - a.getTime()) < ONE_DAY;\n}", "before(other) {\n if (!other) {\n return false;\n }\n if (this.year === other.year) {\n if (this.month === other.month) {\n return this.day === other.day ? false : this.day < other.day;\n }\n else {\n return this.month < other.month;\n }\n }\n else {\n return this.year < other.year;\n }\n }", "function cmpCurrentDate(dat1,datInMsec) {\r\n var day = 1000 * 60 * 60 * 24, // milliseconds in one day\r\n mSec1, mSec2; // milliseconds for dat1 and dat2\r\n // valudate dates\r\n if (!isDate(dat1)) {\r\n // alert(\"cmpDate: Input parameters are not dates!\");\r\n return 0;\r\n }\r\n \r\n // prepare milliseconds for dat1 and dat2\r\n mSec1 = (new Date(dat1.substring(6, 10), dat1.substring(0, 2) - 1, dat1.substring(3, 5))).getTime();\r\n mSec2 = datInMsec;\r\n // return number of days (positive or negative)\r\n return Math.ceil((mSec2 - mSec1) / day);\r\n}", "function compareDashedDates(date1, date2) {\n console.log(date1);\n console.log(date2);\n date1 = date1.split('-');\n date2 = date2.split('-');\n console.log(date1);\n console.log(date2);\n for (let i = 0; i < date1.length; i++) {\n if (parseInt(date1[i]) < parseInt(date2[i])) {\n return true;\n } else if (parseInt(date1[i]) > parseInt(date2[i])) {\n return false;\n }\n }\n return true;\n}", "function datesAreEquivalent(date1,date2){\n return (date1.getMonth() == date2.getMonth()) && (date1.getFullYear() == date2.getFullYear()) && (date1.getDate() == date2.getDate()) ;\n}", "checkIfDelay(date1,date2){\n a = new Date(date1);\n b = new Date(date2);\n\n if(b > a){\n return true\n }else{\n return false\n }\n\n }", "function compareDate(fromDate, toDate){\r\n\t// check both value is there or not\r\n\t// in else it will return true its due to date field validation is done on form level\r\n\tif (toDate != '' && fromDate != ''){\r\n\t\t// extract day month and year from both of date\r\n\t\tvar fromDay = fromDate.substring(0, 2);\r\n\t\tvar toDay = toDate.substring(0, 2);\r\n\t\tvar fromMon = eval(fromDate.substring(3, 5)-1);\r\n\t\tvar toMon = eval(toDate.substring(3, 5)-1);\r\n\t\tvar fromYear = fromDate.substring(6, 10);\r\n\t\tvar toYear = toDate.substring(6, 10);\r\n\r\n\t\t// convert both date in date object\r\n\t\tvar fromDt = new Date(fromYear, fromMon, fromDay);\r\n\t\tvar toDt = new Date(toYear, toMon, toDay); \r\n\r\n\t\t// compare both date \r\n\t\t// if fromDt is greater than toDt return false else true\r\n\t\tif (fromDt > toDt) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}else{\r\n\t\treturn true;\r\n\t}\r\n}", "function sortDate(a, b) {\n\t//getTime provides an equal value for h,min,s: the current time\n return new Date(a.date).getTime() - new Date(b.date).getTime();\n}", "function validateDateIsCorrect(dateObject){\n let currentDate = new Date();\n if(dateObject<currentDate){\n return false;\n }else { return true; }\n}", "function by_datetime( a, b ) {\n\n const a_date = moment( a.day.split(' - ')[1], 'MM/DD/YYYY');\n const b_date = moment( b.day.split(' - ')[1], 'MM/DD/YYYY');\n\n if ( b_date.isAfter( a_date ) ) {\n return -1;\n } else if ( b_date.isBefore( a_date ) ) {\n return 1;\n } else {\n return 0;\n }\n\n}", "function isCorrectOrder(yyyymmdd1, yyyymmdd2) {\r\n return yyyymmdd1 < yyyymmdd2;\r\n}", "function less(a,b) {\r\n return a.date < b.date;\r\n}", "function compareDateObject(date1, date2){\r\n if(date1 == null) return false;\r\n if(date2 == null) return false;\r\n\r\n var date1Long = date1.getTime();\r\n var date2Long = date2.getTime();\r\n\r\n if(date1Long - date2Long > 0) return '>';\r\n if(date1Long - date2Long == 0) return '=';\r\n if(date1Long - date2Long < 0) return '<';\r\n else\r\n return '';\r\n}", "function isSameDate(date1, date2) {\n return (date1 instanceof Date && date2 instanceof Date && date1.getDay()==date2.getDay() && date1.getMonth()==date2.getMonth() && date1.getFullYear()==date2.getFullYear());\n}", "function compareDatesValues(strDataInicial, strDataFinal)\n{\n if ((empty(strDataInicial)) || (empty(strDataFinal)))\n return false;\n if ((strDataInicial.length < 10) || (strDataFinal.length < 10))\n return false;\n if (convertDate(strDataInicial, 'YmdHis') > convertDate(strDataFinal, 'YmdHis')) {\n alertDialog('A data inicial deve ser sempre menor ou igual a data final.', 'Validação', 250, 150);\n return false;\n }\n return true;\n}", "function compareEqualsToday(sender, args)\n{\n args.IsValid = true;\n\n var todaypart = getDatePart(new Date().format(\"dd/MM/yyyy\"));\n var datepart = getDatePart(args.Value);\n\n var today = new Date(todaypart[2], (todaypart[1] - 1), todaypart[0]);\n var date = new Date(datepart[2], (datepart[1] - 1), datepart[0]);\n\n if (date > today || date<today)\n {\n args.IsValid = false;\n }\n\n return args.IsValid;\n}", "function compareDate(date1, date2) {\n\n //Hours equal\n if (date1.getHours() == date2.getHours()) {\n\n //Check minutes\n if (date1.getMinutes() == date2.getMinutes()) {\n return 0;\n } else {\n if (date1.getMinutes() > date2.getMinutes()) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n\n //Hours not equal\n else {\n if (date1.getHours() > date2.getHours()) {\n return 1;\n } else {\n return -1;\n }\n }\n}", "sameDay(d1, d2) {\n return d1.getFullYear() === d2.getFullYear() &&\n d1.getMonth() === d2.getMonth() &&\n d1.getDate() === d2.getDate();\n }", "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function DateCompareEqual(_strDate1, _strDate2) {\n var strDate;\n var strDateArray;\n var strDay;\n var strMonth;\n var strYear;\n\n strDateArray = _strDate1.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate1 = new Date(strYear, GetMonth(strMonth), strDay);\n\n strDateArray = _strDate2.split(\"-\");\n\n strDay = strDateArray[0];\n strMonth = strDateArray[1];\n strYear = strDateArray[2];\n\n _strDate2 = new Date(strYear, GetMonth(strMonth), strDay);\n\n if (_strDate1 >= _strDate2) {\n return true;\n }\n else {\n return false;\n }\n}", "function compare(a,b) {\n if (a.dateOfEvent > b.dateOfEvent)\n return -1;\n if (a.dateOfEvent < b.dateOfEvent)\n return 1;\n return 0;\n }", "function diffDates(date1, date0) { // date1 - date0\n if (largeUnit) {\n return diffByUnit(date1, date0, largeUnit);\n }\n else if (newProps.allDay) {\n return diffDay(date1, date0);\n }\n else {\n return diffDayTime(date1, date0);\n }\n }", "function compareByDateDESC(a, b) {\n\tif (!('date' in a)) {\n\t\treturn 1;\n\t}\n\tif (!('date' in b)) {\n\t\treturn -1;\n\t}\n\t\n\tif (parseInt(a.date) < parseInt(b.date)) {\n\t\treturn 1;\n\t}\n\tif (parseInt(a.date) > parseInt(b.date)) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}", "function date_greater_than (date1, date2)\n{\n //Dates should be in the format Month(maxlength=3) Day(num minlength=2), Year hour(minlength=2):minute(minlength=2)(24h time)\n //Eg Apr 03 2020 23:59\n //the function caller is asking \"is date1 greater than date2?\" and gets a boolean in return\n\n let months = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n\n //Compares the years\n if (parseInt(date1.substr(7, 4)) > parseInt(date2.substr(7, 4))) return true\n else if (parseInt(date1.substr(7, 4)) < parseInt(date2.substr(7, 4))) return false\n else //the elses are for if both values are the same\n {\n //Compares the months\n if (months.indexOf(date1.substr(0, 3)) > months.indexOf(date2.substr(0, 3))) return true\n else if (months.indexOf(date1.substr(0, 3)) < months.indexOf(date2.substr(0, 3))) return false\n else\n {\n //Compares the days\n if (parseInt(date1.substr(4, 2)) > parseInt(date2.substr(4, 2))) return true\n if (parseInt(date1.substr(4, 2)) < parseInt(date2.substr(4, 2))) return false\n else\n {\n //Compares the hours\n if (parseInt(date1.substr(12, 2)) > parseInt(date2.substr(12, 2))) return true\n else if (parseInt(date1.substr(12, 2)) < parseInt(date2.substr(12, 2))) return false\n else\n {\n //Compares minutes\n if (parseInt(date1.substr(15, 2)) > parseInt(date2.substr(15, 2))) return true\n else return false\n }\n }\n }\n }\n}", "function compareDates(d1, m1, y1, d2, m2, y2) {\n\n\tvar date1\t= new Number(d1);\n\tvar month1\t= new Number(m1);\n\tvar year1\t= new Number(y1);\n\tvar date2\t= new Number(d2);\n\tvar month2\t= new Number(m2);\n\tvar year2\t= new Number(y2);\n\n\tvar\treturnVal = 0;\n\tif (year1 < year2) {\n\t\treturnVal = -1;\n\t} else if (year1 > year2) {\n\t\treturnVal = 1;\n\t} else {\n\t\t//alert('same year');\n\t\tif (month1 < month2) {\n\t\t\treturnVal = -1;\n\t\t} else if (month1 > month2) {\n\t\t\treturnVal = 1;\n\t\t} else {\n\t\t\t//alert('same month');\n\t\t\tif (date1 < date2) {\n\t\t\t\treturnVal = -1;\n\t\t\t} else if (date1 > date2) {\n\t\t\t\treturnVal = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn returnVal;\n\n}", "function compareDates(date1, dateformat1, date2, dateformat2) {\n var d1 = getDateFromFormat(date1, dateformat1);\n var d2 = getDateFromFormat(date2, dateformat2);\n if (d1 == 0 || d2 == 0) {\n return -1;\n } else if (d1 > d2) {\n return 1;\n }\n return 0;\n}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function compareDates(date1,dateformat1,date2,dateformat2) {\r\n\tvar d1=getDateFromFormat(date1,dateformat1);\r\n\tvar d2=getDateFromFormat(date2,dateformat2);\r\n\tif (d1==0 || d2==0) {\r\n\t\treturn -1;\r\n\t\t}\r\n\telse if (d1 > d2) {\r\n\t\treturn 1;\r\n\t\t}\r\n\treturn 0;\r\n\t}", "function compareDate(inputDate1, inputDate2) {\r\n if(!inputDate1 || !inputDate2) {\r\n return -1;\r\n }\r\n\tvar date1 = inputDate1.split('-');\r\n\tvar date2 = inputDate2.split('-');\r\n\t\r\n\tif(date1.length != 3 || date2.length != 3 ) { //checks if dates are valid\r\n\t\treturn -1;\r\n\t}\r\n\tif(date1[0] < date2[0]) {\r\n\t\treturn 1;\r\n\t}\r\n\tif(date1[0] == date2[0]) {\r\n\t\tif(date1[1] < date2[1]) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\tif(date1[1] == date2[1]) {\r\n\t\t\tif(date1[2] <= date2[2]) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn -1;\r\n}", "function checkTodateLess(dateField1,dateField2,patname,errorMsg1)\n{\n frmDate=dateField1.value;\n frmDate=Date.UTC(frmDate.substr(6,4),frmDate.substr(3,2)-1,frmDate.substr(0,2)); \n toDate=dateField2.value;\n toDate=Date.UTC(toDate.substr(6,4),toDate.substr(3,2)-1,toDate.substr(0,2)); \n if(frmDate > toDate)\n {\n alert(errorMsg1);\n dateField2.focus();\n return false;\n }\n else\n {\n return true; \n }\n}", "function Date$prototype$lte(other) {\n return lte(this.valueOf(), other.valueOf());\n }", "function compareGreaterThanEqualsToday(sender, args) {\n args.IsValid = true;\n\n var todaypart = getDatePart(new Date().format(\"dd/MM/yyyy\"));\n var datepart = getDatePart(args.Value);\n\n var today = new Date(todaypart[2], (todaypart[1] - 1), todaypart[0]);\n var date = new Date(datepart[2], (datepart[1] - 1), datepart[0]);\n\n if (date >= today) {\n args.IsValid = true;\n }\n else {\n args.IsValid = false;\n }\n\n return args.IsValid;\n}", "function Date$prototype$lte(other) {\n return lte (this.valueOf (), other.valueOf ());\n }", "function calendar_helper_dateEquals(date1, date2){\n if (date1.getFullYear() == date2.getFullYear())\n if (date1.getMonth() == date2.getMonth())\n if (date1.getDate() == date2.getDate())\n return true;\n return false;\n}", "isValidDate(hire_date){\n let arr = hire_date.split('-');\n let hireDate = new Date(parseInt(arr[0]), parseInt(arr[1]) - 1, parseInt(arr[2]));\n let currDate = new Date();\n\n if(hireDate.getTime() < currDate.getTime()){\n return true;\n }\n return false;\n }", "function checkDates(dateField1,dateField2,errorMsg)\n{\n frmDate=dateField1.value;\n frmDate=Date.UTC(frmDate.substr(6,4),frmDate.substr(3,2)-1,frmDate.substr(0,2)); \n toDate=dateField2.value;\n toDate=Date.UTC(toDate.substr(6,4),toDate.substr(3,2)-1,toDate.substr(0,2)); \n if(frmDate > toDate)\n {\n alert(errorMsg);\n dateField2.focus();\n return false;\n }\n else\n {\n return true; \n }\n}" ]
[ "0.6870402", "0.685053", "0.6787804", "0.6778648", "0.67775005", "0.6760404", "0.6747039", "0.67458457", "0.6737737", "0.669407", "0.66880023", "0.6683086", "0.6683086", "0.6683086", "0.6683086", "0.6683086", "0.66746813", "0.6653407", "0.6653407", "0.6587927", "0.6578936", "0.6564979", "0.6561747", "0.6557744", "0.65326726", "0.6503509", "0.6496159", "0.6496159", "0.64830905", "0.6476533", "0.64592737", "0.6458637", "0.64569235", "0.64569235", "0.644933", "0.64379585", "0.64212483", "0.6411755", "0.6411755", "0.6411755", "0.63929105", "0.6371569", "0.6360797", "0.6360797", "0.63548154", "0.6349628", "0.634142", "0.63381225", "0.63318944", "0.6331814", "0.6331814", "0.6325275", "0.63066137", "0.6282755", "0.6277332", "0.62653863", "0.62611", "0.6256773", "0.62461627", "0.62426734", "0.62426734", "0.6239429", "0.62276405", "0.62178993", "0.6211126", "0.6197622", "0.61753905", "0.61719334", "0.61666656", "0.61642", "0.6157276", "0.6155877", "0.6151102", "0.6149432", "0.61361927", "0.61346585", "0.6131606", "0.61276454", "0.6124219", "0.6118727", "0.61153996", "0.6103661", "0.60794854", "0.60776734", "0.6067511", "0.6067487", "0.60591793", "0.60454625", "0.60396576", "0.60343444", "0.60242265", "0.60242265", "0.60239387", "0.60236365", "0.6017142", "0.60130334", "0.601141", "0.60016125", "0.5992584", "0.599184" ]
0.6533868
24
var answer = prompt("") / ADD YOUR CODE BELOW
function checkPassword() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ask(question){\n return prompt(question);\n }", "function ask(question){\n return prompt(question);\n }", "function promptThem() {\n\tvar userResponse = prompt(\"Type something:\");\n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\");\n return input.question(\"Enter a word to score:\");\n }", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\\n\");\n return input.question(\"Enter a word to score: \"); \n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\");\n let word=input.question(\"\\nEnter a word to score:\");\n\n \n return word\n}", "function initialPrompt() {\n console.clear()\n let returnedWord =input.question(\"Let's play some scrabble! Enter a word:\");\n return (returnedWord)\n}", "function q5() {\n\n var answerToFifthQ = prompt('Do I have a professional background in Business Administration and Sales?').toUpperCase();\n\n if (answerToFifthQ === 'Y' || answerToFifthQ === 'YES') {\n alert('Correct! Let\\'s keep going!');\n }else if (answerToFifthQ === 'N' || answerToFifthQ === 'NO') {\n alert('Um, ya dun goofed!');\n }\n\n}", "function initialPrompt() {\n word=input.question(\"Let's play some scrabble! Enter a word to score:\");\n}", "function initialPrompt() {\n console.log(\"\\nLet's play some Scrabble!\");\n word = input.question(\"Enter a word to score:\");\n return word\n}", "function q4() {\n\n var answerToFourthQ = prompt('Will I eventually become an effective front end web developer?').toUpperCase();\n\n if (answerToFourthQ === 'Y' || answerToFourthQ === 'YES') {\n alert('Correct! Let\\'s keep going!');\n }else if (answerToFourthQ === 'N' || answerToFourthQ === 'NO') {\n alert('Um, ya dun goofed!');\n }else{alert('Please type accurately! Answer YES or NO!')};\n\n}", "function getInput(){\n return prompt(\"Enter your score:\");\n}", "function question2(){\n var questionTwo = prompt(\"Do i like CSS more than JavaScript? (yes/y/no/n)\").toLowerCase();\n console.log(\"User's answer to question two\", questionTwo);\n\n if (questionTwo === \"yes\" || questionTwo ==='y'){\n alert(\"You are wrong! I prefer JavaScript.\");\n }\n else if(questionTwo === \"no\" || questionTwo ===\"n\"){\n alert(\"You're right!\");\n correctAnswer++;\n }\n else{\n alert(\"You have to answer with yes or no.\");\n }\n}", "function prompt(str) {}", "function q1() {\n\n var answerToFirstQ = prompt('Was I born in the United States?').toUpperCase();\n\n if (answerToFirstQ === 'N' || answerToFirstQ === 'NO') {\n alert('Correct! Looks like you actually read the bio!');\n userScore++\n }else if (answerToFirstQ === 'Y' || answerToFirstQ === 'YES') {\n alert('Um, ya dun goofed!');\n }else{alert('Please type accurately! Answer YES or NO!')};\n\n}", "function yourName() {\n var userName = prompt('What is your name?');\n console.log('User responded to the user name question with: ' );\n\n alert('thats ' + correctAnswers + '/2 correct answers! Good Job, ' + userName);\n\n//end of yourName Function.\n}", "function promptquestion2(){\nvar userQuestion2 = prompt('Is 8x10=21?');\n//console.log('this is the users answer for question 2 '+ userQuestion2);\n\nif(userQuestion2.toLocaleLowerCase() === 'yes'|| userQuestion2.toLocaleLowerCase()=== 'y') {\n alert('You answered wrong dummy!');\n} else if(userQuestion2.toLocaleLowerCase()=== 'no'|| userQuestion2.toLocaleLowerCase()=== 'n') {\n alert('Correct!');\n userScore= userScore+1;\n} else{\n alert('Please type a correct response');\n}\n}", "function hobby(){\n let myHobby = prompt('Do you know my favorite hobby? yes or no?');\n console.log(myHobby);\n\n if (myHobby === 'yes'){\n alert('Tell me!');\n } else {\n alert('Guess!');\n }\n}", "function question1() {\r\n response = prompt('Have you heard of Scott Pilgrim?');\r\n response = response.toLowerCase();\r\n console.log(response + ' is user response');\r\n if (response === 'yes') {\r\n alert('That\\'s awesome ' + username + '! I hope you enjoyed it! It\\'s my absolute favorite series');\r\n correct++;\r\n } else {\r\n alert('You should check it out! It\\'s my absolute favorite series');\r\n }\r\n }", "function promptquestion2(){\n var userQuestion2 = prompt('Is 8x10=21?');\n\n if(userQuestion2.toLocaleLowerCase() === 'yes'|| userQuestion2.toLocaleLowerCase()=== 'y') {\n alert('You answered wrong dummy!');\n } else if(userQuestion2.toLocaleLowerCase()=== 'no'|| userQuestion2.toLocaleLowerCase()=== 'n') {\n alert('Correct!');\n userScore++;\n } else{\n alert('Please type a correct response');\n }\n}", "function q3() {\n\n var answerToThirdQ = prompt('Am I currently an effective front end web developer?').toUpperCase();\n\n if (answerToThirdQ === 'N' || answerToThirdQ === 'NO') {\n alert('Correct! You\\'re a savant!');\n }else if (answerToThirdQ === 'Y' || answerToThirdQ === 'YES') {\n alert('Um, ya dun goofed!');\n }else{alert('Please type accurately! Answer YES or NO!')};\n\n}", "function ask() {\n return inquirer.prompt(questions);\n}", "function askName(){\nvar UserName = prompt('Hi there! What\\'s your name?');{\n alert('It\\'s to meet you, ' + UserName + ' I hope we can be friends! But first, I must ask ye these questions many to see if I can call you buddy.');\n}\n}", "function getIntern() {\n\n inquirer \n .prompt([\n \n\n ])\n .then(answers =>{\n \n })\n\n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\");\n\n wordEntered = input.question(\"Enter a word to score: \");\n}", "function q1(){\n var favorite_passtime;\n var favorite_passtime_correct_answer = 'y';\n favorite_passtime = prompt('Do you think that rob obsessivly plays video games? Y or N');\n console.log(favorite_passtime + ' y or n');\n if(favorite_passtime === favorite_passtime_correct_answer){\n alert('How could he not come on now');}\n else{\n alert('Well your wrong because gaming is life!');\n }\n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble! \");\n\n let wordToScore = input.question(\"Enter a word to score:\");\n\n return wordToScore;\n}", "function askForString() {\n let response = prompt(\"What string would you like to reverse?\");\n return response;\n}", "function saludarYpedirNombre(){\n let nombre = prompt('Hola! Puede ingresar su nombre por favor');\n alert('Hola alumno ' + nombre);\n alert('A continuacion se le pediran las notas de sus examenes');\n}", "function work1(){\n let work = prompt('Do you know where I work? yes or no?');\n console.log(work);\n\n if (work === 'yes'){\n alert('You know too much about me!');\n } else {\n alert('I work for Apple');\n }\n}", "function four() {\n var hoowah = prompt('Was Dayne an Army Ranger?')\n if (hoowah === 'y' || hoowah === 'yes' || hoowah === 'n' || hoowah === 'no') {\n hoowah = hoowah.toUpperCase()\n console.log(hoowah + ', Dayne was not in the Army.');\n }\n if (hoowah === 'NO') {\n alert('Correct.')\n correctanswer++;\n } else {\n alert('Incorrect.')\n }\n}", "function userPrompt() {\n return inquirer.prompt(questions);\n}", "function questionTwo(){\n var likesFootball = prompt('Do I enjoy watching football?');\n if(likesFootball.toLowerCase() === 'yes' || likesFootball.toLowerCase() === 'y'){\n alert('You know me so well!');\n score++;\n }else{\n alert('Wow, why are you even taking this quiz');\n }\n console.log(likesFootball);\n}", "function Pedirnombre(){\r\n let nombre = prompt(\"Ingrese su nombre\");\r\n alert(\"Su nombre es:\" + nombre);\r\n}", "function initialPrompt() {\n let word = input.question(\"Let's play some scrabble! \\n \\n Enter a word to score:\");\n // console.log(oldScrabbleScorer(word)\n return word\n}", "function initialPrompt() {\n //console.log(\"Let's play some scrabble! Enter a word:\");\n let userWord = input.question(\"Let's play some scrabble! Enter a word: \");\n\n return userWord;\n \n}", "function promptFunc() {\n var txt;\n var mark = prompt(\"Enter your mark\", \"00\");\n if (mark == null || mark == \"\") {\n txt = \"User cancelled the prompt.\";\n } else {\n txt = \"Your mark is \" + mark;\n }\n document.getElementById(\"prmpt\").innerHTML = txt;\n}", "function question1(){\n\n var doneCartwheel = prompt('Have I tried a cartwheel before?').toUpperCase();\n\n console.log('Done Cartwheel?: ' + doneCartwheel);\n\n if (doneCartwheel === 'Y' || doneCartwheel === 'YES') {\n alert('Wrong! I don\\'t know how people do it.');\n } else if (doneCartwheel === 'N' || doneCartwheel === 'NO'){\n alert('So true..I wouldn\\'t imagine doing one.');\n numberOfRightAnswers++;\n } else {\n alert(tryingToBeCool);\n }\n\n var el = document.getElementById('cartwheel-user-response');\n el.textContent = doneCartwheel;\n}", "function questionFour(){\n var likesWorkingOut = prompt('Do I like working out?');\n if(likesWorkingOut.toLowerCase() === 'no' || likesWorkingOut.toLowerCase() ==='n'){\n alert('You got that right!');\n score++;\n }else{\n alert('Sorry, I am the laziest person ever');\n }\n console.log(likesWorkingOut);\n}", "function promptUser(){\n return inquirer.prompt(questions);\n}", "function chap12(){\n var waiterQuestion = \"What would you like for your order? \";\n var menuOption = \"(Lobster)\";\n var waiterAnswer = \"We don't have Lobster anymore.\";\n var waiterAnswer2 = \"Thanks for your order.\";\n var firstOrder = prompt(waiterQuestion + menuOption);\n if (firstOrder === \"Lobster\"){\n alert(waiterAnswer);\n } else {\n alert(waiterAnswer2);\n }\n}", "function prompt (question) {\n return new Promise((resolve, reject) => {\n promptly.prompt(question, (err, value) => {\n if (err) {\n reject(err);\n return;\n }\n resolve(value);\n });\n });\n}", "function q2() {\n\n var answerToSecondQ = prompt('Am I fluent in two languages?').toUpperCase();\n\n if (answerToSecondQ === 'Y' || answerToSecondQ === 'YES') {\n alert('Correct! Let\\'s keep going!');\n }else if (answerToSecondQ === 'N' || answerToSecondQ === 'NO') {\n alert('Um, ya dun goofed!');\n }else{alert('Please type accurately! Answer YES or NO!')};\n\n}", "function myFortune() {\n var children = prompt('How many Kids do you like to have?')\n var partername = prompt('with whoom would you like to marry?')\n var geolocation = prompt('where would you like to live?')\n var jobtitle = prompt('in what positin woild you like to work?') \n alert('you will have ' + children + ' children with ' + partername + '.' + ' you will live in ' + geolocation + ' and work as ' + jobtitle + '.')\n}", "function askCodeQuestion(){\n var codeYN= prompt('Next up: can Courtney code? (yes or no)').toLowerCase();\n\n if (codeYN === 'yes' || codeYN === 'y') {\n alert('DANG STRAIGHT SHE CAN - like a MOTHER! ' + userName + ', you must know her well!');\n qCode = 1;\n } else if (codeYN === 'no' || codeYN === 'n') {\n alert(userName + ', really? OF COURSE SHE CAN!');\n } else {\n alert('Was a \"y\" or \"n\" too difficult? C\\'mon, ' + userName + ', you\\'re better than that! For the record, Courtney can code LIKE A MOTHER!');\n }\n}", "function one() {\n var origin = prompt('Is Dayne from Seattle?');\n if (origin === 'y' || origin === 'yes' || origin === 'n' || origin === 'no') {\n origin = origin.toUpperCase()\n console.log(origin + ', Dayne is from Seattle.');\n }\n if (origin === 'YES') {\n alert('Correct.')\n correctanswer++;\n } else {\n alert('Incorrect.')\n }\n}", "function promptUser() {\n return inquirer.prompt(questions);\n}", "function usrReply() {\n var prmptQuestion = \"Are you a beaver or duck Fan?!!!\"\n var userInput = prompt(prmptQuestion);\n myMessage(userInput);\n }", "function promptUser(){\n return inquirer.prompt(questions)\n }", "function inputUserChoice()\r\n{\r\n var inputChoice = prompt(\"Do you choose rock, paper, scissors?\");\r\n // document.write(\"You chose \" + inputChoice + \"<br>\");\r\n return inputChoice;\r\n}", "function questionTwoFootball() {\n var likeFootball = prompt('Next question. Do I like football? ').toUpperCase();\n console.log('Do I like football? ' + likeFootball);\n\n if(likeFootball === 'Y'){\n alert('Only if the SEAHAWKS are playing! Just kidding. You\\'re right!');\n }else if(likeFootball === 'N'){\n alert('Oh man! You missed that one. I love footall!');\n }else{\n alert('Please answer Y or N.');\n }\n}", "function q1 (){\n let answer = prompt('Is Quen from Maine?');\n answer = answer.toLowerCase();\n \n //question1\n if (answer === answerBank[2] || answer === answerBank[3]){\n console.log('correct');\n globalCorrect = globalCorrect + 1;\n alert('You got it correct, ' + userName + '!');\n }\n else if (answer === answerBank[0] || answer === answerBank[1]){\n console.log('Wrong');\n alert('Ouch! Better luck on the next one.');\n }\n else{\n //console.log('Non accepted answer submitted');\n alert('Wow, really?');\n }\n}", "function greeting(){\r\n var name=prompt(\"what is your name\");\r\n var res=\"hello \"+name;\r\n console.log(res) \r\n}", "function question3(){\n var questionThree = prompt(\"Was i born in March? (yes/y/no/n)\").toLowerCase();\n console.log(\"User's answer to question three\", questionThree);\n if (questionThree === \"yes\" || questionThree ==='y'){\n alert(\"Yes!\");\n correctAnswer++;\n }\n else if(questionOne === \"no\" || questionOne ===\"n\"){\n alert(\"You're wrong.\");\n }\n else{\n alert(\"You have to answer with yes or no.\");\n }\n}", "function tellFortuneAdvanced() {\n\n var job = prompt(\"What is your dream job?\")\n var location = prompt(\"Where do you want to live?\")\n var marry = prompt(\"Who would you like to marry?\")\n var kids = prompt(\"How many kids do you want?\")\n\n alert(\"You will be a \" + job + \" in \" + location + \" and married to \" + marry + \" with \" + kids + \" kids.\");\n\n}", "function questionFiveTravel() {\n var leaveCountry = prompt('Have I ever been out of the country? ').toUpperCase();\n console.log('Have I ever left the US? ' + leaveCountry);\n\n if( leaveCountry === 'Y'){\n alert('Good Answer! I have been a couple places. My favorite was Tahiti.');\n }else{\n alert('Not quite. I have been a couple of places. ');\n }\n}", "function makeQuestion(question, answer) {\n console.log('The question is: ' + question);\n console.log('Your possible answers are: ');\n for (var i = 0; i < answer.length; i++) {\n console.log(i + '.- ' + answer[i].answer);\n }\n userAnswer = prompt('Type your answer: ');\n}", "function questionThree(){\n var likesCheese = prompt('Do I like cheese?');\n if(likesCheese.toLowerCase() === 'no' || likesCheese.toLowerCase() === 'n'){\n alert('Wow, we really are besties');\n score++;\n }else{\n alert('Ewwww cheese, gross');\n }\n console.log(likesCheese);\n}", "function saludarnombre(){\nvar nombre = prompt(\"Ingrese tu nombre :\");\n alert(\"Hola \"+ nombre);\n}", "function prompt() {\n cli.rl.prompt();\n}", "function ask(questions,rightAnswers) {\n var userAnswer = prompt(questions);\n console.log(questions, user + ' answers ' + userAnswer);\n if (rightAnswers === userAnswer.toLowerCase()) {\n alert('you are right!');\n correctTotalAnswers++;\n } else {\n alert('nope, that is wrong!');\n }\n}", "function questionprompt1(){\n var userQuestion1 = prompt('Is 2+2=4?');\n //So these if statements are the questions with the last if being a pop up telling the user their score\n if(userQuestion1.toLocaleLowerCase() === 'yes'|| userQuestion1.toLocaleLowerCase()=== 'y') {\n alert('Correct!');\n userScore++;\n } else if(userQuestion1.toLocaleLowerCase()=== 'no'|| userQuestion1.toLocaleLowerCase()=== 'n') {\n alert('You answered wrong dummy!');\n } else{\n alert('Please type a correct response');\n }\n}", "function questionOnePets() {\n var ownPets = prompt('First question. Do you think I own any pets? ').toUpperCase();\n console.log('Do I own pets? ' + ownPets);\n\n if(ownPets === 'Y'){\n alert('Oh man! I don\\'t own pets currently!');\n }else{\n alert('Lucky Guess!');\n }\n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\\n\");\n let userWord = input.question(\"Enter a word to score: \");\n return userWord.toLowerCase();\n}", "function askJokeQuestion(){\n var jokeYN= prompt('Does she like bad jokes? (yes or no)').toLowerCase();\n\n if (jokeYN === 'yes' || jokeYN === 'y') {\n alert('Like them? More like LOVES them!');\n qJoke = 1;\n } else if (jokeYN === 'no' || jokeYN === 'n') {\n alert('For better or for worse, I\\'m embarrassed to say she LOVES them.');\n } else {\n alert('Invalid input - you were supposed to write yes or no. As for bad jokes? She LOVES \\'em.');\n }\n}", "function getEngineer() {\n\n inquirer \n .prompt([\n \n\n ])\n .then(answers =>{\n \n })\n\n}", "function prompt(text) {\n let response = readlineSync.question(text + ' ');\n\n return response;\n}", "function getInput() {\n console.log(\"Please choose either 'rock', 'paper', or 'scissors'.\");\n return prompt();\n}", "function getInput() {\n console.log(\"Please choose either 'rock', 'paper', or 'scissors'.\");\n return prompt();\n}", "function amIafraid() {\n var bigFear = prompt('Is her biggest fear heights?').toLowerCase();\n if (bigFear === 'no') {\n alert('Correct! My biggest fear is spiders!');\n points = points + 1;\n } else if (bigFear === 'n') {\n alert('Correct! My biggest fear is spiders!');\n } else {\n alert('Sorry, my biggest fear is spiders!');\n }\n console.log('Biggest fear heights? The user answered: ' + bigFear);\n}", "function ask_user() {\n var user = prompt(\"What's your name: \");\n alert(\"Hi! \" + user + \" Welcome to my blog\");\n}", "function myFunction() {\n var person = prompt(\"Please enter your name\", \"Dear\");\n if (person != null) {\n document.getElementById(\"demo\").innerHTML =\n \"Hello \" + person + \"! How are you today?\";\n }\n }", "question(string) {\n\n string = string + ' ' // Add space between question and prompt answer\n\n var answer = readline.question(string)\n\n return answer\n\n }", "function three() {\n var car = prompt('Does Dayne drive a BMW?')\n if (car === 'y' || car === 'yes' || car === 'n' || car === 'no') {\n car = car.toUpperCase()\n console.log(car + ', Dayne drives the Ultimate Driving Machine.');\n }\n if (car === 'YES') {\n alert('Correct.')\n correctanswer++;\n } else {\n alert('Incorrect.')\n }\n}", "function name(){\n var name = prompt(\"Enter your name?\")\n console.log(name)\n}", "function getPalindrome() {\n let response = prompt(\"Let's do a palindrome check! Enter your word:\");\n return response;\n}", "function askName() {\n var userName = prompt(\"Enter name\");\n}", "function getPrompt() {\n rl.question('word ', (answer) => {\n console.log(pigLatin(answer));\n getPrompt();\n });\n}", "function askName(){\n playerName=prompt(\"Introduce tu nombre\", \"Jugador\");\n}", "function myWork(){\n\n let job = prompt(' Please read the second paragraph, I think this will help you, so my last job was \"teacher , chashier\" ?');\n if (job === 'cashier') {\n alert('Unfortenatly yes :P !');\n score++;\n } else if (job === 'teacher') {\n alert('No no !!');\n prompt('So what do you think now ?');\n }\n \n}", "function prompt() {\n console.log(\"Enter input as either:\");\n console.log(\"> 'timeout' [name] [seconds]\");\n console.log(\"> 'ban' [name]\");\n console.log(\"> 'remove' [name]\");\n console.log(\"> 'list'\")\n}", "function setName(){\r\n askForm=prompt('Enter your name here..','');\r\n}", "function prompt(question) {\n\tvar r = rl.createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stdout,\n\t\tterminal: false\n\t});\n\treturn new Promise( function(resolve,error) {\n\t\tr.question(question, function(answer) {\n\t\t\tr.close();\n\t\t\tresolve(answer);\n\t\t});\n\t});\n}", "function promptUser() {\n return inquirer.prompt(userQuestions);\n}", "function myCountryFun(){\n let myCountry=prompt(\"I am from Jordan ! \"+\" \"+\"(yes/no)\");\n console.log(myCountry)\n if(myCountry.toUpperCase()=='YES' || myCountry.toUpperCase()=='Y'){\n alert(\"Yes, this is true.\");\n sum=sum+1;\n }else if(myCountry.toUpperCase()=='NO' || myCountry.toUpperCase()=='N'){\n alert(\"No, this is false. I am really from Jordan.\");\n }else{\n alert(\"You lost the point ! because you should answer with yes or no.\")\n alert(\"Actually to know; I am from Jordan.\")\n }\n }", "function initialPrompt() {\n word = input.question(\"\\nLet's play some scrabble! Enter a word: \");\n\n word = word.toLowerCase();\n\n return word;\n}", "function ask() {\n inquirer.prompt(questions).then(function(answers) {\n output.push(answers.userSelection);\n if (answers.userSelection == choiceArray[0]) {\n console.log(\"Run Display Twitter\");\n twitterCall();\n } else if (answers.userSelection == choiceArray[1]) {\n console.log(\"Run Display Spotify\");\n spotifyCall();\n } else if (answers.userSelection == choiceArray[2]) {\n console.log(\"Run Display Movies\");\n } else {\n console.log(\"Please make a selection by using the arrow keys\");\n }\n })\n\n }", "function haveIbeentoAustralia() {\n var visitedAus = prompt('Has she ever been to Australia?').toLowerCase();\n if (visitedAus === 'no') {\n alert('Correct, I have not been to Australia!');\n points = points + 1;\n } else if (visitedAus === 'n') {\n alert('Correct, I have not been to Australia!');\n } else {\n alert('That\\'s wrong! I have not been to Australia.');\n }\n console.log('Been to australia? The user answered: ' + visitedAus);\n}", "function myFunction() {\r\n var person = prompt(\"Please enter your name\", \"Harry Potter\");\r\n if (person != null) {\r\n document.getElementById(\"demo\").innerHTML =\r\n \"Hello \" + person + \"! How are you today?\";\r\n }\r\n}", "function initialPrompt() {\n let word = input.question(\"\\nLet's play some scrabble! Enter a word: \");\n //console.log(oldScrabbleScorer(word));\n return word; //Pass word to next.\n}", "function askForPrompt() {\n\tprompt.start();\n\n\tprompt.get({\"properties\":{\"name\":{\"description\":\"Enter a command\", \"required\": true}}}, function (err, result) { \n\t\tcommandFinder(result.name)\n\t})\n}", "function questionFourLotto() {\n var winLotto = prompt('Next question. Have I ever won the lottery? ').toUpperCase();\n console.log('Did I win the lottery? ' + winLotto);\n\n if(winLotto === 'Y'){\n alert('Really??');\n alert('Do you think I would be sitting in this class if I did? ');\n }else{\n alert('Unfortunately.....You are right!');\n }\n alert('Okay. Last question.');\n}", "function sayHello () {\n\tvar response = prompt (\"What is your name?\");\n\talert (\"Hello\" + response + \"!\");\n}", "function nombreUsuario() {\r\n\r\n let nombre = prompt(\"Ingresa tu nombre\");\r\n alert(nombre);\r\n\r\n //encapsula codigo para ejecutar\r\n\r\n}", "function initialPrompt() {\n let userInput = null;\n let boolean = false;\n while (boolean == false) {\n userInput = input.question(\"Let's play some scrabble! \\nEnter a word to score: \");\n boolean = validateInput(userInput);\n }\n return userInput;\n}", "function questionFive(){\n var likesDoughnuts = prompt('Do I like doughnuts?');\n if(likesDoughnuts.toLowerCase() === 'yes' || likesDoughnuts.toLowerCase() === 'y'){\n alert('Mmmmmm doughnuts');\n score++;\n }else{\n alert('Who doesn\\'t like doughnuts');\n }\n console.log(likesDoughnuts);\n}", "function quizGame() {\n let name = prompt(\"what is your name?\");\n let questions = [\n `What color do you like to wear ${name}?`,\n `Hey ${name} what do you like to eat?`,\n `Where does ${name} like to travel?`\n ];\n let answers = [];\n let myAnswers = [\"purple\", \"pizza\", \"Australia\"];\n for (let i = 0; i < questions.length; i++) {\n answers[i] = prompt(questions[i]);\n if (answers[i].toLowerCase() === \"q\") {\n break;\n }\n }\n for (let i = 0; i < answers.length; i++) {\n alert(`${name}, you like ${answers[i]}, i like ${myAnswers[i]}`);\n }\n}", "function prompt() {\n let result = inquirer.prompt.apply(inquirer.prompt, arguments);\n result.ui.rl.on('SIGINT', ()=>{process.exit(1);});\n return result;\n}", "function askForName() \n{\n // TODO 1.1b: Ask for candidate's name //\n let candidateName = input.question(\"Enter your name: \");\n console.log('Welcome', candidateName);\n}", "function riddler(questions, answers) {\r\n for (let y = 0; y < questions.length; y++) {\r\n var testAnswer = prompt(questions[y]);\r\n if (testAnswer.charAt(0).toLowerCase() === answers[y]) {\r\n alert('Correct!');\r\n answerCount++;\r\n } else {\r\n alert('That is incorrect.');\r\n }\r\n }\r\n}", "function promptFor(question, valid){\n do{\n var response = prompt(question).trim();\n } while(!response || !valid(response));\n return response;\n}" ]
[ "0.81085867", "0.81085867", "0.7959594", "0.7829161", "0.77704936", "0.7763414", "0.77110785", "0.76751196", "0.7669665", "0.7664098", "0.76631385", "0.76544446", "0.7652089", "0.7645431", "0.76249534", "0.759468", "0.7588119", "0.7565853", "0.75559014", "0.7544984", "0.754453", "0.7535776", "0.75339293", "0.7532296", "0.7520541", "0.7501061", "0.7476519", "0.74484986", "0.74459654", "0.7439666", "0.743392", "0.7396564", "0.7394427", "0.739183", "0.7390818", "0.7381668", "0.73587", "0.7350289", "0.73492134", "0.73459435", "0.7335711", "0.7335369", "0.7329758", "0.7324274", "0.7318769", "0.73154914", "0.73139447", "0.7296651", "0.7292931", "0.7282232", "0.72797006", "0.7277127", "0.7275778", "0.7272367", "0.72722316", "0.72712034", "0.72693217", "0.72692454", "0.7253304", "0.7246794", "0.72456807", "0.72441393", "0.7228286", "0.72270477", "0.721627", "0.7211562", "0.7211116", "0.7208481", "0.7208481", "0.71999866", "0.7197836", "0.7197791", "0.7189019", "0.71832645", "0.7171577", "0.7161673", "0.71608895", "0.71597236", "0.71581113", "0.7156557", "0.7125681", "0.71240634", "0.7123258", "0.7122851", "0.7122513", "0.7111388", "0.7108622", "0.70997584", "0.7097349", "0.7097019", "0.708967", "0.70888066", "0.70837396", "0.7081396", "0.7080835", "0.7070062", "0.7068925", "0.7063573", "0.70630634", "0.7063036", "0.70571965" ]
0.0
-1
TODO: don't use sync, use async
function genHash(password) { return bcrypt.hashSync(password, 8); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async method(){}", "static async method(){}", "function sync() {\n \n}", "async run() {\n }", "function done() {}", "async function asyncCall() {\n result = await resolveAfter2Seconds();\n result.forEach((indItem) =>\n printItem(\n indItem.title,\n indItem.tkt,\n indItem.desc,\n indItem.urg,\n indItem.store,\n indItem.owner,\n indItem.date\n )\n );\n }", "function async_io_normal(cb) {\n\n}", "async onFinished() {}", "function Synchronized () {}", "function Synchronized () {}", "function Synchronized () {}", "async function asyncWrapperFunction() {\r\n await htmlRouting();\r\n await videoRouting();\r\n const data = await dataProcessing();\r\n const nodes = await nodesGetting();\r\n dynamic(data,nodes);\r\n display(data,nodes);\r\n}", "async begin() {\n return;\n }", "function SYNC() {}", "function SYNC() {}", "function SYNC() {}", "function SYNC() {}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async started() {}", "async function test() {}", "function syncMain() {\n\taxios.get(\"https://icanhazdadjoke.com/\", {\n\t\theaders: { accept: \"application/json\" }\n\t}).then(function(response) {\n\t\tfs_async.appendFile(\"jokes.txt\", response.data.joke + \"\\n\\n\")\n\t\t.then(function() {\n\t\t\tfs_async.readFile(\"jokes.txt\").then(function(jokes) {\n\t\t\t\tconsole.log(jokes.toString());\n\t\t\t});\n\t\t});\n\t});\n}", "async onLoad() {}", "async function asyncPromiseAll() {\n //PLACE YOUR CODE HERE:\n}", "AsyncProcessResponse() {\n\n }", "async load () {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "async checkBatchPaymentsStatus()\n {\n console.log('checkBatchPaymentsStatus')\n\n\n var self = this;\n var unconfirmedBatches = await self.mongoInterface.findAll('payment_batch',{confirmed: false} )\n\n\n //this type of for loop works with async & .forEach does not\n console.log(\"batch: \" + unconfirmedBatches)\n for( var element of unconfirmedBatches ) {\n\n console.log(self.getPaymentContractAddress(), element.id)\n\n var complete = await self.paymentContract.methods.paymentSuccessful(element.id).call() ;\n console.log('complete??',complete)\n\n if(complete)\n {\n element.confirmed = true;\n\n await self.markPaymentsCompleteForBatch( element )\n }\n\n await self.mongoInterface.upsertOne('payment_batch',{id: element.id}, element )\n\n }\n\n console.log('done w for each ')\n\n\n return true ;\n }", "function asyncGetTempData(){\n //should I overwrite with the new(and old) data,(takes longer, simple)\n //check the database and only get then upload new data,(more complicated, no needless data retrieval)\n //or temp download all data and then check and upload new data?(might be easier to check database after getting the data)\n //There is also SQL online that will transfer directly from the FTP server to MySQL,\n //but it is beyond my level of knowledge and would have to just copy the code.\n}", "async function syncPipeline() {\n await generateAllowance();\n // await confirmPendingBookings();\n // the server-side script does this now\n await updateContactList();\n await updateTourList();\n}", "function callsASyncFunction() {\n var deferred = Q.defer();\n db.ConnectAndQuery(\"select * from UserGroup\", function () {\n console.log('Finished with non deffered async.');\n });\n return deferred.promise;\n}", "function getMatch(link){\n // async function\n console.log(\"sending request !!!\" , count);\n count++;\n request(link , cb); //node api => 48 request functions\n}", "function syncData() {}", "function myRun(async){\n var gen = async();\n\n var isDone=false;\n\n var middle = [];\n\n while(!isDone){\n\n middle.push(gen);\n\n var res = gen.next();\n\n gen = res.value;\n\n isDone = res.done;\n\n }\n\n /*middle.forEach(function(item){\n\n item.next();\n\n\n })*/\n\n for(var i=0; i< 4;i++){\n middle.pop().next();\n\n }\n //gen.next();\n\n\n }", "function fcallsASyncFunction() {\n var deferred = Q.defer();\n Q.fcall(db.ConnectAndQuery, \"select * from UserGroup\", function () {\n console.log('Finished with non deffered async.');\n });\n return deferred.promise;\n}", "function Sync() {\n\n}", "_flush(cb) {\n\t return cb()\n\t }", "async list() { }", "async function makerequest() {\r\n \r\n}", "async end() { }", "async function Kosarajus(){}", "function addEverySong(Songs, queue, member) {\n //returns a promise\n return new Promise(function(resolve, reject) {\n //some variables we need\n let SongsAdded = 0;\n let SongsToLong = 0;\n let SongsClaimed = 0;\n //call an async forEach so we get when its done\n async.each(Songs, function(Song, callback) {\n //construct out URL\n const URL = \"https://www.youtube.com/watch?v=\" + Song.resourceId.videoId\n //get info about that Song\n yt.getInfo(URL, (err, info) => {\n //if error return and increase SongsClaimed\n if(err) {\n SongsClaimed++;\n //return with the call its done\n return callback();\n }\n //if toLong return and increase SongsToLong\n if(Number(info.length_seconds) > 1800) {\n SongsToLong++\n //return with the call its done\n return callback();\n }\n //attach the member who requested the Song on the info object\n info.requestedBy = member.user;\n //add it to the queue\n queue.push(info);\n //increase SongsAdded\n SongsAdded++;\n //call its done\n callback();\n })\n }, function(err) {\n if (err) reject(new Error(\"I had an fatal error please contact my DEV\"))\n resolve([SongsAdded, SongsToLong, SongsClaimed])\n });\n })\n}", "async update() {}", "async function asyncFn() {\n return value;\n }", "async function asyncFn() {\n return value;\n }", "function callback(){}", "function checkUpdate() {\n console.log(\"---- Start checking for updates ----\")\n var all_comic_data = settings.get('comic');\n async.eachOf(all_comic_data, function(hostDict, host, callback1) {\n async.eachOf(hostDict, function(comics, titlekey, callback2){\n if (all_comic_data[host][titlekey].subscribed) {\n values.hostnames[host].parsers.grabChapters(titlekey, comics.link,onChaptersGrabbed.bind({\n all_comic_data: all_comic_data,\n host: host,\n titlekey: titlekey,\n callback: callback2\n }));\n } else {\n callback2();\n }\n }, function() {\n callback1();\n })\n }, onAllComicsUpdateChecked.bind({all_comic_data : all_comic_data}));\n}", "async function getNewSongs(songType) {\n let type = mapper.mapNewSongType(songType)\n let playlist\n let newSongsDO = dao.getNewSongs(type)\n //var isSongValid = checkSong(newSongs[0].url)\n let isSongValid = true\n //After the if/else, we will populate the playlist with [{id:},{id:}]\n //First read from db toget the new songs\n //TODO: Add retention period for new songs in db\n if(newSongsDO != undefined && newSongsDO != \"\" && newSongsDO.data.length > 0 && isSongValid) {\n //Add the ids to playlist\n playlist = newSongsDO.data\n } else { //Then read from the service if none is in DB or it expires after the retention\n let command = '/top/song?type=';\n const typeList = [0,7,8,16,96]\n if(typeList.indexOf(type) >= 0) command += type\n else command += 0\n let url = host + command\n //Get new songs by calling service\n try {\n const res = await req('GET', url, '')\n const newSongsDO = {}\n newSongsDO.date = new Date()\n newSongsDO.data = new Array()\n playlist = new Array()\n for(let i=0;i<res.body.data.length;i++) {\n newSongsDO.data.push({id:res.body.data[i].id})\n playlist.push({id:res.body.data[i].id})\n }\n //Save the new songs to new songs DB with [{id:},{id:}], at now only saving ids, don't care if the song is playable or not\n dao.saveNewSongs(newSongsDO, type)\n } catch(err) {\n console.log(\"Get an error when get new songs from service \" + err)\n }\n }\n //Then refresh the urls for all the ids in the playlist\n playlist = await refreshPlaylistUrls(playlist)\n //Save the playlist to db with [{id:,url:}]\n return playlist\n}", "async processFile(hndl) {\n }", "async processFile(hndl) {\n }", "async init () {}", "async function translate(file_path, book_id, trans_langs) {\n var arguments = [];\n arguments.push(file_path);\n arguments.push(book_id);\n for (var i = 0; i < trans_langs.length; i++) {\n arguments.push(trans_langs[i]);\n }\n console.log(arguments);\n let options = {\n mode: \"text\",\n executable: \"python3.9\",\n pythonOptions: [\"-u\"], // get print results in real-time\n scriptPath:\n \"./public/translation\",\n args: arguments, //An argument which can be accessed in the script using sys.argv[1]\n };\n console.log(\"entered the async\")\n try{\n await PythonShell.run(\n \"ParseAndTranslate.py\",\n options,\n function (err, result) {\n if (err) throw err;\n //result is an array consisting of messages collected\n //during execution of script.\n console.log(\"result: \", result.toString());\n for(var i = 0 ; i < trans_langs.length ; i++){\n console.log(\"doing something in this loop for downloads\");\n uploadTranslatedBook(book_id, trans_langs[i]);\n }\n }\n );console.log(\"ok this is it\")} catch (error){\n console.log(\"ded\")\n console.log(error)\n }\n console.log(\"exiting the async\")\n \n}", "async function main(){\n var redisHost = process.env.redisHost || '127.0.0.1';\n var redisPort = parseInt(process.env.redisPort) || 6378;\n\n console.log(\"conneting to \" + redisHost + \":\" + redisPort )\n\n var redisClient = redis.createClient({host : redisHost, port : redisPort});\n\n bluebird.promisifyAll(redis.RedisClient.prototype);\n bluebird.promisifyAll(redis.Multi.prototype);\n\n try {\n\n //Get the offset from redis \n var key = await redisClient.getAsync('OrderCommandHandler');\n\n //if there is no offset start reading from begining\n if(key == null){\n key = '0-0' \n }\n\n console.log(\"Reading from StreamCreateOrder\")\n console.log(\" \\n \")\n for(;;){\n let rtnVal = await redisClient.xreadAsync('COUNT', 10, \n 'BLOCK',1000,'STREAMS',\n 'StreamCreateOrder',key )\n\n if( rtnVal != null){\n for(let j = 0; j < rtnVal[0][1].length; j++){\n key = rtnVal[0][1][j][0]; \n\n let val = rtnVal[0][1][j][1][1]; \n let streamPayload = JSON.parse(val);\n console.log(\" Read from StreamCreateOrder: key: \"+ key + \" ; val: \" + val)\n console.log(\" \\n \")\n\n // Create a unique order id\n streamPayload.orderId=streamPayload.user+\":\"+key\n\n let rtn1 = await add_to_event_store(redisClient, key, streamPayload)\n\n let rtn2 = await add_to_payment(redisClient, key, streamPayload)\n \n let rtn3 = await add_to_aggregator(redisClient, key, streamPayload)\n\n console.log(\" ----------------------------------\\n \")\n\n redisClient.set('OrderCommandHandler',key) \n \n }\n }\n }\n }\n catch(error) {\n console.error(error);\n }\n}", "async function asyncCall() {\n if (cart.length > 0) {\n var cartItem = cart;\n //console.log(cartItem)\n for (var i = 0; i < cartItem.length; i++) {\n var sql = \"spSetSalInvoiceItem \" + reqBody.InvoiceItemID + \",\" + InvoiceID + \",\" + parseInt(cartItem[i].itemID) + \",\" + parseInt(cartItem[i].colorID) + \",\" + parseInt(cartItem[i].sizeID) + \",\" + cartItem[i].product_price + \",\" + cartItem[i].qty + \",\" + 0 + \",\" + 0 + \",\" + 0 + \",\" + 0 + \",\" + 0 + \",\" + reqBody.IsApproved + \",\" + reqBody.IsActive + \",\" + reqBody.IsDelivered + \",\" + reqBody.CompanyID + \",\" + reqBody.LoggedUserID + \", '\" + IpAddress.IP + \"', \" + reqBody.IsDeleted + \"\";\n //console.log(sql + \"This is spSetSalInvoiceItem\");\n\n var detailDelay = await Delay();\n db.executeSql(sql, function (data, err) {\n if (err) {\n throw err;\n } else {\n console.log(\"Order Details Posted\");\n }\n //res.end();\n });\n }\n }\n\n var sql = \"getSalInvoiceMasterByInvoiceID \" + InvoiceID + \" \";\n //console.log(sql + \"This is getSalInvoiceMasterByInvoiceID\");\n db.executeSql(sql, function (data, err) {\n if (err) {\n throw err;\n } else {\n var result = data.recordset[0]['JSON_F52E2B61-18A1-11d1-B105-00805F49916B'];\n console.log(result);\n if (result.length == 0) {\n result = \"[]\";\n res.send(result);\n console.log(result);\n //console.log(\"result \");\n } else {\n res.send(data.recordset[0]['JSON_F52E2B61-18A1-11d1-B105-00805F49916B']);\n }\n }\n\n });\n\n }", "function callUnion(callback){\r\n\tvar div;\r\n\tvar div2;\r\n//\tsizeArray = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600,\r\n//\t \t\t\t\t700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000,\r\n//\t \t\t\t\t20000];\r\n\t\r\n\tsizeArray = [10, 20, 30, 40, 50];\r\n\t\r\n\tdiv = document.getElementById(\"polyUnion\");\r\n\tdiv.innerHTML = 'Processing';\r\n\t\r\n\tasync.eachSeries(Object.keys(sizeArray), function(item, done){\r\n\t\tvar geoprocess = \"Union\";\r\n\t\tvar id = sizeArray[item];\r\n\t\t//let html page know what test number we're on\r\n\t\tdiv2 = document.getElementById(\"unionID\");\r\n\t\tdiv2.innerHTML = id;\r\n\t\tmicroAjax(serverlocation +\"/rest/services/union/\" + id, function (data) {\r\n\t\t\tvar dataJSON = JSON.parse(data);\r\n\t\t\tvar dataTime = dataJSON.time;//Time, on server, to retrieve data from db\r\n\t\t\tvar dataOne = dataJSON.wktA;\r\n\t\t\tvar dataTwo = dataJSON.wktB;\r\n\t\t\tvar results = getResults(geoprocess, id, \"polygon\", dataTime, dataOne, dataTwo);\r\n\t\t\tasync.series([\r\n\t\t\t function(returnToProcess){\r\n\t \t\t\tstoreResults(results, returnToProcess);//--> data.js\r\n\t \t\t}\t\r\n\t \t]);\r\n\t\t\tdone();\r\n\t\t});\r\n\t\t\t\r\n\t}, function(err){\r\n\t\tconsole.log(err);\r\n\t\tdiv = document.getElementById('polyUnion');\r\n\t\tdiv.innerHTML = 'Complete!';\r\n\t\tsetTimeout(function(){\r\n\t\t\tlocation.reload();\r\n\t\t},10000);\r\n\t});\r\n\t\r\n}", "sync(...args) {\n return sync.call(this, ...args);\n }", "function asyncInIE (f) {\n f();\n }", "async asyncConstruct() {\n // In single process mode, we flush the redis on startup.\n this.getRedis().flushallAsync();\n }", "setSync(){\n this.async = false;\n }", "httpGetAsync(theUrl, callback){\n var xmlHttp = new XMLHttpRequest()\n xmlHttp.onreadystatechange = function() {\n if (xmlHttp.readyState == 4 && xmlHttp.status == 200)\n callback(xmlHttp.responseText)\n }\n xmlHttp.open(\"GET\", theUrl, true)\n xmlHttp.send(null)\n }", "sendAsync(payload, cb) {\n log.info('ASYNC REQUEST', payload)\n const self = this\n // fixes bug with web3 1.0 where send was being routed to sendAsync\n // with an empty callback\n if (cb === undefined) {\n self.rpcEngine.handle(payload, noop)\n return self._sendSync(payload)\n } else {\n self.rpcEngine.handle(payload, cb)\n }\n }", "async runTest() {}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async started() {\n\n\t}", "async setup() { }", "function make_async(){\n let anchors = document.querySelectorAll('a.async');\n\n anchors.forEach((anchor => {\n anchor.addEventListener('click', (a) => {\n a.preventDefault();\n\n fetchHTML(anchor.pathname);\n })\n }))\n}", "function callSyncFunction() {\n var deferred = Q.defer();\n notDeferred();\n return deferred.promise;\n}", "async write() { }", "async init() {}", "async init() {}", "function asyncCallbackFunc() {\n\t\tif (wsReq.responseXML != null) {\n //Creating a File Host Object.\n var file = new File(\"async-test-file.xml\");\n\n //Writing the response to a file.\n file.openForAppending();\n file.write(wsReq.responseXML);\n }\n }", "function testasync(callback){\n\n\tfs.readFile('test4.txt', (err, data) => {\n\t if (err) throw err;\n\t callback(data);\n\t});\n\n}", "function workMyCollection(arr) {\n var resultArr = [];\n function _recursive(idx) {\n console.log(idx);\n if (idx >= resultArr.length) return resultArr;\n\n return doSomethingAsync(arr[idx]).then(function(res) {\n resultArr.push(res);\n return _recursive(idx + 1);\n });\n }\n return _recursive(0);\n}", "async function asyncFn(){\n\n return 1;\n}", "function startAsync()/* : void*/\n {\n this.asyncTestHelper$oHM3.startAsync();\n }", "async function init() {\n await downloadFromServer();\n let response = await JSON.parse(backend.getItem('tasks')) || [];\n allTasks = response;\n console.log(allTasks)\n updateTasks();\n}", "async function loadData() {\n // Get the health of the connection\n let health = await connection.checkConnection();\n\n // Check the status of the connection\n if (health.statusCode === 200) {\n // Delete index\n await connection.deleteIndex().catch((err) => {\n console.log(err);\n });\n // Create Index\n await connection.createIndex().catch((err) => {\n console.log(err);\n });\n // If index exists\n if (await connection.indexExists()) {\n const parents = await rest.getRequest(rest.FlaskUrl + \"/N\");\n // If parents has the property containing the files\n if (parents.hasOwnProperty(\"data\")) {\n //Retrieve the parent list\n let parrentArray = parents.data;\n\n // Get amount of parents\n NumberOfParents = parrentArray.length;\n console.log(\"Number of parents to upload: \" + NumberOfParents);\n // Each function call to upload a JSON object to the index\n // delayed by 50ms\n parrentArray.forEach(delayedFunctionLoop(uploadParentToES, 50));\n }\n }\n } else {\n console.log(\"The connection failed\");\n }\n}", "async function getuser(){\n //return user;\n return db;\n}", "function searchusers(req,usersref,str){\n var data=[];\n var asyncLoop = require('node-async-loop');\n return new Promise(function(resolve,reject){\n usersref.orderByChild(\"name\").equalTo(str).once(\"value\",function(snapshot){\n if(snapshot.val()){\n asyncLoop(snapshot.val(), function (item, next){\n if(item.value.email==req.user.emails[0].value){\n console.log(\"equals\");\n next();\n }else{\n console.log(\"current doing: \",item.value);\n if(item!=null || item!=undefined){\n var imgpath= path.join(__dirname, '../public/images/dps/' + \n item.value.email + \".jpg\");\n base64Img.base64(imgpath, function(err, data1) {\n if(err){\n console.log(err.message);\n }else{\n data.push({\n username: item.value.name,\n email: item.value.email,\n userimg: data1\n });\n var ema=req.user.emails[0].value; //follower\n ema=ema.substring(0,ema.indexOf(\"@\"));\n \n var email=data[data.length-1].email; //following //following\n email=email.substring(0,email.indexOf(\"@\"));\n \n follows.child(ema+email)\n .once(\"value\",function(snapshot){\n console.log(follows.child(ema+email).toString());\n if(snapshot.numChildren()>0){\n console.log(\"follows\");\n data[data.length-1].userflag=true; //following this person\n }else{\n console.log(\"not follows\");\n data[data.length-1].userflag=false; //not following him/her\n }\n next();\n });\n }\n next();\n });\n }\n }\n },function(err){\n if(err)\n console.log(err.message);\n console.log(\"users found!\");\n resolve(data);\n });\n }\n else{\n resolve(data);\n }\n });\n });\n}", "async function updateDB(){\n // try async update DB\n try{\n console.log(\"async update started\");\n model.updateUserInfo(101,\"usr_type\",\"elder\");\n console.log(\"*** this line will display first before the update completed\");\n\n }catch(err){\n console.log(\"err \",err );\n }\n}", "async function updateDB(){\n // try async update DB\n try{\n console.log(\"async update started\");\n model.updateUserInfo(101,\"usr_type\",\"elder\");\n console.log(\"*** this line will display first before the update completed\");\n\n }catch(err){\n console.log(\"err \",err );\n }\n}", "_esWait() {\n // Create through stream.....\n return es( function(err, data) {\n if (err) {\n log(err, 'red')\n }\n })\n }", "async iterator() {\n return iteratorFn();\n }", "async init() {\n\n }", "async function main() {\n try {\n var id_data = await get_changed_ids_prices();\n console.log(id_data);\n //use the chained async functions to get the data to update\n //wait for it to complete\n await update_prices(id_data);\n //update the database, wait for it to complete\n db.close();\n }\n catch (e) {\n console.log(\"error\");\n console.log(e);\n }\n}", "async function MyAsyncFn () {}", "async function asyncFunction(arg) {\r\n return arg;\r\n}", "function addAsyncClient(x,y){\n console.log(\"[SC] triggering add\");\n addAsync(x,y, function(err, result){\n if (err){\n console.log(\"error occured..\", err);\n return;\n }\n console.log(\"[SC] result = \", result); \n });\n}", "function loop_request(){\r\n let waisted_count = 0; // set to 0\r\n \r\n //requset from api\r\n async function StartR() \r\n {\r\n // request, fetch api data\r\n const response = await fetch(api_url); //fetch\r\n const data = await response.json(); //api\r\n let json_split = JSON.parse(JSON.stringify(data)); // split api data\r\n\r\n // only for the first request\r\n if (beginvar == true){\r\n console.log(\"first try\");\r\n render_call(json_split, waisted_count, beginvar);\r\n last_api = json_split[0].id;\r\n beginvar = false; \r\n } \r\n else{\r\n console.log(\"secound try\");\r\n waisted_count = while_count(last_api, json_split);\r\n render_call(json_split, waisted_count, beginvar);\r\n }\r\n console.log(\"assync vege 15perc \" + \"Last API: \" + last_api);\r\n }\r\n StartR();\r\n}", "async function executeHardAsync() {\n const r1 = await fetchUrlData(apis[0]);\n const r2 = await fetchUrlData(apis[1]);\n}" ]
[ "0.6757941", "0.6624668", "0.62863904", "0.6182573", "0.61776364", "0.6065782", "0.6036318", "0.5987047", "0.5932615", "0.5932615", "0.5932615", "0.5913433", "0.58752793", "0.5870257", "0.5870257", "0.5870257", "0.5870257", "0.583579", "0.583579", "0.583579", "0.583579", "0.583579", "0.580589", "0.57657576", "0.57380974", "0.573491", "0.57268816", "0.56949526", "0.5671073", "0.5671073", "0.5671073", "0.5671073", "0.5671073", "0.566808", "0.5650815", "0.5647393", "0.5641488", "0.5630047", "0.5626776", "0.56258154", "0.562155", "0.561984", "0.55880713", "0.5570819", "0.5560114", "0.55557436", "0.55551374", "0.555073", "0.5541917", "0.5521948", "0.5521948", "0.5517145", "0.55145335", "0.5505645", "0.5498464", "0.5498464", "0.5495495", "0.5485592", "0.5475702", "0.5473732", "0.5470435", "0.5454781", "0.54481393", "0.5445714", "0.5440439", "0.5409082", "0.5405394", "0.5399675", "0.5384189", "0.5384189", "0.5384189", "0.5384189", "0.5384189", "0.5384189", "0.5384189", "0.5381769", "0.53807944", "0.5374104", "0.53690726", "0.536782", "0.536782", "0.53606266", "0.535665", "0.5354795", "0.53545505", "0.5354321", "0.5353328", "0.53521526", "0.5350841", "0.5349988", "0.5348946", "0.5348946", "0.5347544", "0.5347378", "0.534314", "0.5335977", "0.53332597", "0.5329897", "0.53220683", "0.53208095", "0.5312477" ]
0.0
-1
Recrusive Merge Sort merge sort breaks the arrays into smaller pieces and then sorts them comparing the pieces
function mergeSort(arr){ if(arr.length <= 1) return arr; // return a single element or no element depending on odd or even length let mid = Math.floor(arr.length/2); // cut the arr in half let left = mergeSort(arr.slice(0,mid)); // slice array from 0 to mid exclusive by second parameter, this will recursively call itself and slice itself even more let right = mergeSort(arr.slice(mid)); // sort right side of sliced array return merge(left, right); // sort the sliced arrays and return results until the very first stack frame }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeSort(array) {\r\n //まずアレイを一つずつ要素が入った子アレイを持つ親アレイにする。\r\n const decomposedArray = [];\r\n for (let ele of array) {\r\n decomposedArray.push([ele]);\r\n }\r\n\r\n //バラバラになったアレイdecomposedArrayを最終的に並べ替えて一つのアレイにする関数に渡す。この関数は、下に定義。\r\n return reduceArray(decomposedArray);\r\n\r\n //(1)親アレイの要素を半数にする関数(2)を、要素が1つになるまで繰り返す関数。\r\n function reduceArray(array) {\r\n if (array.length === 1) {\r\n return array[0];\r\n }\r\n array = halveArray(array);\r\n return reduceArray(array);\r\n }\r\n\r\n //(2)親アレイの子アレイを(3)を使って二つずつを一つにして半分の要素にする関数。\r\n function halveArray(array, newArray = []) {\r\n if (array.length === 0) {\r\n return newArray;\r\n }\r\n if (array.length === 1) {\r\n newArray.push(array[0]);\r\n array.shift();\r\n return halveArray(array, newArray);\r\n }\r\n newArray.push(mergeTwo(array[0], array[1]));\r\n array.shift();\r\n array.shift();\r\n // console.log(array.length);\r\n return halveArray(array, newArray);\r\n }\r\n\r\n // (3)二つのアレイを小さい要素からマージする関数を定義\r\n function mergeTwo(array1, array2, newArray = []) {\r\n //array1もarray2も空のとき\r\n if (array1.length === 0 && array2.length === 0) {\r\n return newArray;\r\n }\r\n if (array1.length === 0) {\r\n newArray.push(array2[0]);\r\n array2.shift();\r\n return mergeTwo(array1, array2, newArray);\r\n }\r\n if (array2.length === 0) {\r\n newArray.push(array1[0]);\r\n array1.shift();\r\n return mergeTwo(array1, array2, newArray);\r\n }\r\n if (array1[0] <= array2[0]) {\r\n newArray.push(array1[0]);\r\n array1.shift();\r\n\r\n return mergeTwo(array1, array2, newArray);\r\n }\r\n newArray.push(array2[0]);\r\n array2.shift();\r\n return mergeTwo(array1, array2, newArray);\r\n }\r\n}", "function mergeSort(){\n\t\tvar array = getCommandLineVariables();\t\t\n\t\tvar\tdummyArray = undefined;\t\t\t\t\n\t\t\n\t\t// dividing the array into subarrays\n\t\tdivide(array);\n\t\tsort();\n\t\tconsole.log(\" Divided \",arrayOfArrays);\n\n\t\tdo{\n\t\t\tif(arrayOfArrays.length > 1){\n\t\t\t\tdummyArray = mergeAndSort(arrayOfArrays[0],arrayOfArrays[1]);\t\n\t\t\t\tarrayOfArrays = arrayOfArrays.slice(2,arrayOfArrays.length);\n\t\t\t\tarrayOfArrays.push(dummyArray);\n\t\t\t}\n\t\t\tconsole.log(\" Sorted \",arrayOfArrays);\t\n\t\t}while(arrayOfArrays.length > 1);\t\t\t\t\t\t\n\t}", "mergeSort(){\n if(this.length() > 1){\n let mid = traverseIndex(this.length()/2);\n let L = arr.slice(0,mid-1);\n let R = arr.slice(mid);\n\n this.mergeSort(L);\n this.mergeSort(R);\n\n i = j = k = 0;\n\n while( i < ){\n\n }\n }\n }", "function mergeSort(arr) {\n\n}", "function mergeSort(){\n\tvar unsorted = [219, 39, 80, 226, 8, 45, 39, 179, 84, 56];\n\tvar sorted = [];\n\t\n\t//if 1, then the length is odd.\n\tvar isOdd = unsorted.length % 2;\n\t\n\t//calculate the number of times a merge will have to happen.\n\t//\t2^n items will result in n merges. if there's 2 items, then\n\t//\ta merge will happen once, if 4 items, a merge will occur twice\n\t//\tif the number is off, find how many merges there should be.\n\t// #items = 2^n, so do (items)^.5 = n, or the number of merges that\n\t//\tthere should be - 1. if the number has a decimal, there should\n\t//\tbe another merge. \n\tvar n = Math.floor(Math.sqrt(unsorted.length)) + 1; //this is the number of merges that need to be done.\n\t\n\t//this tells how many items should be gotten at a time.\n\t//\twill increase by 2^n each iteration\n\tvar merge = 1;\n\t\n\t//this is used to count the position in the array\n\tvar counter = 0;\n\t\n\t//variables used for merging.\n\tvar left, right;\n\t\n\tfor(i=0; i<n; i++){\n\t\tconsole.log(\"Big loop \" + Math.pow(2, merge));\n\t\t//loop through the array. The number of times it\n\t\t//\tgoes through an array is determined by the bubble\n\t\t//\tbeing compared.\n\t\tfor(j=0; j<unsorted.length; j = j+Math.pow(2, merge)){\n\t\t\t//for each item in the bubble, compare them and then \n\t\t\t//re-arrange them.\n\t\t\t\n\t\t\tfor(k=0; k<Math.pow(2, merge); k++){\t\t\t\t\n\t\t\t\t///////////\n\t\t\t\t//Merge goes here\n\t\t\t\tleft = counter;\n\t\t\t\t//if the right-most end is less than the max length of\n\t\t\t\t//\tthe array\n\t\t\t\tif((counter + Math.pow(2, merge)) < unsorted.length){\n\t\t\t\t\tright = counter + Math.pow(2, merge);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tright = unsorted.length - counter;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconsole.log(k +\" counter: \" + counter + \" left: \" + left + \" right: \" + right);\n\t\t\t\t//\n\t\t\t\t///////////\n\t\t\t\tcounter = counter + 1;\n\t\t\t\tif(counter >= unsorted.length){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\n\t\tcounter = 0; //reset counter\n\t\tmerge = merge+1;\n\t}\n\t\n\t\n}", "mergeSort(arr, l, r) { \n if (l < r){\n let m = Math.floor(l + (r - l) / 2)\n \n // # Sort first and second halves \n this.mergeSort(arr, l, m); \n this.mergeSort(arr, m + 1, r);\n l = 0 \n tStack.add([...arr])\n this.merge(arr, l, m, r); \n }\n }", "function mergeSort(array) {\n\n}", "function mergeSort(arr) {\n if (arr.length < 2)\n return arr;\n \n var middle = parseInt(arr.length / 2);\n var left = arr.slice(0, middle);\n var right = arr.slice(middle, arr.length);\n \n return merge(mergeSort(left), mergeSort(right));\n }", "function mergeSort(array) { // divides the array into a subset of arrays with 1 el each, then calls merge\n if (array.length <= 1) {\n return array;\n }\n\n const middle = Math.floor(array.length / 2);\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n \n left = mergeSort(left);\n right = mergeSort(right);\n return merge(left, right, array);\n}", "function mergeSort(arr) {\n let length = arr.length;\n if (length === 1) return;\n\n let mid = length / 2;\n let left = arr.slice(0, mid);\n let right = arr.slice(mid, length);\n\n mergeSort(left);\n mergeSort(right);\n merge(arr, left, right);\n}", "function mergeSort(arr){\n var len = arr.length;\n if(len <2)\n return arr;\n var mid = Math.floor(len/2),\n left = arr.slice(0,mid),\n right =arr.slice(mid);\n //send left and right to the mergeSort to broke it down into pieces\n //then merge those\n return merge(mergeSort(left),mergeSort(right));\n}", "function mergeSort(arr){\n if(arr.length <= 1) return arr\n let middle = Math.floor(arr.length/2)\n let left = mergeSort(arr.slice(0,middle))\n let right = mergeSort(arr.slice(middle))\n return merge(left,right)\n}", "function mergeSort (arr) {\n if (arr.length <= 1) return arr; // define the base case\n //Break up the array into halves using the slice method.\n let mid = Math.floor(arr.length/2);\n //calls merge sort on the left half of the array recursively\n let left = mergeSort(arr.slice(0, mid));\n // calls merge sort on the right half of the array recursively\n let right = mergeSort(arr.slice(mid));\n // these recursive calls happen until they meet the base case.\n //then merge the sorted arrays back together with the array mergeArrays function\n return mergeArrays(left, right);\n //returns the merged and sorted array\n}", "function mergeSort (arr) {\n // console.log('in mergesort', arr)\n if (arr.length === 1) {\n return arr;\n }\n // split the array into right and left\n const left = arr.splice(0, arr.length/2);\n const right = arr;\n\n return merge(\n mergeSort(left),\n mergeSort(right)\n );\n}", "function mergeSort(arr) {\n\tconst length = arr.length\n\tif (length <= 1) return arr\n\n\tconst middle = Math.round(length / 2)\n\tconst left = arr.slice(0, middle)\n\tconst right = arr.slice(middle)\n\n\tconst sortedLeft = mergeSort(left)\n\tconst sortedRight = mergeSort(right)\n\n\treturn merge(sortedLeft, sortedRight)\n}", "function mergeSort(arr) {\n if(arr.length===1){\n return arr;\n }\n\n const center = Math.floor(arr.length/2);\n const left = arr.slice(0,center);\n const right = arr.slice(center,arr.length);\n\n return merge(mergeSort(left),mergeSort(right));\n}", "function mergeSort(arr) {\n if (arr.length <= 1) return arr\n let mid = Math.floor(arr.length / 2)\n let left = mergeSort(arr.slice(0, mid))\n let right = mergeSort(arr.slice(mid))\n return merge(left, right)\n}", "function mergeSort(arr) {\n if (arr.length <= 1) return arr;\n let middle = Math.floor(arr.length / 2);\n let left = mergeSort(arr.slice(0, middle));\n let right = mergeSort(arr.slice(middle));\n return merge(left, right);\n}", "function mergeSort(arr) {\n\tif (arr.length <= 1) return arr;\n\n\tlet mid = Math.floor(arr.length / 2);\n\tlet left = mergeSort(arr.slice(0, mid));\n\tlet right = mergeSort(arr.slice(mid));\n\tconsole.log(left, right);\n\treturn merge(left, right);\n}", "function mergeSort(numArray){\n\n}", "function mergeSort4(tempArray) {\n\n if (tempArray.length < 2) {\n return tempArray\n }\n\n var half = Math.floor(tempArray.length / 2);\n var left = tempArray.slice(0, half);\n var right = tempArray.slice(half, tempArray.length);\n\n return merge2(mergeSort4(left), mergeSort4(right));\n\n}", "function mergeSort(arr) {\n if (arr.length <= 1) return arr;\n var mid = Math.floor(arr.length/2);\n var left = mergeSort(arr.slice(0,mid));\n var right = mergeSort(arr.slice(mid))\n return merge(left, right);\n}", "function mergeSort(arr) {\n if (arr.length <= 1) return arr;\n let mid = Math.floor(arr.length/2),\n left = mergeSort(arr.slice(0, mid)),\n right = mergeSort(arr.slice(mid));\n return merge(left, right);\n}", "function mergeSort(array) {\n if (array.length <= 1) {\n return array;\n }\n const middle = Math.floor(array.length / 2);\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n console.log(left, right);\n left = mergeSort(left);\n right = mergeSort(right);\n return merge(left, right, array);\n}", "function mergeSort(array) {\n //console.log(array)\n if (array.length <= 1) {\n return array;\n }\n \n const middle = Math.floor(array.length / 2);\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n \n left = mergeSort(left);\n right = mergeSort(right);\n \n return merge(left, right, array);\n }", "function mergeSort(arr) {\n if (arr.length <= 1) return arr;\n\n let mid = Math.floor(arr.length / 2);\n let left = mergeSort(arr.slice(0, mid));\n let right = mergeSort(arr.slice(mid));\n\n return merge(left, right);\n\n //mergeSort()\n}", "function mergeSort(arr) {\n if (arr.length <= 1) {\n return arr;\n }\n let mid = Math.floor(arr.length / 2);\n let left = mergeSort(arr.slice(0, mid));\n let right = mergeSort(arr.slice(mid));\n return merge(left, right);\n}", "function mergeSort(array) {\n if (array.length < 2) {\n return array;\n }\n var mid = Math.floor(array.length / 2);\n var left = array.slice(0, mid);\n var right = array.slice(mid);\n\n return stitch(mergeSort(left), mergeSort(right));\n}", "function mergeSort(arr){\n if (arr.length <= 1) {\n return arr;\n }\n var mid = Math.floor(arr.length/2);\n var left = arr.slice(0, mid);\n var right = arr.slice(mid, arr.length);\n return merge(mergeSort(left), mergeSort(right));\n}", "function mergesort(arr) {\n if (arr.length <= 1) return arr;\n\n let mid = Math.floor(arr.length / 2);\n \n let left = arr.slice(0, mid);\n let right = arr.slice(mid);\n \n let sortedLeft = mergesort(left);\n let sortedRight = mergesort(right);\n\n return merge(sortedLeft, sortedRight);\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n\n const center = Math.floor(arr.length / 2);\n const left = arr.slice(0, center);\n const right = arr.slice(center);\n\n return merge(mergeSort(left), mergeSort(right));\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n // divided arr into two\n const center = Math.floor(arr.length / 2); // mergeSort1 [9, 5, 3, 10] // mergeSort1 [9, 5] [3, 10]\n const left = arr.slice(0, center); // Left1 [9, 5] // left2 [9] [3]\n const right = arr.slice(center); // right1 [3, 10] // right2 [5] [10]\n // recursion \n // passing Left1 && Right1 then recurse\n // pasing Left2 && Right2 then recurse then length === 1\n // call merge function\n return merge(mergeSort(left), mergeSort(right));\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n let middle = Math.floor(arr.length/2);\n let left = arr.slice(0, middle);\n let right = arr.slice(middle, arr.length);\n\n return merged(mergeSort(left), mergeSort(right));\n\n}", "function mergeSort(arr) {\n function ms(arr) {\n if (arr.length == 1) {\n return arr;\n }\n\n let mid = Math.floor(arr.length / 2);\n\n let s1 = ms(arr.slice(0, mid));\n let s2 = ms(arr.slice(mid));\n\n return merge(s1, s2);\n }\n\n function merge(a, b) {\n let result = [];\n let l = 0,\n r = 0;\n while (l < a.length && r < b.length) {\n if (a[l] > b[r]) {\n result.push(b[r]);\n r++;\n } else {\n result.push(a[l]);\n l++;\n }\n }\n\n return result.concat(a.slice(l), b.slice(r));\n }\n\n return ms(arr);\n}", "function mergeSort(arr) {\n // check if array length is less than 2\n if (arr.length < 2) {\n console.log('in merge sort if', arr)\n return arr;\n }\n // get mid point and call merge sort on each sub array\n let mid = Math.floor(arr.length/2);\n let left = arr.slice(0, mid);\n let right = arr.slice(mid);\n console.log('left', left)\n console.log('right', right)\n return merge(mergeSort(left), mergeSort(right));\n}", "function sort(array, inc) {\n function merge(arr, left, right, increasing) {\n //for each value in left array, compare with first/next right array value\n let lL = left.length;\n let lR = right.length;\n let iL = 0;\n let iR = 0;\n for (let i = 0; i < arr.length; i ++) { //we know that arr.lenght = left.lenght + right.lenght\n //start comparing\n if (increasing && left[iL] <= right[iR] && iL < lL) { //study if left part is equal or the same to cover all possibilities\n arr[i] = left[iL]; //overwrite final array since it will be the sorted one for parent iteration\n iL ++; // since we're not studing anymore that element of that array\n } \n else if (increasing && left[iL] > right[iR] && iR < lR) { //means left[iL] > right[iR]\n arr[i] = right[iR];\n iR ++;\n }\n else if (!increasing && left[iL] <= right[iR] && iL < lL) {\n arr[i] = right[iR]; //overwrite final array since it will be the sorted one for parent iteration\n iR ++;\n } \n else if (!increasing && left[iL] > right[iR] && iR < lR) {\n arr[i] = left[iL];\n iL ++;\n }\n else if (iL == lL || iR == lR) { \n //if there is nothing to compare, we just have to concatenate the array just created,\n //with the remaining array, it could be the left or right remaining\n if (iL != lL) {\n arr[i] = left[iL];\n iL ++;\n }\n if (iR != lR) {\n arr[i] = right[iR]\n iR ++;\n }\n }\n else {\n console.log(\"Error: not getting into\")\n }\n }\n }\n //begining of Sorting\n let length = array.length;\n if (length < 2) { //when there is just one element, stop there and start merging with the other elements\n return;\n }\n //split into two arrays\n let mod = length % 2; // 0 or 1\n let leftL = (length - mod) / 2; // will give us always left length (smallest)\n let rightL = length - leftL;\n let aL = array.slice(0, leftL)\n let aR = array.slice(leftL)\n //continuie spliting....\n sort (aL, inc)\n sort (aR, inc)\n merge (array, aL, aR, inc) \n}", "function mergeSort (arr) {\n\tvar length = arr.length;\n//\tconsole.log(length);\n\n\tif (length == 1\t)\n\t\treturn arr;\n\t\n\tvar l1 = arr.slice(0,length/2);\n\tvar l2 = arr.slice(length/2,length);\n\tconsole.log(l1);\n\tconsole.log(l2);\n\tvar mergeResult = merge(mergeSort(l1), mergeSort(l2));\n\tshowLog(\"mergeResult=\", mergeResult);\n\treturn mergeResult;\n\t\n//\tshowLog(\"before merge\");\n//\tshowLog(\"l1=\", l1);\n//\tshowLog(\"l2=\", l2);\n//\treturn merge(l1,l2);\n//\t\n}", "function mergeSort (arr, descending=false) {\n if (arr.length == 1) return arr;\n //if there's only two value around we can't return 0 to the divider, that produce a 0 which aren't really hekoting \n let divider = arr.length >> 1 | 0;\n if (divider == 0) divider++;\n //dividing the array to two parts\n let left = mergeSort(arr.splice(0, divider), descending);\n arr = mergeSort(arr, descending);\n //using recursion to continously dividing the array\n return merge (left, arr, descending);\n}", "function mergeSort(arr){\n let counter = 0;\n \n if(arr.length <= 1){\n return arr; \n }\n\n let middle = Math.floor(arr.length/2); \n let leftArr = arr.slice(0, middle); \n let rightArr = arr.slice(middle,arr.length); \n counter+=1; \n leftArr = mergeSort(leftArr); \n rightArr = mergeSort(rightArr); \n\n return merge(leftArr, rightArr, arr, counter); \n\n}", "function mergeSort(a) {\n let arr = [...a];\n // YOUR CODE HERE\n if (arr.length <= 1) {\n return arr;\n } else {\n let middleIndex = Math.floor(arr.length / 2);\n let left = arr.slice(0, middleIndex);\n let right = arr.slice(middleIndex, arr.length);\n\n let leftSorted = mergeSort(left);\n let rightSorted = mergeSort(right);\n\n //\n return merge(leftSorted, rightSorted);\n }\n }", "function mergeSort(arr) {\n if (arr.length <= 1) return arr;\n\n const halfArrLen = Math.floor(arr.length / 2);\n const sortedHalf1 = mergeSort(arr.slice(0, halfArrLen));\n const sortedHalf2 = mergeSort(arr.slice(halfArrLen));\n console.log(sortedHalf1, sortedHalf2);\n\n return mergeTwoSortedArrays(sortedHalf1, sortedHalf2);\n}", "function mergeSort(left, right) {\n // get a empty array for sorting purposes\n // starting left index variable\n // starting right index variable\n \n // while left index is less than left array length &&\n // right index is less than right array length \n \n // if left index value is lesser than right index, push left index value and increase left index \n \n // else push right index value and increase right index \n \n // combine sorted array with left over of left array and right array\n // return sortedArr;\n }", "function mergeSort (array) {\n if (array.length === 1) {\n return array\n }\n // Split Array in into right and left\n const length = array.length;\n const middle = Math.floor(length / 2)\n const left = array.slice(0, middle) \n const right = array.slice(middle)\n // console.log('left:', left);\n // console.log('right:', right);\n\n\n return merge( mergeSort(left), mergeSort(right) );\n}", "function mergeSort(arr) {\n if(arr.length <= 1) {\n return arr;\n }\n // Find the mid point (so we can split the given array into two parts)\n let mid = Math.floor(arr.length / 2);\n // Split the array into two parts\n let left = mergeSort(arr.slice(0, mid));\n let right = mergeSort(arr.slice(mid));\n // Compare each element in the two arrays and merge them in sorted order (by calling our merge() helper function)\n return merge(left, right);\n}", "function mergeSort(inputArray){\n if(inputArray.length <= 1) return inputArray;\n const middle = Math.floor(inputArray.length / 2);\n const leftHalf = inputArray.slice(0, middle);\n const rightHalf = inputArray.slice(middle);\n return mergeSortedArrays(mergeSort(leftHalf), mergeSort(rightHalf));\n}", "function mergeSort (array) {\n if (array.length < 2) {\n return array;\n }\n \n var middle_index = Math.floor(array.length / 2);\n // recursive variables\n var left_split = mergeSort(array.slice(0, middle_index));\n var right_split = mergeSort(array.slice(middle_index));\n\n return merge(left_split, right_split);\n}", "mergeSort (unsortedArray) {\n // No need to sort the array if the array only has one element or empty\n if (unsortedArray.length <= 1) {\n return unsortedArray;\n }\n // In order to divide the array in half, we need to figure out the middle\n const middle = Math.floor(unsortedArray.length / 2);\n\n // This is where we will be dividing the array into left and right\n const left = unsortedArray.slice(0, middle);\n const right = unsortedArray.slice(middle);\n\n // Using recursion to combine the left and right\n return this.merge(\n this.mergeSort(left), this.mergeSort(right)\n );\n }", "function mergeSort(array) {\n if (array.length < 2) return array;\n let middle = Math.floor(array.length/2);\n let left = array.slice(0, middle);\n let right = array.slice(middle);\n return merge(mergeSort(left), mergeSort(right));\n\n}", "function mergesort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n\n let mid = Math.floor(arr.length / 2);\n let left = mergesort(arr.slice(0, mid));\n let right = mergesort(arr.slice(mid, arr.length));\n\n return merge(left, right);\n}", "function mergeSort(arr) {\n if ( arr.length < 2) {\n return arr;\n }\n\n const middle = Math.floor(arr.length / 2);\n const left = arr.slice(0, middle);\n const right = arr.slice(middle);\n\n return merge(mergeSort(left), mergeSort(right));\n}", "function mergeSort(array) {\n\n //base case\n if (array.length <= 1) {\n return array;\n }\n\n const middle = Math.floor(array.length /2);\n //middle is included in the left side\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n\n left = mergeSort(left);\n right = mergeSort(right);\n return merge(left, right, array);\n}", "function mergeSort(array) {\n if (array.length <= 1) {\n return array;\n }\n\n const middle = Math.floor(array.length / 2);\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n\n left = mergeSort(left);\n right = mergeSort(right);\n return merge(left, right, array);\n}", "function mergeSort(array) {\n if (array.length <= 1) return array;\n const mid = Math.floor(array.length / 2);\n const left = mergeSort(array.slice(0, mid));\n const right = mergeSort(array.slice(mid));\n return merge(left, right);\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n const middleIdx = Math.trunc(arr.length / 2);\n const leftHalf = mergeSort(arr.slice(0, middleIdx));\n const rightHalf = mergeSort(arr.slice(middleIdx));\n return merge(leftHalf, rightHalf);\n}", "function mergeSort(arr){\n if(arr.length<=1){\n return arr\n }\n\n let mid = Math.floor(arr.length/2)\n let left_half = arr.slice(0,mid)\n let right_half = arr.slice(mid)\n \n let left = mergeSort(left_half)\n let right = mergeSort(right_half)\n\n return merge(left,right)\n}", "function merge(arr1,arr2, comparator){\n// take two arrays\nif(arr1.length<=0||arr2.length<=0){return console.warn('provide valid array')}\nlet resArr=[], i=0,j=0,end=true;\n\n\ncomparator= comparator!==undefined?comparator:baseCkeck\n//let resComp=comparator!==undefined?comparator(arr1[i],arr2[j]):baseCheck(arr1[i]>arr2[j])\nwhile(end){\n if(i>=arr1.length-1&&j>=arr2.length-1){\n end=false\n }\n if(comparator(arr1[i],arr2[j])<0){\n resArr.push(arr1[i])\n i++\n }\n else if(comparator(arr1[i],arr2[j])>0){\n resArr.push(arr2[j])\n j++\n }\n else if(comparator(arr1[i],arr2[j])===0){\n resArr.push(arr1[i])\n resArr.push(arr2[j])\n i++\n j++\n }\n //end condition\n if(i===arr1.length){\n for(j;j<arr2.length;j++){\n resArr.push(arr2[j])\n end=false\n }\n }else if(j===arr2.length){\n for(i;i<arr1.length;i++){\n resArr.push(arr1[i])\n }\n end=false\n }\n}\nreturn resArr\n}", "function mergeSort(array) {\n if (array.length <= 1) {\n return array;\n }\n\n const middle = Math.floor(array.length / 2);\n let left = array.slice(0, middle);\n let right = array.slice(middle, array.length);\n\n left = mergeSort(left);\n right = mergeSort(right);\n return merge(left, right, array);\n}", "function mergeSort(array){\n if(array.length < 2){\n return array;\n }\n var middle = Math.floor(array.length/2);\n var left = mergeSort(array.slice(0,middle));\n var right = mergeSort(array.slice(middle, array.length));\n var i = 0;\n var j = 0;\n var output = [];\n while(i < left.length && j < right.length){\n if(left[i] <= right[j]){\n output.push(left[i]);\n i++;\n } else {\n output.push(right[j]);\n j++;\n }\n }\n if(i >= left.length){\n output = output.concat(right.slice(j));\n } else if (j >= right.length) {\n output = output.concat(left.slice(i));\n }\n return output;\n }", "function mergeSorting(arr) {\n if (!arr || !arr.length) {\n return null;\n }\n if (arr.length === 1) {\n return arr;\n }\n\n const middle = Math.floor(arr.length / 2);\n const leftPart = arr.slice(0, middle);\n const rightPart = arr.slice(middle);\n\n return mergeArrays(mergeSorting(leftPart), mergeSorting(rightPart));\n}", "function merge_sort(array) {\r\n return merge_aux(array, 0, array.length - 1);\r\n}", "function doMergeSort( arr ) {\n\t\t// Initialize empty array for 'sorted' values.\n\t\tvar sorted = [];\n\t\tvar position;\n\t\tvar sorted_arr_pos;\n\t\tvar arr_is_even = ( arr.length % 2 === 0 );\n\n\t\t// If `arr` has more than 1x member:\n\t\tif ( arr.length > 1 ) {\n\n\t\t\t// Add empty arrays to `sorted`.\n\t\t\twhile ( sorted.length < Math.floor( arr.length / 2 ) ) {\n\t\t\t\tsorted.push( [] );\n\t\t\t}\n\n\t\t\t// Loop over contents of `arr`.\n\t\t\t// ...\n\t\t\tfor ( var i = 0, x = arr.length; i < x; i++ ) {\n\t\t\t\t// Set `position` equal to current value of `i`.\n\t\t\t\t// A separate variable is required, as we may need to change the value of\n\t\t\t\t// `position` within the current loop iteration.\n\t\t\t\tposition = i;\n\n\t\t\t\t// Set `sorted_arr_pos` to the current `position` divided by 2, rounded down.\n\t\t\t\t// This var stores the position of the empty array that we'll be sorting *into*.\n\t\t\t\tsorted_arr_pos = Math.floor( position / 2 );\n\n\t\t\t\t// If current index is *not* an even number, skip current iteration.\n\t\t\t\tif ( i % 2 !== 0 ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Block below handles special cases where:\n\t\t\t\t// - Current iteration is last in array;\n\t\t\t\t// - Array length is an odd number (eg. 5).\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// Expand on support comment/documentation\n\t\t\t\tif ( i === arr.length - 1 && !arr_is_even ) {\n\t\t\t\t\t// Set `arr[ position - 1 ]` equal to `sorted[ sorted.length - 1 ]`;\n\t\t\t\t\tarr[ position - 1 ] = sorted[ sorted.length - 1 ];\n\n\t\t\t\t\t// Empty last sub-array within `sorted`.\n\t\t\t\t\tsorted[ sorted.length - 1 ] = [];\n\n\t\t\t\t\t// Decrement `position` and `sorted_arr_pos`.\n\t\t\t\t\tposition--;\n\t\t\t\t\tsorted_arr_pos--;\n\t\t\t\t}\n\n\t\t\t\t// If both the array member at `position` and `position + 1` are not emtpy:\n\t\t\t\t// - Compare the first members of the arrays at `position and `position + 1`;\n\t\t\t\t// - ...\n\t\t\t\twhile ( arr[ position ].length && arr[ position + 1 ].length ) {\n\t\t\t\t\tif ( arr[ position ][ 0 ] > arr[ position + 1 ][ 0 ] ) {\n\t\t\t\t\t\tsorted[ sorted_arr_pos ].push( arr[ position ].shift() );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsorted[ sorted_arr_pos ].push( arr[ position + 1 ].shift() );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If either of the arrays being compared *are not* empty:\n\t\t\t\t// Add any remaining members to array at `sorted_arr_pos`.\n\t\t\t\tif ( arr[ position ].length ) {\n\t\t\t\t\tsorted[ sorted_arr_pos ] = sorted[ sorted_arr_pos ].concat( arr[ position ] );\n\t\t\t\t} else if ( arr[ position + 1 ].length ) {\n\t\t\t\t\tsorted[ sorted_arr_pos ] = sorted[ sorted_arr_pos ].concat( arr[ position + 1 ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Rescursively call `doMergeSort()` with `sorted` array.\n\t\t\t// Assign result to original `arr` arg.\n\t\t\tarr = doMergeSort( sorted );\n\n\t\t// Else if `arr` has exactly 1x member which is an array:\n\t\t// - sorting process is complete;\n\t\t// - ...\n\t\t} else if ( arr.length === 1 && Array.isArray( arr[ 0 ] ) ) {\n\n\t\t\t// Return sorted array to initial callsite.\n\t\t\treturn arr[ 0 ].reverse();\n\t\t}\n\n\t\t// Return updated array to callsite, which will be either:\n\t\t// - `doMergeSort()` (in the case of a recusive function call);\n\t\t// - OR\n\t\t// - outermost context (in case where initial invocation received invalid args.).\n\t\treturn arr;\n\t}", "function mergeSort (arr) {\n if (arr.length < 2) {\n // return once we hit an array with a single item\n return arr;\n }\n \n const middle = Math.floor(arr.length / 2) // get the middle item of the array rounded down\n const left = arr.slice(0, middle) // items on the left side\n const right = arr.slice(middle) // items on the right side\n \n return merge(\n mergeSort(left),\n mergeSort(right)\n )\n}", "function mergeSort(arr) {\n // we use this function to break the original array down into smaller arrays length of 0 or 1\n if (arr.length <= 1) return arr;\n\n // find the middle of the current array\n let mid = Math.floor(arr.length / 2);\n // capture the left side of the array to split, and call recursively\n let left = mergeSort(arr.slice(0, mid));\n // capture the right side of the array to split, and call recursively\n let right = mergeSort(arr.slice(mid));\n\n // merge the two arrays that have been returned\n // this will be called repeatedly until mergeSort has worked it's way down recursively to\n // the each item in it's own array and then works itself back up to the first time it is called\n // kind of insane, and also very cool\n return mergeArrays(left, right);\n}", "function mergeSort(array) {\n // 배열 길이가 0 또는 1이면, 배열 자체를 반환해 재귀호출을 끝낸다.\n if (array.length <= 1) {\n return array;\n } \n\n const middle = Math.floor(array.length / 2);\n // 왼쪽, 오른쪽 절반에 대해 mergeSort를 재귀호출한다. - O(logN)\n const left = mergeSort(array.slice(0, middle)); \n const right = mergeSort(array.slice(middle));\n\n // merge를 호출해 부분 배열을 정렬하며 합병한다.\n return merge(left, right);\n}", "function mergeSort(obj) {\n // break array into individual arrays of single integers\n // keep merging until result contains a single array\n //while (result.length > 1) {\n const oddNumbered = obj.result.length % 2 != 0;\n let temp = [];\n\n // iterate 2 subarrays at a time and merge into larger subarray\n for (let i = 0; i < obj.result.length; i += 2) {\n let a = obj.result[i];\n let b = obj.result[i + 1];\n\n // pre-merge 3 subarrays into 2 if there are odd number of subarrays\n if (oddNumbered && i == (obj.result.length - 3)) {\n b = merge(b, obj.result[i + 2]);\n i++;\n }\n // accumulate intermediate result\n temp.push(merge(a, b));\n }\n // current level merged, update result\n obj.result = temp;\n //}\n return obj.result;\n}", "function mergeSort(arr){\n if(arr.length <= 1){\n return arr;\n }else{\n let firstHalf = arr.slice(0, Math.floor(arr.length/2));\n let secondHalf = arr.slice(Math.floor(arr.length/2),arr.length);\n return merge(mergeSort(firstHalf),mergeSort(secondHalf));\n }\n\n\n}", "function mergeSort(data)\n{\n if(data.length == 1 ) return data;\n\n var mid = data.length / 2;\n var left = data.slice(0, mid);\n var right = data.slice(mid);\n\n left = mergeSort(left);\n right = mergeSort(right);\n\n return merge(left, right);\n}", "function merge_sort(left_part,right_part) \n{\n\tvar i = 0;\n\tvar j = 0;\n\tvar results = [];\n\n\twhile (i < left_part.length || j < right_part.length) {\n\t\tif (i === left_part.length) {\n\t\t\t// j is the only index left_part\n\t\t\tresults.push(right_part[j]);\n\t\t\tj++;\n\t\t} \n else if (j === right_part.length || left_part[i] <= right_part[j]) {\n\t\t\tresults.push(left_part[i]);\n\t\t\ti++;\n\t\t} else {\n\t\t\tresults.push(right_part[j]);\n\t\t\tj++;\n\t\t}\n\t}\n\treturn results;\n}", "function mergeSort(arr) {\n if (arr.length <= 1) {\n return arr;\n } else {\n let midIdx = Math.floor(arr.length / 2);\n let leftHalf = mergeSort(arr.slice(0, midIdx));\n let rightHalf = mergeSort(arr.slice(midIdx));\n return zipper(leftHalf, rightHalf)\n }\n}", "function mergeSort(array) {\n if (array.length <= 1) {\n return array;\n }\n let i = Math.floor(array.length / 2);\n let lHalf = array.slice(0, i);\n let rHalf = array.slice(i);\n return merge(mergeSort(lHalf), mergeSort(rHalf));\n}", "function mergeSort(arr) {\n // base case:\n // if arr length is 1 or 0 return arr\n if (arr.length <= 1) return arr;\n\n // recursive case:\n // find midpoint\n // split arr into 2 halves\n // recursively call mergeSort on each half to continue splitting each half\n // call mergeArrays on the halves passed to recursive call to mergeSort\n // NOTE: when the base case is reached, mergeArrays returns a merged and sorted array and passes this array to the mergeArrays call before it, which itself is inside a mergeSort call\n // NOTE: mergeArrays is called on every recursive mergeSort call\n let midpoint = Math.floor(arr.length / 2);\n let left = mergeSort(arr.slice(0, midpoint));\n let right = mergeSort(arr.slice(midpoint));``\n return mergeArrays(left, right);\n}", "function mergeSort(arrayToSort) {\n // BASE STEP: if the array has only one item, we have our result\n if () {\n return arrayToSort;\n }\n\n // RECURSIVE STEP:\n // Split the array into two, rounding down\n\n // Get left side of array\n\n // Get right side of the array\n\n // Compare each of the arrays and return the merged result\n // Merge the left and the right recursively\n\n}", "function mergeSort(array) {\n const sort = (array) => {\n if (array.length === 1) {\n return array\n }\n const middle = Math.floor(array.length / 2)\n const left = array.slice(0, middle)\n const right = array.slice(middle)\n return merge(\n sort(left),\n sort(right)\n )\n }\n const merge = (left, right) => {\n let result = []\n const leftLen = left.length\n const rightLen = right.length\n let l = 0\n let r = 0\n while (l < leftLen && r < rightLen) {\n if (left[l] < right[r]) {\n result.push(left[l])\n l++\n } else {\n result.push(right[r])\n r++\n }\n }\n return result.concat(left.slice(l)).concat(right.slice(r))\n }\n return sort(array)\n}", "function mergeSort(arr) {\n if (arr.length < 2) return arr;\n var middleIndex = Math.floor(arr.length / 2);\n var firstHalf = arr.slice(0, middleIndex);\n var secondHalf = arr.slice(middleIndex);\n return merge(mergeSort(firstHalf), mergeSort(secondHalf));\n}", "function mergeSort(arr){\n if (arr.length<2) return arr\n var middleIndex = Math.floor(arr.length/2)\n var firstHalf = arr.slice(0, middleIndex)\n var secondHalf = arr.slice(middleIndex)\n\n return merge(mergeSort(firstHalf), mergeSort(secondHalf))\n}", "merge(arr, l, m, r) {\n // original array is broken in two parts \n // left and right array \n let len1 = m - l + 1, len2 = r - m;\n let left = [], right = [];\n for (let i = 0; i < len1; i++)\n left[i] = arr[l + i];\n for (let i = 0; i < len2; i++)\n right[i] = arr[m + 1 + i];\n\n let i = 0;\n let j = 0;\n let k = l;\n\n // after comparing, we merge those two array \n // in larger sub array \n while (i < len1 && j < len2) {\n if (left[i] <= right[j]) {\n arr[k] = left[i];\n i++;\n }\n else {\n arr[k] = right[j];\n j++;\n }\n k++;\n }\n\n // copy remaining elements of left, if any \n while (i < len1) {\n arr[k] = left[i];\n k++;\n i++;\n }\n\n // copy remaining element of right, if any \n while (j < len2) {\n arr[k] = right[j];\n k++;\n j++;\n }\n }", "function mergeSort(arr) {\n // return arrays of single values\n if (arr.length < 2) {\n return arr;\n }\n\n // get the middle index, floor it to prevent floats\n const middle = Math.floor(arr.length / 2);\n const left = arr.slice(0, middle);\n const right = arr.slice(middle);\n\n // mergeSortedArray called on the result of mergeSort left and right\n return mergeSortedArrays(mergeSort(left), mergeSort(right));\n}", "function sortMerge(A, B){\n //k is the index the last int of buffer Array A \n let k = A.length + B.length - 1;\n // i is the index of the last int in array A\n let i = A.length - 1;\n // j is the index of the last int in array B\n let j = B.length - 1;\n // while there is still number in array B\n while(j >= 0){\n //if there's also number in array A, and last int of A is larger than last int of B\n if(i >= 0 && A[i] > B[j]){\n //move last int of A to the last index position in buffer A\n A[k] = A[i];\n // decrease last int of A by 1\n i--;\n }else{\n //if last int of A is smaller than last int of B, then set last int of buffer A equal to last int of B\n A[k] = B[j];\n //decrease last int of B by 1\n j--;\n }\n //decrease last int of buffer A by 1\n k--;\n }\n //return array A\n return A;\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n let middle = Math.floor(arr.length / 2);\n let leftArr = arr.slice(0, middle);\n let rightArr = arr.slice(middle, arr.length);\n console.log(\"middle: \", middle);\n console.log(\"leftArr: \", leftArr);\n console.log(\"rightArr: \", rightArr);\n return merge(mergeSort(leftArr), mergeSort(rightArr));\n}", "function mergeSort (array) {\n if (array.length <= 1) {\n return array\n }\n let middle = (Math.floor(array.length/2))\n let leftSide = array.slice(0, middle)\n let rightSide = array.slice(middle)\n\n return merge(mergeSort(leftSide), mergeSort(rightSide))\n}", "function mergeSort(a, cmp) {\n if (a.length < 2) {\n return a.slice();\n }\n function merge(a, b) {\n var r = [], ai = 0, bi = 0, i = 0;\n while (ai < a.length && bi < b.length) {\n if (cmp(a[ai], b[bi]) <= 0) {\n r[i++] = a[ai++];\n } else {\n r[i++] = b[bi++];\n }\n }\n if (ai < a.length) {\n r.push.apply(r, a.slice(ai));\n }\n if (bi < b.length) {\n r.push.apply(r, b.slice(bi));\n }\n return r;\n }\n return (function sort(a) {\n if (a.length <= 1) {\n return a;\n }\n var m = Math.floor(a.length / 2);\n var left = a.slice(0, m);\n var right = a.slice(m);\n left = sort(left);\n right = sort(right);\n return merge(left, right);\n })(a);\n}", "function mergeSort(a, cmp) {\n if (a.length < 2) {\n return a.slice();\n }\n function merge(a, b) {\n var r = [], ai = 0, bi = 0, i = 0;\n while (ai < a.length && bi < b.length) {\n if (cmp(a[ai], b[bi]) <= 0) {\n r[i++] = a[ai++];\n } else {\n r[i++] = b[bi++];\n }\n }\n if (ai < a.length) {\n r.push.apply(r, a.slice(ai));\n }\n if (bi < b.length) {\n r.push.apply(r, b.slice(bi));\n }\n return r;\n }\n return (function sort(a) {\n if (a.length <= 1) {\n return a;\n }\n var m = Math.floor(a.length / 2);\n var left = a.slice(0, m);\n var right = a.slice(m);\n left = sort(left);\n right = sort(right);\n return merge(left, right);\n })(a);\n}", "function mergeSort(a, cmp) {\n if (a.length < 2) {\n return a.slice();\n }\n function merge(a, b) {\n var r = [], ai = 0, bi = 0, i = 0;\n while (ai < a.length && bi < b.length) {\n if (cmp(a[ai], b[bi]) <= 0) {\n r[i++] = a[ai++];\n } else {\n r[i++] = b[bi++];\n }\n }\n if (ai < a.length) {\n r.push.apply(r, a.slice(ai));\n }\n if (bi < b.length) {\n r.push.apply(r, b.slice(bi));\n }\n return r;\n }\n return (function sort(a) {\n if (a.length <= 1) {\n return a;\n }\n var m = Math.floor(a.length / 2);\n var left = a.slice(0, m);\n var right = a.slice(m);\n left = sort(left);\n right = sort(right);\n return merge(left, right);\n })(a);\n}", "function mergeSort(arr) {\n if (arr.length === 1) {\n return arr;\n }\n\n const center = Math.floor(arr.length / 2);\n\n // slice(from, toButNotIncluding)\n const left = arr.slice(0, center);\n\n // second arg is optional (will go from center to the end of array if 2nd arg is not provided)\n const right = arr.slice(center);\n\n return merge(mergeSort(left), mergeSort(right));\n}", "function cheaterMerge(arr1, arr2){\n let merged = arr1.concat(arr2)\n return merged.sort(function(a, b){return a-b});\n}", "mergeSortMain(arrayMain, firstIdx, lastIdx, dynamicArray, animations) {\r\n if (firstIdx === lastIdx) return;\r\n const halfIdx = Math.floor((firstIdx + lastIdx) / 2);\r\n this.mergeSortMain(dynamicArray, firstIdx, halfIdx, arrayMain, animations);\r\n this.mergeSortMain(dynamicArray, halfIdx + 1, lastIdx, arrayMain, animations);\r\n let x = firstIdx;\r\n let y = firstIdx;\r\n let z = halfIdx + 1;\r\n while (y <= halfIdx && z <= lastIdx) {\r\n animations.push([y, z]);\r\n animations.push([y, z]);\r\n if (dynamicArray[y] <= dynamicArray[z]) {\r\n animations.push([x, dynamicArray[y]]);\r\n arrayMain[x++] = dynamicArray[y++];\r\n } else {\r\n animations.push([x, dynamicArray[z]]);\r\n arrayMain[x++] = dynamicArray[z++];\r\n }\r\n }\r\n while (y <= halfIdx) {\r\n animations.push([y, y]);\r\n animations.push([y, y]);\r\n animations.push([x, dynamicArray[y]]);\r\n arrayMain[x++] = dynamicArray[y++];\r\n }\r\n while (z <= lastIdx) {\r\n animations.push([z, z]);\r\n animations.push([z, z]);\r\n animations.push([x, dynamicArray[z]]);\r\n arrayMain[x++] = dynamicArray[z++];\r\n }\r\n }", "function mergeSort2(arr) {\n if (arr.length == 1) {\n return arr;\n }\n var sa = mergeArray(\n mergeSort2(arr[(0, arr.length / 2)]),\n mergeSort2(arr[(length / 2, arr.length)])\n );\n return sa;\n}", "function jsMergeSort(arr) {\n console.log('arr.length: ', arr.length)\n if (arr.length <= 1) {\n return arr\n } else {\n // compute midpoint: \n let midpoint = Math.floor(arr.length/ 2);\n let leftHalf = jsMergeSort(arr.slice(0,midpoint));\n let rightHalf = jsMergeSort(arr.slice(midpoint));\n\n let newList = mergeSortedLists(leftHalf, rightHalf);\n console.log('newList: ', newList)\n return newList\n }\n}", "function mergeSortedArrays(leftArr, rightArr){\n let sortedArr = []\n let leftIdx = 0;\n let rightIdx = 0;\n\n while(sortedArr.length != (leftArr.length+rightArr.length)){\n if(leftIdx==leftArr.length){\n for(rightIdx; rightIdx<rightArr.length; rightIdx++){\n sortedArr.push(rightArr[rightIdx]);\n \n }\n }\n else if(rightIdx==rightArr.length){\n for(leftIdx; leftIdx<leftArr.length; leftIdx++){\n sortedArr.push (leftArr[leftIdx]);\n }\n }\n else if(leftArr[leftIdx]<rightArr[rightIdx]){\n sortedArr.push(leftArr[leftIdx]);\n leftIdx++;\n } \n else {\n sortedArr.push(rightArr[rightIdx])\n rightIdx++;\n }\n }\n return sortedArr;\n \n}", "function mergeSort(l, r) {\n if (r-l <=0 || stop || sorted(auto_generated)) {\n // console.log('we stop'+r+''+l);\n // console.log(auto_generated);\n cancelAnimationFrame(manimateId);\n return;\n }\n \n let m = Math.floor( l + (r-l)/2 );\n \n mergeSort(l, m);\n mergeSort(m+1,r );\n\n merge(l, m, r);\n}", "function mergeSort(nums) {\n\n var length = nums.length,\n m,\n left,\n right;\n\n if (length < 2) {\n return nums;\n }\n\n m = Math.ceil(length / 2);\n left = nums.slice(0, m);\n right = nums.slice(m, length);\n\n return mergeLists(mergeSort(left), mergeSort(right));\n }", "function mergeSort (arr) {\n if (arr.length === 1) {\n // return once we hit an array with a single item\n return arr\n }\n\n var middle = Math.floor(arr.length / 2) // get the middle item of the array rounded down\n var left = arr.slice(0, middle) // items on the left side\n var right = arr.slice(middle) // items on the right side\n\n return merge(\n mergeSort(left),\n mergeSort(right)\n )\n}", "function mergeSort2(arr, helper = [], low = 0, high = arr.length - 1) {\n let middle;\n if (low < high) {\n middle = Math.floor((low + high) / 2);\n mergeSort2(arr, helper, low, middle);\n mergeSort2(arr, helper, middle + 1, high);\n merge2(arr, helper, low, middle, high);\n }\n}", "function createMergeSortIterative(){\n\n\tvar that = {},\n\t\tspec = {};\n\n\t/**\n\t * Merges two arrays in order based on their natural\n\t * relationship.\n\t * @param {Array} left The first array to merge.\n\t * @param {Array} right The second array to merge.\n\t * @return {Array} The merged array.\n\t */\n\tspec.merge = function(left, right){\n\t\tvar result = [];\n\n\t\twhile (left.length > 0 && right.length > 0){\n\t\t\tif (left[0] < right[0]){\n\t\t\t\tresult.push(left.shift());\n\t\t\t} else {\n\t\t\t\tresult.push(right.shift());\n\t\t\t}\n\t\t}\n\n\t\tresult = result.concat(left).concat(right);\n\t\t\n\t\t//make sure remaining arrays are empty\n\t\tleft.splice(0, left.length);\n\t\tright.splice(0, right.length);\n\t\t\n\t\treturn result;\n\t}\n\n\t/**\n\t * Sorts an array in ascending natural order using\n\t * merge sort.\n\t * @param {Array} items The array to sort.\n\t * @return {Array} The sorted array.\n\t */\n\tthat.sort = function(items){\n\n\t\t// Terminal condition - don't need to do anything for arrays with 0 or 1 items\n\t\tif (items.length < 2) {\n\t\t\treturn items;\n\t\t}\n\n\t\tvar work = [],\n\t\t\ti,\n\t\t\tlen;\n\n\t\tfor (i=0, len=items.length; i < len; i++){\n\t\t\twork.push([items[i]]);\n\t\t}\n\t\twork.push([]); //in case of odd number of items\n\n\t\tfor (var lim=len; lim > 1; lim = Math.floor((lim+1)/2)){\n\t\t\tfor (var j=0,k=0; k < lim; j++, k+=2){\n\t\t\t\twork[j] = spec.merge(work[k], work[k+1]);\n\t\t\t}\n\t\t\twork[j] = []; //in case of odd number of items\n\t\t}\n\n\t\treturn work[0];\n\t}\n\t\n\tthat.getStrategyName = function(){\n\t\treturn \"MergeSortIterative\";\n\t}\n\n\treturn that;\n\t\n}", "timSort(arr, n) {\n // Sort individual subarrays of size RUN \n for (let i = 0; i < n; i += this.RUN)\n this.insertionSort(arr, i,((i + 31)-(n-1)) > 0 ? (n-1): (i + 31) );\n // start merging from size RUN (or 32). It will merge \n // to form size 64, then 128, 256 and so on .... \n for (let size = this.RUN; size < n; size = 2 * size) {\n // pick starting point of left sub array. We \n // are going to merge arr[left..left+size-1] \n // and arr[left+size, left+2*size-1] \n // After every merge, we increase left by 2*size \n for (let left = 0; left < n; left += 2 * size) {\n // find ending point of left sub array \n // mid+1 is starting point of right sub array \n let mid = left + size - 1;\n let right = ((left + 2 * size - 1)- (n - 1)) > 0 ? (n - 1) : (left + 2 * size - 1);\n\n // merge sub array arr[left.....mid] & \n // arr[mid+1....right] \n this.merge(arr, left, mid, right);\n }\n }\n }", "function mergeSort(input) {\n if (input.length > 1) {\n let middle = Math.floor(input.length / 2);\n let left = mergeSort(input.slice(0, middle));\n let right = mergeSort(input.slice(middle, input.length));\n\n input = stitch(left, right, input);\n }\n\n return input;\n}", "function mergeSort2(arr) {\n if(arr.length <= 1) return arr;\n\n let subArr1 = mergeSort2(arr.slice(0, arr.length/2));\n let subArr2 = mergeSort2(arr.slice(arr.length/2));\n\n return merge2(subArr1, subArr2);\n\n}", "function mergeSort (unsortedArray) {\n //if the array only has one element or empty\n if (unsortedArray.length <= 1) {\n return unsortedArray;\n }\n //figure out the middle\n const middle = Math.floor(unsortedArray.length / 2);\n\n //dividing the array into left and right\n const left = unsortedArray.slice(0, middle);\n const right = unsortedArray.slice(middle);\n\n //recursion to combine the left and right\n return merge(\n mergeSort(left), mergeSort(right)\n );\n}", "function mergeSort(Arr, start, end) {\n\n\tif(start < end) {\n\t\tlet mid = (start + end) / 2;\n\t\tmergeSort(Arr, start, mid);\n\t\tmergeSort(Arr, mid+1, end);\n\t\tmerge(Arr, start, mid, end);\n\t}\n}", "function mergeArrays(arr1, arr2) {\n\n\tlet i = arr1.length - 1;\n\tlet j = arr2.length - 1;\n\tlet k = i - j - 1;\n\t\n\twhile (j >= 0 && k >= 0) {\n\t\t\n\t\tif (arr1[k] > arr2[j]) {\n\t\t\t\n\t\t\tarr1[i--] = arr1[k--];\n\t\t} else {\n\t\t\t\n\t\t\tarr1[i--] = arr2[j--];\n\t\t}\n\t}\n\t\n\twhile (j >= 0) {\n\t\n\t\tarr1[i--] = arr2[j--];\n\t}\n\t\n\tconsole.log(arr1);\n}" ]
[ "0.789814", "0.76659286", "0.76051456", "0.7557711", "0.75338113", "0.7510642", "0.7456831", "0.7444788", "0.743857", "0.74070936", "0.7398937", "0.7340965", "0.7330385", "0.73298585", "0.7328909", "0.7311629", "0.7310214", "0.7308759", "0.730648", "0.72966003", "0.7289358", "0.727685", "0.72693247", "0.72543633", "0.7251734", "0.7244789", "0.72387844", "0.72376275", "0.72133243", "0.7194406", "0.7188512", "0.7174837", "0.717371", "0.7172511", "0.71722037", "0.716683", "0.71640265", "0.716382", "0.71605295", "0.7158896", "0.71459985", "0.71357524", "0.7128725", "0.7125578", "0.7095141", "0.7081378", "0.7076748", "0.7071177", "0.7070267", "0.7068985", "0.7051541", "0.7045155", "0.7040813", "0.70371616", "0.7034952", "0.70270884", "0.70083237", "0.700354", "0.70034075", "0.70019454", "0.6995278", "0.69926023", "0.6992434", "0.6983426", "0.6977482", "0.69701725", "0.6969434", "0.6963449", "0.69484323", "0.6920357", "0.6917706", "0.6898112", "0.68930894", "0.68901604", "0.686874", "0.68571734", "0.68508804", "0.6838287", "0.6804129", "0.67894715", "0.6766595", "0.6766595", "0.6766595", "0.6760948", "0.6744598", "0.6739743", "0.67328614", "0.6719407", "0.6718864", "0.6715166", "0.67057616", "0.67027694", "0.66958123", "0.6688149", "0.667856", "0.6663193", "0.66566145", "0.6653765", "0.66418254", "0.66331273" ]
0.70249903
56
Pop Menu of Avatar
function userMenuTemplate() { return ` <div class="popover avatar-pop"> <div class="popover-inner"> <ul class="list"> <li class="list-item"><a class="btn" href="#">Profile</a></li> <li class="list-item"><button id="menu--setup" class="btn btn--reset" >Setting</button></li> <li class="list-item"><button id="btn--logout" class="btn btn--reset" >Logout</button></li> </ul> </div> </div>`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OperatE_avatarclearmenu(){\t\n\t\t/* custom the menucustom the menucustom the menucustom the menu\n\t\t * \n\t\t */\n\t\t/*\n\t\t *custom the menucustom the menucustom the menucustom the menu \n\t\t */\n\t\t \t\t\t\t\t \n\t\t/*hide the idea create menu*/\n\t\t$('#MenU_avatarclearback,#MenU_avatarclearcon_can_con').click(function(){\n\t\t\tIdeA_avatarclearmenuhide();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t});\t\n}", "function popItems(mode) {\n if (mpg.lightbox) {\n mpg.lightbox.dismiss();\n }\n var lb = mpg.chooser_lightbox;\n lb.pop(undefined,undefined,true);//without topline\n var fsrc = om.useMinified?\"chooser2.html\":\"chooser2d.html\"; // go to dev version from dev version\n lb.setHtml('<iframe width=\"100%\" height=\"100%\" scrolling=\"no\" id=\"chooser\" src=\"'+fsrc+'?mode='+mode+'\"/>');\n }", "function IdeA_avatarclearmenuhide(){\n\t$('#MenU_avatarclear').css('display','none');\t\t\n}", "function loadSettingsMenu(){\n $('.overlay-menu').append('<h1>Customize Nutrimon!</h1>');\n \n var male = $('<div><h3>Male<h3><img src='+CHARACTER+'></div>')\n \n male.on('click',function(){\n playSound(confirmSound); \n $('#avatar img').attr('src', CHARACTER);\n \n })\n \n var female = $('<div><h3>Female<h3><img src='+ALTCHARACTER+'></div>')\n \n female.on('click',function(){\n playSound(confirmSound); \n $('#avatar img').attr('src', ALTCHARACTER);\n\n })\n \n $('.overlay-menu').append(male); \n \n $('.overlay-menu').append(female); \n \n //set back button\n createBackBtn(); \n \n \n}", "function restoreAvatar() {\n var bookmarksObject = AvatarBookmarks.getBookmarks();\n\n if (bookmarksObject[CONFIG.STRING_BOOKMARK_NAME]) {\n AvatarBookmarks.loadBookmark(CONFIG.STRING_BOOKMARK_NAME);\n AvatarBookmarks.removeBookmark(CONFIG.STRING_BOOKMARK_NAME);\n setIsAviEnabledFalse();\n } else {\n Window.alert(\"No bookmark was saved in the avatar app.\");\n }\n }", "function avatarOnClick(avatar) {\n if (avatar.classList.contains('xAvatar')) {\n return avatar.classList.replace('xAvatar', 'unselected');\n } else if (avatar.classList.contains('oAvatar')) {\n return avatar.classList.replace('oAvatar', 'unselected');\n }\n if (\n document.querySelector('.xAvatar') &&\n document.querySelector('.oAvatar')\n ) {\n return;\n }\n if (document.querySelector('.xAvatar')) {\n avatar.classList.replace('unselected', 'oAvatar');\n } else {\n avatar.classList.replace('unselected', 'xAvatar');\n }\n}", "function showAvatars() {\n \n // cerrar el resto de menus\n document.getElementById(\"uaccept\").style.display = \"none\"; \n document.getElementById(\"uinput\").style.display = \"none\";\n document.getElementById(\"change_id\").style.display = \"none\";\n\n var avatar_list = document.getElementById(\"avatarslist\");\n avatar_list.style.display = \"block\";\n document.body.scrollTop = document.body.scrollHeight;\n}", "function chooseAvatar(){\n $(\"#choose_avatar\").trigger('click');\n}", "function exit_profile(){\n\n $('.profile').removeClass('c_o_body');\n $('.profile').html('');\n $('.profile_container').hide();\n $('.cover_all').hide();\n\n }", "function selectAvatar1(event)\n{\n selectAvatar(event, 1);\n}", "function onAvatarTouched(e){\n\t// Display the mini user profile\n\tvar userProfile = Alloy.createController(\"user/profile\", { \"user\": media.user });\n\t\n\tuserProfile.getView().show({\n\t\t\"view\": e.source\n\t});\n}", "function goBack(event) {\n $(this).parent('ul').prev('a').removeClass('selected').attr('aria-expanded','false')\n $(this).parent('ul').addClass('is-hidden').attr('aria-hidden', 'true').parent('.has-children').parent('ul').removeClass('moves-out'); \n }", "function handleEditAvatarClick() {\n setEditAvatarPopupOpen(true);\n }", "function actionOnClickBack() {\n\t\t\t//alert('Saldras de la carrera');\n\t\t\tgame.state.start('mainMenuState')\n\t\t}", "function avatarOpensProfile(props2) {\n props.navigation.navigate('MatchProfile', { match: props2._id, chet: props.route.params.chatti });\n }", "function closePop(cover, pop) {\n \"use strict\";\n pop.classList.remove(\"down\");\n cover.classList.remove(\"on\");\n setTimeout(function(){document.getElementsByTagName('body')[0].removeChild(cover);}, 200);\n}", "function deselect(e) {\n $('.pop').slideFadeToggle(function() {\n e.removeClass('selected');\n }); \n }", "function popupLevel () {\n // document.getElementById(\"select-level\").classList.add(\"show\");\n selectLevel();\n genRandomBomb();\n\n }", "function openModRegfromPop(){\n\topenFBbox(context_ssi+\"boxes/community/login/modifica_prof_ok.shtml\");\n\tsendDataComm();//1-Modifica profilo effettuata, submit nickname e avatar\n}", "function menu_pop_down(strobj)\n {\n objthis = $(strobj); // $(this);\n obj = objthis.parent();\n strval = obj.attr('ident');\n strvalLi = \"\";\n\n if(objthis == null) return false;\n\n if( obj.children('ul').hasClass('hide') )\n {\n obj.children('ul').removeClass('hide');\n obj.children('ul').addClass('show');\n }\n else\n {\n obj.children('ul').removeClass('show');\n obj.children('ul').addClass('hide');\n }\n }", "function changeMyPic(path){\n avatarPath = path; // aqui solo damos valor a la variable \n update(); // esta cambia el nombre y la foto\n send_avatar_info(path);\n\n // cambiar la foto del menú\n var menu_personal = document.getElementById(\"menu-personal\");\n menu_personal.src = avatarPath;\n\n // -> coge las cosas que son de la clase myavatar\n var all_my_avatars = document.getElementsByClassName(\"myavatar\");\n\n // este for cambia nuestros avatares n el chat \n // coge los hijos de cada cosa que tenia clase avatar\n // despues cambia el src de todos los hijos (en este caso solo hay una imagen en cada hijo)\n for (var i = 0; i < all_my_avatars.length; i++) {\n var div_myavatar = all_my_avatars[i].childNodes;\n for (var j = 0; j < div_myavatar.length; j++) {\n div_myavatar[j].src = avatarPath;\n }\n }\n\n document.getElementById(\"avatarslist\").style.display = \"none\";\n}", "function showpopupimageselection(){\n\t\t$('#imageselectionpopupmenu').popup('open');\n\t}", "function closePopUp () {\n if ( event.target == bell.querySelector('.icon')) {\n list.style.display = 'none'\n }}", "function deleteAvatar(){\n scene.remove(avatar);\n mixers = [];\n AvatarMoveDirection = { x: 0, z: 0 };\n avatarLocalPos = { x: 0, z: 0 };\n}", "function remove_avatar(avatar) {\n if (avatar) {\n avatar.remove();\n }\n}", "function backToMenu() {\r\n //Hide the modal\r\n hideModal();\r\n\r\n //Remove the event listeners\r\n removeListeners();\r\n\r\n //Show the menu again\r\n MENU.menu.classList.remove(\"hide-menu\");\r\n MENU.controlsCntr.classList.remove(\"hide-menu\");\r\n\r\n //Close the game loop\r\n closeGameLoop = true;\r\n }", "function deselect(e) {\n $('.pop').slideFadeToggle(function() {\n e.removeClass('selected');\n });\n}", "function toMenu() {\n\tclearScreen();\n\tviewPlayScreen();\n}", "function setPop(email, name, img) {\r\n\t$(\"#pop img\").replaceWith('<img src=\"' + img + '\"style=\"width:106px;height:106px\"/>');\r\n\t$(\"#pop h2\").replaceWith('<h2><a href=\"' + window.userWall + \"/\" + email + '\">' + name + '</a></h2>');\r\n}", "function animateRemoval(){return dialogPopOut(element,options);}", "function FLdown(){\n console.log(\"In face l arrow clicked\");\n face.destroy();\n faceindex--;\n if(faceindex<=0)\n {\n faceindex = 0;\n face = game.add.image(1015, 415, images.face[faceindex].name);\n face.scale.setTo(0.1);\n bf = bb.create(600, 55, images.face[faceindex].name);\n bf.scale.setTo(0.1);\n }\n else if (faceindex >= images.face.length)\n {\n faceindex = images.face.length -1;\n face = game.add.image(1015, 415, images.face[faceindex].name);\n face.scale.setTo(0.1);\n bf = bb.create(600, 55, images.face[faceindex].name);\n bf.scale.setTo(0.1);\n }\n else\n {\n face = game.add.image(1015, 415, images.face[faceindex].name);\n face.scale.setTo(0.05);\n bf = bb.create(600, 55, images.face[faceindex].name);\n bf.scale.setTo(0.11);\n }\n player.appearance.head.face = images.face[faceindex].name;\n\n}", "function displayAvatar() {\n push();\n noStroke();\n fill(avatar.color);\n ellipse(avatar.x,avatar.y,avatar.size);\n pop();\n}", "function displayAvatar() {\n push();\n noStroke();\n fill(avatar.color);\n ellipse(avatar.x,avatar.y,avatar.size);\n pop();\n}", "function initPopUp() {\n\n\tvar signPopUp = $(\".sign-pop-up\")\n\n\tsignPopUp.click(function() {\n\t\t$(\".pop-up-show\").fadeIn(\"pop-up\") \n\t});\n\n\tvar xMark = $(\".x-mark\")\n\n\txMark.click(function(){\n\t\t$(\".pop-up-show\").fadeOut(\"pop-up\")\n\n\t});\n\n}", "_backToMainAccount() {\n this._closeMenu();\n AuthActions.backToMainAccount();\n }", "function imageClick(){\n\t$('.pic').click(function() { \n\t\tmenuModal.style.display = \"block\";\n\t\twindow.onclick = function(event) {\n\t\t\tif (event.target == menuModal) {\n\t\t\t\tmenuModal.style.display = \"none\";\n\t\t\t}\n\t\t}\n\t});\n}", "function back() {\r\n if(!$(\".profile\").is(':animated')) {\r\n $(\".profile\").animate({left:'0cm',top:'0cm',opacity:'1'});\r\n $(\".charge_area\").animate({right:'0cm',bottom:'14.5cm',opacity:'0.5'});;\r\n $(\".profile\").css(\"z-index\",\"0\");\r\n $(\".charge_area\").css(\"z-index\",\"-1\");\r\n }\r\n}", "function avatarOptions() {\n\tvar avatarType = document.querySelector('input[name=\"avatar\"]:checked').value;\n\tif (avatarType === \"previousAvatar\") {\n\t\tdocument.getElementById(\"selectAvatarType\").style.display='none';\n\t\tdocument.getElementById(\"selectPrevious\").style.display='';\n\t} else if (avatarType === \"newAvatar\") {\n\t\tdocument.getElementById(\"selectAvatarType\").style.display='none';\n\t\tdocument.getElementById(\"selectScript\").style.display='';\n\t}\n}", "static removePhotoPopUp() {\r\n document.querySelector(`.${this.selectors.popup}`).remove();\r\n }", "function toggleProfileMenu() {\n // Hide other windows\n displays.setYTAppsDisplay(false)\n displays.setAddVideoDisplay(false)\n displays.setNotificationsDisplay(false)\n\n // Profile display\n setProfileDisplay(!profileDisplay)\n if (appearanceDisplay) {\n setAppearanceDisplay(!appearanceDisplay)\n setProfileDisplay(profileDisplay)\n }\n }", "backToMenu(button, groupName, index, pointer, event){\n button.scene.board.setHighScore();\n button.scene.scene.start(\"TitleScene\", button.scene.gameData);\n }", "function backToIconHome(){\n $(this).text(\"\");\n $(this).append(\"<img src=\\'../icons/homeicon.png\\' alt=\\'circleicon\\'>\");\n}", "function func_close_join_room_pop() {\n join_room.css(\"display\", \"none\");\n}", "function Back() {\n\tmainMenuController.GetComponent(MainMenu).MainMenu();\n}", "function goBackToInfo(target) {\n target.closest(\".show\").classList.remove(\"show\");\n userInfo.classList.add(\"show\");\n }", "function animateRemoval() {\n return dialogPopOut(element, options);\n }", "function animateRemoval() {\n return dialogPopOut(element, options);\n }", "function animateRemoval() {\n return dialogPopOut(element, options);\n }", "function animateRemoval() {\n return dialogPopOut(element, options);\n }", "function setAvatar(avatar) {\n console.log(\"avatar: \" + avatar);\n iframe.body.querySelectorAll(\"[data-hook='input']\")[0].value =\n \"/avatar \" + avatar;\n iframe.body.querySelectorAll(\"[data-hook='send']\")[0].click();\n\n var notices = iframe.body.getElementsByClassName(\"notice\");\n for (var i = 0; i < notices.length; i++) {\n var notice = notices[i];\n if (notice.innerHTML == \"Avatar set\") {\n notice.parentNode.removeChild(notice);\n }\n }\n}", "function goBack(){\r\n document.getElementById(\"askLogout\").style.display = 'none';\r\n document.getElementById(\"settingsCard\").style.display = 'block'\r\n}", "function closePopUp(){\n\n\t// remove image src\n\tdocument.getElementById('mainPopImage').src = \"\";\n\n\t// close the popup\n\tdocument.getElementById('vis-popup').style.display = \"none\";\n}", "function displayTravelPopupMenu(){\n $(\"#travel-mode-popup-menu\").hide();\n $(\"#mode-menus\").show(200,function(){\n if(platform===2)\n map.refreshLayout();\n });\n\n $(\"#bike-pop\").css('background-image',\"url('\"+pop_bike+\"')\");\n $(\"#walk-pop\").css('background-image',\"url('\"+pop_walk+\"')\");\n $(\"#transit-pop\").css('background-image',\"url('\"+pop_transit+\"')\");\n $(\"#drive-pop\").css('background-image',\"url('\"+pop_drive+\"')\");\n}", "goToProfile(){\n this.props.navigation.pop();\n this.props.navigation.pop();\n this.props.navigation.getParam('update')();\n }", "function popProfile(to_delete) {\n\n document.getElementById(\"old_profile\").remove();\n\n}", "function backToTopOver() {\n document.getElementById(\"arrow-right\").innerHTML = \"Back to top\";\n }", "function closePopUpImage(){\n popUpBackground.classList.remove('active-background');\n setTimeout(function(){ \n popupContainer.remove();\n }, 300);\n }", "function backToMenu() {\r\n //Hide the modal\r\n hideModal();\r\n\r\n //Show the menu again\r\n MENU.menu.classList.remove(\"hide-menu\");\r\n MENU.controlsCntr.classList.remove(\"hide-menu\");\r\n\r\n //Remove event listener\r\n removeListeners();\r\n }", "function backToMenuFromGame()\r\n\t\t{\r\n\t\t\tresetMatch();\r\n\t\t\tcancelAnimationFrame(requestId);\r\n\t\t\tdocument.getElementById('canvasSpace').style.display = \"none\";\r\n\t\t\tdocument.getElementById('menuInGame').style.display = \"none\";\r\n\t\t\tdocument.getElementById('settings').style.display = \"none\";\r\n\t\t\tdocument.getElementById('menu').style.display = \"initial\";\r\n\t\t}", "function close_pop() {\n join_room.css(\"display\", \"none\");\n $(\".join_room_popup_content\").css(\"height\",\"10em\");\n $(\"#pop_message\").html(\"\");\n }", "function flipBack() {\n $('.card').filter($('.open')).toggleClass('open');\n OpenCards = [];\n numOfmoves = numOfmoves + 1;\n $('.moves').text(numOfmoves);\n }", "pop() {\n // YOUR CODE HERE\n }", "function Nav_slideUp_mUp() {\n $(this)\n \t.closest(navItemLevels)\n \t.removeClass('nav__item--show-sub');\n navbar_leave();\n }", "showBack() {\n addclass(this._deckFrame, 'frame--reveal-info');\n }", "function viewtheirstuff(userselected) { \n viewwhichuser(userselected);\n backtotop();\n }", "function showManagePopup(){\n\t$(\"#tags-menu-popUp\").hide();\n\t$(\"#groups-menu-popUp\").hide();\n\t$(\".quickview-outer\").css(\"display\",\"none\");\n\t// $(\".quickview\").html(\"\");\n\t$(\".manage-pop\").css(\"display\",\"block\");\n\t$(\".manage-pop-outer\").fadeToggle();\n\t$(\".quickview-outer-second quickview-outer\").hide();\n\t$(\"#tag-manage-outertags\").hide(); \t\n\t$(\".msg-popup-outer\").hide();\n}", "function menuGripClick() {\n // console.log('menuGripClick');\n\n PageData.MenuOpen = !PageData.MenuOpen;\n setMenuPosition();\n\n if (!PageData.MenuOpen && PageData.ControlsOpen) {\n PageData.ControlsOpen = false;\n setControlsPosition();\n }\n}", "function Backdrop(){\n\t\t$(\".backdrop\").click(function () {\n\t\t\t$(this).remove();\n\t\t\t$(\".marco\").removeClass('marco-in');\n\t\t\t$(\".img-background\").css('filter', '');\n\t\t\tfoco=false;\n\t\t});\n\t}", "function backToMenu() {\n location.reload();\n }", "function openCloseMenu() {\n const elem = document.querySelector('#mobile-menu-burger');\n\n const mobile_menu = document.querySelector('.mobile-menu');\n if (elem.dataset.img === 'open') {\n elem.dataset.img = 'close';\n elem.src = 'images/icons/clear.svg';\n mobile_menu.dataset.active = 'true';\n document.querySelector('header').dataset.overflow = 'hidden';\n } else {\n mobile_menu.dataset.active = 'false';\n elem.dataset.img = 'open';\n elem.src = 'images/icons/burger.svg';\n document.querySelector('header').dataset.overflow = '';\n }\n}", "static PopCamera() {}", "function ELdown(){\n console.log(\"In eyes l arrow clicked\");\n eyes.destroy();\n eyeindex--;\n if(eyeindex<=0)\n {\n eyeindex = 0;\n eyes = game.add.image(970, 235, images.eyes[eyeindex].name);\n eyes.scale.setTo(0.1);\n be = bb.create(550, 55, images.eyes[eyeindex].name);\n be.scale.setTo(0.1);\n }\n else if (eyeindex >= images.eyes.length)\n {\n eyeindex = images.eyes.length -1;\n eyes = game.add.image(970, 235, images.eyes[eyeindex].name);\n eyes.scale.setTo(0.1);\n be = bb.create(550, 55, images.eyes[eyeindex].name);\n be.scale.setTo(0.1);\n }\n else\n {\n eyes = game.add.image(970, 235, images.eyes[eyeindex].name);\n eyes.scale.setTo(0.1);\n be = bb.create(550, 55, images.eyes[eyeindex].name);\n be.scale.setTo(0.1);\n }\n player.appearance.head.eye = images.eyes[eyeindex].name;\n\n}", "function toggleAvatars(e)\n\t{\n\t\te.preventDefault();\n\t\tif (showAvatars === true)\n\t\t{\n\t\t\t$('.userpic-holder').hide();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t$('.userpic-holder').show();\n\t\t}\n\t\tshowAvatars = !showAvatars;\n\t\tconsole.log('Toggled avatar display, now ' + showAvatars);\n\t\tupdateAvatarText();\n\t\tchrome.storage.local.set({\"avatars\": showAvatars}, function(){ console.log(\"Avatar settings saved locally\"); });\n\t}", "popped() {\n this.isPopped = true;\n this.egg.src = \"images/Gold Coin.png\";\n let allGot = this.game.UpdatePoppedEggCount();\n\n ui.Tip(allGot ? \"Got all the eggs! Now head for the eggsit!\" : \"Got one... on to the next!\");\n }", "function user_go_up()\r\n{\r\n\tif(starting_shot == true)\r\n\t{\r\n\t\tmove(\"up\", \"user\");\r\n\t\t//variable_content_viewer();\r\n\t\tdisplay();\r\n\t}\r\n\tif(user_navigate_allow == true)\r\n\t{\r\n\t\tmove(\"up\", \"user\");\r\n\t\t//variable_content_viewer();\r\n\t\tuser_navigate_allow = false;\r\n\t}\r\n}", "nav_helper(data) {\n\t\tbrowser.sleep(2000)\n\t\tutil.selectDropDown(this.profile, data.Profile, 'Profile', 'Clone');\n\t\tbrowser.sleep(2000)\n\t}", "function closePop() {\n document.querySelector('#popupImage').onclick = function closeView() {\n popupWindow.style.display = 'none';\n document.querySelector('#popupbg').style.visibility = 'hidden';\n };\n\n document.querySelector('#popupbg').onclick = function closeView() {\n popupWindow.style.display = 'none';\n document.querySelector('#popupbg').style.visibility = 'hidden';\n };\n }", "function avatar(ava) //selects the avatar of the user\n{\n if(ava==='ronan')\n {\n\tavatarPic=\"ronan\";\n }\n else if(ava==='john')\n {\n\tavatarPic=\"john\";\n }\n else if(ava==='carter')\n {\n\tavatarPic=\"carter\";\n }\n else if(ava==='mckay')\n {\n\tavatarPic=\"mckay\";\n }\n \n}", "off() {\n\t\t\t\tif (this.active) {\n\t\t\t\t\tcameraPop.call(this.p);\n\t\t\t\t\tthis.active = false;\n\t\t\t\t}\n\t\t\t}", "function closeMenuAccount() {\n $('.authorization').mouseleave(function () {\n this.remove();\n });\n}", "function backtoselection() {\n $('#search-invite-list').hide();\n $('#userset').removeClass('active');\n $('#user_list').hide();\n $('#search-list').hide();\n $('#following-list-create').hide();\n $('#followingnlistgroup').removeClass('active');\n $('#followerslistgroup').show().addClass('active');\n $('#search').show().removeClass('active');\n $('#skipinviteval').show().removeClass('active');\n $('#followers-list-create').css('display', 'block');\n $('#backone').show();\n $('#backtwo').show();\n $('#invite-group-members').show();\n $('#invite-selected-div').hide();\n $('#invite-message').hide();\n $('#invite-messageso').hide();\n $('#backbuttonso').hide();\n $('.processGroupBtnOk').show();\n $('.processGroupBtnCreate, .processGroupBtnSendInvite').hide();\n\n setTimeout(function() {\n $.dbeePopup('resize');\n }, 100);\n\n}", "function func_join_room_pop() {\n join_room.css(\"display\", \"block\");\n}", "popupAction() {\n setTimeout(() => {\n // Chi dung navigateBackHome khi tao va chuyen trang\n // Quay ve Home -> Prechecklist List\n NavigationService.navigateBackHome('Prechecklist', {isNew : true})\n }, 400);\n }", "back(){\n viewport.replace( _history.pop(), _options.pop() );\n }", "function pagina_cerrarPopUp(){\n\t$(\"#backImage\").hide();\n}", "function InventoryItemMouth2CupholderGagClick() {\n\tInventoryItemMouthCupholderGagClick();\n}", "function selectFilePrompt() {\n s.avatarInput.click();\n }", "function popup_profile()\n{\n if($(\".profile-popup\").hasClass(\"hide\"))\n {\n $(\".profile-popup\").removeClass(\"hide\");\n $(\".profile\").addClass(\"focus\");\n $(\".notification-popup\").addClass(\"hide\"); // hide notification\n }else{\n $(\".profile-popup\").addClass(\"hide\");\n $(\".profile\").removeClass(\"focus\");\n $(\".notification-popup\").addClass(\"hide\"); // hide notification\n }\n}", "function changeCoverPhotoButton(){\n $(\"#changeCP\").fadeOut(\"fast\",function(){\n $(\"#changeCPMenu\").fadeIn(\"fast\"); \n });\n}", "function ProfileCardUnFollow(){\n PeopleService.UnFollow($rootScope.UserCard.id)\n .then(\n resolve => {\n $rootScope.UserCard.fav = false ;\n $rootScope.User.favs = resolve.data ;\n }\n );\n }", "function deselect(e) {\n\t$('.pop').slideFadeToggle(function() {\n\t\te.removeClass('selected');\n\t});\n}", "function backMenu() {\n inquirer.prompt([\n {\n type: 'list',\n message: 'What would you like to do?',\n name: 'action',\n choices: [\n \"go back to main menu\",\n \"end session\"\n ]\n }\n ]).then(({ action }) => {\n switch (action) {\n case \"go back to main menu\":\n mainMenu();\n break;\n case \"end session\":\n connection.end();\n break;\n }\n });\n}", "function popUp()\n{\n\tlet fg = document.getElementById(\"foreground\");\n\tlet bg = document.getElementById(\"background\");\n\tif(fg.style.visibility == \"hidden\" || fg.style.visibility == \"\")\n\t{\n\t\tfg.style.visibility = \"visible\";\n\t\tbg.style.visibility = \"visible\";\n\t}\n\n}", "function fpPOSH_go_back(){\n\t\t$('#fpPOSH_back').click(function(){\n\t\t\t$(this).animate({'left':'-20px'},'fast');\n\n\t\t\t$('h3.notifications').removeClass('back');\n\n\t\t\t$('.fpPOSH_inner').animate({'margin-left':'0px'}).find('.step2_in').fadeOut();\n\n\n\t\t\t// hide step 2\n\t\t\t$(this).closest('#fpPOSH_outter').find('.step2').fadeOut();\n\n\t\t\t// clear varianles\n\t\t\tshortcode_vars=[];\n\t\t\tshortcode_vars.length=0;\n\n\t\t\tvar code_to_show = $('#fpPOSH_code').data('defsc');\n\t\t\t$('#fpPOSH_code')\n\t\t\t\t.html('['+code_to_show+']')\n\t\t\t\t.attr({'data-curcode':code_to_show});\n\n\t\t\t// change subtitle\n\t\t\t$('h3.notifications span').html( $('h3.notifications span').data('bf') );\n\t\t});\n\t}", "function remove_profile(){\n $('.active').hide();\n}", "function apri_pop_up_foto(path, chiave, larghezza, altezza) {\n\teval(\"document.getElementById('div_pop_up').style.visibility='hidden'\")\n\teval(\"document.getElementById('img_pop_up').style.visibility='hidden'\")\n\t\n\teval(\"document.getElementById('img_pop_up').src='\"+path+\"'\")\n\t\n\tpos_top = parseInt(y)-(parseInt(altezza)/2)\n\tpos_left = parseInt(x)+larghezza\n\teval(\"document.getElementById('div_pop_up').style.top='\"+ pos_top +\"px'\")\n\teval(\"document.getElementById('div_pop_up').style.left='\"+ pos_left +\"px'\")\n\n\teval(\"document.getElementById('div_pop_up').style.visibility='visible'\")\n\teval(\"document.getElementById('img_pop_up').style.visibility='visible'\")\n}", "function showMouseDown(e) {\n if ((! dead) && (! win)) {\n closeAllMenus();\n document.face.src = faceOoh.src; } }", "function backToDefault() {\n\t$('.main-menu li').removeClass('hover');\n\t\n\tvar activeItem = $('.main-menu li.active');\n\tvar target = activeItem.attr('data-target');\n\tvar showcaseHeight = $('.showcase-menu').outerHeight();\n\t\n\tshowcaseHeight = (showcaseHeight * target) * -1;\n\t\n\t$('.showcase-menu').css({\n\t\ttop: showcaseHeight\n\t});\n\t\n\tactiveItem.addClass('hover');\n}", "openPopUp(){\r\n // Hide the back panel.\r\n const element = document.getElementsByClassName(StylesPane.HideBackPanel)[0]\r\n element.className = StylesPane.BackPanel\r\n // Show the settings panel.\r\n }", "function rightRemoveHighlight(){\n\n $('#rightClick').fadeIn('slow', function(){\n $('#rightClick').attr(\"src\", \"icons/right_unclicked.png\");\n });\n}", "function signOut(){\n $('.overlay-menu').append('<h1>Sign Out?</h1>');\n \n var info = $('<div class=\"info\">')\n info.append('<div id=\"Yes\"\"><h2>Yes</h2></div><div id=\"No\"><h2>No</h2></div>'); \n \n $('.overlay-menu').append(info); \n \n $('#Yes').on('click',function(){\n playSound(confirmSound);\n window.location.assign('index.html');\n console.log('signed out'); \n })\n \n $('#No').on('click',function(){\n playSound(confirmSound);\n $('.overlay-menu').empty(); \n $('.overlay-menu').css('max-height', '0px');\n $('.game').removeClass('blurred');\n \n })\n \n \n}" ]
[ "0.63483787", "0.60360366", "0.6025923", "0.59213996", "0.5877805", "0.5851104", "0.58485466", "0.5841474", "0.5749216", "0.57234687", "0.57088906", "0.56457007", "0.56344396", "0.55779487", "0.5571478", "0.5559341", "0.5555883", "0.55438745", "0.55434906", "0.5507514", "0.55040526", "0.54780376", "0.5477805", "0.5457753", "0.54438514", "0.543701", "0.5434648", "0.5432148", "0.5423152", "0.54207224", "0.5417093", "0.54111534", "0.54111534", "0.5403944", "0.53888", "0.5384556", "0.53823745", "0.53814495", "0.538033", "0.537397", "0.5371922", "0.53717655", "0.5367866", "0.5364368", "0.5354812", "0.5328412", "0.5328412", "0.5328412", "0.5328412", "0.5323627", "0.5309005", "0.5304138", "0.53035337", "0.5298563", "0.52968824", "0.52933085", "0.52900916", "0.52893484", "0.5285795", "0.52815807", "0.52803224", "0.52697366", "0.5268706", "0.5254684", "0.5254168", "0.52537817", "0.5253759", "0.52533543", "0.5250903", "0.5248909", "0.5241633", "0.5240005", "0.5236956", "0.52362514", "0.5234282", "0.5231436", "0.52251405", "0.5223993", "0.5216748", "0.52076024", "0.52074397", "0.5205835", "0.52010596", "0.52007186", "0.5199054", "0.51924866", "0.51878875", "0.51841015", "0.51781523", "0.5177848", "0.51761025", "0.5174011", "0.5156965", "0.51540524", "0.51513", "0.51500785", "0.5149424", "0.5148554", "0.51414806", "0.51358116", "0.51316756" ]
0.0
-1
avatar image e.g. alt="avatar
function authNavItemTemplate() { return ` ${JSON.parse(localStorage.getItem('userData')).nickname} <li class="nav-item"> <button id="menu--topAvatar" class="btn btn--reset"> <div class="avatar"> <img class="avatar-img" src="./assets/media/avatar.svg" alt="avatar"> </div> </button> </li>`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AvatarURL( fn )\n{\n return 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/' + fn.substring( 0, 2 ) + '/' + fn + '.jpg';\n}", "function renderAvatar(user) {\n\tvar img = document.createElement('img')\n\timg.className = \"avatar\"\n\timg.src = user.avatarURL\n\timg.alt = \"\"\n\treturn img\n}", "function Avatar(props) {\n return (\n <img className=\"Avatar\" src={props.user.avatarUrl} alt={props.user.name} />\n );\n}", "function Avatar(props) {\n return (\n <img className=\"Avatar\"\n src={props.user.avatarUrl}\n alt={props.user.name}\n />\n\n );\n}", "function avatar(ava) //selects the avatar of the user\n{\n if(ava==='ronan')\n {\n\tavatarPic=\"ronan\";\n }\n else if(ava==='john')\n {\n\tavatarPic=\"john\";\n }\n else if(ava==='carter')\n {\n\tavatarPic=\"carter\";\n }\n else if(ava==='mckay')\n {\n\tavatarPic=\"mckay\";\n }\n \n}", "function Avatar(props) {\n return (\n <img className=\"Avatar\"\n src={props.user.avatarUrl}\n alt={props.user.name}\n />\n );\n}", "get avatar24() {\n return \"http://www.gravatar.com/avatar/\" + $md5.hex_md5(this.email) +\n \".jpg?d=wavatar&s=24\";\n }", "setAvatar(url) {\n const template = `<img src=\"${url}\" alt=\"\">`;\n this._userAvatar.insertAdjacentHTML(\"afterbegin\", template);\n }", "getAvatarUrl() {\n const { user } = this.state;\n return endpoint + '/core/avatar/' + user.id + '/' + user.avatar;\n }", "function display_profile_image(image) {\n if (image) {\n return 'src = \"' + image + '\"';\n } else {\n return 'src = \"files\\\\profile\\\\img\\\\default.png\"';\n }\n}", "function setAvatarBo() {\n avatar = 'img/char-boy.png';\n}", "function Avatar(_ref) {\n var path = _ref.path,\n size = _ref.size;\n //size:.avatar-medium .avatar-sm\n return /*#__PURE__*/React.createElement(\"img\", {\n src: path,\n alt: \"Avatar\",\n className: \"avatar \" + size\n });\n}", "get sourceAvatar() {}", "set sourceAvatar(value) {}", "renderAvatar() {\n const avatarId = this.props.currentUser.profile_photo_id;\n if (avatarId && (this.props.photos[avatarId] && this.props.photos[avatarId].avatar)) {\n return (\n <img src={this.props.photos[avatarId].avatar}\n id=\"menu-button\"\n className=\"profile-image nav-bar-avatar\"/>\n );\n } else {\n return (\n <img src=\"https://s3.us-east-2.amazonaws.com/flexpx-dev/avatar.png\"\n id=\"menu-button\"\n className=\"profile-image stock-avatar\"/>\n );\n }\n }", "function displayAvatar(hash, type, binval) {\n // Define the path to replace\n var replacement = hash + \" .avatar-container\";\n // var replacement = \"avatar-container\";\n var code = '<div class=\"avatar-container\"><img class=\"avatar removable\" src=\"';\n \n // If the avatar exists\n if(type != 'none' && binval != 'none')\n code += 'data:' + type + ';base64,' + binval;\n else\n code += $('.system .default-avatar').val();\n\n code += '\" alt=\"\" /></div>';\n \n // Replace with the new avatar (in the roster and in the chat)\n $('.' + replacement + ', #' + replacement).replaceWith(code);\n // $('.' + replacement).replaceWith(code);\n}", "function avatar(url) {\n\tlet div = document.createElement(\"DIV\");\n\tlet a = document.createElement(\"A\");\n\tlet img = document.createElement(\"IMG\");\n\timg.src = url;\n\timg.width = 40;\n\timg.height = 40;\n\timg.className = \"avatar\";\n\tdiv.appendChild(a.appendChild(img));\n\treturn div;\n}", "getProfilePic() {\n return 'images/' + this.species.toLowerCase() + \".png\";\n }", "function NoAvatar() {\n return (\n <img \n src=\"/defaultAvatar.png\"\n title=\"Default Avatar\"\n alt=\"Default Avatar\"\n className=\"usrAvatar\"\n />\n )\n}", "function createAvatar(id) {\n var avatar = document.createElement('img');\n avatar.className = \"icon-avatar avatar\";\n avatar.src = \"https://www.gravatar.com/avatar/\" + id + \"?d=wavatar&size=30\";\n\n return avatar;\n}", "function updateUIforSignIn(avatarSrc) {\n\tauthDropdownItem.innerHTML = `<i><img class=\"avatar-image\" src=\"${avatarSrc}\" /></i>`;\n}", "function characterPic2(avatarIMG) //avatar of who is speaking\n{\n \n document.getElementById('speakerPic2').innerHTML = \"<img src='images/\"+avatarIMG+\".jpg' height='115px' width='75px'>\";\n}", "function changeIMG() {\n document.getElementById(\"eins\").src =\n \"/registration/avatar/<%= file.filename %>\";\n}", "function createAvatar() {\n var avatar = document.createElement('i');\n avatar.className = \"icon-avatar avatar\";\n\n return avatar;\n }", "function Avatar({\n className,\n children,\n imageURL,\n style,\n size = \"\",\n status,\n placeholder,\n icon,\n color = \"\",\n onClick,\n onMouseEnter,\n onMouseLeave,\n onPointerEnter,\n onPointerLeave,\n}: Props): React.Node {\n const classes = cn(\n {\n avatar: true,\n [`avatar-${size}`]: !!size,\n \"avatar-placeholder\": placeholder,\n [`avatar-${color}`]: !!color,\n },\n className\n );\n return (\n <span\n className={classes}\n style={\n imageURL\n ? Object.assign(\n {\n backgroundImage: `url(${imageURL})`,\n },\n style\n )\n : style\n }\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onPointerEnter={onPointerEnter}\n onPointerLeave={onPointerLeave}\n >\n {icon && <Icon name={icon} />}\n {status && <span className={`avatar-status bg-${status}`} />}\n {children}\n </span>\n );\n}", "function customerAvatar(item) {\n if (!item.customer || !item.customer.firstname) return \"?\";\n\n var r = item.customer.firstname.substr(0, 1);\n\n if (item.customer.lastname)\n r +=\n item.customer.lastname.indexOf(\" \") > -1\n ? item.customer.lastname.substr(\n item.customer.lastname.lastIndexOf(\" \"),\n 1\n )\n : item.customer.lastname.substr(0, 1);\n\n return r.toUpperCase();\n }", "function getImageUrl(authData) {\n switch (authData.provider) {\n // case 'password':\n // return authData.password.email.replace(/@.*/, '');\n case 'twitter':\n /* jshint -W106 */\n return authData.twitter.cachedUserProfile.profile_image_url;\n // case 'facebook':\n // return authData.facebook.displayName;\n }\n }", "function imageURL() {\n var range = this.quill.getSelection();\n var value = prompt('What is the image URL');\n this.quill.insertEmbed(range.index, 'image', value, Quill.sources.USER);\n }", "function setNameAvatar(inName, inAvatarSrc){\r\n\t//local logic\r\n\tif( !CURRENT_USER ){\r\n\t\tCURRENT_USER = new User(inName, inAvatarSrc);\r\n\t} else {\r\n\t\tCURRENT_USER.name = inName;\r\n\t\tCURRENT_USER.avatar = inAvatarSrc;\r\n\t}\r\n\r\n\t//on local page\r\n\tupdateProfileOnPage(inName, inAvatarSrc);\r\n\r\n\t//update UI\r\n\tupdateUI();\r\n}", "function emojiImage(el) {\n const image = document.createElement('img')\n image.className = 'emoji'\n image.alt = el.getAttribute('alias') || ''\n image.height = 20\n image.width = 20\n return image\n}", "function setAvatar(avatar) {\n console.log(\"avatar: \" + avatar);\n iframe.body.querySelectorAll(\"[data-hook='input']\")[0].value =\n \"/avatar \" + avatar;\n iframe.body.querySelectorAll(\"[data-hook='send']\")[0].click();\n\n var notices = iframe.body.getElementsByClassName(\"notice\");\n for (var i = 0; i < notices.length; i++) {\n var notice = notices[i];\n if (notice.innerHTML == \"Avatar set\") {\n notice.parentNode.removeChild(notice);\n }\n }\n}", "function customerAvatar(item) {\r\n if (!item.customer || !item.customer.firstname) return \"?\";\r\n\r\n var r = item.customer.firstname.substr(0, 1);\r\n\r\n if (item.customer.lastname)\r\n r +=\r\n item.customer.lastname.indexOf(\" \") > -1\r\n ? item.customer.lastname.substr(\r\n item.customer.lastname.lastIndexOf(\" \"),\r\n 1\r\n )\r\n : item.customer.lastname.substr(0, 1);\r\n\r\n return r.toUpperCase();\r\n }", "function getAvatar() {\n api.getAvatar().$promise.then(function (result) {\n UserService.avatar = result.pictures[0].picture;\n $location.path('/main');\n }, function () {\n window.alert('Not Logged In');\n $location.path('/');\n });\n }", "function getUserAvatar() {\n\n var contract = {\n \"function\": \"sm_getAddressAvatar\",\n \"args\": JSON.stringify([gUserAddress])\n }\n\n return neb.api.call(getAddressForQueries(), gdAppContractAddress, gNasValue, gNonce, gGasPrice, gGasLimit, contract);\n\n}", "function getProfilePicUrl() {\n return getAuth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "previewFile() {\n var preview = document.getElementById('avatarBox');\n var file = document.querySelector('input[type=file]').files[0];\n var reader = new FileReader();\n\n reader.onload = function () {\n // changes the avatar icon to the file's image\n preview.src = reader.result;\n }\n\n if (file) {\n reader.readAsDataURL(file);\n }\n }", "getName() {\nreturn this.avatarName;\n}", "getGalleryAvatarPict(uid) {\n let j = this.jQuery;\n let prefUrl = 'https://sonic-world.ru/files/public/avatars/av';\n if (uid == undefined) return false;\n j.ajax({\n url: prefUrl + uid +'.jpg',\n type:'HEAD',\n error:\n function(){\n j.ajax({\n url: prefUrl + uid +'.png',\n type:'HEAD',\n error:\n function(){\n j.ajax({\n url: prefUrl + uid +'.gif',\n type:'HEAD',\n error:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-color', '#E0E0E0');\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.gif)');\n }\n });\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.png)');\n }\n });\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.jpg)');\n }\n });\n }", "updateAvatar (avatarUrl) {\n $(\"#dominantSpeakerAvatar\").attr('src', avatarUrl);\n }", "function getAvatarID(){\n\tvar clientID = client.GetConnectionID();\n\tvar avatarx = \"Avatar\" + clientID.toString();\n\treturn avatarx;\n}", "function Gravatar (props) {\n const email = props.email;\n const hash = md5(email);\n\n return(\n <img className={props.className}\n src={'https://s.gravatar.com/avatar/'||`${hash}`||'?s=80'} //arreglar el Hash \n alt=\"Avatar\" />\n )\n}", "function assignImage(user){\n if(!user) return \"\";\n if(user.image) return user.image;\n if(user.twitchData && user.twitchData.profile_image_url) return user.twitchData.profile_image_url;\n if(user.facebookData && user.facebookData.photos) return user.facebookData.photos[0].value;\n if(user.googleData && user.googleData.photos) return user.googleData.photos[0].value;\n return \"\";\n}", "function recupérationAvatar() {\n var f = $(\"#boutonAvatar\");\n if (f.files && f.files[0] && verifImage()==false) {\n var f = $(\"#boutonAvatar\");\n var reader= new FileReader();\n reader.onload = function(e) {\n $('#imageAvatar').setAttribute('src', e.target.result);\n }\n reader.readAsDataURL(f.files[0]);\n }\n}", "function set_avatar(fighter){\n \n var x =fighter.coordinate_x;\n var y =fighter.coordinate_y;\n var id = '#'+x+'_'+y;\n var link =\"/WebArenaGoupSI1-04-BE/img/avatars/\"+fighter.player_id+\".png\";\n var link_default =\"/WebArenaGoupSI1-04-BE/img/avatars/default/1.png\";\n var img;\n \n //img=\"<img src='\"+link+\"' data-toggle='tooltip' data-placement='top' title='\"+fighter.name+\"'>\";\n \n \n $.get(link)\n .done(function() { \n img=\"<img src='\"+link+\"' data-toggle='tooltip' data-placement='top' title='\"+fighter.name+\"'>\";\n $(id).html(img);\n }).fail(function() { \n // Image doesn't exist - do something else.\n img=\"<img src='\"+link_default+\"' data-toggle='tooltip' data-placement='top' title='\"+fighter.name+\"'>\";\n $(id).html(img);\n });\n \n \n \n \n \n}", "function image(elem) {\n var alt = elem.getAttribute(\"alt\");\n var title = elem.getAttribute(\"title\");\n var url = elem.getAttribute(\"src\");\n\n if (alt === null) {\n alt = url;\n }\n\n var op = \" ![\" + alt + \"](\" + url;\n\n if (title !== null) {\n op += \" \\\"\" + title + \"\\\"\";\n }\n\n return op + \") \";\n}", "function displayAvatar() {\n push();\n noStroke();\n fill(avatar.color);\n ellipse(avatar.x,avatar.y,avatar.size);\n pop();\n}", "function displayAvatar() {\n push();\n noStroke();\n fill(avatar.color);\n ellipse(avatar.x,avatar.y,avatar.size);\n pop();\n}", "function image_name() {\n return program.user + '/' + program.image;\n}", "function iconError() {\n if (this.src != 'https://cdn.discordapp.com/embed/avatars/1.png?size=128') {\n const match =\n this.src.match(/^https:\\/\\/cdn.discordapp.com\\/avatars\\/([^.]+)\\./);\n const matchSB =\n this.src.match(/^https:\\/\\/www.spikeybot.com\\/avatars\\/([^.]+)\\./);\n if (match) {\n this.src = `https://www.spikeybot.com/avatars/${match[1]}.png`;\n } else if (matchSB) {\n this.src = `https://kamino.spikeybot.com/avatars/${matchSB[1]}.png`;\n } else {\n this.src = 'https://cdn.discordapp.com/embed/avatars/1.png?size=32';\n }\n }\n }", "function avatarAssign(fact) {\n switch(fact) {\n case \"New Conglomerate\":\n return \"https://www-cdn.planetside2.com/images/empires/nc/nc-soldier-right.png?v=3304520529\"\n case \"Terran Republic\":\n return \"https://www-cdn.planetside2.com/images/empires/tr/tr-soldier-right.png?v=157706187\"\n case \"Vanu Sovereignty\":\n return \"https://www-cdn.planetside2.com/images/empires/vs/vs-soldier-right.png?v=616336742\"\n default: \n return \"https://vignette.wikia.nocookie.net/planetside2/images/9/93/Auraxis.jpg/revision/latest/scale-to-width-down/220?cb=20150129141914\"\n }\n}", "function getDefaultImage(fname, lname) {\n let p = gender.guess(`${fname} ${lname}`);\n return p.gender === 'female' ? \n 'https://upload.wikimedia.org/wikipedia/commons/5/53/Blank_woman_placeholder.svg'\n :\n 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/63/Upload_free_image_notext.svg/2000px-Upload_free_image_notext.svg.png';\n}", "loadAndSaveAvatar(character) {\n this.loadImage('/' + character.avatarImg).then(img => {\n character.img = img;\n });\n }", "function updateAvatar(avatar) {\n props.handleChangeInputs(avatar, 'photo');\n }", "function image(node) {\n var self = this;\n var content = uri(self.encode(node.url || '', node));\n var exit = self.enterLink();\n var alt = self.encode(self.escape(node.alt || '', node));\n\n exit();\n\n if (node.title) {\n content += ' ' + title(self.encode(node.title, node));\n }\n\n return '![' + alt + '](' + content + ')';\n}", "function getProfilePicUrl() {\n return (\n firebase.auth().currentUser.photoURL ||\n \"../../resources/images/profile_placeholder.png\"\n );\n}", "getMxcAvatarUrl(): string { throw new Error(\"Member class not implemented\"); }", "function findHeadShot(key) {\n return \"../images/avatars/\" + key + \".png\"\n }", "function drawAvatar(canvas,avatarN,source,avatarName){\n\tvar ctx=canvas.getContext('2d');\n\tvar newAvatarId = 'avatar'+avatarN;\n\tvar pad = 30;\t//size of padding aroud starting text\n\n\tvar imageObj = new Image();\n imageObj.onload = function() {\n\t\tctx.clearRect(0, 0, SMALL, SMALL); //clear canvas\n \tctx.drawImage(imageObj,0, 0);\n\t\tctx.fillStyle = \"black\";\n\t\tctx.font = \"bold 20px Arial\";\n\t\tvar texSize = 20; //for spacing, should match above in ctx.font\n\t\tvar newlPad = 5;\t//spacing between lines of text\n\t\tvar x = pad;\n\t\tvar y = SMALL-pad;\n\t\tctx.fillText(avatarName, x, y);\n\t\ty += texSize + newlPad;\n\t\tctx.fillText(\" activity: \"+ACTIVITY_LEVEL[avatarN], x, y);\n };\n\timageObj.src = source;\n}", "function get_avatar(req, res) {\n\tvar image_file = req.params.image;\n\tvar path_file = './uploads/avatars/' + image_file;\n\n\tfs.exists(path_file, (exists) => {\n\t\tif (!exists) return res.status(404).send({ message: 'No existe la imagen' });\n\t\treturn res.status(200).sendFile(path.resolve(path_file));\n\t});\n}", "function getProfilePicUrl() {\r\n if(isUserSignedIn()){\r\n return auth.currentUser.photoURL || '/assets/images/becoder.png';\r\n }\r\n}", "grabAvatar(userId, avatarHash) {\n let Format = avatarHash.startsWith(\"a_\") ? \"gif\" : \"png\";\n return {\n \"hash\": avatarHash,\n \"format\": Format,\n \"url\": `https://cdn.discordapp.com/avatars/${userId}/${avatarHash}.${Format}?size=1024`\n };\n }", "function userPicture(itemNo,idLoc) { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tvar userPic = document.createElement(\"img\");\t\t\t\t\t\t\t\t\t\t\t// create element\n\t\tvar userID = gapi.hangout.data.getValue(\"listTxt\" + itemNo + \"listID\" + idLoc) || \"0\"; \t// Get Persons ID\n\t\tvar userObj = eval(gapi.hangout.getParticipantById(userID));\t\t\t\t\t\t\t// Get person object and JSON convert\n\t\tuserPic.src = userObj.person.image.url + \"sz=25\";\t\t\t\t\t\t\t\t\t\t// Use Avatar as image (+ resize to 50x50)\n\t\tuserPic.width = 25;\n\t\tuserPic.height = 25;\n\t\tuserPic.align = \"top\"; \n\t\treturn userPic;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// return button element\n\t}", "static imageAltForRestaurant(restaurant) {\r\n return (`${restaurant.name}`);\r\n }", "function previewFile() {\n var preview = document.querySelector('img');\n var file = document.querySelector('input[type=file]').files[0];\n var reader = new FileReader();\n\n reader.onloadend = function (ev) {\n preview.src = reader.result;\n signupInfo.avatar = { \"image\": reader.result }\n }\n reader.readAsDataURL(file);\n }", "function TB_image() {\n\tvar t = this.title || this.name ;\n\tTB_show(t,this.href,'image');\n\treturn false;\n}", "function selectAvatarPicForChange() {\n\tlet file = this.files[0],\n\t\tmime = [\"image/jpeg\", \"image/svg+xml\", \"image/png\", \"image/gif\"],\n\t\tfileReader = new FileReader(),\n\t\terrBox = document.getElementById(\"changeDetailsErrorBox\");\n\n\terrBox.style.display = \"none\";\n\n\t//check if user actually selected a file or left the field empty\n\tif (document.getElementById(\"changeAvatarInput\").files.length == 0) {\n\t\terrBox.style.display = \"block\";\n\t\terrBox.innerText = \"You must select a file or go back\";\n\t\treturn;\n\t}\n\n\t//check valid file type\n\tif (mime.indexOf(file.type) === -1) {\n\t\terrBox.style.display = \"block\";\n\t\terrBox.innerText = \"Only jpg, svg, png and gif files allowed\";\n\t\treturn;\n\t}\n\t//check if file doesn't exceed maximum allowed size (1mb set)\n\tif (file.size > 1024 * 1024) {\n\t\terrBox.style.display = \"block\";\n\t\terrBox.innerText = \"Size must not exceed 1 MB\";\n\t\treturn;\n\t}\n\t//all ok, save the image in avatarBase64 variable for later use\n\tfileReader.onload = function () {\n\t\tavatarBase64 = fileReader.result;\n\t}\n\tfileReader.readAsDataURL(file);\n}", "function getUserImage(username) {\n for (var i = 0, length = users.length; i < length; i++) {\n if (users[i].username == username) {\n if (!Methods.isNullOrEmpty(users[i].picture) && !Methods.isNullOrEmpty(users[i].picture.url)) {\n return users[i].picture.url;\n }\n else {\n return 'images/groups/' + username.slice(0, 1).toUpperCase() + '.png';\n }\n }\n }\n return 'images/other/Cat.png';\n }", "function handleAvatar(iq) {\n var handleXML = iq.getNode();\n var handleFrom = iq.getFrom();\n var hash = hex_md5(handleFrom);\n var find = $(handleXML).find('vCard');\n var aChecksum = '';\n \n // vCard not empty?\n if(find.text()) {\n // We get the avatar\n var aType = find.find('TYPE:first').text();\n var aBinval = find.find('BINVAL:first').text();\n \n // No or not enough data\n if(!aType || !aBinval) {\n aType = 'none';\n aBinval = 'none';\n }\n \n // Process the checksum\n else\n aChecksum = hex_sha1(Base64.decode(aBinval));\n \n // We display the user avatar\n displayAvatar(hash, aType, aBinval);\n \n // Store the avatar\n setPersistent('avatar-type', handleFrom, aType);\n setPersistent('avatar-binval', handleFrom, aBinval);\n setPersistent('avatar-checksum', handleFrom, aChecksum);\n }\n \n // vCard's empty\n else\n resetAvatar(handleFrom);\n \n // This is me?\n if(handleFrom == getJID()) {\n // First presence?\n if(!getDB('checksum', 1))\n firstPresence(aChecksum);\n \n // Update our DB for later presence stanzas\n setDB('checksum', 1, aChecksum);\n }\n}", "getImage(){\n return '';//This might change later, we will see what I want this to be\n }", "function Image() {\n return (\n <div className=\"Image\">\n <img src={'/isa.JPG'} className=\"profile-pic\" alt=\"logo\" />\n \n </div>\n );\n }", "get image() {\n return this.getStringAttribute('image');\n }", "function setupAccountPage(){\n $(\".avatar\").attr(\"src\",\"/static/images/players/default.png\");\n if(loggedIn()){\n try{\n $.ajax(\"/static/images/players/\"+firebase.auth().currentUser.email+\".txt\",{error:function(e){\n $(\".avatar\").attr(\"src\",\"/static/images/players/default.png\");\n }}).done(function(data){\n $(\".avatar\").attr('src',data);\n });\n } catch(e){\n console.log(e);\n }\n $(\".playerName\").text(playerName().substring(0,14));\n \n }\n}", "function CommentAvatar(props) {\n var className = props.className,\n src = props.src;\n var classes = (0, _classnames[\"default\"])('avatar', className);\n var rest = (0, _lib.getUnhandledProps)(CommentAvatar, props);\n\n var _partitionHTMLProps = (0, _lib.partitionHTMLProps)(rest, {\n htmlProps: _lib.htmlImageProps\n }),\n _partitionHTMLProps2 = (0, _slicedToArray2[\"default\"])(_partitionHTMLProps, 2),\n imageProps = _partitionHTMLProps2[0],\n rootProps = _partitionHTMLProps2[1];\n\n var ElementType = (0, _lib.getElementType)(CommentAvatar, props);\n return _react[\"default\"].createElement(ElementType, (0, _extends2[\"default\"])({}, rootProps, {\n className: classes\n }), (0, _lib.createHTMLImage)(src, {\n autoGenerateKey: false,\n defaultProps: imageProps\n }));\n}", "function displayUserAvatars(users) {\n\n return `\n <!-- Start avatars -->\n <div class=\"avatars-stack mt-2\">\n\n ${users.map(users => ` \n <div class=\"avatar\">\n <a href=\"${users.userProfileURL}\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"${users.display_name} ${users.aboutdisplay}\">\n <img class=\"img-avatar\" src=\"${users.profilepictureurl}\" onerror=\"this.onerror=null;this.src='${avatarImageDefaut}';\">\n </a>\n </div> \n `).join(\"\")}\n </div> \n <!-- stop avatars --> \n`;\n}", "function gravatar(user, size) {\n if (!size) {\n size = 200;\n }\n if (!this.email) {\n return `https://gravatar.com/avatar/?s=${size}&d=retro`;\n }\n const md5 = crypto.createHash('md5').update(this.email).digest('hex');\n return `https://gravatar.com/avatar/${md5}?s=${size}&d=retro`;\n}", "function loadUserImage(imageName) {\n const avatar = document.getElementById('avatar');\n checkReference(avatar, () => {\n const path = './assets/images/User_Avatars/';\n avatar.src = path + imageName;\n console.log('user image changed');\n });\n}", "function badgeImg(link, name) { return ' '; }", "function getOppImage(oppAbbr) {\n if (oppAbbr[0] === '@') {\n oppAbbr = oppAbbr.substring(1, oppAbbr.length);\n }\n return \"/images/teams/\" + oppAbbr + \".png\";\n}", "function getImageUrl(context) {\n let imageName =\n context.animalHead +\n '_' +\n context.animalBody +\n '_' +\n context.animalLegs +\n '_render.gif';\n let imageUrl = `https://storage.googleapis.com/${\n firebaseConfig.storageBucket\n }/gifs/${imageName}`;\n return imageUrl;\n}", "function controlloFotoDefault(picture)\n{\n\tpic = picture;\n\tif (picture == 'Photo' || picture == 'photo' || picture == '' || picture.length == 0)\n\t{\n\t\tpicture = './img/missingAvatar.png';\n\t}else\n\t{\n\t\tpicture = 'http://95.141.45.174'+pic;\n\t}\n\treturn picture;\n}", "function getImageUrl (photo, format) {\n\treturn \"https://farm\" + photo.farm + \".static.flickr.com/\" + photo.server + \"/\" + photo.id + \"_\" + photo.secret + format + \".jpg\";\n}", "async function showProfilePic() {\n const imageObj = await util.getProfilePicById(util.currentProfile);\n\n let profilePicSrc;\n !imageObj\n ? (profilePicSrc = './images/user.png')\n : (profilePicSrc = `./uploadedImages/${imageObj.img_id}.${imageObj.img_ext}`);\n\n document.querySelector('#profilePicElement').src = profilePicSrc;\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\r\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\r\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function getProfilePicUrl() {\n return firebase.auth().currentUser.photoURL || '/images/profile_placeholder.png';\n}", "function FindUserAvatar()\n{\n var scene = framework.Scene().MainCameraScene();\n if (scene && client.IsConnected())\n return scene.EntityByName(\"Avatar\" + client.connectionId);\n else\n return null;\n}", "function onAvatarTouched(e){\n\t// Display the mini user profile\n\tvar userProfile = Alloy.createController(\"user/profile\", { \"user\": media.user });\n\t\n\tuserProfile.getView().show({\n\t\t\"view\": e.source\n\t});\n}", "avatarInitial(username) {\n let parts = (username == null) || (username == undefined) ? ['Not', '/', 'Available'] : username.split(/[ -]/)\n let initials = ''\n\n for (var i = 0; i < parts.length; i++) {\n initials += parts[i].charAt(0)\n }\n\n if (initials.length > 3 && initials.search(/[A-Z]/) !== -1) {\n initials = initials.replace(/[a-z]+/g, '')\n }\n\n initials = initials.substr(0, 3).toUpperCase()\n\n return initials\n }", "function loadAvatar(hash, index, email, blank, counter, contactEmail){\n var count = 0;\n\n var url = \"https://secure.gravatar.com/avatar/\" + hash + \"?s=300&d=404\";\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'blob';\n xhr.onload = function(e) {\n \n var img = document.createElement('img');\n img.setAttribute(\"id\", \"realImageContainer\");\n if(blank){\n img.src = \"assets/transparent.png\";\n }\n \n if(xhr.status == 404 && email != ''){\n count++;\n loadInitials(email,index, contactEmail);\n }\n else\n {\n img.src = window.URL.createObjectURL(this.response);\n \n var divName = \"#g\" + index;\n \n $(divName).empty();\n if(email)\n $(divName).prepend(img);\n\n $(divName).append('<p id=\"gravatarName\">' + email + '</p>');\n \n var srcClone = img.src;\n $scope.trelloImages.push({\"Name\": email, \"Image\" :srcClone, \"Email\" : contactEmail});\n $scope.completedXMLRequests++;\n \n //Check if all xml requests are done and send\n if($scope.completedXMLRequests == 28){\n Service.updateGravatars($scope.trelloImages);\n }\n }\n \n \n };\n xhr.send();\n }", "function imgPrincipal(url) {\r\n let img_principal = `\r\n <img\r\n src=\"${url}\"\r\n style=\"width:300px;height:300px;\"\r\n />\r\n `;\r\n $(\"#img_principal\").html(img_principal);\r\n}", "function displayIconAddress() {\n\n var icon = blockies.create({\n seed: gUserAddress.toLowerCase(),\n\n });\n $('.identicon').attr('src', icon.toDataURL());\n}", "function getGoogleAvatar(index, googleId, callback) {\n gapi.client.load('plus','v1', function() {\n var request = gapi.client.plus.people.get({\n 'userId': googleId\n });\n request.execute(function(resp) {\n var img;\n if(resp.image) {\n if(!resp.image.isDefault) {\n img = resp.image.url.replace('?sz=50', '?sz=100');\n }\n }\n callback(index, img);\n });\n });\n}", "function CardImage(props) {\n return <img src={props.src} alt=\"Avatar\" />;\n}" ]
[ "0.7290859", "0.72849363", "0.71193886", "0.707134", "0.7067917", "0.7065247", "0.70588756", "0.7021117", "0.6947409", "0.6942486", "0.68954796", "0.68745506", "0.6841702", "0.6724568", "0.6671925", "0.66380215", "0.6635885", "0.65981466", "0.6590609", "0.6577588", "0.6558165", "0.6500929", "0.6409545", "0.63754016", "0.6360612", "0.63402534", "0.63177824", "0.63149965", "0.631177", "0.62955636", "0.6251722", "0.6232578", "0.62176794", "0.62022454", "0.6190684", "0.6188693", "0.6183482", "0.6178756", "0.6167171", "0.6136514", "0.6134605", "0.6129767", "0.611418", "0.6109719", "0.6109551", "0.61070734", "0.61070734", "0.61046493", "0.6097855", "0.60955685", "0.60938585", "0.60694987", "0.60668176", "0.6065536", "0.60599977", "0.6030961", "0.6021105", "0.59854305", "0.5979448", "0.5968637", "0.5966261", "0.5965462", "0.59438956", "0.5943644", "0.59415394", "0.594086", "0.5925153", "0.5921455", "0.59209627", "0.59131944", "0.5905902", "0.59001726", "0.58954847", "0.5885906", "0.5874216", "0.58738226", "0.5872998", "0.58688694", "0.5867396", "0.586575", "0.5848343", "0.5848107", "0.58428735", "0.5838899", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827653", "0.5827154", "0.58163667", "0.5812227", "0.5811144", "0.5804493", "0.5784306", "0.57665026", "0.57594764" ]
0.0
-1
again, the hackiest bullet ever
function mousePressed() { if (pharah.ammoCapacity <= 0) { return false; } else { flip = true; shotSound.play(); pharah.ammoCapacity -= 1; //yeah, so here I create the bullet so it can be drawn. flip the bool, etc. b = new Bullet(pharah, mouseX, mouseY, .02); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function special_bullet(_enemy,b_level) {\n\tvar _left = _enemy.offsetLeft;\n\tvar _top = _enemy.offsetTop;\n\tvar _width = _enemy.offsetWidth;\n\tvar _height = _enemy.offsetHeight;\n\tvar _space = Math.floor(_width / 5);\n\tvar ene_bullet = create_enemy_bullet(_left, _top + _height / 2, enemy_bullets[b_level]);\n\tmove_enemy_bullet(-2, 8, ene_bullet);\n\tene_bullet = create_enemy_bullet(_left + _space, _top + _height / 2 + 30, enemy_bullets[b_level]);\n\tmove_enemy_bullet(-1, 8, ene_bullet);\n\tene_bullet = create_enemy_bullet(_left + _space * 2, _top + _height / 2 + 45, enemy_bullets[b_level]);\n\tmove_enemy_bullet(0, 8, ene_bullet);\n\tene_bullet = create_enemy_bullet(_left + _space * 3, _top + _height / 2 + 30, enemy_bullets[b_level]);\n\tmove_enemy_bullet(1, 8, ene_bullet);\n\tene_bullet = create_enemy_bullet(_left + _space * 4, _top + _height / 2, enemy_bullets[b_level]);\n\tmove_enemy_bullet(2, 8, ene_bullet);\n}", "function drawAlienShoot() {\n graphics.drawImage(bullet, bulletX, bulletY + 35, 50, 50);\n }", "function spellBomb () {\n\n for (var i = 0; i < 21; i++) { newBullet(i * 18, mouse.X, mouse.Y); }\n\n playerList[0].MP -= playerList[0].special_MP_cost;\n playerList[0].specialCooldown = playerList[0].MAX_SPECIAL_COOLDOWN;\n}", "function fireBullet(){\n bullets.push({\n x: bullet.x + killa.width/2 - bullet.width/2,\n y: bullet.y + killa.height/2 - bullet.height/2\n\n })\n}", "function fireBullet () {\n\t//\n if (game.time.now > bulletTime)\n {\n // Grab the first bullet we can from the pool\n lazer = lazers.getFirstDead(true, player.x + 24 * player.scale.x, player.y + 8, 'lazer');\n }\n}", "function shootBullet() {\r\n // Disable shooting for a short period of time\r\n if (BULLET_COUNT > 0){\r\n \tcanShoot = false;\r\n \tvar audio = new Audio('player_shoot.mp3');\r\n\t\taudio.play();\r\n \tsetTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n \tvar bullet = new Bullet(player.facing);\r\n\t\tbulletarray[bulletarray.length] = bullet;\r\n \t// Create the bullet using the use node\r\n \tsvgdoc.getElementById(\"bullets\").appendChild(bullet.node);\r\n \tBULLET_COUNT --;\r\n\t}\r\n}", "function fire_bullet(){\r\n\tif(parseInt(num_bullets.innerHTML) > 0){\r\n\t\tbullet_coords.push(new vec4(0.004, -0.005, 0, 1));\r\n\t\tbullet_directions.push(new vec4(-0.04 + (Math.random() * 0.08), -0.04 * (Math.random() * 0.08), -1, 1));\r\n\t\tbullet_timeouts.push(0);\r\n\t\tnum_bullets.innerHTML = parseInt(num_bullets.innerHTML) - 1;\r\n\t}\r\n}", "function Start() {\r\n // Bullets = MaxBullets;\r\n Cursor.visible = false;\r\n Screen.lockCursor = true;\r\n Bullets = MaxBullets;\r\n timeBetweenPunch = 0;\r\n}", "function Bullet() {\n this.srcX = 331;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 16;\n this.height = 14;\n this.explosion = new Explosion();\n}", "function toggleBullet(editor) {\n editor.focus();\n editor.addUndoSnapshot(function () { return processList_1.default(editor, \"insertUnorderedList\" /* InsertUnorderedList */); }, \"Format\" /* Format */);\n}", "function addBullet(top,left,_d,_s, BT) {\n var is_en = tank.attr('isEnemy')=='true'?false:true;\n var by_whom = tank.attr('title');\n \t\tvar $bullet = $('<span title=\"'+ tank.attr('id') +'\" class=\"'+ tank.attr('isEnemy') +'\" style=\"position:absolute;width:18px;height:18px;top:' + top + 'px;left:' + left + 'px;z-index: 3;\"></span>');\n $bullet.css('background','url(images/bullet/bullet.png) no-repeat');\n $('div#container').append($bullet);\n isHit($bullet, top, left, _d, _s, is_en, by_whom, BT);\n }", "private internal function m248() {}", "function li(t) {\n return t + \"\u0001\u0001\";\n}", "function bulletsShoot() {\n if (ship.fireGun && ship.bullets.length < maxBullets) {\n ship.bullets.push({\n x: ship.x + 4/3 + ship.r * Math.cos(ship.a),\n y: ship.y - 4/3 * ship.r * Math.sin(ship.a),\n xv: bulletSpeed * Math.cos(ship.a),\n yv: -bulletSpeed * Math.sin(ship.a),\n r: 2,\n }); \n }\n // ship.fireGun = false;\n}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function draw_bullets(){\n bullets.forEach(function(element){\n element.y -= 10;\n element.update()\n })\n}", "function Bullet (e){\n e.active = true;\n e.xVelocity = e.speed;\n e.yVelocity = 0;\n e.width = 3;\n e.height = 3;\n e.color = \"red\";\n //set boundaries for bullets\n e.inBounds = function(){\n return e.x >= 0 && e.x <= 6656\n && e.y >= 0 && e.y <= 468;\n };\n e.draw = function (){\n ctx.fillStyle = this.color;\n ctx.fillRect(this.x, this.y, this.width, this.height);\n };\n e.update = function(){\n e.x += e.xVelocity;\n e.y += e.yVelocity;\n \n e.active = e.active && e.inBounds();\n }\n return e;\n }", "function resetBullet(bullet){\n bullet.kill();\n}", "function resetBullet(bullet){\n bullet.kill();\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n }", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 42 /* * */ && marker !== 45 /* - */ && marker !== 43 /* + */) {\n return -1;\n }\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace$7(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n return pos;\n }", "function shootBullet() {\n if (!cheatMode) {\n --bulletsLeft;\n }\n\n updateBulletsNumber();\n\n // Disable shooting for a short period of time\n player.readyToShoot = false;\n setTimeout(\"player.readyToShoot = true\", PLAYER_SHOOT_INTERVAL);\n\n // Create the bullet using the use node\n var bullet = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n if (player.facing == facingType.RIGHT) {\n x = player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2;\n } else {\n x = player.position.x + BULLET_SIZE.w / 2;\n }\n\n bullet.setAttribute(\"direction\", player.facing)\n bullet.setAttribute(\"x\", x);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n document.getElementById(\"bullets\").appendChild(bullet);\n playSound(SOUND_SHOOT);\n}", "function drawBullets() {\n\t\n\t// Retire todos los proyectiles que han pasado fuera de la pantalla.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\tif (bullets[b].defunct == true || bullets[b].y <= 0) {\n\t\t\tbullets.splice(b, 1);\n\t\t\tb--;\n\t\t}\n\t}\n\t\n\t// pinta todas las balas que aún quedan.\n\tfor (var b = 0; b < bullets.length; b++) {\n\t\t\n\t\t// Mueva la bala un poco.\n\t\tbullets[b].y -= DELTA_BULLET;\n\t\t\n\t\t// Si la bala ha afectado a alguna de las naves espaciales!\n\t\tvar hit = false;\n\t\tfor (var s = 0; s < spaceships.length && hit == false; s++) {\n\t\t\t\n\t\t\t// Es un éxito de la prueba para ver si la bala ha afectado esta nave espacial.\n\t\t\tif ((Math.abs(spaceships[s].x - bullets[b].x) < HIT_PROXIMITY) &&\n\t\t\t\t(Math.abs(spaceships[s].y - bullets[b].y) < HIT_PROXIMITY)) {\n\t\t\t\t\n\t\t\t\t// Es un éxito! Así que marquen la nave espacial y la bala como \"defunct\".\n\n ctx.drawImage(explosion, spaceships[s].x, spaceships[s].y);\n\n\n\n\t\t\t\tspaceships[s].defunct = true;\n\t\t\t\tbullets[b].defunct = true;\n\t\t\t\thit = true;\n\n\t\t\tpunto++;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Si la bala no alcanzó ninguna de las naves espaciales, a continuación, dibuje la bala.\n\t\tif (!hit) {\n\t\t\tctx.drawImage(bullet, bullets[b].x, bullets[b].y);\n\t\t}\n\t}\n}", "function fireBullet(){\n if(game.time.now>bulletTime){\n bullet=bullets.getFirstExists(false);\n if(bullet){\n bullet.reset(player.x + 14,player.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n }", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$7(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "get bulletFrame() {\n return this._bulletFrame;\n }", "function resetBullet (bullet) {\n\n bullet.kill();\n\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$3(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function createBullet(){\n if (game.time.now > bulletTime)\n {\n var bullet = bullets.getFirstExists(false);\n\n if (bullet)\n {\n // And fire it\n bullet.reset(player.x-6, player.y-10);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200; \n }\n}}", "shoot () {\n\t\tnew Bullet (this.containerElement, this.mapInstance, this.position, this.direction);\n\t}", "drawExistingBullets() {\n const bullets = this.bulletManager.entitiesDisplayed;\n\n for (let index = 0; index < bullets.length; index++) {\n bullets[index].draw(this.ctx);\n }\n }", "function Bullet() {\n this.x = -1;\n this.y = -1;\n this.velX = 0;\n this.velY = 0;\n this.elem = 'fire';\n }", "function spawnBullet(p){\n add([rect(6,18), \n pos(p), \n origin('center'), \n color(0.5, 0.5, 1),\n 'bullet'\n ])\n }", "function Bullet() {\n\tSprite.call(this, BULLET_IMG_SRC, BULLET_WIDTH, BULLET_HEIGHT)\n}", "add( bullet ){\r\n\r\n this.bullets[this.bullets.length] = bullet;\r\n }", "protected internal function m252() {}", "function glowBullet(){\n for(var i =0; i < bulletArrays.length; i++) {\n bulletArrays[i].style.backgroundImage = inactiveBackground;\n\n }\n bulletArrays[currentImage].style.backgroundImage = activeBackground;\n }", "function Bullet() {\n _super.call(this, \"bullet\");\n this.name = \"bullet\";\n // set the small insect to start at a random y value\n this.y = Math.floor(Math.random() * constants.SCREEN_HEIGHT);\n this.x = 0;\n // add drift to the cloud \n this._dx = 5;\n }", "function drawBulletEnemies(t_bullet)\n{\n t_bullet.x_pos -= t_bullet.speed; // Decreases x_pos to make Bullet fly across the word.\n \n if (t_bullet.x_pos <= -1300) //Resets Bullet Positioning if has reached the defined boundries.\n {\n t_bullet.x_pos = 3500;\n }\n \n \n x = t_bullet.x_pos;\n y = t_bullet.y_pos;\n size = t_bullet.size;\n push();\n \n if (t_bullet.deadly)\n { \n fill(170, 13, 0);\n }\n else\n { \n fill(0); \n }\n \n \n first_part = {\n x: x,\n y: y,\n width: 25 * size,\n height: 25 * size\n };\n rect(first_part.x, first_part.y, first_part.width, first_part.height, 360, 0, 0, 360);\n\n \n fill(10); \n second_part = {\n x: x + (25 * size),\n y: y + (2.5 * size),\n width: 4 * size,\n height: 20 * size\n };\n rect(second_part.x, second_part.y, second_part.width, second_part.height);\n \n \n fill(0);\n third_part = {\n x: (x + (25 * size) + 4 * size),\n y: y,\n width: 2 * size,\n height: 25 * size\n };\n rect(third_part.x, third_part.y, third_part.width, third_part.height);\n\n \n fill(255);\n eyes_blank = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 8 * size,\n height: 9 * size\n }; \n arc(eyes_blank.x_pos, eyes_blank.y_pos, eyes_blank.width,\n eyes_blank.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n eyes_pupil = {\n x_pos: x + (8.5 * size),\n y_pos: y + (6.5 * size),\n width: 3 * size,\n height: 4.5 * size\n };\n \n //Eyes\n fill(0);\n arc(eyes_pupil.x_pos, eyes_pupil.y_pos, eyes_pupil.width,\n eyes_pupil.height, -HALF_PI + QUARTER_PI, PI + -QUARTER_PI, CHORD);\n\n \n //Mouth\n fill(255, 0, 0);\n mouth = {\n x_pos: x * 3,\n y_pos: y * 2.6\n };\n\n beginShape();\n vertex(x + (2.5 * size), y + (20 * size));\n bezierVertex( x + (10 * size), y + (10 * size),\n x + (13 * size), y + (22 * size),\n x + (6 * size), y + (23 * size));\n endShape();\n pop();\n\n //Sets the center x and y properties of bullet object based on full width and height of shapes\n t_bullet.center_x = x + ( (first_part.width + second_part.width + third_part.width) / 2); \n t_bullet.center_y = y + ( first_part.height / 2); \n \n checkBulletEnemies(t_bullet); //Check bullet object collision.\n}", "get bulletKey() {\n return this._bulletKey;\n }", "function bullet_shot(e_plane) {\n\tvar bullets = battle_ground.getElementsByClassName(\"myBullet\");\n\tfor(var i = 0; i < bullets.length; i++) {\n\t\tfor(var j = 0; j < e_plane.length; j++) {\n\t\t\tif(!bullets[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar bullet_left = parseInt(bullets[i].style.left);\n\t\t\tvar bullet_top = parseInt(bullets[i].style.top);\n\t\t\tvar _left = parseInt(e_plane[j].style.left);\n\t\t\tvar _top = parseInt(e_plane[j].style.top);\n\t\t\tvar bHeight = parseInt(bullets[i].offsetHeight);\n\t\t\tvar bWidth = parseInt(bullets[i].offsetWidth);\n\t\t\tvar _height = parseInt(e_plane[j].offsetHeight);\n\t\t\tvar _width = parseInt(e_plane[j].offsetWidth);\n\t\t\tif(e_plane[j].HP > 0 && bullet_left > _left - bWidth && bullet_left < _left + _width && bullet_top < _top + _height - bHeight && bullet_top > _top - bHeight) {\n\t\t\t\tbattle_ground.removeChild(bullets[i]);\n\t\t\t\te_plane[j].HP--;\n\t\t\t\tif(e_plane[j].HP <= 0) {\n\t\t\t\t\tscores = scores + e_plane[j].score;\n\t\t\t\t\tscore_init(scores, score_view); \n\t\t\t\t\texplosion(e_plane[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n marker = state.src.charCodeAt(pos++); // Check bullet\n\n if (marker !== 0x2A\n /* * */\n && marker !== 0x2D\n /* - */\n && marker !== 0x2B\n /* + */\n ) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n} // Search `\\d+[.)][\\n ]`, returns next pos after marker on success", "function Bullet(X, Y, toX,toY) {\n this.x = X;\n this.y = Y;\n this.tox = toX;\n this.toy = toY;\n}", "function Update_Player_Bullet (bullet, id, player) {\r\n if (bullet) {\r\n bullet.identifier = id;\r\n if (bullet.posX < 1200) {\r\n bullet.posX += 5;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex;\r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n player.DeleteShot(parseInt(bullet.identifier));\r\n }\r\n }\r\n }", "toString() {\n\t\treturn \"Bullet (starting position): \" + this.originalPosition.toString();\n\t}", "function bullet(xBullet, yBullet, dirBullet, velBullet)\n{\n this.xBullet = xBullet;\n this.yBullet = yBullet;\n this.dirBullet = dirBullet;\n this.velBullet = velBullet;\n this.collided = false;\n}", "function Bullet(j) {\n this.jet = j;\n this.srcX = 100;\n this.srcY = 500;\n this.drawX = -20;\n this.drawY = 0;\n this.width = 30;\n this.height = 10;\n this.explosion = new Explosion();\n}", "function create_enemy_bullet(bullet_left, bullet_top, enemy_bullet) { //coordinates\n\tvar enemy_bullets = document.createElement(\"img\");\n\tenemy_bullets.className = \"enemy_bullets\";\n\tenemy_bullets.style.width = enemy_bullet[0].width + \"px\";\n\tenemy_bullets.style.height = enemy_bullet[0].height + \"px\";\n\tenemy_bullets.ATK = enemy_bullet[0].ATK;\n\tenemy_bullets.style.position = \"absolute\";\n\tenemy_bullets.style.top = bullet_top + \"px\";\n\tenemy_bullets.style.left = bullet_left + \"px\";\n\tenemy_bullets.index = 0;\n\tenemy_bullets.src = enemy_bullet[1][0];\n\tclearInterval(enemy_bullets.times);\n\tenemy_bullets.times = setInterval(function(){\n\t\tif (!pause_clicked) {\n\t\t\tenemy_bullets.index++;\n\t\t\tif (enemy_bullets.index > 3) {\n\t\t\t\tenemy_bullets.index = 0;\n\t\t\t}\n\t\t\tenemy_bullets.src = enemy_bullet[1][enemy_bullets.index];\n\t\t\tif (parseInt(enemy_bullets.style.top) >= 950 || \n\t\t\t\tparseInt(enemy_bullets.style.left) <= -parseInt(enemy_bullets.style.width) || \n\t\t\t\tparseInt(enemy_bullets.style.left) >= 750) {\n\t\t\t\tclearInterval(enemy_bullets.times);\n\t\t\t}\n\t\t}\n\t},200);\n\tbattle_ground.appendChild(enemy_bullets);\n\treturn enemy_bullets;\n}", "function DrawBullets () {\r\n for (var j = 0; j < player_1.bullets.length; j++) {\r\n var disparoBueno = player_1.bullets[j];\r\n Update_Player_Bullet(disparoBueno, j, player_1);\r\n }\r\n\r\n if (Jugadores == 2) {\r\n for (var j = 0; j < player_2.bullets.length; j++) {\r\n var disparoBueno = player_2.bullets[j];\r\n Update_Player_Bullet(disparoBueno, j, player_2);\r\n }\r\n }\r\n\r\n if (enemy_1.life > 0) {\r\n for (var i = 0; i < enemy_1.bullets.length; i++) {\r\n var disparoMalo = enemy_1.bullets[i];\r\n Update_Enemy_Bullet(disparoMalo, i);\r\n }\r\n }\r\n }", "display()\n {\n image(this.sprite, this.bulletX, this.bulletY);\n }", "explode() {\n\t\tthis.bulletSpecial = 0;\n\t\tsetTimeout(() => {\n\t\t\tthis.size = 150;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.delete;\n\t\t\t}, 0.5 * 1000)\n\t\t}, 0.8 * 1000);\n\t}", "function bullets_borders(){\n for (var x = 0; x < bullets.length; x++){\n console.log(\"Recorcholis\");\n if(bullets[x] !== undefined){\n console.log(\"y mas Recorcholis\");\n if ((bullets[x].x) >1000){\n console.log(bullets[x].x);\n bullets.splice(x,1);\n }\n if ((bullets[x].x) < 0){\n bullets.splice(x,1);\n }\n if((bullets[x].y)<-50){\n bullets.splice(x,1);\n }\n if((bullets[x].y) >500){\n bullets.splice(x,1);\n }\n }\n }\n}", "function bulletsTemplate({\n bullets,\n config\n}) {\n return bullets.map(bullet => `* ${bullet}`).join(config.lineBreak);\n}", "function bulletsBasicShooterCollision(enemy, bullet) {\n makeBloodParticles(bullet, enemy);\n bullet.destroy();\n enemy.hp -= bullet.damage;\n damage += bullet.damage*100;\n hitMarker.play();\n bulletsHit++;\n\n //knock back the enemy\n if(!enemy.knockedBack) {\n enemy.knockedBack = true;\n knockback(enemy, bullet.knockbackValue, enemy.rotation);\n enemy.body.drag.x = 1000;\n enemy.body.drag.y = 1000;\n }\n}", "function resetBullet(bullet) {\n // Destroy the laser\n bullet.kill();\n}", "function drawBullet(){\n if(playerBullet.firing){\n playerBullet.x+=playerBullet.direction*5;\n }\n //console.log(playerBullet.firing);\n for(var i = 0; i<platforms.length; i++){\n if(playerBullet.x+playerBullet.width>platforms[i].x && playerBullet.x<platforms[i].x+platforms[i].width &&\n playerBullet.y+playerBullet.height>platforms[i].y && playerBullet.y<platforms[i].y+platforms[i].height){\n console.log(platforms[i]);\n playerBullet.firing = false;\n playerBullet.x = levelDimensions.right+500;\n playerBullet.y = levelDimensions.right+500;\n }\n }\n ctx.beginPath();\n ctx.rect(playerBullet.x-cameraX,playerBullet.y-cameraY,playerBullet.width,playerBullet.height);\n ctx.fillStyle = \"#FF00FF\";\n ctx.fill();\n ctx.closePath(); \n}", "drawBullet(bullet) {\n const { x, y, size, color } = bullet;\n this.context.beginPath();\n this.context.strokeStyle = \"#000000\";\n this.context.arc(x, y, size, 0, 2 * Math.PI, false);\n this.context.fillStyle = color;\n this.context.fill();\n }", "function newBullet(e) {\n \tbulletX = 35;\n bulletY = shipY + 10;\n \n bullet.push(bulletX);\n \n }", "createBullets() {\n\n if (this.bullets.length < 2) {\n let blt = new Bullet()\n blt.pos.x = this.pos.x + (this.size.w / 2) // Centers the bullet starting point\n blt.pos.y = this.pos.y + (this.size.h / 2) // to the players body\n blt.color = '#00ff00'\n blt.damage = this.bulletDamage\n\n blt.vector.dx = this.bulletDirection.dx // Sets the vector of the bullet \n blt.vector.dy = this.bulletDirection.dy // to the mouse pos\n this.bullets.push(blt) // Push the bullet object to bullets array\n\n HelperFunctions.playAudio(this.gunVolume, \"https://raw.githubusercontent.com/JoshMatthew/PeewPeew/master/assets/sfx/enemy-gun.mp3\")\n }\n }", "function shootBullet() {\n // Disable shooting for a short period of time\n canShoot = false;\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\n\n // Create the bullet using the use node\n var bullet = document.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n bullet.setAttribute(\"x\", player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n document.getElementById(\"bullets\").appendChild(bullet);\n}", "function _recreateBullets(oldReferenceLayer,targetElement){if(this._options.showBullets){var existing=document.querySelector(\".introjs-bullets\");existing.parentNode.replaceChild(_createBullets.call(this,targetElement),existing);}}", "function Enemy3_bullet() {\n _super.call(this, \"enemy3_bullet\", -4);\n }", "function shootBullet() {\n\t// Disable shooting for a short period of time\n\tcanShoot = false;\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\n\tbullet_number += 1;\n\t\n // Create the bullet by createing a use node\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\n\n // Calculate and set the position of the bullet\n bullet.setAttribute(\"x\", player.position.x + PLAYER_SIZE.w / 2 - BULLET_SIZE.w / 2);\n bullet.setAttribute(\"y\", player.position.y + PLAYER_SIZE.h / 2 - BULLET_SIZE.h / 2);\n\tif(!PLAYER_FACE_RIGHT) {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#lbullet\");\n\t} else {\n\t\tbullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\n\t}\n // Set the href of the use node to the bullet defined in the defs node\n \n\n // Append the bullet to the bullet group\n\tif(PLAYER_FACE_RIGHT == true) {\n\t\tsvgdoc.getElementById(\"rightBullets\").appendChild(bullet);\n\t} else {\n\t\tsvgdoc.getElementById(\"leftBullets\").appendChild(bullet);\n\t}\t\n}", "function checkBullets() {\n //\"clearar\" canvasen så inte det gamla finns kvar\n Game.bulletCanvas.clearRect(0, 0, 800, 500);\n //loopar igenom alla kulor\n for (var p = 0; p < Game.players.length; p++) {\n for (var i = 0; i < Game.players[p].bullets.length; i++) {\n //om kulan finns på spelytan renderas den ut\n if (Game.players[p].bullets[i].drawY <= 500 && Game.players[p].bullets[i].drawY >= 0) {\n Game.players[p].bullets[i].render();\n }\n //om kulan är över spelytan anropas funktionen resetBullet\n else if (Game.players[p].bullets[i].drawY <= 0) {\n Game.players[p].bullets[i].resetBullet(Game.players[p].bullets[i]);\n }\n }\n }\n}", "get bulletAngleOffset() {\n return this._bulletAngleOffset;\n }", "function shootBullet() {\r\n //if all bullets used\r\n if(bulletremain==0) return;\r\n var shoot = svgdoc.getElementById(\"shoot\");\r\n shoot.play();\r\n bulletremain--;\r\n if(cheat) bulletremain++;\r\n svgdoc.getElementById(\"bulletLeft\").innerHTML = \"Bullet Left: \"+bulletremain;\r\n // Disable shooting for a short period of time\r\n canShoot = false;\r\n setTimeout(\"canShoot = true\", SHOOT_INTERVAL);\r\n // Create the bullet using the use node\r\n var bullet = svgdoc.createElementNS(\"http://www.w3.org/2000/svg\", \"use\");\r\n if(!playFaceLeft){\r\n svgdoc.getElementById(\"bullets\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bullet\");\r\n svgdoc.getElementById(\"bullet\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(1,1)\");\r\n }else {\r\n svgdoc.getElementById(\"bulletsToLeft\").appendChild(bullet);\r\n var bullet_x = player.position.x + (PLAYER_SIZE / 2) - (BULLET_SIZE.w / 2);\r\n var bullet_y = player.position.y + (PLAYER_SIZE / 2) - (BULLET_SIZE.h / 2);\r\n bullet.setAttribute(\"x\", player.position.x);\r\n bullet.setAttribute(\"y\", player.position.y);\r\n bullet.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", \"#bulletleft\");\r\n svgdoc.getElementById(\"bulletleft\").setAttribute(\"transform\", \"translate(\" +BULLET_SIZE.w + \", 0) scale(-1,1)\");\r\n }\r\n\r\n}", "function fireBullet() {\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n if (bullet) {\n bullet.reset(ship.x, ship.y);\n bullet.body.velocity.y = -400;\n bulletTime = game.time.now + 200;\n }\n }\n}", "function diffuseTheBomb() { return true }", "function Bullet(j){\n\tthis.jet=j;\n\tthis.srcX=100;\n\tthis.srcY=500;\n\tthis.drawX=-20;\n\tthis.drawY=0\n\tthis.width=7;\n\tthis.height=7;\n\tthis.speed=5;//10;\n\tthis.gravity=.01;\n\tthis.angle=25;\n\tthis.explosion=new Explosion();\n\tthis.sound= new Audio('sounds/BANG.mp3');\n\tthis.sound.volume =0.06;\n}", "function mousePressed() {\n\n //create bullet\n var bullet = createSprite(pac.position.x, pac.position.y, BULLET_WIDTH, BULLET_HEIGHT);\n\n //velocity\n bullet.velocity.x = random(-5, 5);\n bullet.velocity.y = random(-5, 5);\n\n}", "function flipTilHeads(){\n flipTil('heads');\n}", "function Update_Enemy_Bullet(bullet, id) {\r\n if (bullet) {\r\n bullet.identifier = id; \r\n if (bullet.posX >= 0) {\r\n bullet.posX -= bullet.speed;\r\n //Obtener carril de la bala \r\n var carril = bullet.zindex; \r\n //Segun el carril, pintarlo en una capa u otra\r\n switch (carril) {\r\n case 0: capa0ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 1: capa1ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n case 2: capa2ctx.drawImage(bullet.sprite, bullet.posX, bullet.posY, bullet.w, bullet.h);\r\n break;\r\n }\r\n } else {\r\n enemy_1.DeleteShot(parseInt(bullet.identifier));\r\n } \r\n }\r\n }", "function forceTextOverprinting(lHead) {\r\n // Comm'd out Mar'21. I suspect that this was necessary for an earlier version of Illy\r\n // but it no longer seems necessary. If this holds, I can remove altogether...\r\n // lHead.blendingMode = BlendModes.MULTIPLY;\r\n}", "RemoveBullet(){\n\n for(this.i = 0; this.i < this.bulRemove.length; this.i++)\n {\n this.bullets.splice(this.bulRemove[this.i], 1);\n }\n this.bulRemove.splice(0, this.bulRemove.length);\n }", "shoot() {\n let newBullet = new Bullet(this.x, this.y, 6, color(0, 0, 0), 15, bulletImage, bulletList.length);\n newBullet.direction();\n bulletList.push(newBullet);\n audioShoot.play();\n }", "function fireBullet() {\n\n if (game.time.now > bulletTime) {\n bullet = bullets.getFirstExists(false);\n\n if (bullet) {\n bullet.reset(player.x+50, player.y+15);\n bullet.body.velocity.x = 500;\n //This code determines how fast you can fire bullets.\n bulletTime = game.time.now + shootRate;\n enemybulletTime = game.time.now + 100;\n }\n }\n}", "private public function m246() {}", "function createBullet(){\n bullArr.push(new bulletMaker(player.x));\n}", "function alienShootsBullet() {\r\n // create a random number 1, 2, 3 (for alien row)\r\n var randAlienRow = Math.floor((Math.random() * 3) + 1);\r\n\r\n var randAlien; // random alien in array\r\n var alienBullet; // bullet \r\n\r\n if (randAlienRow == 1) {\r\n randAlien = Math.floor(Math.random() * aliensRow1.length);\r\n addAlienBullets(aliensRow1, randAlien);\r\n }\r\n if (randAlienRow == 2) {\r\n randAlien = Math.floor(Math.random() * aliensRow2.length);\r\n addAlienBullets(aliensRow2, randAlien);\r\n }\r\n if (randAlienRow == 3) {\r\n randAlien = Math.floor(Math.random() * aliensRow3.length);\r\n addAlienBullets(aliensRow3, randAlien);\r\n }\r\n\r\n function addAlienBullets(aliens, num) {\r\n // prevent crash\r\n if (aliens[num]) {\r\n alienBullet = new AliensBullet(aliens[num].x + aliens[num].w/2, aliens[num].y + aliens[num].h);\r\n alienBullets.push(alienBullet);\r\n }\r\n }\r\n}", "addBullet(x, y, angle) {\n var bullet = this.bullets.get();\n if (bullet){\n bullet.fire(x, y, angle);\n }\n }", "function fireBullet() {\r\n // We need to slow down the fire rate.\r\n let cTime = Date.now(); // Get the current date.\r\n if ((cTime - player.pTime) / 1000 > fire_per_second) {\r\n // IF current and previous time's difference is less then fire_per_second\r\n player.pTime = cTime;\r\n // Push a Bullet.\r\n let x = player.x + player.width / 2,\r\n y = player.y - 20,\r\n color = player.color,\r\n velocity = 20;\r\n bullets.push(new Bullet(x, y, color, velocity));\r\n }\r\n}", "function newBullet(data){\n\t//creates a new bullet\n\twindow.bullets.push(new Bullet(data.id, data.x, data.y, data.bulletSize, data.pierce));\n\t//play the fire bullet sound\n\tbulletshotsound.play();\n}", "function updateRandomBullet(){\n\t\tnextBullet.play(); \n\t\tvar length = bulletQueueValues.length;\n\t\tvar x = Math.floor((Math.random() * 11) - 5);\n\t\tbulletQueueValues.shift();\n\t\tbulletQueueValues.push(x);\n\t\tfor(i = 0; i < length; i++){\n\t\t\tdocument.getElementById(\"insideQueue\" + i).innerHTML = bulletQueueValues[i];\n\t\t}\n\t\tcurrentBullet = bulletQueueValues[0];\n\t}", "function generateBullets (qtd) {\r\n\r\n for (var i=0; i<qtd; i++){\r\n var bullet = $(\"<a>\").html(\"&bullet; \").attr(\"href\",\"#\").data(\"id\",i);\r\n $(\".bullets\").append(bullet);\r\n } \r\n $(\".bullets a\").eq(position).addClass(\"active\");\r\n}", "function ShowLargeBullets(html, page, start, end)\n{ \n for (var i = html.length, j = start; j <= end; i++, j++)\n {\n if (j == page){ \n html[i] = '<div class=\\\"bullet active\\\">' + j + '</div>';\n } \n else {\n html[i] = '<div class=\\\"bullet\\\">' + j + '</div>'; \n }\n }\n \n return html;\n}", "function cleanBullets() {\n clearInterval(bulletInterval);\n}" ]
[ "0.6111116", "0.61081576", "0.6070366", "0.6038821", "0.603126", "0.6014635", "0.597998", "0.5959703", "0.5946248", "0.5942812", "0.5901715", "0.58573765", "0.5853544", "0.5849044", "0.5840483", "0.5840483", "0.5840483", "0.58364546", "0.58075726", "0.5800599", "0.5800599", "0.5789394", "0.5785856", "0.57792646", "0.57755804", "0.576958", "0.5750902", "0.5750902", "0.5750902", "0.5746522", "0.57455736", "0.5732098", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.5728939", "0.57234395", "0.5720626", "0.5712401", "0.57038283", "0.57009023", "0.5685318", "0.56791466", "0.5674704", "0.567405", "0.5666194", "0.5663656", "0.56627893", "0.5659375", "0.56497127", "0.5629982", "0.5619722", "0.5609399", "0.56025034", "0.55931604", "0.5572602", "0.5560711", "0.5554229", "0.55492", "0.55379933", "0.5534117", "0.55305666", "0.5526226", "0.55259085", "0.55241394", "0.55137485", "0.5510774", "0.5510356", "0.5503627", "0.5498778", "0.54884875", "0.5487742", "0.54874915", "0.548583", "0.54855084", "0.5472565", "0.54724157", "0.54697245", "0.54689336", "0.54612625", "0.5457071", "0.54462725", "0.54383594", "0.54328126", "0.54312515", "0.54309815", "0.54294", "0.54290736", "0.5422008", "0.5417546", "0.54062104", "0.5406179", "0.54028296", "0.54028034", "0.54006565" ]
0.54245335
93
just a helper function when I thought it would be cute to do so
function spawnEnemies(enemyArr, num) { for (let i = 0; i < num; i++) { enemyArr[i].display(); enemyArr[i].move(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static private protected internal function m118() {}", "static final private internal function m106() {}", "static transient private protected internal function m55() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "function StupidBug() {}", "static transient final private internal function m43() {}", "static protected internal function m125() {}", "static transient final protected internal function m47() {}", "static transient private protected public internal function m54() {}", "function TMP(){return;}", "function TMP(){return;}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function i(e){return a(e)||o(e)||s()}", "transient final private protected internal function m167() {}", "hacky(){\n return\n }", "function Hx(a){return a&&a.ic?a.Mb():a}", "function normal() {}", "static private protected public internal function m117() {}", "static transient final private protected internal function m40() {}", "function __it() {}", "transient private protected public internal function m181() {}", "function a(e){return void 0===e&&(e=null),Object(r[\"p\"])(null!==e?e:i)}", "static transient private public function m56() {}", "static transient final protected public internal function m46() {}", "static final private protected internal function m103() {}", "static transient private internal function m58() {}", "function dummy() {}", "function dummy() {}", "function dummy() {}", "function reallyCoolFunction(val){\n\tval = val.toString();\n\tif(val.length == 1){ \n\t\t\t// do nothing\n\t} else {\n\t\t//console.log(val);\n\t\tval = val.slice(1); // .slice() function extracts parts of a string. Removes first character.\n\t}\n\tvalue = val;\n\t return val;\n}", "function i(e,t){return t}", "function miFuncion (){}", "function a(e){return void 0===e&&(e=null),Object(i[\"q\"])(null!==e?e:o)}", "function fe(a){return\"\"+a}", "function ze(a){return a&&a.ae?a.ed():a}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "function gb(a,b,c){return null!=a?a:null!=b?b:c}", "expected( _utils ) {\n\t\t\treturn 'nothing';\n\t\t}", "function es(e){return void 0===e&&(e=null),bn(null!==e?e:\"store\")}", "static transient final protected function m44() {}", "function customHandling() { }", "function Helper() {}", "function TMP() {\n return;\n }", "function tricky(want) {\n want = false;\n return want;\n}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function fb(a,b,c){return null!=a?a:null!=b?b:c}", "function i(e){return null==e}", "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "function fuzzTestingFunctionArg(d, b) { return \"this\"; }", "function i(t){return void 0===t&&(t=null),Object(r[\"l\"])(null!==t?t:o)}", "function used(value) { }", "function gb(a, b, c) { return null != a ? a : null != b ? b : c }", "function makeBigger() {\n\n}", "function ge(a){return\"\"+a}", "transient final private internal function m170() {}", "apply () {}", "function petitTrue(a) {\n return a;\n}", "function returnArg(arg) {\n return arg;\n}", "static final private protected public internal function m102() {}", "function l(){t={},u=\"\",w=\"\"}", "transient private public function m183() {}", "function returnUndefined() {}", "static transient final private protected public internal function m39() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "static final private public function m104() {}", "function solution(s) {\n\n}", "function check_param(par) { \n return (par != null && par.length > 0) ? par:'';\n}" ]
[ "0.6342047", "0.60449404", "0.60239273", "0.5888331", "0.56321007", "0.55737513", "0.55453974", "0.5460224", "0.54267573", "0.5385835", "0.53846025", "0.5383574", "0.538021", "0.5295506", "0.5238226", "0.5203738", "0.5184301", "0.5184301", "0.5177063", "0.5177063", "0.5177063", "0.5169103", "0.5140764", "0.51156265", "0.5079863", "0.5064732", "0.50575846", "0.5051146", "0.5049939", "0.50442034", "0.50394666", "0.5036438", "0.50218755", "0.501749", "0.50087285", "0.4998622", "0.4998622", "0.4998622", "0.4993389", "0.4979382", "0.49689347", "0.4954148", "0.4940592", "0.49392766", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.49087238", "0.4907817", "0.48877412", "0.48838997", "0.4882346", "0.48809326", "0.48799816", "0.48720023", "0.48623878", "0.48623878", "0.48623878", "0.48623878", "0.48623878", "0.48623878", "0.48623878", "0.48623878", "0.48603252", "0.485333", "0.485333", "0.485333", "0.485333", "0.485333", "0.48527852", "0.4847145", "0.48377892", "0.48352337", "0.48313254", "0.48221776", "0.48102522", "0.48102343", "0.48084223", "0.480482", "0.48027164", "0.48013222", "0.48002177", "0.47808903", "0.47741503", "0.47741503", "0.47741503", "0.47738615", "0.4770237", "0.4768976" ]
0.0
-1
instantiate all her important stuff
constructor(health, ammoCapacity) { this.xPos = 250; this.yPos = 250; this.sprite = pharahSprite; this.crosshair = crosshairSprite; this.accel = 0.1; this.xSpeed = 0; this.ySpeed = 0; this.gravity = 0.03; this.xLimit = 5; this.aimX = mouseX; this.aimY = mouseY; this.bulletX = this.sprite.width + (this.sprite.width / 2); this.bulletY = this.sprite.height + (this.sprite.height / 2); this.bulletSpeed = .02; this.ammoCapacity = ammoCapacity; this.fuelCapacity = rangeData;; this.fuel = rangeData; this.currentTime = 0; this.jumpSize = 50; this.jumpSpeed = .02; this.health = 1000; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init () {\n // Here below all inits you need\n }", "initialise () {}", "function initModules() {\n model_store = new Soapify.model_store();\n vc_navbar = new Soapify.viewcontroller_navbar();\n vc_info = new Soapify.viewcontroller_info();\n vc_map = new Soapify.viewcontroller_map(model_store);\n vc_contact = new Soapify.viewcontroller_contact();\n }", "function _construct()\n\t\t{;\n\t\t}", "init() {\n //todo: other init stuff here\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init () {}", "init () {}", "function contruct() {\n\n if ( !$[pluginName] ) {\n $.loading = function( opts ) {\n $( \"body\" ).loading( opts );\n };\n }\n }", "function init() {\n cookies = new Cookies();\n ui = new UI();\n game = new Game();\n}", "_init() {\n this._addBreakpoints();\n this._generateRules();\n this._reflow();\n }", "function init(){\r\n\tcreateMap();\r\n\tcreateSnake();\r\n\tcreateFruit();\r\n}", "initializing() {\n this.initializeBoilerplate();\n }", "static initialize()\n {\n RPM.songsManager = new SongsManager();\n RPM.settings = new Settings();\n RPM.datasGame = new DatasGame();\n RPM.gameStack = new GameStack();\n RPM.loadingDelay = 0;\n RPM.clearHUD();\n }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function init() {\n\t\tloadPosts();\n\t\tloadPages();\n\t\tloadCategories();\n\t\tloadTags();\n\t}", "init(){}", "_init() {\n\t\tthis.life.init();\n\t\tthis.render.init();\n\n\t\tthis.emission.init();\n\t\tthis.trail.init(this.node);\n\n\t\tthis.color.init();\n\t}", "_initialize() {\n\n }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "init() {\n }", "function _init() {\n }", "static init() {\n objectFitVideos();\n objectFitImages();\n new Dot;\n InitFullpage();\n initScreenVideo();\n customScroll();\n initMobMenu();\n }", "function init() {\n\t \t\n\t }", "init() {\n }", "init() {\n }", "init() {\n }", "init () {\n }", "function createInitialStuff() {\n\n\t//Sniðugt að búa til alla units í Levelinu hér og svoleiðis til \n\t// allt sé loadað áðurenn hann byrjar render/update\n\t//AKA það er betra að hafa þetta sem part af \"loading\" frekar en \n\t//byrjunar laggi\n}", "function init(){}", "function construct() { }", "setupComponents() {\n\t\tthis.contactBar = new ContactBar();\n\t\tthis.contactBar.setup();\n\n\t\tthis.modal = new Modal();\n\t\tthis.modal.setup();\n\n\t\tthis.accordion = new Accordion();\n\t\tthis.accordion.setup();\n\n\t\tthis.mediaGallery = new MediaGallery();\n\t\tthis.mediaGallery.setup();\n\t}", "function init() {\n\n\t\t\t// WOW일때 컬러칩 active 안 되는 경우 처리\n\t\t\tif( $('.layout-2 #selectColor').length > 0 && $('.layout-2 #selectColor .active').length == 0 ){\n\t\t\t\t$('.layout-2 #selectColor').find('.swatch').first().addClass('active');\n\t\t\t}\n\n\t\t\tnew ss.PDPStandard.PDPFeaturesController();\n\t\t\tnew ss.PDPStandard.PDPAccessories();\n\n\t\t\tnew ss.PDPStandard.PDPThreeSixty();\n\t\t\tnew ss.PDPStandard.PDPGallery();\n\t\t\t//new ss.PDPStandard.PDPKeyVisual();\n\n\t\t\tif ($('.media-module').find('.sampleimages').length > 0) {\n\t\t\t\tnew ss.PDPStandard.PDPSampleImages();\n\t\t\t}\n\n\t\t\tcurrentMetrics = ss.metrics;\n\n\t\t\tbindEvents();\n\t\t\theroSize();\n\t\t\tthrottleCarousel();\n\n\t\t\tnew ss.PDPStandard.PDPCommon();\n\t\t\tnew ss.PDPStandard.PDPeCommerceWOW();\n\t\t\tss.PDPStandard.optionInitWOW();\n\t\t}", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "_init() {\n this.floors.all = FloorsJSON\n this.locations.all = LocationsJSON\n this._segregateLocations()\n this._groupFloorsByBuildings()\n }", "function _ctor() {\n\t}", "__previnit(){}", "function _init() {\n\t\tgetHeadlines();\n\t}", "function init() {\n _create();\n _subMediator();\n }", "constructor() {\n super();\n this._init();\n }", "function instantiateObjects(event) { \n\t$(\"*[data-jsclass]\").each( function () {\n\t\tif(!$(this).data('iowajsinstance')) {\n\t\t\tvar handler = null;\n\t\t\ttry {\n\t\t\t\thandler = new window[$(this).data('jsclass')](this);\n\t\t\t\t$(this).data('iowajsinstance',handler);\n\t\t\t\t\n\t\t\t\tif($(this).data('iowajsinstance').start) {\n\t\t\t\t\t$(this).data('iowajsinstance').start(event);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$(this).data('iowajsinstanceinitialized',1);\n\t\t\t} \n\t\t\tcatch(err) {\n\t\t\t\talert('Could not initialize element:' + this.id + ' jsclass:' + $(this).data('jsclass') + ' error:' + err);\n\t\t\t}\n\t\t}\n\t});\n}", "function init() {\n\t//TODO\n}", "init() {\n try {\n this.makeCommentsLinks();\n this.makeDescriptionLinks();\n } catch (ignore) {}\n }", "init() {\n try {\n this.makeCommentsLinks();\n this.makeDescriptionLinks();\n } catch (ignore) {}\n }", "init() {\n this.loadModules();\n this.cacheDOM();\n this.attachEvents();\n this.stickFooterToBottom();\n }", "_construct() {\n for (let url in methods) {\n const urlParts = url.split('/');\n const name = urlParts.pop(); // key for function\n\n let tmp = this;\n for (let p = 1; p < urlParts.length; ++p) { // acts like mkdir -p\n tmp = tmp[urlParts[p]] || (tmp[urlParts[p]] = {});\n }\n\n tmp[name] = (() => {\n const method = methods[url]; // closure forces copy\n return (params) => {\n return this._call(method, params);\n };\n })();\n }\n\n this._debug(`Trakt.tv: module loaded, as ${this._settings.useragent}`);\n }", "init() {\n\n }", "init() {\n\n }", "init () {\n // Load application configuration\n this.config = require('./config').init(this)\n\n // Axios Http client\n this.http = require('./http').init(this)\n\n // TigoPesa API client\n this.api = require('./api').init(this)\n\n // Init express app instance\n this.express = require('./express').init(this)\n\n // Init job queue\n this.jobs = require('./jobs').init(this)\n }", "_startUp()\n {\n // Check debug.\n if (RodanClientCore.config.DEBUG)\n {\n Radio.tuneIn('rodan');\n }\n\n this._initializeRadio();\n this._initializeControllers();\n this._initializeBehaviors();\n this._initializeDateTimeFormatter();\n this.addRegions({regionMaster: '#region-master'});\n this._initializeViews();\n require('./.plugins');\n }", "constructur() {}", "constructor () {\n this.media = new Media();\n this.selector = new Selector();\n this[_initProps]();\n this[_initTable]();\n this[_initTableEvents]();\n this[_initCallback]();\n this[_addHotkeyListener]();\n }", "function init() {\n getAllPups()\n filterDogsEvent() \n}", "async init () {\n this.bridge = await this._getBridge()\n this.lamps = await this._getLamps()\n this.modules = await this._loadModules()\n }", "init(){\n var self = this;\n self.generateData();\n self.insertInfo();\n self.copyData();\n }", "function initMain()\r\n{\r\n\t// Initialize a new instance\r\n\tinitInstance();\r\n\r\n\t// Initialize AJAX components\r\n\tinitAjaxComponents();\r\n\r\n\t// Initialize AJAX navigation\r\n\tinitAjaxNavigation();\r\n\r\n\t// Initialize addons\r\n\tinitAddons();\r\n}", "init(){\n\n\n }", "function init() {\n\t\tbuildBar();\n\t\tbuildBubble();\n\t\tbuildGauge();\n\t\t//buildMeta();\n\t}", "initialize() {\n //\n }", "constructor() {\n this.init();\n }", "function _setup () {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "function init(){\n loadOrders();\n verifyPermission(); \n loadProducts();\n setfilter(); \n}", "async init(){}", "function _constructComponents() {\r\n\t//having a set root element allows us to make queries\r\n\t//and resultant styling safe and much faster.\r\n\t//var elOuterParent = _rootDiv;\r\n\t//document.getElementById(_rootID);\r\n\tvar builder = new WidgetBuilder();\r\n\t_debugger.log(\"building html scaffolding.\"); //#\r\n\t_el = builder.construct(CSS_PREFIX, _manips);\r\n\t\r\n\t//todo: do we need to \"wait\" for these? Is there any initialization problem\r\n\t//that prevents them from being constructed to no effect?\r\n\t\r\n\t_debugger.log(\"building slideMotion.\"); //#\r\n\t_slideMotion = new SlideMotion();\r\n\tthis.slideMotion = _slideMotion; //# debugging only\r\n\t\r\n\t_debugger.log(\"building slideLogic.\"); //#\r\n\t_slideLogic = new SlideLogic(_slideMotion);\r\n\t_animator = _slideLogic;\r\n\t\r\n\t_debugger.log(\"building Event Manager.\"); //#\r\n\t_evtMgr = new EvtMgr(_behavior, _animator);\r\n\t_debugger.log(\"building Scaler.\"); //#\r\n\t_deviceWrangler = new DeviceWrangler();\r\n\t_scaler = new Scaler(_outerParent, _evtMgr, _animator);\r\n}", "constructor()\n {\n this.init();\n }", "function init() { }" ]
[ "0.6835924", "0.6747634", "0.67198426", "0.6681028", "0.66585827", "0.6649186", "0.6649186", "0.6649186", "0.6649186", "0.6649186", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.66419524", "0.66419524", "0.66215324", "0.660782", "0.6595955", "0.65575", "0.6537578", "0.6523256", "0.6490703", "0.6490703", "0.6490703", "0.6490703", "0.6490703", "0.6490703", "0.64745504", "0.64612603", "0.64449453", "0.6429314", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6423356", "0.6417393", "0.6396035", "0.637885", "0.6367529", "0.6352245", "0.6352245", "0.6352245", "0.6343675", "0.6342601", "0.63116246", "0.6307325", "0.630299", "0.62944007", "0.62919104", "0.62919104", "0.62919104", "0.6291551", "0.6284609", "0.6274986", "0.6266308", "0.6249218", "0.62453693", "0.6243542", "0.6239179", "0.62346673", "0.6224493", "0.6224493", "0.62215185", "0.621785", "0.6217088", "0.6217088", "0.6216908", "0.6216876", "0.62054914", "0.6192257", "0.61751574", "0.6170127", "0.6150064", "0.6144648", "0.61393327", "0.61384004", "0.61373526", "0.6135094", "0.61344445", "0.61340535", "0.6132957", "0.6132891", "0.6131493", "0.6124457", "0.61212116" ]
0.0
-1
basic collision taken from KAPP notes
detectHit(x, y) { if(dist(x, y, this.xPos, this.yPos) < 50) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "collision () {\n }", "function collision (px,py,pw,ph,ex,ey,ew,eh){\nreturn (Math.abs(px - ex) *2 < pw + ew) && (Math.abs(py - ey) * 2 < ph + eh);\n \n}", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "function collision(top_x, bottom_x, top_y, bottom_y) {\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\tvar b = bricks[j][i];\n\t\t\t\tif (b.exists == 1) {\n\t\t\t\t\tif (top_y < (b.y + block_height) && bottom_y > b.y && top_x < (b.x + block_width) && bottom_x > b.x) {\n\t\t\t\t\t\tb.exists = 0;\n\t\t\t\t\t\tball.y_speed = -ball.y_speed;\n\t\t\t\t\t\tplayer1Score += 1;\n\t\t\t\t\t\tbrickcount -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function checkCollision(){\r\n\t//check se la macchina esce dalla pista\r\n\tif(center_carr[2]<-408)vz=0;\r\n\tif(center_carr[2]>109)vz=0;\r\n\t\r\n\tif(center_carr[0]<track_dimension[1])vz=0;\r\n\tif(center_carr[0]>track_dimension[0])vz=0;\r\n\t\r\n\t//check collisione con i booster\r\n\tif((center_carr[0]<2.3 && center_carr[0]>0) && (center_carr[2]>-10 && center_carr[2]<-6)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-35 && center_carr[2]<-31)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-48 && center_carr[2]<-44)) vz=vz*1.12;\r\n\tif((center_carr[0]<6 && center_carr[0]>4) && (center_carr[2]>-161 && center_carr[2]<-157)) vz=vz*1.12;\r\n\tif((center_carr[0]<3 && center_carr[0]>0.7) && (center_carr[2]>-184 && center_carr[2]<-180)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-240 && center_carr[2]<-236)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-251 && center_carr[2]<-247)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-257 && center_carr[2]<-253)) vz=vz*1.12;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-290 && center_carr[2]<-286)) vz=vz*1.12;\r\n\tif((center_carr[0]<6&& center_carr[0]>3.8) && (center_carr[2]>-310 && center_carr[2]<-306)) vz=vz*1.15;\r\n\tif((center_carr[0]<3.6&& center_carr[0]>1.3) && (center_carr[2]>-331 && center_carr[2]<-327)) vz=vz*1.12;\r\n\t\r\n\t//check collisione con i debooster\r\n\tif((center_carr[0]<1.15 && center_carr[0]>-0.8) && (center_carr[2]>-113 && center_carr[2]<-109)) vz=vz*0.9;\r\n\tif((center_carr[0]<6 && center_carr[0]>3.6) && (center_carr[2]>-144 && center_carr[2]<-140)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>0.85) && (center_carr[2]>-170 && center_carr[2]<-166)) vz=vz*0.9;\r\n\tif((center_carr[0]<6.66 && center_carr[0]>4.6) && (center_carr[2]>-203 && center_carr[2]<-199)) vz=vz*0.9;\r\n\tif((center_carr[0]<2.81 && center_carr[0]>0.93) && (center_carr[2]>-222 && center_carr[2]<-218)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>1) && (center_carr[2]>-277 && center_carr[2]<-281)) vz=vz*0.9;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-300 && center_carr[2]<-296)) vz=vz*0.9;\r\n\t\r\n}", "collision() {\n\t\tthis.vars.collision = true;\n\t}", "function basicCollision(){\n if(this.x + this.xLen > canvas.width){\n this.xSpeed = -1 * this.xSpeed;\n this.x = canvas.width - this.xLen;\n }\n if(this.x < 0){\n this.xSpeed = -1 * this.xSpeed;\n this.x = 0;\n }\n if(this.y + this.yLen > canvas.height){\n this.ySpeed = -1 * this.ySpeed;\n this.y = canvas.height - this.yLen;\n }\n if(this.y < 0){\n this.ySpeed = -1 * this.ySpeed;\n this.y = 0;\n }\n}", "function checkCollision(i1, i2, result) {\n\n var p1 = i1.position;\n var b1 = i1.body;\n var p2 = i2.position;\n var b2 = i2.body;\n\n if ((b1.type & 1) && (b2.type & 1)) {\n // this check is pointless for 2 circles as it's the same as the full test\n if (b1.type !== T.BODY_CIRCLE || b2.type !== T.BODY_CIRCLE) {\n vec2.add(p1, b1.boundOffset, tv1);\n vec2.add(p2, b2.boundOffset, tv2);\n var rss = b1.boundRadius + b2.boundRadius;\n if (tv1.distancesq(tv2) > rss*rss) {\n return false;\n }\n }\n }\n\n var colliding = null;\n var flipped = false;\n\n if (b1.type > b2.type) {\n \n var tmp = b2;\n b2 = b1;\n b1 = tmp;\n\n tmp = i2;\n i2 = i1;\n i1 = tmp;\n\n tmp = p2;\n p2 = p1;\n p1 = tmp;\n\n flipped = true;\n\n }\n\n if (b1.type === T.BODY_AABB) {\n if (b2.type === T.BODY_AABB) {\n colliding = AABB_AABB(i1, i2, result);\n } else if (b2.type === T.BODY_CIRCLE) {\n colliding = AABB_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = AABB_lineSegment(p1, b1, p2, b2, result);\n }\n } else if (b1.type === T.BODY_CIRCLE) {\n if (b2.type === T.BODY_CIRCLE) {\n colliding = circle_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = circle_lineSegment(i1, i2, result);\n }\n } else if (b1.type === T.BODY_LINE_SEGMENT) {\n if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = lineSegment_lineSegment(p1, b1.size, p2, b2.size, result);\n }\n }\n\n if (colliding === null) {\n console.error(\"warning: unsupported arguments to collision detection\");\n return false; \n } else {\n if (flipped) {\n result.mtv.x *= -1;\n result.mtv.y *= -1;\n }\n return colliding;\n }\n\n}", "collision() {\n const playerBox = {x: player.x, y: player.y, width: 76, height: 83};\n const enemyBox = {x: this.x, y: this.y, width: 76, height: 83};\n\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n player.restart();\n hearts.pop();\n life--;\n if (life === 0) {\n lose();\n }\n }\n }", "function collidesWith( a, b )\n{\n return a.bottom > b.top && a.top < b.bottom;\n}", "collide(oth) {\n return this.right > oth.left && this.left < oth.right && this.top < oth.bottom && this.bottom > oth.top\n }", "function collides(a, b) {\n \treturn \ta.getx() < b.getx() + b.getwidth() &&\n \ta.getx() + a.getwidth() > b.getx() &&\n \ta.gety() < b.gety() + b.getheight() &&\n \ta.gety() + a.getheight() > b.gety();\n }", "function collision(obj1, obj2){\n\tif (obj1.x > obj2.x + obj2.width || obj1.x + obj1.width < obj2.x || obj1.y+obj1.height > obj2.y + obj2.height || obj1.y + obj1.height < obj2.y){\n\t\t\n\t} else {\n\t\tif (!collidesArr.includes(obj2.value)){\n\t\t\tcollidesArr.push(obj2.value)\n\t\t\tif (collidesArr.length === 2)\n\t\t\t\tcheckOrderForTwo(collidesArr)\n\t\t\tif (collidesArr.length === 3)\n\t\t\t\tcheckOrder(collidesArr)\n\t\t\t}\n\t\t}\n\t\t// console.log(`collides with ${obj2.name}`)\n\t\tconsole.log(collidesArr)\n\t}", "function collision() {\r\n isObstacle_Clash_leftofWindow();\r\n isBullet_Clash_obstacle();\r\n isRocket_Clash_obstacle();\r\n if (lives <= 0) {\r\n endGame();\r\n }\r\n draw_Score_Lives();\r\n isRocket_Clash_Bomb();\r\n isBullet_Clash_Ship();\r\n }", "onCollision() {\n\n }", "collide(p2, damp = 1) {\n // reference: http://codeflow.org/entries/2010/nov/29/verlet-collision-with-impulse-preservation\n // simultaneous collision not yet resolved. Possible solutions in this paper: https://www2.msm.ctw.utwente.nl/sluding/PAPERS/dem07.pdf \n let p1 = this;\n let dp = p1.$subtract(p2);\n let distSq = dp.magnitudeSq();\n let dr = p1.radius + p2.radius;\n if (distSq < dr * dr) {\n let c1 = p1.changed;\n let c2 = p2.changed;\n let dist = Math.sqrt(distSq);\n let d = dp.$multiply(((dist - dr) / dist) / 2);\n let np1 = p1.$subtract(d);\n let np2 = p2.$add(d);\n p1.to(np1);\n p2.to(np2);\n let f1 = damp * dp.dot(c1) / distSq;\n let f2 = damp * dp.dot(c2) / distSq;\n let dm1 = p1.mass / (p1.mass + p2.mass);\n let dm2 = p2.mass / (p1.mass + p2.mass);\n c1.add(new Pt_1.Pt(f2 * dp[0] - f1 * dp[0], f2 * dp[1] - f1 * dp[1]).$multiply(dm2));\n c2.add(new Pt_1.Pt(f1 * dp[0] - f2 * dp[0], f1 * dp[1] - f2 * dp[1]).$multiply(dm1));\n p1.previous = p1.$subtract(c1);\n p2.previous = p2.$subtract(c2);\n }\n }", "handleCollision(climber) {\n\n // distance\n //\n // to calculate the distance between the avalanche and climber\n let d = dist(this.x, this.y, climber.x, climber.y);\n\n // dist()\n //\n // To keep track of the avalanche and the avatar are in contact\n if (d < this.width / 2 + climber.width / 2) {\n // this is to push the climber down\n climber.vy += 2;\n\n }\n }", "collision() {\n if (this.y === (player.y - 12) && this.x > player.x - 75 && this.x < player.x + 70) {\n player.collide();\n }\n }", "function collisionCheck() {\n for (var count = 0; count < BUSH_NUM; count++) {\n elfAndBush(bushes[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n elfAndBunny(bunnies[count]);\n }\n\n for (var count = 0; count < BUNNY_NUM; count++) {\n arrowAndBunny(bunnies[count], arrows[0]);\n arrowAndBunny(bunnies[count], arrows[1]);\n arrowAndBunny(bunnies[count], arrows[2]);\n arrowAndBunny(bunnies[count], arrows[3]);\n arrowAndBunny(bunnies[count], arrows[4]);\n }\n\n for (var count = 0; count < APPLE_NUM; count++) {\n elfAndApple(apples[count]);\n }\n}", "function detectCollision() {\n ballCollision();\n brickCollision();\n}", "function checkCollision (obj1,obj2){\n return obj1.y + obj1.height - 10 >= obj2.y\n && obj1.y <= obj2.y + obj2.height\n && obj1.x + obj1.width - 10 >= obj2.x\n && obj1.x <= obj2.x + obj2.width\n }", "collision (b) {\n\n let mdiff = this.mDiff(b);\n if (mdiff.hasOrigin()) {\n\n let vectors = [ new Vector (0,mdiff.origin.y),\n new Vector (0,mdiff.origin.y+mdiff.height),\n new Vector (mdiff.origin.x, 0),\n new Vector (mdiff.origin.x + mdiff.width, 0) ];\n\n\t\t\tlet n = vectors[0];\n\n\t\t\tfor (let i = 1; i < vectors.length; i++) {\n\t\t\t\tif (vectors[i].norm() < n.norm())\n\t\t\t\tn = vectors[i];\n\t\t\t};\n\n\t\t\tlet norm_v = this.velocity.norm();\n\t\t\tlet norm_vb = b.velocity.norm();\n\t\t\tlet kv = norm_v / (norm_v + norm_vb);\n\t\t\tlet kvb = norm_vb / (norm_v + norm_vb);\n\n\t\t\tif (norm_v == 0 && norm_vb == 0) {\n\t\t\t\tif (this.invMass == 0 && b.invMass == 0)\n\t\t\t\treturn null;\n\t\t\t\telse {\n\t\t\t\t\tif (this.mass <= b.mass)\n\t\t\t\t\tkv = 1;\n\t\t\t\t\telse\n\t\t\t\t\tkvb = 1\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t\tthis.move(n.mult(kv));\n\t\t\tb.move(n.mult(-kvb));\n\n\t\t\tn = n.normalize();\n\n\t\t\t// (2) On calcule l'impulsion j :\n\t\t\tlet v = this.velocity.sub(b.velocity);\n\t\t\tlet e = Constants.elasticity; // pour les étudiants, juste faire let e = 1;\n\n\t\t\tlet j = -(1 + e) * v.dot(n) / (this.invMass + b.invMass);\n\n\t\t\t// (3) On calcule les nouvelle vitesse:\n\t\t\tlet new_v = this.velocity.add(n.mult(j * this.invMass));\n\t\t\tlet new_bv = b.velocity.sub(n.mult(j * b.invMass));\n\n\t\t\tb.setCollision(true);\n\t\t\tthis.setCollision(true);\n\n\t\t\treturn { velocity1 : new_v, velocity2 : new_bv };\n\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "function collision_check(a,b) {\n let res = (Math.abs(a.x-b.x) * 2 < (16+8)) &&\n (Math.abs(a.y-b.y) * 2< (16+8))\n return res;\n}", "function collides(a, b) {\n if(a.x == b.x && a.y == b.y) return true;\n return false;\n }", "function collides(a, b) {\n\n\treturn a.x < b.x + b.width &&\n\t\t\t\t a.x + a.width > b.x &&\n\t\t\t\t a.y < b.y + b.height &&\n\t\t\t\t a.y + a.height > b.y;\n\n}", "checkCollision (obj) {\n if (this.x < obj.x + obj.width\n && this.x + this.width > obj.x\n && this.y < obj.y + obj.height\n && this.y + this.height > obj.y) {\n obj.resetPosition();\n }\n }", "function collision() {\n let impact = edge.NONE;\n\n if (y+size >= height) impact = edge.BOTTOM;\n if (y-size <= 0) impact = edge.TOP;\n if (x+size >= width) impact = edge.RIGHT;\n if (x-size <= 0) impact = edge.LEFT;\n\n if (impact === edge.NONE) {\n // no collision detected\n return;\n }\n\n // get correct orientation of collision (base is BOTTOM)\n let cx = 0;\n let cy = 0;\n if (impact === edge.BOTTOM) {\n cx = dx;\n cy = dy;\n } else if (impact === edge.TOP) {\n cx = -dx;\n cy = -dy;\n } else if (impact === edge.LEFT) {\n cx = dy;\n cy = -dx;\n } else if (impact === edge.RIGHT) {\n cx = -dy;\n cy = dx;\n }\n\n // get angle of impact (in [-90, 90])\n let theta = Math.abs(Math.atan2(cy, cx) / Math.PI * 180);\n if (theta > 90) theta -= 90;\n if (theta < -90) theta += 90;\n\n // make coefficient of restitution vary in [-1,1] for AOIs in [-90,90] degrees\n let ex = -(90 - theta)/90 + theta/90;\n\n // =======================================================================================================\n // calculate new velocities\n // see: https://pdfs.semanticscholar.org/5a4a/c4105406ff2055344e943093687002da8513.pdf\n cy = -ey * cy;// - (1 + ey)*sy;\n cx = ((1 - alpha*ex) / (1 + alpha)) * cx + alpha * (1 + ex) / (1 + alpha) * ((size/scale) * dr);\n dr = ((alpha - ex) / (1 + alpha)) * dr + (1 + ex) / (1 + alpha) * (cx/scale) / (size/scale);\n // =======================================================================================================\n\n // reverse orientation\n if (impact === edge.BOTTOM) {\n dx = cx;\n dy = cy;\n } else if (impact === edge.TOP) {\n dx = -cx;\n dy = -cy;\n } else if (impact === edge.LEFT) {\n dx = -cy;\n dy = cx;\n } else if (impact === edge.RIGHT) {\n dx = cy;\n dy = -cx;\n }\n}", "collideBroadPhase(other) {\n // By default assume all collisions will be checked.\n return true;\n }", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function collision(rec1, rec2)\n{\n if (rec1.x < rec2.x + rec2.width &&\n rec1.x + rec1.width > rec2.x &&\n rec1.y < rec1.y + rec2.height &&\n rec1.y + rec1.height > rec2.y) {\n return \"true\";\n }\n else {\n return \"false\";\n }\n}", "function check_collision( objects_to_check )\n\t{\n\t\treturn false;\n\t}", "function is_collision()\n{\n\tif (frog.lane > 6 && frog.lane < 12) {\n\t\tvar lane = frog.lane - 7;\n\t\tfor (car in cars[lane].x) {\n\t\t\tif (frog.x + frog.w >= cars[lane].x[car] &&\n\t\t\t\tfrog.x <= cars[lane].x[car] + cars[lane].w) {\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}", "function collision(b, p) {\r\n p.top = p.y;\r\n p.bottom = p.y + p.height;\r\n p.left = p.x;\r\n p.right = p.x + p.width;\r\n\r\n b.top = b.y - b.radius;\r\n b.bottom = b.y + b.radius;\r\n b.left = b.x - b.radius;\r\n b.right = b.x + b.radius;\r\n\r\n return (\r\n p.left < b.right && p.top < b.bottom && p.right > b.left && p.bottom > b.top\r\n );\r\n}", "function checkCollision(a, b) {\n if (a !== undefined && b !== undefined) {\n var aRad = (a.a + a.b + a.c) / 3;\n var bRad = (b.a + b.b + b.c) / 3;\n var aPos = vec3.create();\n\n vec3.add(aPos, a.center, a.translation);\n var bPos = vec3.create();\n vec3.add(bPos, b.center, b.translation);\n var dist = vec3.distance(aPos, bPos);\n\n if (dist < aRad + bRad) {\n //spawn explosion and destroy asteroid, doesn't matter what asteroid collided with, always explodes\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(a.x, a.y, a.z),\n vec3.fromValues(a.translation[0], a.translation[1], a.translation[2])), false);\n deleteModel(a);\n //handle collision\n if (b.tag == 'shot') {\n // destroy asteroid and shot, give player points\n //test *******apocalypse = true;\n //test *******gameOver(b);\n deleteModel(b);\n score += 10;\n document.getElementById(\"score\").innerHTML = \"Score: \" + score;\n } else if (b.tag == 'station') {\n // destroy asteroid, damage station and destroy if life < 0 then weaken shield\n // if last station destroyed, destroy shield as wells\n b.health -= 5;\n if (b.css == 'station1') {\n document.getElementById(\"station1\").innerHTML = \"Station Alpha: \" + b.health;\n } else if (b.css == 'station2') {\n document.getElementById(\"station2\").innerHTML = \"Station Bravo: \" + b.health;\n } else {\n document.getElementById(\"station3\").innerHTML = \"Station Charlie: \" + b.health;\n }\n if (b.health == 0) {\n var change = false;\n base_limit--;\n // reduce shield alpha by one to signify weakening\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n inputEllipsoids[o].alpha -= 0.2;\n }\n }\n // if the destroyed center is highlighted, switch to next\n if (b.id == current_center) {\n for (var s in stations) {\n if (stations[s].id > b.id) {\n stations[s].id--;\n }\n }\n change = true;\n }\n // remove the destroyed station\n station_centers.splice(b.id, 1);\n deleteModel(b);\n // has to be after splice/delete or else will access out of date station_centers\n if (change) {\n current_center++;\n changeStation();\n }\n shield_level--;\n document.getElementById(\"shield\").innerHTML = \"Shield: \" + shield_level;\n // destroy shield if no more stations\n if (shield_level == 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n deleteModel(inputEllipsoids[o]);\n break;\n }\n }\n deleteModel(highlight);\n }\n if (b.css == 'station1') {\n document.getElementById(\"station1charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station1\").innerHTML = \"Station Alpha:\"\n } else if (b.css == 'station2') {\n document.getElementById(\"station2charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station2\").innerHTML = \"Station Bravo:\"\n } else {\n document.getElementById(\"station3charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station3\").innerHTML = \"Station Charlie:\"\n }\n }\n } else if (b.tag == 'shield') {\n // destroy asteroid, damage earth based on shield strength\n earth_health -= 15 / shield_level;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'earth') {\n // handle game over\n gameOver(inputEllipsoids[o]);\n break;\n }\n }\n }\n } else if (b.tag == 'earth') {\n // destroy asteroid, damage earth and destroy if life < 0\n earth_health -= 15;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n // handle game over\n gameOver(b);\n }\n } else if (b.tag == 'moon') {\n b.health -= 5;\n if (b.health <= 0) {\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(b.x, b.y, b.z),\n vec3.fromValues(b.translation[0], b.translation[1], b.translation[2])), true);\n deleteModel(b);\n }\n }\n }\n }\n}", "collidesWith(player) {\n //this function returns true if the the rectangles overlap\n // console.log('this.collidesWith')\n const _overlap = (platform, object) => {\n // console.log('_overlap')\n // check that they don't overlap in the x axis\n const objLeftOnPlat = object.left <= platform.right && object.left >= platform.left;\n const objRightOnPlat = object.right <= platform.right && object.right >= platform.left;\n const objBotOnPlatTop = Math.abs(platform.top - object.bottom) === 0;\n \n // console.log(\"OBJECT BOTTOM: \", object.bottom/);\n // console.log(\"PLATFORM TOP: \", platform.top);\n // console.log('objectBotOnPlat: ', !objBotOnPlatTop)\n // console.log('OBJECT RIGHT: ', object.right)\n // console.log('PLATFORM RIGHT: ', platform.right)\n // console.log(\"OBJECT LEFT: \", object.left);\n // console.log(\"PLATFORM LEFT: \", platform.left);\n // console.log('objectLeftOnPlat', !objLeftOnPlat);\n // console.log('objRightOnPlat', !objRightOnPlat);\n\n if (!objLeftOnPlat && !objRightOnPlat) {\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n // if (objBotOnPlatTop) return true;\n // return false;\n }\n \n if (objLeftOnPlat || objRightOnPlat) {\n // debugger\n // console.log('PLATFORM:::::', platform.top)\n // console.log('PLAYER:::::::', object.bottom)\n // console.log('objBotOnPlat:::::::::', objBotOnPlatTop)\n\n if (objBotOnPlatTop) {\n debugger\n }\n }\n //check that they don't overlap in the y axis\n const objTopAbovePlatBot = object.top > platform.bottom;\n if (!objBotOnPlatTop) {\n // console.log()\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n }\n\n return true;\n };\n\n let collision = false;\n this.eachPlatform(platform => {\n //check if the bird is overlapping (colliding) with either platform\n if (_overlap(platform, player.bounds())) {\n // console.log('WE ARE HERE IN THE OVERLAP')\n // console.log(platform)\n collision = true;\n // debugger\n // console.log(player)\n player.y = platform.top;\n // console.log('PLATFORM: ', platform)\n // console.log(collision)\n // player.movePlayer(\"up\")\n }\n // _overlap(platform.bottomPlatform, player)\n });\n\n // console.log('collision:')\n // console.log(collision)\n return collision;\n }", "onCollision(otherObjects) {}", "function collide(o1T, o1B, o1L, o1R, o2T, o2B, o2L, o2R) {\n\tif ((o1L <= o2R && o1L >= o2L) || (o1R >= o2L && o1R <= o2R)) {\n\t\tif ((o1T >= o2T && o1T <= o2B) || (o1B >= o2T && o1B <= o2B)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}", "function handleCollision() {\n if (Math.sqrt(Math.pow(xPosition - randomPoint[0], 2) + Math.pow(zPosition - randomPoint[1] - 10, 2)) < 2) {\n randomPoint = getRandomPointOnTrack();\n boxPosition = [randomPoint[0], 1, randomPoint[1]];\n box.generate();\n }\n}", "function CollisionCalculatorC2P(o1,pt) \n{\n var dx = pt.x - o1.x;\n var dy = pt.y - o1.y;\n\n var dist = Math.sqrt( Math.pow((pt.x-o1.x),2)+Math.pow((pt.y-o1.y),2));\n if(dist>o1.r) {\n return false;\n }\n return true;\n}", "checkCollisions() {\n // check for collisions with window boundaries\n if (this.pos.x > width || this.pos.x < 0 ||\n this.pos.y > height || this.pos.y < 0) {\n this.collision = true;\n }\n\n // check for collisions with all obstacles\n for (let ob of obstacles) {\n if (this.pos.x > ob.x && this.pos.x < ob.x + ob.width &&\n this.pos.y > ob.y && this.pos.y < ob.y + ob.height) {\n this.collision = true;\n break;\n }\n }\n }", "function BoxCollision() {\n\tif(BallX+BallDisplacementX >1130 || BallX+ BallDisplacementX < BallRadius) {\n\t\tBallDisplacementX = -1.05*BallDisplacementX;\n\t\tBallDisplacementY = 1.05*BallDisplacementY;\n\t}\n\n\tif (BallY + BallDisplacementY - BallRadius < 0) {\n\t\tBallDisplacementY = -1.05*BallDisplacementY;\n\t}\n\n}", "function checkCollision(obj1, obj2) {\n if (obj1.x > obj2.x) {\n if (obj1.y > obj2.y) {\n if (obj1.x - obj2.x < obj2.width && obj1.y - obj2.y < obj2.height) {\n if (obj1.x - obj2.x > obj1.y - obj2.y) { return 1; }\n return 2;\n }\n } else {\n if (obj1.x - obj2.x < obj2.width && obj2.y - obj1.y < obj1.height) {\n if (obj1.x - obj2.x > obj2.y - obj1.y) { return 1; }\n return 3;\n }\n }\n } else {\n if (obj1.y > obj2.y) {\n if (obj2.x - obj1.x < obj1.width && obj1.y - obj2.y < obj2.height) {\n if (obj2.x - obj1.x > obj1.y - obj2.y) { return 0; }\n return 2;\n }\n } else {\n if (obj2.x - obj1.x < obj1.width && obj2.y - obj1.y < obj1.height) {\n if (obj2.x - obj1.x > obj2.y - obj1.y) { return 0; }\n return 3;\n }\n }\n }\n return -1;\n}", "function collisionDetection(body1, body2){\n if(body1.x+body1.width > body2.x-cameraX && body1.x < body2.x+body2.width-cameraX && \n body1.y+body1.height > body2.y-cameraY && body1.y < body2.y+body2.height-cameraY){\n return true;\n }else{\n return false;\n }\n}", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,\n height: box.height\n }\n // Get actual key position\n let keyPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,\n height: box.height\n }\n // If collision happened:\n if (playerPosition.x < keyPosition.x + keyPosition.width && playerPosition.x + playerPosition.width > keyPosition.x && playerPosition.y < keyPosition.y + keyPosition.height && playerPosition.y + playerPosition.height > keyPosition.y) {\n audioFiles.collect.play();// Play collect sound effect\n player.remainAlive++;// add 1 life to th player\n let heart = new Life(lives.length*20, 0);// create a new Life and set position coordinates arguments\n lives.push(heart);// add the new heart object into lives array (See engine.js-line 171)\n this.x = -100;// hide the key by moving it offscreen\n }\n }", "function collisonBords(e) {\n let collision = false;\n\n if (GestionnaireCollision.cercleDansCarre(e, map.cageDroite)) {\n if (e.x + e.width >= map.cageDroite.x + map.cageDroite.width) {\n e.x = (map.cageDroite.x + map.cageDroite.width) - e.width;\n e.inverserVx();\n\n collision = true;\n }\n if (e.y <= map.cageDroite.y) {\n e.y = map.cageDroite.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.cageDroite.y + map.cageDroite.height) {\n e.y = (map.cageDroite.y + map.cageDroite.height) - e.height;\n e.inverserVy();\n\n collision = true;\n }\n // S'il y a collision avec la cage gauche\n } else if (GestionnaireCollision.cercleDansCarre(e, map.cageGauche)) {\n if (e.x <= map.cageGauche.x) {\n e.x = map.cageGauche.x;\n e.inverserVx();\n\n collision = true;\n }\n if (e.y <= map.cageGauche.y) {\n e.y = map.cageGauche.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.cageGauche.y + map.cageGauche.height) {\n e.y = (map.cageGauche.y + map.cageGauche.height) - e.height;\n e.inverserVy();\n\n collision = true;\n }\n } else if (e.x <= map.x) {\n e.x = map.x;\n e.inverserVx();\n\n collision = true;\n } else if (e.x + e.width >= map.x + map.width) {\n e.x = (map.x + map.width) - e.width;\n e.inverserVx();\n\n collision = true;\n } else if (e.y <= map.y) {\n e.y = map.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.y + map.height) {\n e.y = (map.y + map.height) - e.height;\n e.inverserVy();\n collision = true;\n }\n\n if (collision) {\n soundsManager.collisionBords();\n }\n }", "collision(that, dt) {\n\t\tvar relv = this.vel.sub(that.vel);\n\t\tvar bigBox = new PhysicPrimitive();\n\t\tbigBox.pos = this.pos.min(this.updatePosition(relv, dt));\n\t\tbigBox.size = this.pos.max(this.updatePosition(relv, dt)).add(this.size).sub(bigBox.pos);\n\t\tvar retVal = {};\n\t\tif (bigBox.intersects(that)) {\n\t\t\tvar invEntry = new Vector2(0, 0);\n\t\t\tvar invExit = new Vector2(0, 0);\n\t\t\tif (relv.x >= 0) {\n\t\t\t\tinvEntry.x = that.pos.x - (this.pos.x + this.size.x);\n\t\t\t\tinvExit.x = (that.pos.x + that.size.x) - this.pos.x;\n\t\t\t} else {\n\t\t\t\tinvEntry.x = (that.pos.x + that.size.x) - this.pos.x;\n\t\t\t\tinvExit.x = that.pos.x - (this.pos.x + this.size.x);\n\t\t\t}\n\t\t\tif (relv.y >= 0) {\n\t\t\t\tinvEntry.y = that.pos.y - (this.pos.y + this.size.y);\n\t\t\t\tinvExit.y = (that.pos.y + that.size.y) - this.pos.y;\n\t\t\t} else {\n\t\t\t\tinvEntry.y = (that.pos.y + that.size.y) - this.pos.y;\n\t\t\t\tinvExit.y = that.pos.y - (this.pos.y + this.size.y);\n\t\t\t}\n\t\t\tvar entry = new Vector2(0, 0);\n\t\t\tvar exit = new Vector2(0, 0);\n\t\t\tif (relv.x == 0) {\n\t\t\t\tentry.x = (invEntry.x > 0 ? 1 : -1) * (dt + 1);\n\t\t\t\texit.x = (invExit.x > 0 ? 1 : -1) * (dt + 1);\n\t\t\t} else {\n\t\t\t\tentry.x = invEntry.x / relv.x;\n\t\t\t\texit.x = invExit.x / relv.x;\n\t\t\t}\n\t\t\tif (relv.y == 0) {\n\t\t\t\tentry.y = (invEntry.y > 0 ? 1 : -1) * (dt + 1);\n\t\t\t\texit.y = (invExit.y > 0 ? 1 : -1) * (dt + 1);\n\t\t\t} else {\n\t\t\t\tentry.y = invEntry.y / relv.y;\n\t\t\t\texit.y = invExit.y / relv.y;\n\t\t\t}\n\t\t\tvar entryTime = Math.max(entry.x, entry.y);\n\t\t\tvar exitTime = Math.min(exit.x, exit.y);\n\t\t\tvar normal = new Vector2(1, 1);\n\t\t\tif (entryTime > exitTime || entry.x < -eps && entry.y < -eps || entry.x - dt > eps || entry.y - dt > eps) {\n\t\t\t\tretVal.dt = dt + 1;\n\t\t\t\tretVal.proj = new Vector2(1, 1);\n\t\t\t\treturn retVal;\n\t\t\t} else {\n\t\t\t\tif (entry.x - eps > entry.y) {\n\t\t\t\t\tif (relv.x >= 0) {\n\t\t\t\t\t\tnormal = new Vector2(-1, 0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnormal = new Vector2(1, 0);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (relv.y >= 0) {\n\t\t\t\t\t\tnormal = new Vector2(0, -1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnormal = new Vector2(0, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tretVal.dt = entryTime;\n\t\t\t\tretVal.proj = normal;\n\t\t\t\treturn retVal;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tretVal.dt = dt + 1;\n\t\t\tretVal.proj = new Vector2(1, 1);\n\t\t\treturn retVal;\n\t\t}\n\t}", "checkCollision (playerPosition) {\n /*\n if (playerPosition[0] > this.position[0][0] && playerPosition[0] < this.position[0][1]) {\n if (playerPosition[1] > this.position[1][0] && playerPosition[1] < this.position[1][1]) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }\n */\n\n let er = 0;\n let ec = 0;\n let pr = 0;\n let pc = 0;\n\n /* player x position */\n if(player.x < 100){ pc = 0; }\n if(player.x >= 100 && player.x < 200){ pc = 1; } \n if(player.x >= 200 && player.x < 300){ pc = 2; }\n if(player.x >= 300 && player.x < 400){ pc = 3; }\n if(player.x >= 400){ pc = 4; }\n\n /* player y position */\n if(player.y < 72) { pr = 0; } \n if(player.y >= 72 && player.y < 154) { pr = 1; } \n if(player.y >= 154 && player.y < 236) { pr = 2; } \n if(player.y >= 236 && player.y < 318) { pr = 3; } \n if(player.y >= 318 && player.y < 400) { pr = 4; } \n if(player.y >= 400) { pr = 5; } \n\n /* enemy car x position + 10 buffer for easyer gameplay */\n if(this.x < -100){ ec = -1; }\n if(this.x >= -100 && this.x < 0){ ec = 0; } \n if(this.x >= 0 && this.x < 100){ ec = 1; } \n if(this.x >= 100 && this.x < 200){ ec = 2; }\n if(this.x >= 200 && this.x < 300){ ec = 3; }\n if(this.x >= 300 && this.x < 400){ ec = 4; }\n if(this.x >= 400){ ec = 5; }\n\n /* enemy car y position */\n if(this.y < 63) { er = 0; } \n if(this.y >= 63 && this.y < 143) { er = 1; } \n if(this.y >= 143 && this.y < 223) { er = 2; } \n if(this.y >= 223 && this.y < 303) { er = 3; } \n if(this.y >= 303 && this.y < 383) { er = 4; } \n if(this.y >= 383) { er = 5; } \n/*\n if (ec == 2) { \n alert(this.x.toString()); \n }\n*/\n if ((pc == ec) && (pr == er)) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }", "paddleCollision(paddle1, paddle2) {\n\n \n // if moving toward the right end ================================\n if (this.vx > 0) {\n let paddle = paddle2.coordinates(paddle2.x, paddle2.y, paddle2.width, paddle2.height);\n let [leftX, rightX, topY, bottomY] = paddle;\n // right edge of the ball is >= left edge of the paddle\n if(\n (this.x + this.radius >= leftX) && \n (this.x + this.radius <= rightX) &&\n (this.y >= topY && this.y <= bottomY)\n ){\n this.vx = -this.vx;\n this.ping.play();\n }\n }\n else {\n\n // if moving toward the right end ============================\n let paddle = paddle1.coordinates(paddle1.x, paddle1.y, paddle1.width, paddle1.height);\n let [leftX, rightX, topY, bottomY] = paddle;\n // right edge of the ball is <= left edge of the paddle\n if(\n (this.x - this.radius <= rightX) && \n (this.x - this.radius >= leftX) &&\n (this.y >= topY && this.y <= bottomY)\n ){\n this.vx = -this.vx;\n this.ping.play();\n }\n }\n \n }", "function tester_collision1() {\n\tfor (var p=0; p<18; p++) {\n\n/* On test le contact de la sphère avec chaque sommet du mur de gauche */\n\t\tif (Math.sqrt(Math.pow(polygone[p][0]-xplayer1,2)+ Math.pow(polygone[p][1]-yplayer1,2)) < rayon) {\n\t\t\tcontinuer = false;\n\t\t\tbreak;\n\t\t}\n\n/* Idem avec le mur de droite */\n\t\tif (Math.sqrt(Math.pow(polygone[p][0]+largeur-xplayer1,2)+ Math.pow(polygone[p][1]-yplayer1,2)) < rayon ) {\n\t\t\tcontinuer = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\t \n}", "function bodyCollision() {\n\tvar headID = segments[segments.length - 1].ID;\n\tvar headTop = $(headID).position().top;\n\tvar headLeft = $(headID).position().left;\n\tvar segmentID;\n\tvar segmentTop;\n\tvar segmentLeft;\n\n\tfor (i = 0; i < segments.length - 2; i++) {\n\t\tsegmentID = segments[i].ID;\n\t\tsegmentTop = $(segmentID).position().top;\n\t\tsegmentLeft = $(segmentID).position().left;\n\t\tif ((headTop === segmentTop) && (headLeft === segmentLeft)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function collisions() {\n collisonBords(ballon);\n\n equipes.forEach((eq) => {\n eq.joueurs.forEach((e) => {\n // Touche le cote droit\n collisonBords(e);\n });\n });\n\n let collision = false;\n\n // Pour toutes les equipes\n equipes.forEach((e) => {\n // Pour chaque joueur de chaque équipe\n e.joueurs.forEach((j) => {\n if (GestionnaireCollision.cercleCercle(j, ballon, j.rayon(), ballon.rayon())) {\n gererCollision(j, ballon);\n collision = true;\n }\n\n // Pour chaque équipe\n equipes.forEach((e2) => {\n // Chaque joueur de chaque équipe\n e2.joueurs.forEach((j2) => {\n if (j.x === j2.x && j.y === j2.y) {\n return;\n }\n\n if (GestionnaireCollision.cercleCercle(j, j2, j.rayon(), j2.rayon())) {\n collision = true;\n gererCollision(j, j2);\n }\n });\n });\n });\n });\n\n if (collision) {\n soundsManager.collisionJoueurs();\n }\n\n if (GestionnaireCollision.pointDansRectangle(map.cageGauche, ballon.centre())) {\n score.DROITE += 1;\n reset();\n soundsManager.but();\n } else if (GestionnaireCollision.pointDansRectangle(map.cageDroite, ballon.centre())) {\n score.GAUCHE += 1;\n reset();\n soundsManager.but();\n }\n }", "slowOnCollision() {\n\t\tundefined;\n\t}", "function checkCollision() {\n snake1.checkCollision();\n if(snake2) {\n snake2.checkCollision();\n if(snake1.collidesWith(snake2)) {\n $('#ouch_girl').trigger('play');\n }\n if(snake2.collidesWith(snake1)) {\n $('#ouch_boy').trigger('play');\n }\n }\n }", "boxCollision() {\r\n if ((this.x - this.radius) <= 0)\r\n this.x = 0 + this.radius;\r\n if ((this.x + this.radius) >= canvas.src.width)\r\n this.x = canvas.src.width - this.radius;\r\n if ((this.y - this.radius) <= 0)\r\n this.y = this.radius;\r\n if ((this.y + this.radius) >= canvas.src.height)\r\n this.y = canvas.src.height - this.radius;\r\n }", "function checkCollision() {\n // check 2 heads\n if (distance(part[1][0].x, part[1][0].y, part[2][0].x, part[2][0].y) < part[1][0].r + part[2][0].r) {\n if (part[1][0].r > part[2][0].r) gameOver(1);\n\telse if (part[1][0].r < part[2][0].r) gameOver(2);\n\telse if (part[1][0].r == part[2][0].r) gameOver(0);\n return;\n }\n // check snake's head with other snake parts\n for (var id_snake_cCol = 1; id_snake_cCol <= 2; id_snake_cCol++) {\n var id_other_cCol = 3 - id_snake_cCol;\n for (var id_part_cCol = 1; id_part_cCol < part[id_snake_cCol].length; id_part_cCol++) {\n\t if (distance(part[id_other_cCol][0].x, part[id_other_cCol][0].y, \n\t\t\t\t part[id_snake_cCol][id_part_cCol].x, part[id_snake_cCol][id_part_cCol].y) < \n\t\t\t\t part[id_other_cCol][0].r + part[id_snake_cCol][id_part_cCol].r) {\n\t\t\t\t \n\t\t//console.log(id_other_cCol +\" \"+ id_snake_cCol +\" \"+ id_part_cCol +\" \"+ part[id_other_cCol][0].x +' '+ part[id_other_cCol][0].y +' '+ \n\t\t//\t\t part[id_snake_cCol][id_part_cCol].x +' '+ part[id_snake_cCol][id_part_cCol].y +' '+ \n\t\t//\t\t part[id_other_cCol][0].r +' '+ part[id_snake_cCol][id_part_cCol].r);\n\t gameOver(id_snake_cCol);\n\t\treturn;\n\t \n\t }\n\t}\n }\n}", "function collision (first, second){\n const w = (first.width + second.width) / 2;\n const h = (first.height + second.height) / 2;\n const dx = Math.abs(first.x - second.x);\n const dy = Math.abs(first.y - second.y);\n if (dx <= w && dy <= h){\n const wy = w * (first.y - second.y);\n const hx = h * (first.x - second.x);\n if (wy > hx){\n if (wy > -hx){\n stopUp = true;\n // console.log('collision: up');\n return true;\n } else {\n stopRight = true;\n // console.log('collision: right');\n return true;\n }\n }else{\n if (wy > -hx){\n stopLeft = true;\n // console.log('collision: left');\n return true;\n } else {\n stopDown = true;\n // console.log('collision: down');\n return true;\n };\n };\n }else{\n stopUp = false;\n stopRight = false;\n stopDown = false;\n stopLeft = false;\n return false;\n };\n}", "checkCollision() { \n return (player.x < this.x + 80 &&\n player.x + 80 > this.x &&\n player.y < this.y + 60 &&\n 60 + player.y > this.y)\n }", "function collision(ObjectX, ObjectY){\n var x1, y1, x2, y2; //ObjectX vertices\n var w1, z1, w2, z2; //ObjectY vertices\n \n /* Identifying player object. this object has difference on center position and sprite position.\n It is adjusted by method updateCenter() from Player Object. */\n if(typeof ObjectX.updateCenter === 'function' && \n typeof ObjectY.updateCenter === 'function') { //Player/Enemy objects founded\n /* Setting up ObjectX vertices */\n x1 = (ObjectX.centerx - ObjectX.collisionsize);\n y1 = (ObjectX.centery - ObjectX.collisionsize);\n x2 = (ObjectX.centerx + ObjectX.collisionsize);\n y2 = (ObjectX.centery + ObjectX.collisionsize);\n \n /* Setting up ObjectY vertices */\n w1 = (ObjectY.centerx - ObjectY.collisionsize);\n z1 = (ObjectY.centery - ObjectY.collisionsize);\n w2 = (ObjectY.centerx + ObjectY.collisionsize);\n z2 = (ObjectY.centery + ObjectY.collisionsize);\n \n //collision detection math calculations.\n return collisionMath(x1, y1, x2, y2, w1, z1, w2, z2);\n }\n else if (typeof ObjectX.updateCenter === 'function'){ //Player object founded.\n /* Setting up ObjectX vertices */\n x1 = (ObjectX.centerx - ObjectX.collisionsize);\n y1 = (ObjectX.centery - ObjectX.collisionsize);\n x2 = (ObjectX.centerx + ObjectX.collisionsize);\n y2 = (ObjectX.centery + ObjectX.collisionsize);\n \n /* Setting up ObjectY vertices */\n w1 = (ObjectY.x - ObjectY.collisionsize);\n z1 = (ObjectY.y - ObjectY.collisionsize);\n w2 = (ObjectY.x + ObjectY.collisionsize);\n z2 = (ObjectY.y + ObjectY.collisionsize);\n \n //collision detection math calculations.\n return collisionMath(x1, y1, x2, y2, w1, z1, w2, z2);\n }\n else if(typeof ObjectY.updateCenter === 'function') { //Player object founded.\n /* Setting up ObjectX vertices */\n x1 = (ObjectX.x - ObjectX.collisionsize);\n y1 = (ObjectX.y - ObjectX.collisionsize);\n x2 = (ObjectX.x + ObjectX.collisionsize);\n y2 = (ObjectX.y + ObjectX.collisionsize);\n \n /* Setting up ObjectY vertices */\n w1 = (ObjectY.centerx - ObjectY.collisionsize);\n z1 = (ObjectY.centery - ObjectY.collisionsize);\n w2 = (ObjectY.centerx + ObjectY.collisionsize);\n z2 = (ObjectY.centery + ObjectY.collisionsize);\n \n //collision detection math calculations.\n return collisionMath(x1, y1, x2, y2, w1, z1, w2, z2);\n }\n else{ //Objects aren't a player.\n console.log(\"Objects aren't a player\");\n /* Setting up ObjectX vertices */\n x1 = (ObjectX.x - ObjectX.collisionsize);\n y1 = (ObjectX.y - ObjectX.collisionsize);\n x2 = (ObjectX.x + ObjectX.collisionsize);\n y2 = (ObjectX.y + ObjectX.collisionsize);\n \n /* Setting up ObjectY vertices */\n w1 = (ObjectY.x - ObjectY.collisionsize);\n z1 = (ObjectY.y - ObjectY.collisionsize);\n w2 = (ObjectY.x + ObjectY.collisionsize);\n z2 = (ObjectY.y + ObjectY.collisionsize);\n \n //collision detection math calculations.\n return collisionMath(x1, y1, x2, y2, w1, z1, w2, z2);\n }\n return false;\n}", "collision() {\n return this.sprite.overlap(player.sprite) && this.colour == player.colour;\n }", "check_collision() {\n const rtx = this.x + 4;\n const rty = this.y + 59;\n const rpx = player.x + 31;\n const rpy = player.y + 57;\n if (rtx < rpx + player.width - 5 &&\n rpx < rtx + this.width - 5 &&\n rty < rpy + player.height - 15 &&\n rpy < rty + this.height - 15) {\n // Reset the game when collision happens\n allEnemies = [new Enemy(), new Enemy(), new Enemy()];\n player = new Player();\n }\n }", "function CollisionCalculatorC2C(o1,o2) {\n //console.log(o1,o2);\n var dist = Math.sqrt( Math.pow((o2.x-o1.x),2)+Math.pow((o2.y-o1.y),2));\n var totalR = o2.r + o1.r;\n if(dist>totalR){\n return false;\n }\n /*\n var colPoint = new Point( o2.x + (o1.position.x-o2.position.x)*o2.r/(o2.r+o1.r),o2.y + (o1.position.y-o2.position.y)*o2.r/(o2.r+o1.r);\n */\n\n var region = \"\";\n if (o1.y < o2.y - Math.abs(o2.height/2)) {\n\n //If it is, we need to check whether it's in the\n //top left, top center or top right\n if (o1.x < o2.x - 1 - Math.abs(o2.width/2)) {\n region = \"topLeft\";\n } else if (o1.x > o2.x + 1 + Math.abs(o2.width/2)) {\n region = \"topRight\";\n } else {\n region = \"topMiddle\";\n }\n }\n\n else if ((o1.y > o2.y + Math.abs(o2.height/2))) {\n\n //If it is, we need to check whether it's in the bottom left,\n //bottom center, or bottom right\n if (o1.x < o2.x - 1 - Math.abs(o2.width/2)) {\n region = \"bottomLeft\";\n } else if (o1.x > o2.x + 1 + Math.abs(o2.width/2)) {\n region = \"bottomRight\";\n } else {\n region = \"bottomMiddle\";\n }\n } \n else {\n if (o1.x < o2.x - Math.abs(o2.width/2)) {\n region = \"leftMiddle\";\n } else {\n region = \"rightMiddle\";\n }\n }\n\n //return true;\n return [true,region];\n}", "function collision(object1, object2) {\n if (object1.x <= object2.x && object1.y <= object2.y && object1.x + object1.w >= object2.x && object1.y + object1.h >= object2.y) {\n return true;\n }\n if (object1.x <= object2.x && object1.y >= object2.y && object1.x + object1.w >= object2.x && object2.y + object2.h >= object1.y) {\n return true;\n }\n if (object1.x >= object2.x && object1.y <= object2.y && object2.x + object2.w >= object1.x && object1.y + object1.h >= object2.y) {\n return true;\n }\n return object1.x >= object2.x && object1.y >= object2.y && object2.x + object2.w >= object1.x && object2.y + object2.h >= object1.y;\n}", "function collision(head,body) {\nfor (i = 0; i < snake.length; i++) {\n\tif (head.x == body[i].x && head.y == body[i].y) {\n\t\treturn true;\n\t\t\t}\n\t\t}\n\treturn false;\n\t}", "function collision(target1, target2) {\n return (target1.x > target2.x - 20 && target1.x < target2.x + 20) &&\n (target1.y > target2.y - 20 && target1.y < target2.y + 20);\n}", "function collision(first, second) {\n\treturn !(first.x > second.x + second.width ||\n\t\tfirst.x + first.width < second.x ||\n\t\tfirst.y > second.y + second.height ||\n\t\tfirst.y + first.height < second.y);\n}", "function collide(l1, l2) {\n\t \tvar r1 = { left: l1.x, top: l1.y, right: l1.x+l1.width, bottom: l1.y+l1.height };\n\t \tvar r2 = { left: l2.x, top: l2.y, right: l2.x+l2.width, bottom: l2.y+l2.height };\n \t\t\t \n \t\t\t return !(r2.left > r1.right || \n\t\t\t r2.right < r1.left || \n\t\t\t r2.top > r1.bottom ||\n\t\t\t r2.bottom < r1.top);\n\t }", "function detectCollision(player1, player2){\n\treturn Math.abs(player1.x-player2.x) < 40 && Math.abs(player1.y-player2.y) < 40;\n}", "function collide(A, B) {\n if ( A.x < B.x + CAR_WIDTH && A.x + CAR_WIDTH > B.x &&\n A.y < B.y + CAR_HEIGHT && A.y + CAR_HEIGHT > B.y ) {\n if ( DEBUG ) {\n console.log(\"Colision entre deux véhicules\");\n }\n return true;\n }\n return false;\n}", "collision(ptl, pbr) {//player dimensions\n //add the x first\n if(this.taken){ return false;}\n if ((ptl.x <this.bottomRight.x && pbr.x > this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) {\n this.taken = true;\n return true;\n }\n return false;\n }", "function collisionDetect(balls) {\r\n var i,j,d,a,b;\r\n for(i=0;i<balls.length-1;i++)\r\n {\r\n for(j=i+1;j<balls.length;j++) \r\n { a = balls[i].x - balls[j].x;\r\n b = balls[i].y - balls[j].y;\r\n d=Math.sqrt(a*a+b*b);\r\n if(d<=balls[i].size+balls[j].size)\r\n \t\t {\r\n \t\t\t //reverse ball one\r\n \t\t\t balls[i].velX = -balls[i].velX;\r\n \t\t\t balls[i].velY= -balls[i].velY;\r\n \r\n \t\t\t //reverse ball two\r\n \t\t\t balls[j].velX = -balls[j].velX;\r\n \t\t\t balls[j].velY = -balls[j].velY;\r\n \t\t }\r\n \r\n }\r\n }\r\n \r\n}", "function overlap(actor1,actor2){\n return actor1.pos.x+actor1.size.x > actor2.pos.x &&\n actor1.pos.x < actor2.pos.x + actor2.size.x &&\n actor1.pos.y + actor1.size.y > actor2.pos.y &&\n actor1.pos.y<actor2.pos.y + actor2.size.y;\n }", "function collisionDetection(x, y) {\r\n if (\r\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\r\n x - getShipLocation(angle)[0] <= 35 &&\r\n x - getShipLocation(angle)[0] >= -35 &&\r\n y - getShipLocation(angle)[1] <= 35 &&\r\n y - getShipLocation(angle)[1] >= -35\r\n ) {\r\n // Calls crash screen when a collision is detected\r\n crashScreen();\r\n }\r\n}", "function areCollide(r1, r2) {\n //Define the variables we'll need to calculate\n var hit, combinedHalfWidths, combinedHalfHeights, vx, vy;\n\n //hit will determine whether there's a collision\n hit = false;\n\n //Find the center points of each sprite\n r1.centerX = r1.x + r1.width / 2;\n r1.centerY = r1.y + r1.height / 2;\n r2.centerX = r2.x + r2.width / 2;\n r2.centerY = r2.y + r2.height / 2;\n\n //Find the half-widths and half-heights of each sprite\n r1.halfWidth = r1.width / 2;\n r1.halfHeight = r1.height / 2;\n r2.halfWidth = r2.width / 2;\n r2.halfHeight = r2.height / 2;\n\n //Calculate the distance vector between the sprites\n vx = r1.centerX - r2.centerX;\n vy = r1.centerY - r2.centerY;\n\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = r1.halfWidth + r2.halfWidth;\n combinedHalfHeights = r1.halfHeight + r2.halfHeight;\n\n //Check for a collision on the x axis\n if (Math.abs(vx) < combinedHalfWidths) {\n\n //A collision might be occuring. Check for a collision on the y axis\n if (Math.abs(vy) < combinedHalfHeights) {\n\n //There's definitely a collision happening\n hit = true;\n } else {\n\n //There's no collision on the y axis\n hit = false;\n }\n } else {\n\n //There's no collision on the x axis\n hit = false;\n }\n\n //`hit` will be either `true` or `false`\n return hit;\n}", "function have_collided(object1,object2){\n return !(\n ((object1.y + object1.height) < (object2.y)) || //\n (object1.y > (object2.y + object2.height)) ||\n ((object1.x + object1.width) < object2.x) ||\n (object1.x > (object2.x + object2.width))\n );\n }", "collide(other) {\n\t\tlet al = this.x + this.hitbox.x \n\t\tlet au = this.y + this.hitbox.y\n\t\tlet ar = al + this.hitbox.w\n\t\tlet ad = au + this.hitbox.h\n\t\tlet bl = other.x + other.hitbox.x \n\t\tlet bu = other.y + other.hitbox.y\n\t\tlet br = bl + other.hitbox.w\n\t\tlet bd = bu + other.hitbox.h\n\t\treturn ar > bl && al < br && ad > bu && au < bd\n\t}", "function collide(s,a){\n var self = this;\n self.o = s;\n self.a = a;\n}", "function doCollide(obj1, obj2) {\n \n obj1.leftX = obj1.X;\n obj1.topY = obj1.Y;\n obj1.rightX = obj1.X + 50;\n obj1.bottomY = obj1.Y + 200;\n \n obj2.leftX = obj2.X;\n obj2.topY = obj2.Y;\n obj2.rightX = obj2.X + 30;\n obj2.bottomY = obj2.Y + 30;\n \n\tif (obj1.rightX > obj2.leftX &&\n obj1.leftX < obj2.rightX &&\n obj1.bottomY > obj2.topY &&\n obj1.topY < obj2.bottomY) {\n \n obj2.speedX = -obj2.speedX;\n \n }\n\t\t\n}", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,// Get its box width\n height: box.height// Get its box height\n }\n // Get actual gem position\n let gemPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,// Get its box width\n height: box.height// Get its box height\n }\n // If collision happened:\n if (playerPosition.x < gemPosition.x + gemPosition.width && playerPosition.x + playerPosition.width > gemPosition.x && playerPosition.y < gemPosition.y + gemPosition.height && playerPosition.y + playerPosition.height > gemPosition.y) {\n audioFiles.collect.play();// Play collect sound effect\n // If th gem collect is orange the score will be incremented by 100\n // If th gem collect is blue the score will be incremented by 200\n // If th gem collect is green the score will be incremented by 300\n player.score += (this.gemSelected+1)*100;\n this.x = -100;// hide the gem by moving it offscreen\n this.gemCollected++;// increment player gem collected\n }\n }", "function collision(player,blocker) {\n var x1 = player.offset().left;\n var y1 = player.offset().top;\n var h1 = player.outerHeight(true);\n var w1 = player.outerWidth(true);\n var b1 = y1 + h1;\n var r1 = x1 + w1;\n var x2 = blocker.offset().left;\n var y2 = blocker.offset().top;\n var h2 = blocker.outerHeight(true);\n var w2 = blocker.outerWidth(true);\n var b2 = y2 + h2;\n var r2 = x2 + w2;\n \n // if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {\n // console.log(\"false\");\n // } else {\n // console.log(\"true\");\n // } \n \n if (b1 < y2 || y1 > b2 || r1 < x2 || x1 > r2) {\n return false;\n } else { \n return true;\n }\n\n }", "function hikerCollide() {\n for (i = 0; i <= 3; i++) {\n\n var hikerX = hikerXs[i];\n var hikerY = hikerYs[i];\n\n if (hikerX + HIKER_WIDTH >= bearX - bearFace / 2 && hikerX <= bearX + bearFace / 2 &&\n hikerY + HIKER_HEIGHT >= bearY - bearChin / 2 && hikerY <= bearY + bearChin / 2) {\n hikerXSpeed[i] = 0;\n hikerYSpeed[i] = 0;\n }\n }\n}", "function checkCollision(entA, entB)\n{\n var colBoxA = entA.colBox;\n var colBoxB = entB.colBox;\n return !(colBoxB.left > colBoxA.right ||\n colBoxB.right < colBoxA.left ||\n colBoxB.top > colBoxA.bottom ||\n colBoxB.bottom < colBoxA.top);\n}", "function collisionDetection(x, y) {\n if (\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\n x - getShipLocation(angle)[0] <= 35 &&\n x - getShipLocation(angle)[0] >= -35 &&\n y - getShipLocation(angle)[1] <= 35 &&\n y - getShipLocation(angle)[1] >= -35\n ) {\n // Calls crash screen when a collision is detected\n crashScreen();\n }\n}", "rectangleCollision(r1, r2, bounce = false, global = true) {\n //Add collision properties\n if (!r1._bumpPropertiesAdded)\n this.addCollisionProperties(r1);\n if (!r2._bumpPropertiesAdded)\n this.addCollisionProperties(r2);\n let collision, combinedHalfWidths, combinedHalfHeights, overlapX, overlapY, vx, vy;\n //Calculate the distance vector\n if (global) {\n vx = (r1.gx + Math.abs(r1.halfWidth) - r1.xAnchorOffset) - (r2.gx + Math.abs(r2.halfWidth) - r2.xAnchorOffset);\n vy = (r1.gy + Math.abs(r1.halfHeight) - r1.yAnchorOffset) - (r2.gy + Math.abs(r2.halfHeight) - r2.yAnchorOffset);\n }\n else {\n //vx = r1.centerX - r2.centerX;\n //vy = r1.centerY - r2.centerY;\n vx = (r1.x + Math.abs(r1.halfWidth) - r1.xAnchorOffset) - (r2.x + Math.abs(r2.halfWidth) - r2.xAnchorOffset);\n vy = (r1.y + Math.abs(r1.halfHeight) - r1.yAnchorOffset) - (r2.y + Math.abs(r2.halfHeight) - r2.yAnchorOffset);\n }\n //Figure out the combined half-widths and half-heights\n combinedHalfWidths = Math.abs(r1.halfWidth) + Math.abs(r2.halfWidth);\n combinedHalfHeights = Math.abs(r1.halfHeight) + Math.abs(r2.halfHeight);\n //Check whether vx is less than the combined half widths\n if (Math.abs(vx) < combinedHalfWidths) {\n //A collision might be occurring!\n //Check whether vy is less than the combined half heights\n if (Math.abs(vy) < combinedHalfHeights) {\n //A collision has occurred! This is good!\n //Find out the size of the overlap on both the X and Y axes\n overlapX = combinedHalfWidths - Math.abs(vx);\n overlapY = combinedHalfHeights - Math.abs(vy);\n //The collision has occurred on the axis with the\n //*smallest* amount of overlap. Let's figure out which\n //axis that is\n if (overlapX >= overlapY) {\n //The collision is happening on the X axis\n //But on which side? vy can tell us\n if (vy > 0) {\n collision = \"top\";\n //Move the rectangle out of the collision\n r1.y = r1.y + overlapY;\n }\n else {\n collision = \"bottom\";\n //Move the rectangle out of the collision\n r1.y = r1.y - overlapY;\n }\n //Bounce\n if (bounce) {\n r1.vy *= -1;\n /*Alternative\n //Find the bounce surface's vx and vy properties\n var s = {};\n s.vx = r2.x - r2.x + r2.width;\n s.vy = 0;\n \n //Bounce r1 off the surface\n //this.bounceOffSurface(r1, s);\n */\n }\n }\n else {\n //The collision is happening on the Y axis\n //But on which side? vx can tell us\n if (vx > 0) {\n collision = \"left\";\n //Move the rectangle out of the collision\n r1.x = r1.x + overlapX;\n }\n else {\n collision = \"right\";\n //Move the rectangle out of the collision\n r1.x = r1.x - overlapX;\n }\n //Bounce\n if (bounce) {\n r1.vx *= -1;\n /*Alternative\n //Find the bounce surface's vx and vy properties\n var s = {};\n s.vx = 0;\n s.vy = r2.y - r2.y + r2.height;\n \n //Bounce r1 off the surface\n this.bounceOffSurface(r1, s);\n */\n }\n }\n }\n else {\n //No collision\n }\n }\n else {\n //No collision\n }\n //Return the collision string. it will be either \"top\", \"right\",\n //\"bottom\", or \"left\" depending on which side of r1 is touching r2.\n return collision;\n }", "checkCollision(rocket, ship){\n //simple AABB checking\n if (rocket.x < ship.x + ship.width && rocket.x + rocket.width > ship.x && rocket.y < ship.y + ship.height && rocket.height + rocket.y > ship.y){\n return true;\n } else {\n return false;\n }\n }", "function collides(a, b) {\n return (\n a.x < b.x + pipeWidth &&\n a.x + a.width > b.x &&\n a.y < b.y + b.height &&\n a.y + a.height > b.y\n );\n}", "function CollisionManager(policy){\n\t\n\tthis.policy=policy;\n\t\n\tthis.checkCollision=function(){\n\t\t\n\t\tif(this.policy==Constants.defaultCollision){\n\t\t\tcheckCollisionDefault();\n\t\t}\n\t\t\n\t};\n\t\n\t\n\t/**\n\t * Check for collision with the default policy\n\t */\n\tcheckCollisionDefault=function(){\n\t\t\n\t\tvar user=entityManager.getUser();\n\t\tvar entities=entityManager.getEntities();\n\t\tvar solids=entityManager.getSolids();\n\t\t\n\t\t\n\t\tvar userLeft=parseFloat(user.x);\n\t\tvar userRight=parseFloat(user.x+user.frameW);\n\t\tvar userTop=parseFloat(user.y);\n\t\tvar userBottom=parseFloat(user.y+user.frameH);\n\t\tvar isCollision=false;\n\t\t\n\t\tfor(var i=0; i<entities.length; i++){\n\t\t\n\t\t\tvar isSpriteOverlap=true;\n\t\t\t\n\t\t\tvar entity=entities[i];\n\t\t\t\n\t\t\tvar entityLeft=parseFloat(entity.x);\n\t\t\tvar entityRight=parseFloat(entity.x+entity.frameW);\n\t\t\tvar entityTop=parseFloat(entity.y);\n\t\t\tvar entityBottom=parseFloat(entity.y+entity.frameH);\n\t\t\t\n\t\t\t//Check if the two Sprites overlap so the images are close \n\t\t\tif(userLeft > entityRight || entityLeft > userRight || userTop > entityBottom || entityTop > userBottom){\n\t\t\t\tisSpriteOverlap=false;\n\t\t\t}\n\n\t\t\t//if they are close then do pixel-by-pixel comparison\n\t\t\tif(isSpriteOverlap){\n\t\t\t\n\t\t\t\tuserData=weavejs.getOffCanvasContext().getImageData(user.x,user.y,user.frameW,user.frameH);\n\t\t\t\tentityData=weavejs.getOffCanvasContext().getImageData(entity.x,entity.y,entity.frameW,entity.frameH);\n\t\t\t\t\n\t\t\t\tisCollision=checkForPixelCollision(userData,user.x,user.y,entityData,entity.x,entity.y);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\tconsole.log(\"Collision:\"+isCollision);\n\t\t\n\t};\n\t\n\t/**\n\t * the method take two entities and theeir coordinate information and checks for nont transparent pixel collision\n\t * @param firstEntityData the data of the first entity \n\t * @param firstEntityX the x coordinates of the first entity\n\t * @param firstEntityY the y coordinates of the first entity\n\t * @param secondEntityData the data of the second entity \n\t * @param secondEntityX the x coordinates of the second entity\n\t * @param secondEntityY the y coordinates of the second entity\n\t * \n\t */\n\tcheckForPixelCollision=function(firstEntityData,firstEntityX,firstEntityY,secondEntityData,secondEntityX,secondEntityY){\n\t\t\n\n\t var firstEntityWidth = firstEntityData.width;\n\t var firstEntityHeight = firstEntityData.height;\n\t var secondEntityWidth = secondEntityData.width;\n\t var secondEntityHeight = secondEntityData.height;\n\n\t //we calculate the top right and bottom left corners\n\t var xMin = Math.max( firstEntityX, secondEntityX );\n\t var yMin = Math.max( firstEntityY, secondEntityY );\n\t var xMax = Math.min( firstEntityX+firstEntityWidth, secondEntityX+secondEntityWidth );\n\t var yMax = Math.min( firstEntityY+firstEntityHeight, secondEntityY+secondEntityHeight );\n\t \n\t \n\t var firstEntityPixels = firstEntityData.data;\n\t var secondEntityPixels = secondEntityData.data;\n\t\t\n\t //we iterate through the pixels of the each entity\n\t for ( var i = xMin; i < xMax; i++ ) {\n\t for ( var j = yMin; j < yMax; j++ ) {\n\t \n\t \t //we get the alpha value of each pixel we want to check\n\t \t var firstEntityPixelAlpha = ((i-firstEntityX ) + (j-firstEntityY )*firstEntityWidth )*4 + 3 ;\n\t \t var secondEntityPixelAlpha = ((i-secondEntityX) + (j-secondEntityY)*secondEntityWidth)*4 + 3 ;\n\t \t\n\t \t //if the pixels the collide are not transparent then we a collision of the entities\n\t \t if ( firstEntityPixels[firstEntityPixelAlpha] !== 0 && secondEntityPixels[secondEntityPixelAlpha] !== 0 ) {\n\t \t\t return true;\n\t \t\t}\n\t \t\n\t }\n\t }\n\n\t return false;\n\t \n\t \n\t};\n\t\n\t\n}", "handleCollision() {\n\n for (let i = 0; i < this.balls.length; i++) {\n\n this.balls[i].collideWithTable(this.table); //looks if collided with border\n this.balls[i].handlePocketCollision();\n\n for (let j = i + 1; j < this.balls.length; j++) {\n\n const ball1 = this.balls[i];\n const ball2 = this.balls[j];\n\n ball1.collideWithBall(ball2);\n }\n }\n }", "function collision_detector(first, second) {\r\n var x1 = first.get(\"X\");\r\n var y1 = first.get(\"Y\");\r\n var width1 = first.get(\"width\");\r\n var height1 = first.get(\"height\");\r\n var x2 = second.get(\"X\");\r\n var y2 = second.get(\"Y\");\r\n var width2 = second.get(\"width\");\r\n var height2 = second.get(\"height\");\r\n\r\n if (x2 > x1 && x2 < x1 + width1 || x1 > x2 && x1 < x2 + width2) {\r\n if (y2 > y1 && y2 < y1 + height1 || y1 > y2 && y1 < y2 + height2) {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n}", "function criminalCollision() {\r\n\r\n for (i = 0; i < bullet.length; i++) {\r\n var distXCrime = Math.abs(bullet[i].x - eX - 45 / 2);\r\n var distYCrime = Math.abs(bullet[i].y - eY - 45 / 2);\r\n\r\n //no collision\r\n if (distXCrime > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n if (distYCrime > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n\r\n //collision\r\n if (distXCrime <= (25 / 2)) {\r\n return true;\r\n }\r\n if (distYCrime <= (25 / 2)) {\r\n return true;\r\n }\r\n\r\n //Initially was a colision algrothim for circle-rectangle, this part still worked though so kept\r\n var dx=distXCrime-25/2;\r\n var dy=distYCrime-25/2;\r\n if (dx*dx+dy*dy<=(20*20)){\r\n return true;\r\n }\r\n }\r\n}", "function collision($end, $start) {\n let x1 = $start.offset().left;\n let y1 = $start.offset().top;\n let h1 = $start.outerHeight(true);\n let w1 = $start.outerWidth(true);\n let b1 = y1 + h1;\n let r1 = x1 + w1;\n let x2 = $end.offset().left;\n let y2 = $end.offset().top;\n let h2 = $end.outerHeight(true);\n let w2 = $end.outerWidth(true);\n let b2 = y2 + h2;\n let r2 = x2 + w2;\n\n if( x2==x1){\n \t$('#game_result').text('Congratulations you won!');\n }\n \t\n }", "function collide() {\r\n $(\".box\").each(function(index, element) {\r\n if ($(this).hasClass('collide')) {\r\n b_left = $(this).offset().left;\r\n b_top = $(this).offset().top;\r\n b_width = $(this).width();\r\n m_left = $(\"#man\").offset().left;\r\n m_top = $(\"#man\").offset().top;\r\n m_width = $(\"#man\").width();\r\n if (b_left > m_left && b_left < m_left + m_width) {\r\n if (b_top > m_top && b_top < m_top + (m_width / 2)) {\r\n if ($(this).hasClass('bomb')) {\r\n audio_b.play();\r\n prize(\"bomb\");\r\n // \tover();\r\n } else if ($(this).hasClass('collide1')) {\r\n prize(\"collide1\");\r\n } else {\r\n prize(\"collide2\");\r\n }\r\n $(this).remove();\r\n\r\n } else if (b_top < m_top && b_top + b_width > m_top) {\r\n if ($(this).hasClass('bomb')) {\r\n audio_b.play();\r\n prize(\"bomb\");\r\n // \tover();\r\n } else if ($(this).hasClass('collide1')) {\r\n prize(\"collide1\");\r\n } else {\r\n prize(\"collide2\");\r\n }\r\n // if($(this).find('img').hasClass('bomb')){\r\n // \taudio_b.play();\r\n // \tover();\r\n // }else{\r\n //\tprize();\r\n // }\r\n $(this).remove();\r\n }\r\n } else if (b_left < m_left && b_left + b_width > m_left) {\r\n if (b_top > m_top && b_top < m_top + (m_width / 2)) {\r\n if ($(this).hasClass('bomb')) {\r\n audio_b.play();\r\n prize(\"bomb\");\r\n // \tover();\r\n } else if ($(this).hasClass('collide1')) {\r\n prize(\"collide1\");\r\n } else {\r\n prize(\"collide2\");\r\n }\r\n // if($(this).find('img').hasClass('bomb')){\r\n // \taudio_b.play();\r\n // \tover();\r\n // }else{\r\n //\tprize();\r\n // }\r\n $(this).remove();\r\n } else if (b_top < m_top && b_top + b_width > m_top) {\r\n if ($(this).hasClass('bomb')) {\r\n audio_b.play();\r\n prize(\"bomb\");\r\n // \tover();\r\n } else if ($(this).hasClass('collide1')) {\r\n prize(\"collide1\");\r\n } else {\r\n prize(\"collide2\");\r\n }\r\n // if($(this).find('img').hasClass('bomb')){\r\n // \taudio_b.play();\r\n // \tover();\r\n // }else{\r\n //\tprize();\r\n // }\r\n $(this).remove();\r\n }\r\n }\r\n }\r\n });\r\n}", "function ballWallCollision(){\r\n if(ball.x+ball.radius>cvs.width || ball.x-ball.radius<0)\r\n {\r\n ball.dx =- ball.dx;\r\n WALL_HIT.play();\r\n }\r\n if(ball.y-ball.radius<0){\r\n WALL_HIT.play();\r\n ball.dy =- ball.dy;\r\n }\r\n if(ball.y +ball.radius >cvs.height){\r\n LIFE--; // Lose Life\r\n LIFE_LOST.play();\r\n resetBall();\r\n }\r\n}", "function detectCollision(new_x, new_y) {\n var new_index = tu.getIndex(new_x, new_y, TILE_WIDTH, TILE_HEIGHT, MAP_WIDTH);\n var tileID = foreground[new_index];\n\n if (tileID == 1) return 1;\n else if (tileID == 2) return 2;\n else if (tileID == 4) return 3;\n else return 0; // no collision detected\n}", "function CheckCollisions()\n{\n /* Right wall collision = player 1 wins */\n if(ball_x + ball_velo_x >= COLS)\n {\n player1_win = true;\n return false;\n }\n /* Left wall collision = player 2 wins */\n else if(ball_x + ball_velo_x <= 0)\n {\n player2_win = true;\n return false;\n }\n /* Ball-Player collision = invert the x coord of velocity */\n else if((ball_x + ball_velo_x == player1_x && \n Math.abs(ball_y + ball_velo_y - player1_y) <= half_player_size) ||\n (ball_x + ball_velo_x == player2_x && \n Math.abs(ball_y +ball_velo_y - player2_y) <= half_player_size))\n {\n ball_velo_x = -ball_velo_x;\n document.getElementById( 'pong_sound' ).play();\n return false;\n }\n /* Horizontal Wall Collision = invert the y coord of velocity */\n else if(ball_y + ball_velo_y >= ROWS || ball_y + ball_velo_y < 0)\n {\n ball_velo_y = -ball_velo_y;\n return false; \n }\n /* No collisions */\n else\n {\n return true;\n }\n}", "handleCollisions(){\n\t const newX = this.head.x + (this.direction.x * this.speed);\n\t const xExplorer = new Coord(newX, this.head.y);\n\t const xCollision = this.map.collidingWithWall(xExplorer);\n\t\n\t const newY = this.head.y + (this.direction.y * this.speed);\n\t const yExplorer = new Coord(this.head.x, newY);\n\t const yCollision = this.map.collidingWithWall(yExplorer);\n\t\n\t const zExplorer = new Coord(newX, newY);\n\t const zCollision = this.map.collidingWithWall(zExplorer);\n\t\n\t if (xCollision || yCollision || zCollision) {\n\t // generate reflected ray\n\t\n\t // reflect direction based on collision\n\t const reflectionDirection = new Coord(this.direction.x, this.direction.y);\n\t if (xCollision) {\n\t reflectionDirection.x = -reflectionDirection.x;\n\t } else if (yCollision) {\n\t reflectionDirection.y = -reflectionDirection.y;\n\t } else {\n\t reflectionDirection.y = -reflectionDirection.y;\n\t reflectionDirection.x = -reflectionDirection.x;\n\t }\n\t\n\t const origin = new Coord(this.head.x, this.head.y);\n\t const reflection = new Ray(\n\t origin,\n\t reflectionDirection,\n\t this.map,\n\t this.age, // advance new ray age to parent ray current age\n\t this.body.length // set new ray max length\n\t );\n\t\n\t reflection.monster = this.monster;\n\t\n\t this.map.rays.push(reflection);\n\t // console.log(this.map.rays.length);\n\t\n\t // stop expansion of current ray\n\t this.direction.x = 0;\n\t this.direction.y = 0;\n\t\n\t return true;\n\t } else {\n\t return false;\n\t }\n\t }", "function collision(sharkObject, fishObject) {\n var objectOne = $(sharkObject);\n var objectTwo = $(fishObject);\n var objectOneX = objectOne.offset().left;\n var objectOneW = objectOne.width();\n var objectOneY = objectOne.offset().top;\n var objectOneH = objectOne.height();\n var objectTwoX = objectTwo.offset().left;\n var objectTwoW = objectTwo.width();\n var objectTwoY = objectTwo.offset().top;\n var objectTwoH = objectTwo.height();\n if (objectOneY + objectOneH < objectTwoY || objectTwoY + objectTwoH < objectOneY || objectTwoX + objectTwoW < objectOneX || objectOneX + objectOneW < objectTwoX) {\n return false;\n }\n else {\n return true;\n }\n}", "function checkCollisionPoint( s, x, y ) {\n return ( s.x - s.img.width/2 < x && s.x + s.img.width/2 > x && s.y - s.img.height/2 < y && s.y + s.img.height/2 > y );\n}", "function collision(head, tabSnake){\n for(let i = 0; i < tabSnake.length; i++){\n if(head.x == tabSnake[i].x && head.y == tabSnake[i].y){ \n return true;\n }\n \n }return false\n}", "checkCollisions() {\n let xPos = Math.round(this.x);\n let yPos = Math.round(this.y);\n let approxXpos = xPos + 20;\n let approxYpos = yPos + 20;\n if ((player.x >= xPos && player.x <= approxXpos) && (player.y >= yPos && player.y <= approxYpos)) {\n player.x = 200;\n player.y = 420;\n player.lives--;\n player.livesText.textContent = player.lives;\n\n }\n }", "function compute_collision() {\n for (var i = 0; i < elements.length; i++) {\n // Compute collision with wall\n if ((elements[i].object.x\n - elements[i].center.x) <= 0) {\n elements[i].speed.x = \n Math.abs(elements[i].speed.x);\n elements[i].real_coord.x = \n elements[i].object.x = \n elements[i].center.x + 1;\n }\n else if ((elements[i].object.x + \n elements[i].center.x) >= world_width) {\n elements[i].speed.x = \n - Math.abs(elements[i].speed.x);\n elements[i].real_coord.x = \n elements[i].object.x = \n world_width - elements[i].center.x - 1;\n }\n if ((elements[i].object.y\n - elements[i].center.y) <= 0) {\n elements[i].speed.y = \n Math.abs(elements[i].speed.y);\n elements[i].real_coord.y = \n elements[i].object.y = \n elements[i].center.y + 1;\n }\n else if((elements[i].object.y + \n elements[i].center.y) >= world_height) {\n elements[i].speed.y = \n - Math.abs(elements[i].speed.y);\n elements[i].real_coord.y = \n elements[i].object.y =\n world_height - elements[i].center.y - 1;\n }\n }\n }" ]
[ "0.7815291", "0.7584494", "0.72525024", "0.72525024", "0.72280777", "0.71984136", "0.71654373", "0.7127391", "0.71147245", "0.7076632", "0.70550996", "0.70301557", "0.7013475", "0.7010389", "0.6982803", "0.69723916", "0.69542193", "0.6946078", "0.6944615", "0.69343364", "0.6933118", "0.69307435", "0.6927367", "0.692087", "0.6908681", "0.68978643", "0.6897775", "0.6882674", "0.6881064", "0.6871422", "0.6871422", "0.68505", "0.6847541", "0.6842154", "0.68401587", "0.68399334", "0.68321234", "0.6830514", "0.6822206", "0.6797947", "0.6795681", "0.6795065", "0.67687523", "0.67685443", "0.67587686", "0.67527086", "0.6749505", "0.67426646", "0.67386514", "0.6732845", "0.6722624", "0.67193156", "0.6716922", "0.6715606", "0.67135495", "0.6711446", "0.6704749", "0.6704448", "0.6685669", "0.66856086", "0.6680384", "0.66781676", "0.6677338", "0.6675226", "0.6675023", "0.6663194", "0.66630435", "0.6652501", "0.66450685", "0.6644427", "0.664126", "0.6634014", "0.6628293", "0.66177434", "0.6613983", "0.66070557", "0.66057116", "0.6605225", "0.66044337", "0.6603647", "0.66016144", "0.6597442", "0.6593025", "0.6577275", "0.65755445", "0.65702546", "0.65675", "0.6563013", "0.6561966", "0.65575707", "0.65568113", "0.6552671", "0.65509397", "0.6548848", "0.65459067", "0.65455055", "0.6537743", "0.6535355", "0.6528105", "0.65277004", "0.6523923" ]
0.0
-1
set the mouseX and mouseY offsets so the crosshair looks more centered
aim() { this.aimX = mouseX - (this.sprite.width / 2 - 33); this.aimY = mouseY - ((this.sprite.height / 2) + 10); image(this.crosshair, this.aimX, this.aimY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderCrosshairUpdateLogic () {\n crosshairX = SI.game.Renderer.getScene().getMouseX() - crosshairSpriteHalfSize;\n crosshairY = SI.game.Renderer.getScene().getMouseY() - crosshairSpriteHalfSize;\n }", "changeMousePos(x, y) {\n\t\tvar rect = this.canvas.getBoundingClientRect();\n\t\tthis.mousePos.x = x - rect.left;\n\t\tthis.mousePos.y = y - rect.top;\n\t}", "function drawCrosshair(x, y) {\n var r = 6.5 * window.innerWidth / window.outerWidth;\n\n x = floor(x);\n y = floor(y);\n\n for (var n = 0 ; n < 2 ; n++) {\n _g.strokeStyle = n == 0 ? backgroundColor : defaultPenColor;\n _g.lineWidth = bgClickCount == 1 ? 1 : 3;\n\n _g_beginPath();\n _g_moveTo(x - r, y);\n _g_lineTo(x + r, y);\n _g_stroke();\n\n _g_beginPath();\n _g_moveTo(x, y - r);\n _g_lineTo(x, y + r);\n _g_stroke();\n }\n }", "function mouseClicked() {\n if ((mouseX >= 0 & mouseX <= width) & (mouseY >= 0 & mouseY <= height)) {\n master.origin = [mouseX - 5, mouseY - 5];\n }\n}", "function setMousePosition(e) {\n mouseX = e.clientX - canvasPos.x;\n mouseY = e.clientY - canvasPos.y;\n }", "updateCrosshairDisplay () {\n this.axisElements['plot-marker']\n .selectAll('line.crosshair')\n .style('display', this.showDoseProfile() ? '' : 'none')\n }", "function ChartMouseMoveHandler(e){\r\n if(global_chart){\r\n e = global_chart.pointer.normalize(e);\r\n if(global_chart.isInsidePlot(e.chartX - global_chart.plotLeft, e.chartY - global_chart.plotTop)){\r\n mouse_cursor_center = global_chart.xAxis[0].toValue(e.chartX);\r\n } else {\r\n mouse_cursor_center = null;\r\n }\r\n \r\n }\r\n \r\n}", "function on_mousemove(event){\n\tif(event.offsetX) {\n\t\tmouseX = event.offsetX;\n\t\tmouseY = event.offsetY;\n\t\t}\n\telse if(event.layerX) {\n\t\tmouseX = event.layerX;\n\t\tmouseY = event.layerY;\n\t\t}\n\tmouse_pos = [mouseX, mouseY];\n\t}", "function setMousePos(event, game, canvas) {\n\tvar rect = canvas.getBoundingClientRect();\n\n game.mouse_x = event.clientX - rect.left;\n game.mouse_y = event.clientY - rect.top;\n}", "setMouseOffset(nonScaledMouse, point) {\n this.mouseOffsetX = point.x;\n this.mouseOffsetY = point.z;\n this.nonScaledMouseOffsetY = nonScaledMouse.y;\n }", "function crosshair(event) {\n\t// get the html element tooltip, make sure it doesn't show\n\tvar tooltip_element = document.getElementById('tooltip');\n\ttooltip_element.style.display=\"none\";\n\n\t// get values from the event that's done on overlay canvas\n\tvar pagex = event.pageX;\n\tvar pagey = event.pageY;\n\t// subtract mouseposition.left from pagex to get canvasx\n\tvar canvasx = pagex - mouseposition.left;\n\t// subtract mouseposition.top from pagey to get canvasy\n\tvar canvasy = pagey - mouseposition.top;\n\n\t// get the current day the mouse is on\n\tvar crosshairx = canvasx / 2;\n\t// round to nearest integer\n\tvar mouse_on_day = Math.round(crosshairx);\n\t// get the temperature for that day\n\tvar degrees_on_day = myarray[mouse_on_day].temperature;\n\t// transform the temperature to its y-value on the canvas\n\t// since the createTransform was for the base canvas, substract 75 because the overlay canvas starts lower\n\tvar crosshairy = transform(degrees_on_day)-75;\n\n\t// calculate y-position of x axis of overlay canvas\n\tvar x_axis_overlay = 375 + mouseposition.top;\n\n\tvar radius_of_outer_circle = 10;\n\n\tctx2.clearRect(0,0,732,400);\n\n\t// draw vertical hair, lower part\n\tctx2.beginPath();\n\tctx2.strokeStyle = \"#000\";\n\tctx2.moveTo((mouse_on_day*2),(crosshairy+radius_of_outer_circle));\n\tctx2.lineTo((mouse_on_day*2),400);\n\tctx2.closePath();\n\tctx2.stroke();\n\n\t// draw vertical hair, higher part\n\tctx2.beginPath();\n\tctx2.strokeStyle = \"#000\";\n\tctx2.moveTo((mouse_on_day*2),0);\n\tctx2.lineTo((mouse_on_day*2),(crosshairy-radius_of_outer_circle));\n\tctx2.closePath();\n\tctx2.stroke();\n\n\t// draw horizontal hair, left part\n\tctx2.beginPath();\n\tctx2.strokeStyle = \"#000\";\n\tctx2.moveTo((mouse_on_day*2-radius_of_outer_circle),crosshairy);\n\tctx2.lineTo(0,crosshairy);\n\tctx2.closePath();\n\tctx2.stroke();\n\n\t// draw horizontal hair, right part\n\tctx2.beginPath();\n\tctx2.strokeStyle = \"#000\";\n\tctx2.moveTo((mouse_on_day*2+radius_of_outer_circle),crosshairy);\n\tctx2.lineTo(731,crosshairy);\n\tctx2.closePath();\n\tctx2.stroke();\n\n\t// draw outer circle\n\tctx2.beginPath();\n\tctx2.arc((mouse_on_day*2),crosshairy,radius_of_outer_circle,0,2*Math.PI);\n\tctx2.stroke();\n\n\t// draw inner circle\n\tctx2.beginPath();\n\tctx2.arc((mouse_on_day*2),crosshairy,3,0,2*Math.PI);\n\tctx2.stroke();\n\n\t/*\n\tTooltip\n\t*/\n\tfunction tooltip() {\n\t\t// display the element\n\t\ttooltip_element.style.display=\"inline\";\n\t\t// calculate what value the left-margin of the tooltip should be\n\t\tvar lmargin = mouse_on_day*2+250-200 + 'px';\n\t\t// change the left margin to let the tooltip move with the mouse\n\t\ttooltip_element.style.marginLeft=lmargin;\n\t\t// get the full date string from the array that belongs to the current date\n\t\tvar full_date = myarray[mouse_on_day].date;\n\t\t// change the text in the div\n\t\ttooltip_element.textContent = 'On ' + full_date + ' it was ' + degrees_on_day + '℃';\n\t}\n\t// only call the tooltip when some time has passed\n\tsetTimeout(tooltip, 1000);\n}", "function createCrosshair() {\n let divTarget = document.createElement(\"div\");\n divTarget.style.zIndex = \"98\";\n divTarget.style.width = \"5px\";\n divTarget.style.height = \"30px\";\n divTarget.style.background = \"white\";\n divTarget.style.position = \"absolute\";\n divTarget.style.top = \"0\";\n divTarget.style.left = \"0\";\n divTarget.style.right = \"0\";\n divTarget.style.bottom = \"0\";\n divTarget.style.margin = \"auto\";\n divTarget.style.zIndex = \"99\";\n let divTarget2 = document.createElement(\"div\");\n divTarget.style.zIndex = \"99\";\n divTarget2.style.width = \"30px\";\n divTarget2.style.height = \"5px\";\n divTarget2.style.background = \"white\";\n divTarget2.style.position = \"absolute\";\n divTarget2.style.top = \"0\";\n divTarget2.style.left = \"0\";\n divTarget2.style.right = \"0\";\n divTarget2.style.bottom = \"0\";\n divTarget2.style.margin = \"auto\";\n divTarget2.style.zIndex = \"99\";\n document.getElementById(\"body\").appendChild(divTarget);\n document.getElementById(\"body\").appendChild(divTarget2);\n}", "function mouseTracker(){\n\tif(jQuery('#mouse-tracker-wrap').length){\n\t\tdocument.querySelector('#mouse-tracker-wrap').onmousemove = (e) => {\n\t\t\tconst x = e.pageX - e.target.offsetLeft\n\t\t\tconst y = e.pageY - e.target.offsetTop\n\n\t\t\tvar y1 = e.pageY;\n\t\t\tvar y2 = e.target.offsetTop;\n\t\t\tconsole.log(x);\n\t\t\tconsole.log(y);\n\n\t\t\te.target.style.setProperty('--x', `${ x }px`)\n\t\t\te.target.style.setProperty('--y', `${ y }px`)\n\t\t}\n\t}\t\n}", "_setMousePosition(e) {\n this.mouse.x = e.x - this._rect.left;\n this.mouse.y = e.y - this._rect.top;\n }", "function handleSelection(event) {\n calculateImageScale();\n var cH = $('#crosshair-h'), cV = $('#crosshair-v');\n var position = globals.image.offset();\n if (event.pageX > position.left &&\n event.pageX < position.left + globals.image.width() &&\n event.pageY > position.top &&\n event.pageY < position.top + globals.image.height()) {\n cH.show();\n cV.show();\n gMousepos.show();\n\n cH.css('top', event.pageY + 1);\n cV.css('left', event.pageX + 1);\n cV.css('height', globals.image.height() - 1);\n cV.css('margin-top', position.top);\n cH.css('width', globals.image.width() - 1);\n cH.css('margin-left', position.left);\n\n gMousepos.css({\n top: (event.pageY) + 'px',\n left: (event.pageX) + 'px'\n }, 800);\n gMousepos.text(\n '(' + Math.round((event.pageX - position.left) * globals.imageScaleWidth) + ', ' +\n Math.round((event.pageY - position.top) * globals.imageScaleHeight) + ')');\n event.stopPropagation();\n }\n else{\n cH.hide();\n cV.hide();\n gMousepos.hide();\n }\n tool.handleMousemove(event);\n }", "function handleMouseMove(evt){\n\t\tdocument.getElementById(\"box\").style.cursor=\"crosshair\";\n\t}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.mouseover = true;\n this.stroke = 3;\n }\n else {\n this.mouseover = false;\n this.stroke = 2;\n }\n }", "function setup() {\n canvas = createCanvas(windowWidth, 200);\n canvas.style('z-index', '-1')\n rectMode(CENTER);\n xPos = mouseX/120;\n yPos = mouseY/150;\n}", "function mouseOverGraphic(ev) {\n map.setMapCursor(\"crosshair\");\n}", "function updateMouse(event)\r\n{\r\n\tvar rect = canvas.getBoundingClientRect();\r\n\tmouse.x = event.clientX - rect.left;\r\n mouse.y = event.clientY - rect.top;\r\n}", "function mouseXY(e) {\r\n\t\t\t\tpageX = e.pageX;\r\n\t\t\t\tpageY = e.pageY;\r\n\t\t\t}", "function onMouseMove( event ) {\n\tmouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;\n\tmouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;\n}", "function _onMouseMove(event) {\n $.mouse.x = Graphics.pageToCanvasX(event.pageX);\n $.mouse.y = Graphics.pageToCanvasY(event.pageY);\n }", "setMouse() {\n let rect = this.canvas.getBoundingClientRect();\n let mouse = this.mouse;\n\n if (mouse &&\n mouse.x && mouse.x >= rect.left && mouse.x <= rect.right &&\n mouse.y && mouse.y >= rect.top && mouse.y <= rect.bottom) {\n this.activeProgram.setUniform(\"u_mouse\", (mouse.x - rect.left)/this.canvas.width, (this.canvas.height - (mouse.y - rect.top))/this.canvas.height, mouse.z);\n }\n }", "function onMouseMove( event ) {\n // normalize mouse point\n mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;\n mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;\n\n}", "function interMouseMove() {\n var m = d3.mouse(this);\n line.attr(\"x2\", m[0]-3)\n .attr(\"y2\", m[1]-3);\n}", "function interMouseMove() {\n var m = d3.mouse(this);\n line.attr(\"x2\", m[0]-3)\n .attr(\"y2\", m[1]-3);\n}", "mouseMove(x, y) {}", "function setMouseOut(){\n\t\tglobals.mouseCoords.x = -1;\n\t\tglobals.mouseCoords.y = -1;\n\t}", "function getMousePos() {\n\t\t\t\t\t\t\treturn (mouseTopPerc * 400) + 10;\n\t\t\t\t\t\t}", "function mouseMove() {\n /* jshint validthis: true */ // `this` is the D3 svg object\n var m = d3.mouse(this);\n zoomHandler.center([\n m[0] - layoutOffset[0] - margin.left,\n m[1] - layoutOffset[1] - margin.top]);\n }", "function mouseXY(e){\r\n var rect = canvas.getBoundingClientRect();\r\n mouseX = e.x - rect.left;\r\n mouseY = e.y - rect.top;\r\n\r\n}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.stroke = 2;\n this.mouseover = true;\n }\n else {\n this.stroke = 1;\n this.mouseover = false;\n }\n }", "mouseMove(event) {\n this.pmouse = this.mouse.clone();\n\n if (event.offsetX) {\n this.mouse.x = event.offsetX;\n this.mouse.y = event.offsetY;\n } else {\n var clientRect = this.container.getBoundingClientRect();\n this.mouse.x = event.pageX - Math.round(clientRect.left + window.pageXOffset);\n this.mouse.y = event.pageY - Math.round(clientRect.top + window.pageYOffset);\n }\n }", "mouseMove(event) {\n this.pmouse = this.mouse.clone();\n\n if (event.offsetX) {\n this.mouse.x = event.offsetX;\n this.mouse.y = event.offsetY;\n } else {\n var clientRect = this.container.getBoundingClientRect();\n this.mouse.x = event.pageX - Math.round(clientRect.left + window.pageXOffset);\n this.mouse.y = event.pageY - Math.round(clientRect.top + window.pageYOffset);\n }\n }", "function mouseMove(event) {\n // Update the mouse coordinates\n data.input.mouse.x = event.clientX;\n data.input.mouse.y = event.clientY;\n}", "function mouseClicked(){\n // the x position will take the value of the horizontal mouse position\n xPos=mouseX;\n // the y position will take the value of the vertical mouse position\n yPos = mouseY;\n}", "function handleMouseMove(evt) {\r\n\r\n g_mouseX = evt.clientX - g_canvas.offsetLeft;\r\n g_mouseY = evt.clientY - g_canvas.offsetTop;\r\n \r\n}", "function adjustMouseX (mouseX) {\n return mouseX-chart1.offset-$('.kineticjs-content').offset().left;\n}", "function central_mouse() {\n var window = getCurrentWindow();\n if (window === undefined) {\n return;\n }\n set_mouse_position_for_window_center(window);\n}", "function documentMouseMoveHandler(event){\n mouseX = event.clientX * scale;\n mouseY = event.clientY * scale;\n }", "function onMouseMove(event) {\n\tmousePos = event.point;\n}", "mouseLister(x,y)\n\t{\n\t\tthis.planeX = x;\n\t\tthis.planeY = y;\n\t}", "function mouseCoordinates(e){\n\n var horizontalPosition = windowWidth - e.clientX - 26;\n var verticalPosition = windowHeight - e.clientY - 26;\n\n CIRCLE.style.left = horizontalPosition + 'px';\n CIRCLE.style.top = verticalPosition + 'px';\n\n}", "function showCrosshair(e, show){\n if (show){\n var mouseX = d3.mouse(e)[0];\n var mouseY = d3.mouse(e)[1];\n\n hLine.attr(\"y1\", mouseY).attr(\"y2\", mouseY).style(\"opacity\", 1);\n vLine.attr(\"x1\", mouseX).attr(\"x2\", mouseX).style(\"opacity\", 1);\n }else{\n hLine.style(\"opacity\", 0);\n vLine.style(\"opacity\", 0);\n } \n}", "mouseMove(prev, pt) {}", "mousemoved(mouseX, mouseY){\n // check if the mouse is to the left or right of the center of the outer eye\n if(mouseX < this.midX){\n // if the mouse is on the left, find the difference between the x coordinate of the mouse and the left hand side of the page and turn that into a percentage\n var x = (mouseX - this.midX) / this.midX;\n }else if(mouseX > this.midX){\n // if the mouse is on the right, find the difference between the x coordinate of the mouse and right hand side of the page and turn that into a percentage\n var x = (mouseX - this.midX) / (window.innerWidth - this.midX);\n }else{\n // if the mouse is in line with the eye, center the eye\n var x = 0;\n };\n // check if the mouse is to the above or below of the center of the outer eye\n if(mouseY < this.midY){\n // if the mouse is on the above, find the difference between the y coordinate of the mouse and the top of the page and turn that into a percentage\n var y = (mouseY - this.midY) / this.midY;\n }else if(mouseY > this.midY){\n // if the mouse is on the below, find the difference between the x coordinate of the mouse and bottom of the page and turn that into a percentage\n var y = (mouseY - this.midY) / (window.innerHeight - this.midY);\n }else{\n // if the mouse is in line with the eye, center the eye\n var y = 0;\n };\n // multiply the 2 values by the movenent factor (set earlier) and turn into a percentage\n x = this.movement * x + \"%\";\n y = this.movement * y + \"%\";\n // finally move the iris\n this.iris.style.transform = \"translate(\"+ x +\",\"+ y +\")\";\n }", "function mousemove(event) {\n y = event.pageY - startY;\n x = event.pageX - startX;\n element.css({\n top: y + 'px',\n left: x + 'px'\n });\n }", "function documentMouseMoveHandler(event){\n game.mouse.position.x = event.clientX - 10;\n game.mouse.position.y = event.clientY - 10;\n}", "function canvasMouseMove(e) {\n\tblockus.setMousePosition(getCursorPosition(e));\n}", "function validatePosition(){\n if (cursorPos.x < 0){\n cursorPos.x = 0;\n }\n\n if (cursorPos.x + img.width > canvasCrosshair.width){\n cursorPos.x = canvasCrosshair.width - img.width;\n }\n\n if (cursorPos.y < 0){\n cursorPos.y = 0;\n }\n\n if (cursorPos.y +img.height > canvasCrosshair.height){\n cursorPos.y = canvasCrosshair.height - img.height;\n }\n\n}", "function cursorCoords(x, y) {\r\n // update global chart width and height dimensions\r\n aleph.chartWidth = svgWidth;\r\n aleph.chartHeight = svgHeight;\r\n var currentSelectedYear = aleph.formatDate(aleph.xYear);\r\n\r\n // modify class definiton of tooltip 'g' element and current offset position based on mouse cursor position\r\n d3.selectAll(\".aleph-toolTip-Div\")\r\n .moveToFront()\r\n .classed(\"aleph-hide\", false)\r\n .style(\"left\", function () {\r\n if (x < aleph.chartWidth / 2) {\r\n d3.selectAll(\".aleph-mouseover-textlabel\")\r\n .style(\"text-anchor\", \"end\")\r\n .attr(\"transform\", \"translate(-20,3)\");\r\n\r\n return x + 15 + \"px\"; // left half\r\n } else {\r\n d3.selectAll(\".aleph-mouseover-textlabel\")\r\n .style(\"text-anchor\", \"start\")\r\n .attr(\"transform\", \"translate(10,3)\");\r\n\r\n return x - aleph.toolTipDimensions.width - 15 + \"px\"; // right half\r\n }\r\n })\r\n .style(\"top\", function () {\r\n if (y < aleph.chartHeight / 2) {\r\n return y + 15 + \"px\"; // top half\r\n } else {\r\n return (\r\n y -\r\n d3.selectAll(\".aleph-toolTip-Div\").style(\"height\").replace(\"px\", \"\") +\r\n \"px\"\r\n ); // bottom half\r\n }\r\n });\r\n\r\n // upate main tootlitp title.\r\n d3.selectAll(\".aleph-toolTipTitle-label\").html(currentSelectedYear);\r\n\r\n // initialise local array to help sort information content to display on tooltip\r\n var unsortedScenarioArray = [];\r\n var sortedScenarioArray = [];\r\n\r\n // cycle through all currently displayed scenarios, and push into a local array ...\r\n for (var scenario in aleph.scenarios) {\r\n unsortedScenarioArray.push(aleph.scenarios[scenario]);\r\n } // end for loop\r\n\r\n // sort local storage array based on summed values for each tiem series year.\r\n sortedScenarioArray = unsortedScenarioArray.sort(function (a, b) {\r\n return (\r\n +b.yearSummedValues[currentSelectedYear] -\r\n +a.yearSummedValues[currentSelectedYear]\r\n );\r\n });\r\n\r\n // remove the main tooltip div\r\n d3.selectAll(\".aleph-tooltip-scenario-div\").remove();\r\n\r\n d3.selectAll(\".toolTip-content-to-Remove\").remove();\r\n d3.selectAll(\".aleph-toolTip-Div\")\r\n .append(\"table\")\r\n .attr(\"class\", \"tooltip-table toolTip-content-to-Remove\")\r\n .style(\"width\", \"100%\")\r\n .style(\"height\", \"100%\");\r\n\r\n d3.selectAll(\".tooltip-table\").append(\"tr\").attr(\"class\", \"table-header-row\");\r\n\r\n var headers = [\r\n \"Marker\",\r\n \"Population Size\",\r\n \"% Total Year UK Pop.\",\r\n \"Scenario Criteria*\",\r\n ];\r\n\r\n headers.forEach(function (d, i) {\r\n d3.selectAll(\".table-header-row\")\r\n .append(\"td\")\r\n .attr(\"class\", \"table-header-row-header-cell header-cell-\" + i)\r\n .style(\"width\", \"auto\");\r\n\r\n d3.selectAll(\".table-header-row-header-cell.header-cell-\" + i)\r\n .append(\"label\")\r\n .attr(\r\n \"class\",\r\n \"table-header-row-header-cell-label header-cell-label-\" + i\r\n )\r\n .html(headers[i]);\r\n });\r\n\r\n sortedScenarioArray.forEach(function (d, i) {\r\n var rowNumber = i;\r\n d3.selectAll(\".tooltip-table\")\r\n .append(\"tr\")\r\n .attr(\r\n \"class\",\r\n \"tooltip-table-row toolTip-content-to-Remove tooltip-table-row-\" +\r\n rowNumber\r\n )\r\n .style(\"width\", \"100%\");\r\n\r\n for (var columnNumber = 0; columnNumber < headers.length; columnNumber++) {\r\n d3.selectAll(\".tooltip-table-row-\" + rowNumber)\r\n .append(\"td\")\r\n .attr(\"class\", function () {\r\n return \"table-dataCell table-dataCell-\" + columnNumber;\r\n });\r\n\r\n if (columnNumber == 0) {\r\n d3.selectAll(\".tooltip-table-row-\" + rowNumber)\r\n .selectAll(\".table-dataCell-\" + columnNumber)\r\n .append(\"div\")\r\n .attr(\"class\", \"aleph-tooltip-marker-circle-div\")\r\n .style(\"background-color\", d.lineColour);\r\n } else {\r\n d3.selectAll(\".tooltip-table-row-\" + rowNumber)\r\n .selectAll(\".table-dataCell-\" + columnNumber)\r\n .append(\"label\")\r\n .attr(\r\n \"class\",\r\n \"table-cell-text-content table-cell-text-content-\" + columnNumber\r\n )\r\n .html(function () {\r\n if (columnNumber == 1) {\r\n return numberWithCommas(d.yearSummedValues[currentSelectedYear]);\r\n } else if (columnNumber == 2) {\r\n return (\r\n (\r\n (d.yearSummedValues[currentSelectedYear] /\r\n aleph.dataYearPopulations[\r\n aleph.years.indexOf(currentSelectedYear)\r\n ]) *\r\n 100\r\n ).toFixed(2) + \"%\"\r\n );\r\n } else if (columnNumber == 3) {\r\n var string = \"\";\r\n\r\n if (\r\n d.genderString.split(\",\").length == 2 &&\r\n d.ethnicityString.split(\",\").length == 6 &&\r\n d.agebandString.split(\",\").length == 9 &&\r\n d.nationalitiesString.split(\",\").length == 2 &&\r\n d.religionsString.split(\",\").length == 4 &&\r\n d.healthString.split(\",\").length == 7 &&\r\n d.qualificationString.split(\",\").length == 4\r\n ) {\r\n string = \"Full Population\";\r\n } else {\r\n if (d.genderString.split(\",\").length != 2) {\r\n d.genderString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.genders[d - 1] + \", \";\r\n });\r\n string =\r\n \"<span class='spanBold'>Genders:</span> \" +\r\n string.substr(0, string.length - 2) +\r\n \"</br>\";\r\n }\r\n\r\n if (d.ethnicityString.split(\",\").length != 6) {\r\n string =\r\n string + \"<span class='spanBold'> Ethnicities:</span> \";\r\n d.ethnicityString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.ethnicities[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n\r\n if (d.agebandString.split(\",\").length != 9) {\r\n string =\r\n string + \"<span class='spanBold'> Age Bands:</span> \";\r\n d.agebandString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.ageBands[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n\r\n if (d.nationalitiesString.split(\",\").length != 2) {\r\n string =\r\n string + \"<span class='spanBold'> Nationalities:</span> \";\r\n d.nationalitiesString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.nationalities[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n\r\n if (d.religionsString.split(\",\").length != 4) {\r\n string =\r\n string + \"<span class='spanBold'> Religions:</span> \";\r\n d.religionsString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.religions[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n\r\n if (d.healthString.split(\",\").length != 7) {\r\n string = string + \"<span class='spanBold'> Health:</span> \";\r\n d.healthString.split(\",\").forEach(function (d, i) {\r\n string = string + aleph.codes.health[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n\r\n if (d.qualificationString.split(\",\").length != 4) {\r\n string =\r\n string + \"<span class='spanBold'> Qualifications:</span> \";\r\n d.qualificationString.split(\",\").forEach(function (d) {\r\n string = string + aleph.codes.qualifications[d - 1] + \", \";\r\n });\r\n string = string.substr(0, string.length - 2) + \"</br>\";\r\n }\r\n }\r\n\r\n return string;\r\n }\r\n });\r\n }\r\n }\r\n });\r\n\r\n d3.selectAll(\".aleph-toolTip-Div\")\r\n .append(\"label\")\r\n .attr(\"class\", \"aleph-tooltip-footer toolTip-content-to-Remove\")\r\n .text(\r\n \"* Only criteria are listed for those selections modified from 'Full Population'.\"\r\n );\r\n\r\n d3.selectAll(\".aleph-toolTip-Div\").moveToFront();\r\n\r\n return;\r\n}", "constructor(mouseX, mouseY) {\n super();\n this._MouseX = mouseX;\n this._MouseY = mouseY;\n }", "function mouse_move_handler(e) {\n //Saves the previous coordinates\n mouse.px = mouse.x;\n mouse.py = mouse.y;\n\n //Sets the new coordinates\n mouse.x = e.offsetX || e.layerX;\n mouse.y = e.offsetY || e.layerY;\n }", "function setMousePosition(e) {\n var ev = e || window.event; //Moz || IE\n if (ev.pageX) { //Moz\n mouse.x = ev.pageX + window.pageXOffset;\n mouse.y = ev.pageY + window.pageYOffset;\n } else if (ev.clientX) { //IE\n mouse.x = ev.clientX + document.body.scrollLeft;\n mouse.y = ev.clientY + document.body.scrollTop;\n }\n }", "function mousePressed() {\n\tx = 40;//Cada vez que pressiona o mouse posicao x recebe o valor\n\ty = 10;//Cada vez que pressiona o mouse posicao y recebe o valor\n}", "function adapt_mouse_pos_for_trackball(evt) {\n var canvas_pos = viewport_offset_for_element(canvas);\n return {\n x: evt.clientX - canvas_pos.x - CANVAS_SIZE / 2,\n y: evt.clientY - canvas_pos.y - CANVAS_SIZE / 2\n };\n }", "function mouseSeeker() {\n\tstroke(230);\n\tline(mouseX, 0, mouseX, height);\n\tline(0, mouseY, width, mouseY);\n\t//color(0,0);\n\t//rect(0,0,959,383);\n}", "function themeMouseMove() {\n screen_has_mouse = true;\n }", "externalMouseMove() {\n this._strikeMouseMove();\n this._localPointer._mouseX = this.getPointer()._mouseX;\n this._localPointer._mouseY = this.getPointer()._mouseY;\n }", "function onMouseMove(event) {\n mousePos = event.point;\n}", "function setCursor(x, y, select){\n cursor.x = x\n cursor.y = y\n cursor.selected = select\n display.setCursor(x,y,select)\n }", "function readMouseXY(event) {\n mouse.x = event.pageX - theCanvas[0].offsetLeft;\n mouse.y = event.pageY - theCanvas[0].offsetTop;\n }", "function onMouseMove(event) {\r\n\r\n // Update the mouse variable\r\n event.preventDefault();\r\n mouse.x = (event.clientX / window.innerWidth) * 2 - 1;\r\n mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;\r\n}", "function handleMouseMove(event) {\n // here we are converting the mouse position value received\n // to a normalized value varying between -1 and 1;\n // this is the formula for the horizontal axis:\n\n let tx = -1 + (event.clientX / WIDTH) * 2;\n\n // for the vertical axis, we need to inverse the formula\n // because the 2D y-axis goes the opposite direction of the 3D y-axis\n\n let ty = 1 - (event.clientY / HEIGHT) * 2;\n mousePos = { x: tx, y: ty };\n}", "on_mousemove(e, localX, localY) {\n\n }", "function onMouseMove(event) {\n\tmousePosition=event;\n}", "static movingMouse(canvas, offsetX){\r\n\r\n\t}", "function drawRect() {\n changeCursor(\"crosshair\")\n coordinates = getCanvasMousePosition(canvas, event)\n if(coordinates.x > leftCorner.x && coordinates.y > leftCorner.y)\n {\n drawDragRect(canvas, event, leftCorner)\n }\n }", "function handleMouseMove(event) {\n\t// here we are converting the mouse position value received \n\t// to a normalized value varying between -1 and 1;\n\t// this is the formula for the horizontal axis:\n\t\n\tlet tx = -1 + (event.clientX / WIDTH) * 2;\n\n\t// for the vertical axis, we need to inverse the formula \n\t// because the 2D y-axis goes the opposite direction of the 3D y-axis\n\t\n\tlet ty = 1 - (event.clientY / HEIGHT) * 2;\n\tmousePos = {x:tx, y:ty};\n\n}", "function onMouseMove(event) {\n // Update the mouse variable\n mouse.x = (event.clientX / window.innerWidth) * 2 - 1;\n mouse.y = - (event.clientY / window.innerHeight) * 2 + 1;\n\n mouse.x = Math.round((mouse.x + 1) * window.innerWidth / 2);\n mouse.y = Math.round((- mouse.y + 1) * window.innerHeight / 2);\n}", "function mousePressed() {\n startMouseX = mouseX;\n startMouseY = mouseY;\n }", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.mouseover = true;\n }\n else {\n this.mouseover = false;\n }\n }", "function onDocumentMouseMove(event) {\n\tmouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;\n\tmouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;\n}", "setMouseControl() {\n let mousePositionControl = new ol.control.MousePosition({\n coordinateFormat: ol.coordinate.createStringXY(4),\n projection: 'EPSG:4326',\n // comment the following two lines to have the mouse position be placed within the map.\n //className: 'custom-mouse-position',\n //target: document.getElementById('mouse-position'),\n undefinedHTML: '&nbsp;'\n });\n return mousePositionControl;\n }", "function mouseDragged() {\n onceMoved = true;\n mouseMove = true;\n \n xCentreCoord -= (1/coordToPixelRatio)*(mouseX - startMouseX);\n yCentreCoord += (1/coordToPixelRatio)*(mouseY - startMouseY);\n\n startMouseX = mouseX;\n startMouseY = mouseY;\n }", "function handleMouseMove(event) {\n\n\t// here we are converting the mouse position value received \n\t// to a normalized value varying between -1 and 1;\n\t// this is the formula for the horizontal axis:\n\t\n\tvar tx = -1 + (event.clientX / sceneWidth)*2;\n\n\t// for the vertical axis, we need to inverse the formula \n\t// because the 2D y-axis goes the opposite direction of the 3D y-axis\n\t\n\tvar ty = 1 - (event.clientY / sceneHeight)*2;\n\tmousePos = {x:tx, y:ty};\n\n}", "function onWindowMouseMove( event )\n\t\t{\n\t\t\tmouseX = event.clientX-$(canvasContainer).offset().left;\n\t\t\tmouseY = event.clientY-$(canvasContainer).offset().top;\n\t\t\ttargetX += (mouseX-targetX)*0.2;\n\t\t\ttargetY += (mouseY-targetY)*0.2;\n\t\t}", "function mouseMoved(){\n stroke(r, g, b, 120);\n strokeWeight(5);\n fill(r, g, b, 100);\n ellipse(mouseX, mouseY, 10);\n}", "function setupMouseMove(){\n\t\tcanvas.addEventListener('mousemove', function(e){\n\t\t\t\tdocument.body.style.backgroundImage = \"url('')\";\n\t\t\t\t\n\t\t\t\tvar currentXMovement = e.movementX;\n\t\t\t\tcurrentRotateY += currentXMovement + prevX;\n\t\t\t\tprevX = currentXMovement;\n\t\t\t\tyaw = currentRotateY * rotateSpeed;\n\t\t\t\t\n\t\t\t\tvar currentYMovement = e.movementY;\n\t\t\t\tcurrentRotateX += currentYMovement + prevY;\n\t\t\t\tprevY = currentYMovement;\n\t\t\t\tpitch = -currentRotateX * rotateSpeed;\n\t\t\t\t\n\t\t\t\t// Stops the camera sticking to the bottom/top of scene\n\t\t\t\tif(pitch > 70){\n\t\t\t\t\tpitch = 70;\n\t\t\t\t\tcurrentRotateX = -850;\n\t\t\t\t}\n\t\t\t\tif(pitch < -70){\n\t\t\t\t\tpitch = -70;\n\t\t\t\t\tcurrentRotateX = 850;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Should be in radians first\n\t\t\t\tvar pitchInRadians = utility.toRadians(pitch);\n\t\t\t\tvar yawInRadians = utility.toRadians(yaw);\n\n\t\t\t\tcameraTarget[0] = Math.cos(pitchInRadians) * Math.cos(yawInRadians);\n\t\t\t\tcameraTarget[1] = Math.sin(pitchInRadians);\n\t\t\t\tcameraTarget[2] = Math.cos(pitchInRadians) * Math.sin(yawInRadians);\n\n\t\t\t\tm4.normalize(cameraTarget);\n\t\t});\t\t\n\t}", "function onMouseMove(move) \n{\n\t//pageX gives the mouse position and compares it to the canvas dimensions. The bar is then redrawn based on how much the mouse is moved and the canvas size.\n\tif (move.pageX > minx && move.pageX < maxx)\n\t{\n\t\txbar = Math.max(move.pageX - minx - (barwidth / 2), 0)\n\t\txbar = Math.min(canvaswidth - barwidth, xbar)\n\t}\n}", "onMouseMove(event) {\n\t\tthis.mouse.x = event.clientX / window.innerWidth * 2 - 1;\n\t\tthis.mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;\n\t\tthis.mouseUpdate();\n\t}", "function game_initmouse(x,y){\n\tgameinit_input.x=x;\n\tgameinit_input.y=y;\n}", "setMouseCursor (type = 'crosshair') {\n this.canvas.style.cursor = type;\n }", "hover(x, y){\n var self = this;\n self.startX = x || self.startX;\n self.startY = y || self.startY;\n self.draw(self.selected ? self.line.keyboard.keySelectedHoverBorderColor : self.line.keyboard.keyHoverBorderColor, true);\n }", "mouseLocationStart(e){\n this.xStart = e.offsetX;\n this.yStart = e.offsetY;\n }", "function setMouse(z) {\n var r = event.target.getBoundingClientRect();\n gl.cursor.x = (event.clientX - r.left ) / (r.right - r.left) * 2 - 1;\n gl.cursor.y = (event.clientY - r.bottom) / (r.top - r.bottom) * 2 - 1;\n if (z !== undefined)\n\t gl.cursor.z = z;\n }", "set Mouse0(value) {}", "function mouseMoved(){\n posY.push(mouseY); \n posX.push(mouseX);\n}", "function mouseMove(event) {\n\t//mouse x position in percentage\n\tvar x = (event.clientX / innerWidth)*100;\n\t//Whole numbers\n\tz=~~x;\n\t\n\t//Set value for HTML. 100-z mirrors the movement.\n\troot.style.setProperty('--mouse-x', 100-z+\"%\");\n\t\n\t//Test Values\n\t//document.getElementById('demoT').innerHTML = \"Mouse position once leave Div: \" + z;\n\t\n\t//Kills the centerCrop() while mouse is over the img\n\tstopTime();\n}", "mouseMove(evt, point) {\n this.setHover(this.topBlockAt(point));\n }", "function handleMouseMove(event) {\n var tx = -1 + (event.clientX / WIDTH) * 2;\n var ty = 1 - (event.clientY / HEIGHT) * 2;\n mousePos = {\n x: tx,\n y: ty\n };\n}", "function onMouseMove(event) {\n // calculate mouse position in normalized device coordinates\n // (-1 to +1) for both components\n mouse.x = (event.clientX / window.innerWidth) * 2 - 1;\n mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;\n console.log('[' + mouse.x + ',' + mouse.y + ']')\n console.log('-------------------------------------')\n}", "function updateMousePosition(event){\n // get position on page of canvas\n var rect = canvas.getBoundingClientRect();\n var root = document.documentElement;\n\n // Get the mouse location - the document scrolling and bounding\n mouseX = event.clientX - rect.left - root.scrollLeft;\n mouseY = event.clientY - rect.top - root.scrollTop;\n\n // carCheat();\n \n}", "function mymousemove(e){\r\n\r\nvar currentX = e.clientX-canvas.offsetLeft;\r\nvar currentY = e.clientY-canvas.offsetTop;\r\nif(mouseevents==\"mousedown\"){\r\n\r\nctx.beginPath();\r\nctx.strokeStyle=color;\r\nctx.lineWidth=width;\r\nctx.arc(currentX, currentY, 40, 0, 360);\r\nctx.stroke();\r\n\r\n}\r\nlast_x=currentX;\r\nlast_y=currentY;\r\n\r\n}", "externalActiveMouseMove() {\n //TODO: check for mouse button active\n this._strikeActiveMouseMove();\n this._localPointer._mouseX = this.getPointer()._mouseX;\n this._localPointer._mouseY = this.getPointer()._mouseY;\n }", "updatePositions(e) {\n this.mouseX = e.clientX;\n this.mouseY = e.clientY;\n this.handleX = this.$handle.offset().left + this.$handle.outerWidth() / 2;\n this.handleY = this.$handle.offset().top + this.$handle.outerHeight() / 2;\n}", "__attachUpdateMouseCoordinatesEventListener() {\n let mouse = this.mouse;\n let myScene = this;\n myScene.canvasNode.addEventListener('mousemove', function (event) {\n mouse.x = ( (event.clientX - myScene.canvasNode.offsetLeft - 1) / myScene.canvasNode.clientWidth )* 2 - 1;\n mouse.y = - (( event.clientY - myScene.canvasNode.offsetTop - 1) / myScene.canvasNode.clientHeight ) * 2 + 1;\n });\n }", "function dispMouseCoord(){\t\t\t\t\t//used for debugging, put in main function\n\tctx.font = \"12px Arial\";\n\tctx.fillStyle = \"black\";\n\tctx.textAlign = \"left\";\n\tctx.fillText(`x: ${mousePos.x}, y: ${mousePos.y}`, 16, 16);\n}", "function SwatterCross() {\n ctx.beginPath();\n ctx.moveTo(mouse.x + 14, mouse.y + 27);\n ctx.lineTo(mouse.x + 43, mouse.y + 28);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n\n ctx.beginPath();\n ctx.moveTo(mouse.x + 28, mouse.y + 12);\n ctx.lineTo(mouse.x + 28, mouse.y + 42);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n\n ctx.beginPath();\n ctx.arc(mouse.x + 28, mouse.y + 27, 5, 0, Math.PI * 2, false);\n ctx.strokeStyle = '#D04D00';\n ctx.stroke();\n}" ]
[ "0.7471149", "0.6857028", "0.6661967", "0.6461135", "0.6459944", "0.6454804", "0.6432006", "0.64254874", "0.6415586", "0.63053364", "0.62903816", "0.6275102", "0.6270356", "0.6257311", "0.6241621", "0.62300867", "0.6228995", "0.6214071", "0.6212384", "0.6211772", "0.6203972", "0.6195057", "0.6189135", "0.6187733", "0.6167145", "0.6166574", "0.6166574", "0.6159227", "0.6143856", "0.61299723", "0.60903835", "0.606533", "0.60606027", "0.6047684", "0.6047684", "0.6029641", "0.60239345", "0.60230166", "0.6019359", "0.6018927", "0.60044205", "0.6000698", "0.5994741", "0.5988609", "0.5985164", "0.59768814", "0.5973142", "0.5970894", "0.59629256", "0.5961857", "0.5948866", "0.59461385", "0.59414786", "0.5936496", "0.5930909", "0.591763", "0.5908908", "0.5903773", "0.59029865", "0.5901775", "0.58977556", "0.58976156", "0.5895351", "0.5893724", "0.588958", "0.58881867", "0.5885822", "0.5884988", "0.5876007", "0.587285", "0.58718294", "0.5870093", "0.58629715", "0.5854348", "0.5850588", "0.5850053", "0.58448917", "0.5844229", "0.58437705", "0.5841574", "0.58311605", "0.58240455", "0.5816003", "0.5813835", "0.5806683", "0.58006096", "0.5797882", "0.57936496", "0.5783479", "0.57808185", "0.57787853", "0.5772665", "0.5769837", "0.576474", "0.57521516", "0.5751858", "0.57376635", "0.5730334", "0.5727772", "0.5727632" ]
0.61546606
28
not implemented, unfortuantely. Couldn't get it to work. Want to go back to it
jump() { let yDistance = this.yPos - this.jumpSize; this.yPos -= this.jumpSpeed * yDistance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "static final private internal function m106() {}", "static private protected internal function m118() {}", "function StupidBug() {}", "transient private protected public internal function m181() {}", "transient final private protected internal function m167() {}", "static transient final protected internal function m47() {}", "static private internal function m121() {}", "static transient final private internal function m43() {}", "static transient final protected public internal function m46() {}", "static transient private protected internal function m55() {}", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "frame() {\n throw new Error('Not implemented');\n }", "static transient private protected public internal function m54() {}", "static private protected public internal function m117() {}", "transient final private internal function m170() {}", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "transient private public function m183() {}", "__previnit(){}", "transient final private protected public internal function m166() {}", "static transient final private protected internal function m40() {}", "upgrade() {}", "fixupFrame() {\n // stub, used by Chaos Dragon\n }", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "static transient private internal function m58() {}", "initiator() {\n throw new Error('Not implemented');\n }", "function _____SHARED_functions_____(){}", "method() {\n throw new Error('Not implemented');\n }", "static notImplemented_() {\n throw new Error('Not implemented');\n }", "function kp() {\n $log.debug(\"TODO\");\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "static final protected internal function m110() {}", "static protected internal function m125() {}", "static final private protected public internal function m102() {}", "static transient final private protected public internal function m39() {}", "function Scdr() {\r\n}", "static transient final private protected public function m38() {}", "static transient private public function m56() {}", "static transient final protected function m44() {}", "function fm(){}", "static final private protected internal function m103() {}", "function jessica() {\n $log.debug(\"TODO\");\n }", "function fos6_c() {\n ;\n }", "preset () { return false }", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "transient final private public function m168() {}", "hacky(){\n return\n }", "_reflow() {\n this._init();\n }", "patch() {\n }", "static private public function m119() {}", "static final private public function m104() {}", "__fbpReady(){super.__fbpReady();//this._FBPTraceWires()\n}", "__fbpReady(){super.__fbpReady();//this._FBPTraceWires()\n}", "function fechaserver() {\n}", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "update()\n\t{ \n\t\tthrow new Error(\"update() method not implemented\");\n\t}", "function updateroster() {\n\n}", "function InitWebFlyPostBackManager(v6cc59){ return wdd9448.m52d93(v6cc59); }", "function wa(){}", "function StackFunctionSupport() {\r\n}", "disorient(){\n\t\t//\n\t}", "function DWRUtil() { }", "function Mechanism() {\n\t }", "function Mechanism() {\n\t }", "function Mechanism() {\n\t }", "function Mechanism() {\n\t }", "unsee() {}", "__init7() {this._isEnabled = false;}", "function fixError() {\n /* exploit = \"installFix\";\n switch (checkFw()) {\n case \"7.02\":\n localStorage.setItem(\"exploit702\", SCMIRA702(\"miraForFix\"));\n document.location.href = \"mira.html\";\n break;\n case \"6.72\":\n let func2 = SCMIRA(\"c-code\");\n let func1 = SCMIRA(\"MiraForFix\");\n newScript(func1);\n newScript(func2);\n setTimeout(function () {\n loadPayload(\"Todex\");\n }, 8000);\n break;\n }*/\n}", "static transient final private public function m41() {}", "function JFather() {\r\n\t}", "static transient protected internal function m62() {}", "static ready() { }", "function AeUtil() {}", "function InitWebFlyPostBackManager(v09411){ return wdbb71.mb2499(v09411); }", "static first(context) {\n throw new Error(\"TODO: Method not implemented\");\n }", "function Main()\n {\n \n }", "function oldGLnk(target, description, linkData)\n{\n}", "function HTML5_SolutionStorage() {\n}", "refresh()\n\t{\n\t}", "_mapDeprecatedFunctionality(){\n\t\t//all previously deprecated functionality removed in the 5.0 release\n\t}", "function oob_system(){\n\t\ntest_find_conflict();\n}//end function oob_system", "function no_overlib() { return ver3fix; }", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function noop(){}// No operation performed.", "function Expt() {\r\n}" ]
[ "0.7205108", "0.70692784", "0.68558437", "0.678435", "0.6586199", "0.65379435", "0.6341079", "0.6324782", "0.6271534", "0.6258766", "0.62465733", "0.6101953", "0.6073968", "0.60264665", "0.5912936", "0.58836424", "0.58747494", "0.586811", "0.58423746", "0.5811706", "0.5798759", "0.5776804", "0.57726455", "0.5766687", "0.56745267", "0.5673179", "0.5631673", "0.5604811", "0.55766237", "0.5562988", "0.5562988", "0.55384314", "0.55379885", "0.5534883", "0.5524477", "0.55117357", "0.5482099", "0.545968", "0.545968", "0.545968", "0.54513484", "0.54509413", "0.54385567", "0.5436419", "0.5430775", "0.5428452", "0.5421061", "0.5394176", "0.5369641", "0.5365719", "0.53613925", "0.5330252", "0.53080606", "0.5303395", "0.5303395", "0.5275942", "0.5275372", "0.52368903", "0.5235929", "0.5233859", "0.5220732", "0.5219321", "0.5219321", "0.5212159", "0.5179624", "0.51729566", "0.51625", "0.51516503", "0.51473916", "0.51386225", "0.5129941", "0.5125717", "0.51177925", "0.51177925", "0.51177925", "0.51177925", "0.5113592", "0.51065993", "0.5104201", "0.5102951", "0.509581", "0.5084713", "0.5077169", "0.5075083", "0.5059569", "0.5058224", "0.5057135", "0.5053757", "0.50514024", "0.5050399", "0.5050392", "0.5049246", "0.50489515", "0.5042984", "0.5042984", "0.5042984", "0.5042984", "0.5042984", "0.5042984", "0.5042984", "0.5040678" ]
0.0
-1
this will move our character
move() { //contain logic within borders if (this.xPos + this.sprite.width > width) { this.xSpeed = 0; this.collided = true; this.xPos = width - this.sprite.width } if (this.xPos < 0) { this.xSpeed = 0; this.collided = true; this.xPos = 0; } if (this.yPos > height-238-this.sprite.height) { this.ySpeed = 0; this.collided = true; this.yPos = height-238 - this.sprite.height; } if (this.yPos < 0) { this.ySpeed = 0; this.collided = true; this.yPos = 0; } //kapp notes helpful as always // move left? if (keyIsDown(LEFT_ARROW) || keyIsDown(65)) { // subtract from character's xSpeed this.xSpeed -= this.accel; this.left = true; this.right = false; } // move right? if (keyIsDown(RIGHT_ARROW) || keyIsDown(68)) { // add to character's xSpeed this.xSpeed += this.accel; this.right = true; this.left = false; } //reload, basic if (keyIsDown(82)) { this.ammoCapacity = 8; } // fuel!! if (keyIsDown(32)) { if (this.fuel > 0) { //if you still have fuel, then use it this.ySpeed -= this.accel; } if (this.fuel > -250) { //250 is the threshold under 0 to simulate a "delay" since idk how millis() works this.fuel -= 15; } } //look at this sad commented out failure of a feature... maybe one day /* if (keyCode == SHIFT) { if (cooldown) { let yDistance = this.yPos - this.jumpSize; this.yPos -= this.jumpSpeed * yDistance; jumping = true; } }*/ //this I felt I wanted to do so that the left and right speeds //would naturally slow down over time. Felt unnatural otherwise. if (this.right) { this.xSpeed -= this.gravity; if (this.xSpeed < 0) { this.right = false; this.left = true; } } else if (this.left) { this.xSpeed += this.gravity; if (this.xSpeed > 0) { this.right = true; this.left = false; } } //the standard movement. Add gravity, speed to position this.ySpeed += this.gravity; this.xPos += this.xSpeed; this.yPos += this.ySpeed; //gradually grow your fuel overtime. A counter would've been great but I couldn't learn it in time... //no pun intended. if (this.fuel < this.fuelCapacity) { this.fuel += 5; } // speed limit! prevent the user from moving too fast this.xSpeed = constrain(this.xSpeed, -this.xLimit, this.xLimit); this.ySpeed = constrain(this.ySpeed, -25, 25); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move(){\n\n this.charY = windowHeight - 200;\n if (this.state === \"right\") this.charX += 4;\n if (this.state === \"left\") this.charX -= 4;\n \n }", "function movementChar () {\n player.movement();\n enemy.movement();\n }", "moveCharacter(data) {\n this.currentEnd = data;\n this._duration = this.getCharacterDuration(data);\n this.addNewPosition(this.currentEnd);\n\n }", "move()\n {\n if(keyCode === 39)\n {\n Matter.body.applyForce(this.body,{x:40,y:-30});\n }\n\n if(keyCode === 37)\n {\n Matter.body.applyForce(this.body,{x:-40,y:-30});\n }\n }", "move() {\n this.posX += this.deltaX;\n this.posY += this.deltaY;\n }", "move() {\n // figure out which key was pressed\n if (keyIsDown(LEFT_ARROW)) {\n this.xPos -= 5;\n this.myGraphic = user_left;\n }\n if (keyIsDown(RIGHT_ARROW)) {\n this.xPos += 5;\n this.myGraphic = user_right;\n }\n if (keyIsDown(UP_ARROW)) {\n this.yPos -= 5;\n }\n if (keyIsDown(DOWN_ARROW)) {\n this.yPos += 5;\n }\n }", "move() {\n this.x += 3;\n this.y += 0;\n if (this.x > 50) {\n this.x += 0;\n this.y += 4;\n }\n if (this.x > 1200) {\n this.y = this.dy;\n this.x = this.dx;\n }\n }", "move(){\r\n this.x += this.dx;\r\n this.y += this.dy;\r\n\r\n }", "move(){\r\n if(keyDown(UP_ARROW)){\r\n this.harry.y = this.harry.y - 10;\r\n }\r\n if(keyDown(DOWN_ARROW)){\r\n this.harry.y = this.harry.y + 10;\r\n }\r\n if(keyDown(RIGHT_ARROW)){\r\n this.harry.x = this.harry.x + 10;\r\n }\r\n if(keyDown(LEFT_ARROW)){\r\n this.harry.x = this.harry.x - 10;\r\n }\r\n \r\n }", "function moveChar(thisChar, type){\r\n\t\t\r\n\tswitch(type){\r\n\t\tcase 1:\r\n\t\t//random\r\n\t\tif(!thisChar.canMove){\r\n\t\t\tthisChar.dirX = thisChar.dirX*-1;\r\n\t\t\tthisChar.dirY = thisChar.dirY*-1;\r\n\t\t}\r\n\t\tif(timer == 0){\r\n\t\t\ttimer = Math.floor(Math.random() * (300-200+1) + 200);\r\n\t\t\tif(isMoving){\r\n\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\twhile(newDirX == 0 && newDirY == 0){\r\n\t\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\t}\r\n\t\t\t\tthisChar.dirX = newDirX;\r\n\t\t\t\tthisChar.dirY = newDirY;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}else{\r\n\t\t\t\tthisChar.dirX = 0;\r\n\t\t\t\tthisChar.dirY = 0;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\ttimer--;\r\n\t\t}\t\t\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 2:\r\n\t\t//Follow\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX > 50 || newDirX < -50){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY > 50 || newDirY < -50){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 3:\r\n\t\t//flee\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX < 75 && newDirX > -75){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY < 75 && newDirY > -75){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tdefault:\r\n\t\t//still\r\n\t\tthisChar.dirX = 0;\r\n\t\tthisChar.dirY = 0;\r\n\t}\r\n}", "move(){\n if (keyIsDown (LEFT_ARROW) ) {\n this.pos.x -= this.speed;\n } \n if (keyIsDown(RIGHT_ARROW) ) {\n this.pos.x += this.speed;\n } \n if (keyIsDown (UP_ARROW) ) {\n this.pos.y -= this.speed;\n } \n if (keyIsDown (DOWN_ARROW) ) {\n this.pos.y += this.speed;\n }\n }", "function move() {\r\n\t\r\n}", "move(){\r\n this.x += this.dx;\r\n }", "function movement() {\r\n if (cursors.left.isDown) {\r\n player.body.velocity.x = -150;\r\n keyLeftPressed.animations.play(\"leftArrow\");\r\n }\r\n if (cursors.right.isDown) {\r\n player.body.velocity.x = 150;\r\n keyRightPressed.animations.play(\"rightArrow\");\r\n }\r\n\r\n if (player.body.velocity.x > 0) {\r\n player.animations.play(\"right\");\r\n } else if (player.body.velocity.x < 0) {\r\n player.animations.play(\"left\");\r\n } else {\r\n player.animations.play(\"turn\");\r\n }\r\n if (cursors.up.isDown && player.body.onFloor()) {\r\n player.body.velocity.y = -290;\r\n keyUpPressed.animations.play(\"upArrow\");\r\n jumpSound.play();\r\n jumpSound.volume = 0.15;\r\n }\r\n }", "function move() {\n\t\tmovePiece(this);\n\t}", "move(x,y){\n this.position.x += x;\n this.position.y += y;\n }", "movePlayer() {\r\n this.ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n this.drawText();\r\n this.posY = this.posY + this.speed * this.inputY;\r\n this.posX = this.posX + this.speed * this.inputX;\r\n this.renderPlayer();\r\n }", "function goingUp() {\n yCharacter -= characterSpeed;\n}", "move() {\n this.x += this.xdir * .5;\n this.y += this.ydir * .5;\n }", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "move() {\r\n this.y = this.y + Enemy.v;\r\n }", "moveCharacter(character) {\n // ensure call shouldMove method shouldMove()\n if (character.shouldMove()) {\n const { nextMovePos, direction } = character.getNextMove(\n this.objectExist\n );\n const { classesToRemove, classesToAdd } = character.makeMove();\n \n // only for pacman\n if (character.rotation && nextMovePos !== character.pos) {\n this.rotateDiv(nextMovePos, character.dir.rotation);\n this.rotateDiv(character.pos, 0);\n }\n\n this.removeObject(character.pos, classesToRemove);\n this.addObject(nextMovePos, classesToAdd);\n\n character.setNewPos(nextMovePos, direction);\n }\n }", "move(){\n switch(this.direction){\n case \"n\":\n this.col-=1;\n this.direction=\"n\";\n break;\n case \"e\":\n this.row += 1;\n this.direction=\"e\"; \n break;\n case \"s\":\n this.col+=1;\n this.direction = \"s\";\n break;\n case \"w\":\n this. row -=1;\n this.direction=\"w\";\n }\n }", "move(){\n this.x = this.x + this.s;\n if (this.x > width){\n this.x = 0;\n }\n }", "function move()\n{\n\tif (player.direction == MOVE_NONE)\n\t{\n \tplayer.moving = false;\n\t\t//console.log(\"y: \" + ((player.y-20)/40));\n\t\t//console.log(\"x: \" + ((player.x-20)/40));\n \treturn;\n \t}\n \tplayer.moving = true;\n \t//console.log(\"move\");\n \n\tif (player.direction == MOVE_LEFT)\n\t{\n \tif(player.angle != -90)\n\t\t{\n\t\t\tplayer.angle = -90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y-1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y -=1;\n\t\t\tvar newX = player.position.x - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n \t}\n\tif (player.direction == MOVE_RIGHT)\n\t{\n \tif(player.angle != 90)\n\t\t{\n\t\t\tplayer.angle = 90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y+1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newX = player.position.x + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_UP)\n\t{\n\t if(player.angle != 0)\n\t\t{\n\t\t\tplayer.angle = 0;\n\t\t}\n\t\tif(map[playerPos.x-1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x-=1;\n\t\t\tvar newy = player.position.y - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({y: newy}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_DOWN)\n\t{\n\t if(player.angle != 180)\n\t\t{\n\t\t\tplayer.angle = 180;\n\t\t}\n\t\tif(map[playerPos.x+1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newy = player.position.y + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: player.position.x, y: newy}, 250).call(move);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n}", "move() {\n\t this.pos[0] += this.vel[0];\n\t this.pos[1] += this.vel[1];\n\t }", "function moveCharacterUp(){\n gameModel.moveCharacter(0);\n}", "update() {\r\n // Move the this.char at this speed.\r\n var speed = 100;\r\n\r\n if (this.cursors.up.isDown) {\r\n this.char.body.velocity.y = -speed;\r\n }\r\n else if (this.cursors.down.isDown) {\r\n this.char.body.velocity.y = speed;\r\n }\r\n else {\r\n this.char.body.velocity.y = 0;\r\n }\r\n\r\n if (this.cursors.left.isDown) {\r\n this.char.body.velocity.x = -speed;\r\n }\r\n else if (this.cursors.right.isDown) {\r\n this.char.body.velocity.x = speed;\r\n }\r\n else {\r\n this.char.body.velocity.x = 0;\r\n }\r\n }", "move() {\n\n // Horizontal movement\n this.x_location += this.delta_x;\n\n // Vertical movement\n this.y_location += this.delta_y;\n\n }", "move() {\n\n }", "function moveCharacter(characterWrap){\n\t\t\tvar sizeY = characterWrap.outerHeight() / 2;\n\t\t\tvar sizeX = characterWrap.outerWidth() / 2;\n\t\t\tvar character = characterWrap.find('.active');\n\n\t\t\tif(supportTransitions()){\n\t\t\t\tif(character.hasClass('moveRight')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('left', '-' + sizeX + 'px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('left', '0px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveLeft')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('left', '0px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('left', '-' + sizeX + 'px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveUp')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('top', '0px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('top', '-' + sizeY + 'px');\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveDown')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.css('top', '-' + sizeY + 'px');\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.css('top', '0px');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//jquery fallback \n\t\t\telse{\n\t\t\t\tif(character.hasClass('moveRight')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '-' + sizeX + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveLeft')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left': '0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'left' : '-' + sizeX + 'px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveUp')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'top': '0px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'top': '-' + sizeY + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}\n\t\t\t\t} else if(character.hasClass('moveDown')){\n\t\t\t\t\tif(!characterWrap.hasClass('moved')){\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'bottom' : sizeY + 'px'\n\t\t\t\t\t\t}, 400);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tcharacterWrap.animate({\n\t\t\t\t\t\t\t'bottom':'0px'\n\t\t\t\t\t\t},400);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharacterWrap.toggleClass('moved');\n\t\t}", "move() {\n\t\tthis.lastPosition = [ this.x, this.y ];\n\n\t\tthis.x += this.nextMove[0];\n\t\tthis.y += this.nextMove[1];\n\t}", "function moveBear() {\n if (key == 'w') {\n bearY--;\n } else if (key == 'a') {\n bearX--;\n } else if (key == 's') {\n bearY++;\n } else if (key == 'd') {\n bearX++;\n }\n}", "function moveCharacter(char, index) {\n if (game.data.go_back[index]) {\n game.data.go_back[index] = false;\n char.pos.x = game.data.back_x;\n char.pos.y = game.data.back_y;\n game.data.location_x[index] = game.data.back_x;\n game.data.location_y[index] = game.data.back_y;\n return true;\n } else if (game.data.show_menu || game.data.waited[index]) {\n return true;\n } else if (game.data.moving[index] && me.input.keyStatus(\"click\")) {\n\n var x = (Math.floor(me.input.mouse.pos.x / 32));\n var y = (Math.floor(me.input.mouse.pos.y / 32));\n var tot_x = x + char.off_x - char.pos.x/32;\n var tot_y = y + char.off_y - char.pos.y/32;\n\n if (Math.abs(tot_x)+Math.abs(tot_y) <= game.data.movement[index]) {\n\n var x1 = game.data.location_x.slice(0,0);\n var x2 = game.data.location_x.slice(1);\n var y1 = game.data.location_y.slice(0,0);\n var y2 = game.data.location_y.slice(1);\n var x_removed = x1.concat(x2);\n var y_removed = y1.concat(y2);\n if ((x_removed.indexOf(x*32) < 0) || (y_removed.indexOf(y*32) < 0)) {\n game.data.location_x[index] = x*32;\n game.data.location_y[index] = y*32;\n char.pos.x = x*32;\n char.pos.y = y*32;\n char.off_x = tot_x;\n char.off_y = tot_y;\n }\n }\n return true;\n\n } \n\n else if (game.data.update_plz[index]) {\n game.data.update_plz[index] = false;\n return true;\n } \n\n else if (!game.data.moving[index]) {\n char.off_x = 0;\n char.off_y = 0;\n }\n\n return false;\n}", "move () {\n }", "move(dir = 1){\n this.x += this.xspeed * dir;\n this.y += this.yspeed * dir;\n }", "move() {\n this.y -= this.speed;\n }", "move() {\n this.x = this.x - 7\n }", "move() {\n let frameTime = fc.Loop.timeFrameGame / 1000;\n let distance = fc.Vector3.SCALE(this.velocity, frameTime);\n this.translate(distance);\n }", "move(x, y) {\n\n this.tr.x += x;\n this.tr.y += y;\n }", "move_player(graphics_state,dt)\r\n {\r\n let temp = Mat4.inverse( graphics_state.camera_transform);\r\n this.battle = temp;\r\n this.battle = this.battle.times(Mat4.translation([0,0,-3]));\r\n //let origin = Vec.of(0,0,0,1);\r\n //temp = temp.times(origin);\r\n \r\n let origin = Vec.of(0,0,0,1);\r\n let char_pos = temp.times(origin);\r\n //console.log(char_pos);\r\n \r\n if(this.rotate_right == true)\r\n {\r\n temp = temp.times(Mat4.rotation( -0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation + 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_right = false;\r\n }\r\n if(this.rotate_left == true)\r\n {\r\n temp = temp.times(Mat4.rotation( 0.05*Math.PI, Vec.of( 0,1,0 )));\r\n this.rotation = (this.rotation - 0.05*Math.PI)%(2*Math.PI);\r\n this.rotate_left = false;\r\n }\r\n\r\n if(this.move_forward == true)\r\n {\r\n \r\n this.velocity = this.velocity.plus(Vec.of(0,0,-0.2*dt));\r\n \r\n /*else\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n }*/\r\n }\r\n if(this.move_backward == true)\r\n {\r\n this.velocity = this.velocity.plus(Vec.of(0,0,0.2*dt));\r\n \r\n //else\r\n //{\r\n //this.velocity = this.velocity.plus(Vec.of(0.2*dt*Math.cos(this.rotation),0,0));\r\n //}\r\n }\r\n let old_temp = temp;\r\n temp = temp.times(Mat4.translation(this.velocity));\r\n char_pos = temp.times(origin);\r\n if(this.out_of_bounds(char_pos) == true || this.finished == false)\r\n {\r\n temp = old_temp;\r\n }\r\n if(this.check_door(char_pos) == true)\r\n {\r\n this.touching_door = true;\r\n }\r\n if(this.check_enemy(char_pos) == true && this.touching_door == false)\r\n {\r\n this.touching_enemy = true;\r\n this.enemy = this.map[this.player_room[0]][this.player_room[1]].enemy_type;\r\n this.finished = false;\r\n }\r\n if(this.check_key(char_pos) == true)\r\n {\r\n this.touching_obj = true;\r\n }\r\n temp = Mat4.inverse(temp);\r\n \r\n return temp;\r\n }", "function move(){\n\tif(left){\n\t\tif(player1.x >= 450){\n\t\t\tdiff -= speed;\n\t\t}else{\n\t\t\tplayer1.x += speed;\n\t\t}\n\t\tlastKey = \"left\";\n\t}\t\n\tif(right){\n\t\tif(player1.x <= 10){\n\t\t\tdiff += speed;\n\t\t}else{\n\t\t\tplayer1.x -= speed;\n\t\t}\n\t\tlastKey = \"right\";\n\t}\n}", "function player_move(dir) {\n player.pos.x += dir;\n if (collide(arena, player)) {\n player.pos.x -= dir;\n }\n}", "_drawCharacter() {\n this.flappy.style.top = `${this.charY}px`;\n }", "move(){\n this.vel.vector[1] = 0;\n this.pos.plus(this.vel);\n if(this.mworld.legendSolid(this.pos.vector[0], this.pos.vector[1]+2) == 1 || this.mworld.legendSolid(this.pos.vector[0]+this.width,this.pos.vector[1]+2) == 1){\n this.vel.vector[0] = 0 - this.vel.vector[0];\n }\n }", "function move()\n{\n\n}", "function moveLeg(e, distance) {\n if ((\n e.keyCode == 65 &&\n e.keyCode !== storedKeyPress &&\n character.attr(\"dataMoving\") == 1\n )\n || (\n e.keyCode == 68 &&\n e.keyCode !== storedKeyPress &&\n character.attr(\"dataMoving\") == 1\n )\n ) {\n $(\"#playerProfile\").animate({left: distance}, 0, function () {\n storedKeyPress = e.keyCode\n })\n }\n}", "move() {\r\n this.x += this.vX;\r\n this.y += this.vY;\r\n }", "function update () {\n\n\n //Adds callback to event listener for clicking\n //Uncomment this if you want to move one step at a time with a mouse click\n //game.input.onTap.add(moveCharactersQuadrantAbsolute, this);\n\n // //Uncomment this if you want to move the characters by pushing the up arrow\n // if(game.input.keyboard.isDown(Phaser.Keyboard.UP)){\n // //moveCharacters();\n // moveCharactersQuadrant();\n // }\n\n}", "move() {\n }", "move() {\n this._offset = (this._offset + 1) % plainAlphabet.length\n }", "function keyPressed() {\r\n\t//if the right arrow is pressed, Mario will move to the right\r\n\tif (keyCode == RIGHT_ARROW) {\r\n\t\tposX += 25;\r\n\t}\r\n\t//if the left arrow is pressed, Mario will move to the left\r\n\telse if (keyCode == LEFT_ARROW) {\r\n\t\tposX -= 25;\r\n\t}\r\n\t//if the up arrow is pressed, Mario will move up \r\n\telse if (keyCode == UP_ARROW) {\r\n\t\t//when the up button is pressed he will jump\r\n\t\tposY -= 75;\r\n\t}\r\n\t//if the down arrow is pressed, Mario will move down\r\n\telse if (keyCode == DOWN_ARROW) {\r\n\t\tposY += 25;\r\n\t}\r\n}", "function movePlayer() {\n screenWarping(\"player\");\n playerX += playerVX;\n playerY += playerVY;\n}", "move(dx, dy) {\n this.x += dx;\n this.y += dy;\n }", "function moveStep(){\n megamanXPos += megamanXSpeed;\n megamanYPos += megamanYSpeed;\n }", "move() {\n // Handle movement with edge conditions\n if (upPressed) {\n if (player.y <= 0) {\n player.y += 1;\n } else {\n player.y -= player.speed;\n }\n }\n else if (downPressed) {\n if (player.y >= canvas.height) {\n player.y -= 1;\n } else {\n player.y += player.speed;\n }\n }\n if (rightPressed) {\n if (player.x >= canvas.width) {\n player.x -= 1;\n } else {\n player.x += player.speed;\n }\n }\n else if (leftPressed) {\n if (player.x <= 0) {\n player.x += 1;\n }\n else {\n player.x -= player.speed;\n }\n }\n }", "move(movement) {\n let newPosition = kontra.vector(\n clamp(this.x + movement.x, 0, map.width - this.width),\n clamp(this.y + movement.y, 0, map.height - this.height));\n this.position = newPosition;\n }", "moveNorth(){\n this.move ( 'N' );\n }", "function moveCar(e){\n e = e || window.event;\n if (e.keyCode == '37') {\n if(cPosition>1){\n cPosition= cPosition-1;\n }\n \n \n }\n else if (e.keyCode == '39') {\n if(cPosition<9){\n cPosition= cPosition+1;\n }\n }\n}", "function getCharacterMove(dir){\n character_face[dir] = getCharacterImg(moveInd[dir])\n moveInd[dir] += 1\n \n}", "move() {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n\n if (this.x + this.vx < 0 + this.size / 2 || this.x + this.vx > width - this.size / 2) {\n this.vx = -this.vx;\n }\n\n if (this.y + this.vy < 0 + this.size || this.y + this.vy > cockpitVerticalMask - this.size) {\n //this.speed = -this.speed;\n this.vy = -this.vy;\n }\n\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n //increases enemy's size every frame,\n this.size += this.speed / 10;\n //constrain enemies on screen\n this.x = constrain(this.x, 0, width);\n this.y = constrain(this.y, 0, height * 75 / 100);\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "move() { }", "move() { }", "function movePig() {\n\tdocument.onkeydown = function(evt) {\n\t\tpig.classList.remove('eat');\n\t\tswitch(evt.keyCode) {\n\t\t\t// Left\n\t\t\tcase 37:\n\t\t\t\t//console.log(\"left\")\n\t\t\t\tif(psX > 0) {\n\t\t\t\t\tpsX -= 100;\n\t\t\t\t\tpig.style.left = psX+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t// Up\n\t\t\tcase 38:\n\t\t\t\t//console.log(\"up\")\n\t\t\t\tif(psY > 0) {\n\t\t\t\t\tpsY -= 100;\n\t\t\t\t\tpig.style.top = psY+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\n\t\t\t// Right\n\t\t\tcase 39:\n\t\t\t\t//console.log(\"right\")\n\t\t\t\tif(psX < 500) {\n\t\t\t\t\tpsX += 100;\n\t\t\t\t\tpig.style.left = psX+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\n\t\t\t// Down\n\t\t\tcase 40:\n\t\t\t\t//console.log(\"down\")\n\t\t\t\tif(psY < 500) {\n\t\t\t\t\tpsY += 100;\n\t\t\t\t\tpig.style.top = psY+\"px\";\n\t\t\t\t}\n\t\t\t\tbreak;\t\t\t\n\t\t}\n\t}\n}", "function move(e) {\n var keynum;\n\n if (window.event) { // IE \n keynum = e.keyCode;\n } else if (e.which) { // Netscape/Firefox/Opera \n keynum = e.which;\n }\n\n\n if (!win) {\n if (keynum == 68) {\n updatePosition(2, \"right\"); //Moving right\n\n }\n //left\n if (keynum == 65) {\n updatePosition(2, \"left\"); //Moving left\n\n }\n //up\n if (keynum == 87) {\n updatePosition(2, \"up\"); //Moving up\n\n }\n //down\n if (keynum == 83) {\n updatePosition(2, \"down\"); //Moving down\n\n }\n }\n\n checkWin(); //Check if the player has won\n requestAnimationFrame(drawCanvas);\n}", "move() {\n this.position = Utils.directionMap[this.orientation].move(this.position)\n this.log(`I moved and now at x: ${this.position.x} y: ${this.position.y}`)\n }", "function Character() {\n this.tileFrom = [1, 1];\n this.tileTo = [1, 1];\n this.timeMoved = 0;\n this.dimensions = [30, 30]\n this.position = [45, 45]\n this.delayMove = 700\n \n }", "move() {\n\n if (this.inputKeys.left.isDown) {\n this.body.setVelocityX(-this.movementSpeed);\n } else if (this.inputKeys.right.isDown) {\n this.body.setVelocityX(this.movementSpeed);\n } else {\n this.body.setVelocityX(0);\n }\n\n if (this.inputKeys.up.isDown) {\n this.body.setVelocityY(-this.movementSpeed);\n } else if (this.inputKeys.down.isDown) {\n this.body.setVelocityY(this.movementSpeed);\n } else {\n this.body.setVelocityY(0);\n }\n }", "function playerMove(dir){\n player.pos.x += dir;\n if(collide(arena, player))\n player.pos.x -= dir;\n}", "move(direction) {\n if (direction === 'left') this.x -= 101; // Step left\n if (direction === 'up') this.y -= 85; // Step up\n if (direction === 'right') this.x += 101; // Step right\n if (direction === 'down') this.y += 85; // Step down\n }", "function Char(){\r\n this.x= (canvas.width/2)-100;\r\n this.y = (canvas.height/2)-300;\r\n this.w = 30;\r\n this.h = 30;\r\n //update variables\r\n this.speed = 1;\r\n this.gravity = 1;\r\n this.draw = function(){\r\n c.beginPath();\r\n c.fillStyle = \"rgb(140,87,234)\";\r\n c.fillRect(this.x,this.y, this.w, this.h);\r\n }\r\n this.update = function(){\r\n \r\n if(this.y+this.h>=foreground.y){\r\n this.y = foreground.y-this.h;\r\n this.draw();\r\n this.speed = 1;\r\n this.gravity = 1;\r\n }\r\n else{\r\n this.draw();\r\n this.y += this.speed;\r\n this.speed += this.gravity;\r\n }\r\n \r\n\r\n }\r\n this.jump = function () {\r\n this.y += -30;\r\n this.speed = -15;\r\n this.gravity = 1;\r\n };\r\n}", "update() {\n super.update();\n this.move();\n }", "move(xMovement, yMovement) {\n this.x = this.x + xMovement;\n this.y = this.y + yMovement;\n this.refillOptions();\n canvas.redrawCanvas();\n }", "move()\n {\n if (keys !== null)\n {\n //if \"w\" or \"arrow up\" pressed\n if (keys[38] || keys[87])\n {\n this.velY -= 1.5;\n }\n //if \"s\" or \"arrow down\" pressed\n if (keys[40] || keys[83])\n {\n this.velY += 3;\n }\n //if \"a\" or \"arrow left\" pressed\n if (keys[37] || keys[65])\n {\n this.velX -= 2;\n }\n //if \"d\" or \"arrow right\" pressed\n if (keys[39] || keys[68])\n {\n this.velX += 1.5;\n }\n }\n\n //decceleration based on drag coefficient\n this.velX *= this.drag;\n this.velY *= this.drag;\n\n //position change based on velocity change\n this.xPos += this.velX;\n this.yPos += this.velY;\n\n if (winCondition === undefined || winCondition === true)\n {\n //in bounds x axis\n if (this.xPos > WIDTH - 70)\n {\n this.xPos = WIDTH - 70;\n }\n else if (this.xPos < 0)\n {\n this.xPos = 0;\n }\n }\n\n //in bounds y axis\n if (this.yPos > HEIGHT - balloonGround - 120)\n {\n this.yPos = HEIGHT - balloonGround - 120;\n this.hitGround++;\n }\n else if (this.yPos < 0)\n {\n this.yPos = 0;\n }\n }", "function moveUp(){\n\t\t\tplayerPosition.x += 1\n\t\t\tplayer.attr({\n\t\t\t\t'cx': playerPosition.x\n\t\t\t})\n\t\t}", "move(x, y) {\n this.x = x;\n this.y = y;\n\n const player = document.getElementById(\"player2\");\n player.style.left = (this.x * widthCase) + \"px\";\n player.style.top = (this.y * widthCase) + \"px\";\n\n this.attributes.addLife(this.x,this.y);\n this.attributes.addBomb(this.x,this.y);\n this.attributes.addDamageBomb(this.x,this.y);\n this.attributes.removeLife(this.x,this.y)\n\n }", "move_to(x, y) {\n this.move(x - this.abs_x, y - this.abs_y)\n }", "function moveGunner() {\n /* HOW IT WORKS\n 1) gunX is assigned to the x-coordinate (in px) of the gunner. \n 2) Depending on the value of charCode the gunX will be either incremented or decremented.\n 3) The position of the gunner is then set to the new value of gunX\n */\n gunX = gunner.offsetLeft\n gunStep = 0.01 * mainContainer.scrollWidth\n if (charCode === 39) {\n gunner.offsetLeft + gunStep > mainContainer.scrollWidth - gunner.offsetWidth ? clearInterval(gunMoveTimer) : gunX += gunStep\n } else if (charCode === 37) {\n gunner.offsetLeft - gunStep <= 0 ? clearInterval(gunMoveTimer) : gunX -= gunStep\n }\n gunner.style.left = `${gunX}px`\n }", "moveRight() {\n\n if (this.posX <= 670 && pause == false)\n this.posX = this.posX + 5;\n }", "function pieceMove(dir){\r\n piece.pos.x += dir;\r\n if(collision(arena, piece)){\r\n piece.pos.x -= dir;\r\n }\r\n }", "move() {\n // To update the position\n this.x += this.vx;\n this.y += this.vy;\n // Handle wrapping\n this.handleWrapping();\n }", "move() {\n const skier = Players.getInstance(\"skier\").getPlayer(\"skier\");\n this.direction = skier.direction;\n if (!this.eating) {\n if (skier.checkIfSkierStopped()) {\n this.y += this.speed;\n this.distance_gained_on_stop += this.speed;\n this.checkIfRhinoHitsSkier(skier);\n } else {\n this.y = skier.y - Constants.RHINO_SKIER_DISTANCE;\n this.y += this.distance_gained_on_stop;\n this.x = skier.x;\n }\n }\n }", "function moveLeft(){\n var left = parseInt(window.getComputedStyle(character).getPropertyValue(\"left\"));\n if(left>0){\n character.style.left = left - 2 + \"px\";\n }\n}", "move() {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n // Handle wrapping\n this.handleWrapping();\n }", "function moveCharacter(event) {\n event.stopPropagation();\n if (selectedCharacter && this.classList.contains(\"movable\")) {\n const currentCell = this;\n const currentIndex = Array.from(cells).indexOf(currentCell);\n const characterImg = selectedCharacter.querySelector(\"img\");\n\n // If the clicked cell contains a character, swap their positions\n if (currentCell.dataset.char) {\n const tempChar = currentCell.querySelector(\"img\");\n currentCell.appendChild(characterImg);\n selectedCharacter.appendChild(tempChar);\n } else {\n currentCell.appendChild(characterImg);\n }\n\n // Update last position and movable cells after moving\n lastCharacterPosition = Array.from(cells).indexOf(selectedCharacter);\n updateMovableCells(lastCharacterPosition);\n // Deselect the character after moving\n deselectCharacter();\n // Reset movable characters after moving\n resetMovableCharacters();\n }\n }", "move() {\n var me = this.localDonutRender;\n if (me == null) {\n return;\n }\n var direction = {\n x: this.heading.x - me.donutData.x,\n y: this.heading.y - me.donutData.y\n };\n this.client.emit('move', { pid: this.playerId, rid: this.roomId, dir: direction });\n }", "function start_move() {\n\tlet coordinate = X;\t\t//defaults to x dimension\n\tlet modifier = 1;\t\t//defaults to positive \n\tlet no_collision = true;\n\t//starts animation if necessary\n\tif(animating == false) {\n\t\tanimating = true;\n\t\tanimate();\t\t\t//does first frame of animation immediately\n\t\ttID_animate = setInterval(animate.bind(null), 140);\n\t}\n\t\n\t//change to y dimension if needed\n\tif (direction == 0 || direction == 3) coordinate = Y;\n\t//change to positive direction\n\tif (direction == 1 || direction == 3) modifier = -1;\n\t\n\n\t\n\t//check for collisions\n\tif(coordinate == X) {\n\t\tif(betterCollisionDetection(pos[0]+modifier*32, pos[1]) == true)\n\t\t\tno_collision = false;\n\t}\n\telse if(coordinate == Y) {\n\t\tif(betterCollisionDetection(pos[0], pos[1]+modifier*32) == true)\n\t\t\tno_collision = false;\n\t}\n\t\t\t\t\n\t\t\t\n\t\n\tif(no_collision) {\n\t\t//check if move would leave the valid area\n\t\t//if it would, move the bacground instead\n\t\tlet test_value = pos[coordinate] + modifier;\n\t\t// console.log(spots)\n\t\tif (test_value < MIN_POS[coordinate] || test_value > MAX_POS[coordinate]) {\n\n\t\t\tfor(let i = 0; i < index; i++){\n\t\t\t\tlet element = document.getElementById(`field${i}`);\n\t\t\t\tdelete spots[`${element.dataset.x},${element.dataset.y}`];\n\t\t\t}\n\t\t\tdo_move_background(coordinate, modifier*-1, 1, 0);\n\t\t}\n\t\telse {\n\t\t\t//do the move for the character\n\t\t\tdelete spots[`${pos[0]},${pos[1]}`];\n\t\t\tdo_move(coordinate, modifier, 0);\n\t\t}\n\t}\n\telse{\n\t\t\n\t\tclearInterval(tID_animate);\t\t\n\t\tanimating = false;\n\t\tmoving = false;\n\t\t\n\t\t//reset frame to 0, draw the frame so character stops on his feet\n\t\tfr_num = 0;\n\t\tanimate();\n\t}\n}", "function moveUp(){\r\n //defines the position in pixels of the character (parsing it to make it an int rather than a string)\r\n //we are defining position based on its bottom value but you could from right as well/instead\r\n let position = parseInt(window.getComputedStyle(character).getPropertyValue(\"bottom\"));\r\n //logging the position in the console\r\n console.log(position)\r\n //moving the character up by 5 pixels.\r\n character.style.bottom = position + 5 + \"px\";\r\n}", "move() {\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n }", "moveRight() {\n this.shinobiPos.x += 30\n }", "keyMove(direction, player) {\n let newPos = player.pos;\n if (direction == 'l')\n newPos = [newPos[0]-1, newPos[1]];\n else if (direction == 'r') \n newPos = [newPos[0]+1, newPos[1]];\n else if (direction == 'd')\n newPos = [newPos[0], newPos[1]-1];\n else if (direction == 'u')\n newPos = [newPos[0], newPos[1]+1];\n this.socket.emit('move', newPos);\n }", "movement() {\n this.velocity = this.velocity + this.gravity; // updates velocity\n this.y = this.y + this.velocity // updates position with velocity\n }", "move() {\n\n // if it leaves the w, change direction\n if (this.x > width) {\n this.xspeed = -this.xspeed;\n }\n else if (this.x < 0) {\n this.xspeed = Math.abs(this.xspeed);\n }\n\n //if it leaves the height, change direction\n\n if (this.y > height + 50) {\n return true;\n }\n\n if (this.y < 0) {\n this.yspeed = Math.abs(this.yspeed)\n }\n\n\n\n this.x += this.xspeed;\n this.y += this.yspeed;\n \n }", "function moveSprite() {\n if(keyIsDown(RIGHT_ARROW))\n playerSprite.velocity.x = 10;\n else if(keyIsDown(LEFT_ARROW))\n playerSprite.velocity.x = -10;\n else\n playerSprite.velocity.x = 0;\n\n if(keyIsDown(DOWN_ARROW))\n playerSprite.velocity.y = 10;\n else if(keyIsDown(UP_ARROW))\n playerSprite.velocity.y = -10;\n else\n playerSprite.velocity.y = 0;\n}", "function moveRight(){\r\n //defines the position in pixels of the character (parsing it to make it an int rather than a string)\r\n //we are defining position based on its left value but you could from right as well/instead\r\n let position = parseInt(window.getComputedStyle(character).getPropertyValue(\"left\"));\r\n //logging the position in the console\r\n console.log(position)\r\n //moving the character to the right by 5 pixels.\r\n character.style.left = position + 5 + \"px\";\r\n}", "update() {\n this.moveNinja();\n }", "move() {\r\n this.x = this.x + this.v;\r\n }", "function movePlayer() {\n p1.render();\n p1.move();\n}" ]
[ "0.83372414", "0.7929643", "0.75312644", "0.7495457", "0.7476283", "0.7460674", "0.7401486", "0.73511064", "0.72903544", "0.7283865", "0.72585624", "0.7254449", "0.72355175", "0.7222043", "0.71958673", "0.7181574", "0.7175159", "0.7152343", "0.71407807", "0.7139268", "0.71341574", "0.7107162", "0.70972395", "0.7087286", "0.7074916", "0.7071622", "0.7054304", "0.7042999", "0.7037664", "0.7032343", "0.70244324", "0.70190036", "0.69776505", "0.69768614", "0.694817", "0.69477713", "0.6944721", "0.69377214", "0.6907129", "0.6888982", "0.68881214", "0.687508", "0.68678623", "0.68634534", "0.68569374", "0.6854411", "0.6841795", "0.6840116", "0.68295467", "0.6812978", "0.67897326", "0.67842966", "0.677353", "0.67695904", "0.67573076", "0.6755725", "0.67544425", "0.6742312", "0.6738949", "0.6735972", "0.6732726", "0.6731012", "0.6731012", "0.67300457", "0.67300457", "0.67208767", "0.67171276", "0.67132616", "0.6702802", "0.6689907", "0.6684334", "0.667593", "0.6674001", "0.66685057", "0.66676444", "0.6666326", "0.6664857", "0.6664146", "0.6661465", "0.6641234", "0.6640124", "0.6639565", "0.66384673", "0.66381526", "0.66370803", "0.66262364", "0.66237986", "0.66231656", "0.66180336", "0.66154665", "0.660989", "0.6608437", "0.66015315", "0.659951", "0.6593067", "0.6588343", "0.6587729", "0.65874594", "0.6584405", "0.65783614" ]
0.70880014
23
simple display function (hallelujah)
display() { image(this.sprite, this.bulletX, this.bulletY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display(n){\n document.write(\"<br/><font color=red> Value is \"+n+\"</font>\") \n // while display time big logic. \n}", "function sc_display(o, p) {\n if (p === undefined) // we assume not given\n\tp = SC_DEFAULT_OUT;\n p.appendJSString(sc_toDisplayString(o));\n}", "function display(){\r\n\r\n \r\n}", "function display(input){\r\n dispStr=dispStr+input;\r\n displayInScreen(dispStr);\r\n}", "function qdisplay() {\n\t\t$('#main').html(\"<p>\" + test[count].b + \"</p>\");\n\t\tconsole.log(\"test[count].b\" + test[count].b)\n\t}", "function display()\n{\n nameDisp.textContent= name;\n scoreDisp.textContent= score;\n lifeDisp.textContent= life;\n missileDisp.textContent= missile;\n levelDisp.textContent= level;\n}", "function printx(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function despliega(x){\n document.getElementById(\"display\").innerHTML = x\n }", "function printDisplay(num) {\n if (num == \"\") {\n document.getElementById(\"display\").innerText = num;\n } else {\n document.getElementById(\"display\").innerText = getFormattedNumber(num);\n }\n}", "display() {\n console.log('head:', this.head)\n console.log('[ ')\n this.displayHelper(this.head)\n console.log(' ]')\n console.log('tail:', this.tail)\n }", "function _display(){\n\t\t\t$(levelID).html(level);\n\t\t\t$(pointsID).html(points);\n\t\t\t$(linesID).html(lines);\n\t\t}", "function display(msg) {\n document.getElementById('display').innerHTML = msg;\n}", "function display()\n{\n\n}", "function display() {\r\n let showArg = () => arguments[0];\r\n return showArg();\r\n }", "function print(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function print(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function display()\n\t\t{\n\t\t\tvar i;\n\t\t\tvar arr = [];\n\t\t\tfor(i=1;i<dd.value;i++)\n\t\t\t{\n\t\t\t\tif(prime(i))\n\t\t\t\t\tarr[arr.length] = \" \"+i+\" \";\n\t\t\t}\n\t\t\tdocument.getElementById(\"demo\").innerHTML = arr;\n\t\t}", "function treeDisplay(tree) {\n var h = tree.tall;\n for (var i = 0; i < tree.tall; i++) {\n var whitespace = (h - 1) - i;\n var num = 2 * i + 1;\n\n console.log(\" \".repeat(whitespace) + tree.char.repeat(num));\n }\n}", "function show( obj )\r\n{ var r = \"\" ;\r\n for (var i in obj)\r\n r += i + \" = \" + obj[i] + \"\\n\" ;\r\n return r ;\r\n}", "function output(content) {\n document.getElementById(\"display1\").innerHTML = content;\n}", "function display() {\n\n\t$(\"#random\").html(targetNumber);\n\t$(\"#score\").html(score);\n\t$(\"#wins\").html(wins);\n\t$(\"#losses\").html(losses);\n\t// $(\"#result\").html(\"&nbsp;\");\n\n}", "function deviceprint_display ()\n\t{\n\t\tt = \"\";\n\t\tif (self.screen)\n\t\t{\n\t\t\tt += screen.colorDepth +SEP+ screen.width +SEP+ screen.height +SEP+ screen.availHeight;\n\t\t}\n\t\treturn t;\n\t}", "function displayF (item)\n\t{\n\t\tlet display = document.querySelector(\"span\");\n\t\tdisplay.textContent = Number(item);\n\t}", "function display(result) {\n console.log(result)\n}", "function display(text) {\n\t\tvar resultNode = document.createElement(\"p\"); //create a paragraph tag to store and display result\n\t\tresultNode.innerHTML = text; //store that result\n\t\tvar resultParent = document.getElementById(\"biases\"); //find place to attach result\n\t\tresultParent.appendChild(resultNode); //actually attach value to that div tag thing\n\t}", "function displayText(x){\r\n \r\n document.getElementById(\"display\").innerHTML = (x[0].model)+\" \"+(x[0].make);\r\n \r\n \r\n}", "function display() {\n lcd.clear();\n lcd.cursor(0, 0).print(displayDate());\n lcd.cursor(1, 0).print(displayMeasure());\n }", "function display1()\n\t{\n\t\tdocument.getElementById(\"score\").innerHTML = Underscores.join(' ');\n\t\tdocument.getElementById(\"left\").innerHTML =(\"you have \" + guessesleft + \" guesses left\");\n\t\tdocument.getElementById(\"lettersguessed\").innerHTML = wrongguess;\n\t}", "function printDisplay(text) {\n $('#display').text(text);\n}", "function displayBetter(data) {\n document.getElementById(\"better\").innerHTML = data;\n}", "function display(values) {\n\t//Display these values as a 2-D grid.\n\tvar width = max(vals(values), 'length');\n\tvar lines = [];\n\tfor (var ri=0; ri < rows.length; ri++) {\n\t\tvar r = rows[ri];\n\t\tvar line = '';\n\t\tfor (var ci=0; ci < cols.length; ci++) {\n\t\t\tvar c = cols[ci];\n\t\t\tline += center(values[r+c], width);\n\t\t\tif (c == '3' || c == '6') {\n\t\t\t\tline +='|';\n\t\t\t} else if (c != '9') {\n\t\t\t\tline += ' ';\n\t\t\t}\n\t\t}\n\t\tlines.push(line);\n\t\tif (r == 'C' || r == 'F') {\n\t\t\tlines.push('x+x+x'.replace(/x/g, repeat('-', width*3+2)));\n\t\t}\n\t}\n\tprint(lines.join('\\r\\n'));\n}", "function displayToScreen() {\n\n\n\t}", "function display(num) {\r\n outputScreen.value += num;\r\n}", "function displayObservation(obs) {\n\t \n sys.innerHTML = obs.sys;\n dia.innerHTML = obs.dia;\n glucose.innerHTML = obs.glucose;\n a1c.innerHTML = obs.a1c;\n fastp.innerHTML = obs.fastp;\n hdl.innerHTML = obs.hdl;\n ldl.innerHTML = obs.ldl;\n cholesterol.innerHTML = obs.cholesterol;\n tri.innerHTML = obs.triglycerides;\n}", "function display(result) {\n let displayArea = document.querySelector('#display-text');\n displayArea.textContent = result;\n}", "display() {\n var output = '';\n\n var runner = this.head;\n\n if (runner == null) {\n return 'empty';\n }\n\n while (runner.next != null) {\n output += runner.value + ' - ';\n runner = runner.next;\n }\n\n output += runner.value;\n\n return output;\n }", "function seDisplay(data, type, row, meta) {\n if(type === \"display\") {\n return formatNum(row[meta.col-1]) + \" (\" + formatNum(data) +\")\";\n } else {\n return toNumber(row[meta.col-1]);\n }\n }", "function tiro1() {\n displays();\n}", "function display(){\n\n\t\t\t$(\"#number\").html(randNum);\n\t\t\t$(\"#winsLosses\").html(\"<p>Wins: \" + wins + \"</p><br>\"\n\t\t\t\t+ \"<p>Losses: \" + losses + \"</p>\");\n\t\t\t$(\"#totalScore\").html(totalScore);\n\n\t\t}", "_replaceDisplay(value) {}", "function display(result) {\n console.log(`the result is: ${result}`)\n}", "_initDisplay(value) {}", "print() {\n return console.log(\n \"Display: \" + this.list.map(num => [num]).join(\" \")\n );\n }", "function printTimedisplay (hours, minutes, seconds, milliseconds) {\n maintimeDisplay.innerHTML = hours + ':' + minutes + ':' + seconds;\n millisecondDisplay.innerHTML = '.' + milliseconds;\n}", "function displayHTML(){\n\t\tdom.name.innerHTML = \"1. Name: \"+studentArray[position].name;\n\t\tdom.address.innerHTML = \"2. Address: \"+studentArray[position].street+\n\t\t\", \"+studentArray[position].city+\n\t\t\", \"+studentArray[position].state;\n\t\tdom.grades.innerHTML = \"3. Grades: \"+studentArray[position].grades;\n\t\tdom.date.innerHTML = \"4. Date: \"+studentArray[position].getDate();\n\t\tdom.gpaAvg.innerHTML = \"5. Average GPA: \"+studentArray[position].getAverage(studentArray[position].grades).toFixed(2);\n\t}//close displayHTML function", "show() {\n\t\tnoStroke();\n\t\tfill(150)\n\t\tcircle(this.x,this.y,this.r*2)\n\t\tfill(255)\n\t\ttextSize(30)\n\t\ttextAlign(CENTER, CENTER)\n\t\ttext(this.name, this.x, this.y)\n\t\t/*\n\t\ttext(this.one, 40, 461)\n\t\ttext(this.two, 121, 461)\n\t\ttext(this.three, 40+81*2, 461)\n\t\ttext(this.four, 40+81*3, 461)\n\t\ttext(this.five, 40+81*4, 461)\n\t\ttext(this.six, 40+81*5, 461)\n\t\ttext(this.ti, 40+81*6, 461)\n\t\ttext(this.te, 40+81*7, 461)\n\t\ttext(this.ta, 40+81*8, 461)\n\t\ttext(this.la, 40+81*9, 461)\n\t\ttext(this.le, 40+810, 461)*/\n\t}", "function displayInterests (zero, one, two, three) {\n console.log(\"* \" + zero);\n console.log(\"* \" + one);\n console.log(\"* \" + two);\n console.log(\"* \" + three);\n console.log(\"\");//adds a blank space\n}", "function display(val)\n {\n \tdocument.getElementById(\"header\").innerHTML += val;\n \t\n }", "displayInConsole() {\n console.log(\"{ name: \" + this.name + \", colors: \" + this.colors + \", manaCost: \" + this.manaCost + \", type: \" + this.modifier + \", TCGPlayer price: \" + this.tcgprice + \", Card Kingdom price: \" + this.ckprice);\n }", "function displayHelper (num) {\n if (num < 10) {\n return '0' + num.toString()\n } else {\n return num.toString()\n }\n }", "function displayScore() {\n displayText(36, score, width / 2, height - 50);\n}", "function displayCoord(a) {\r\n\t\tc.beginPath();\r\n\t\tc.moveTo(parseInt(a[0],10)-3,output(parseInt(a[1],10)-3));\r\n\t\tc.lineTo(parseInt(a[0],10)+3,output(parseInt(a[1],10)+3));\r\n\t\tc.stroke();\r\n\t\tc.beginPath();\r\n\t\tc.moveTo(parseInt(a[0],10)-3,output(parseInt(a[1],10)+3));\r\n\t\tc.lineTo(parseInt(a[0],10)+3,output(parseInt(a[1],10)-3));\r\n\t\tc.stroke();\r\n\t\tif (showCoordsCheck) c.fillText(\"(\"+a[0]+\",\"+a[1]+\")\",parseInt(a[0],10)+10,output(parseInt(a[1],10)+10));\r\n\t}", "function SLSdisplay() {\n return stack_arr;\n }", "function spotifyDisplay() {\n\tvar spotifyName = process.argv[3];\n\n\tif (!spotifyName) {\n\t\tspotifyName = \"i want it that way\";\n\t\t//Calling the spotifySubDisplay function..............\n\t\tspotifySubDisplay();\n\n\t} else {\n\n\t\t//Calling the spotifySubDisplay function.......\t\n\t\tspotifySubDisplay();\n\t}\n\n\tfunction spotifySubDisplay() {\n\t\tspotify.search({ type: \"track\", query: spotifyName}, function(error, data) {\n\t\t\tif (error) {\n\t\t\t\tconsole.log(\"Spotify error: \" + error);\n\t\t\t} else {\n\t\t\t\tvar track = data.tracks.items[0].name;\n\t\t\t\tvar artist = data.tracks.items[0].artists[0].name;\n\t\t\t\tvar album = data.tracks.items[0].album.name;\n\t\t\t\tvar url = data.tracks.items[0].preview_url;\n\t\t\t\tvar getSpotifys = \n\t\t\t\t\"\\n\" + \"----------------------------------------------------\" + \"\\n\" +\n\t\t\t\t\"Artists name: \" + artist + \"\\n\"+\n\t\t\t\t\"Album name: \" + album + \"\\n\"+\n\t\t\t\t\"Song name: \" + track + \"\\n\"+\n\t\t\t\t\"Preview Url: \" + url + \"\\n\"+\n\t\t\t\t\"-----------------------------------------------------\" + \"\\n\";\n\t\t\t\tconsole.log(getSpotifys);\n\t\t\t\tlogDisplay(getSpotifys);\n\t\t\t}\n\t\t});\n\t}\n}", "function displayInfo() {\n\tctx.fillStyle = '#FFFFFF';\n\tctx.font = '16px Times New Roman';\n\tfor (var i = 0; i < lives; i++) {\n\t\tctx.drawImage(player.ship, 800 + (i*20), 90, 15, 20);\n\t\tctx.fillText(\"Lives: \", 750, 100);\n\t}\n\tctx.fillText(\"Level: \" + level, 750, 130);\n\tctx.fillText(\"Score: \" + score, 750, 160);\n\tctx.fillText(\"Controls\", 750, 240);\n\tctx.fillText(\"Arrow keys to move\", 750, 270);\n\tctx.fillText(\"Space to shoot\", 750, 300);\n\tctx.fillText(\"W to warp\", 750, 330);\n\treturn;\n}", "function show() {\n best.html(population.pop[0].genes);\n averageFitness.html(population.averageFitness);\n generationNum.html(gNum);\n phrases.html(\"\");\n\n var phrs = \"\";\n\n for (let i = 1; i < population.pop.length && i < nPhrases.val(); i++) {\n phrs += '<span>' + population.pop[i].genes.join(\"\") + '</span>';\n }\n\n phrases.html(phrs);\n }", "function displayInConsole(mat, width, height) {\n for (var i = 0; i < width; i++) {\n let line = \"\";\n for (var j = 0; j < width; j++) {\n line += mat[i][j];\n }\n console.log(line);\n }\n}", "function writeDisplay(value) {\n if (clear) {\n display.textContent = \"\";\n clear = false;\n }\n display.textContent += value;\n displayValue = parseFloat(display.textContent);\n canOperate = true;\n //this firstEntry variable makes sense for the equal operator not to execute right after an arithmetic operator\n //but after a statement (like 5*8)\n if (firstEntry){\n canEqual = true;\n }\n}", "function debug_display(msg) {\n document.getElementById('debug_display').innerHTML += msg + '<br>';\n}", "function updateDisplay(info) {\n\n display.innerHTML = info;\n\n }", "function displayValue(value) {\r\n if (isNumber(value) && String(value).length > 14) value = value.toExponential(6);\r\n\r\n value = String(value);\r\n\r\n let sign = \"\";\r\n // If there is a sign ignore adding commas\r\n if (value[0] === \"-\" || value[0] === \"+\") {\r\n sign = value[0];\r\n value = value.slice(1);\r\n }\r\n\r\n // If it is a float number ignore commas after the dot\r\n let after_dot = \"\";\r\n if (isFloatNum(value)) {\r\n let dot_id = value.indexOf(\".\");\r\n after_dot = value.slice(dot_id);\r\n value = value.slice(0, dot_id);\r\n }\r\n\r\n let displayed_value = value;\r\n\r\n // Add commas every 3 characters\r\n if (value.length >= 4) {\r\n for (let i = value.length - 1; i >= 0; i--) {\r\n if (i % 3 === 0 && i != 0) displayed_value = displayed_value.slice(0, -i) + \",\" + displayed_value.slice(-i);\r\n }\r\n }\r\n // Display \r\n screen.innerHTML = sign + displayed_value + after_dot;\r\n}", "function display() {\ndocument.getElementById(\"lives\").textContent = (\"Lives Left = \" + livesLeft);\ndocument.getElementById(\"guesses\").textContent = (\"WRONG = \" + wrongLetter);\ndocument.getElementById(\"wins\").textContent = (\"Wins = \" + winscounter);\ndocument.getElementById(\"losses\").textContent = (\"Losses = \" + losses);\n}", "function screenPrint(coinFilp) {\n let shownValue;\n if (coinFlip === 1) {\n shownValue = 'Tails';\n displayCoin(shownValue);\n } else {\n shownValue = 'Heads';\n displayCoin(shownValue);\n }\n window.console.log(shownValue);\n}", "display() {\n // ˅\n console.log(this.displayData);\n // ˄\n }", "function display(argument){\n\t$('#display').append(\"<p class='input-1'>\" + argument + \"</p>\");\t\n\t}", "function displayContents(txt) {\n var el = document.getElementById('main');\n el.innerHTML = txt; //display output in DOM\n}", "function updateDisplay(){\n var num = $(this).text();\n var displayText = display.text();\n if (display.text() == '0'){\n display.text(num);\n } else {\n var output = display.text()+num;\n display.text(output);\n }\n }", "display() {\n\n if (this.head == null) {\n return null;\n }\n\n var output = this.head.value;\n var runner = this.head.next;\n\n while (runner != null) {\n output += \" - \" + runner.value;\n runner = runner.next;\n }\n\n return output;\n }", "function print(x) {\n var div = document.getElementById('output');\n div.innerHTML = x;\n}", "function display() {\n // console.log(\"I'm in display - no arg\");\n // console.log(display.arguments.length);\n // console.log(display.arguments);\n\n for(i=0; i<display.arguments.length; i++) {\n console.log(display.arguments[i]);\n }\n}", "function displayValue(value) {\n display.textContent = value;\n}", "function swPrint(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function displayText(string){\n push();\n textFont(`Blenny`);\n textAlign(CENTER,CENTER);\n textSize(60);\n text(string, width/2, height/2);\n pop();\n}", "function displayChar(c) {\n LaunchBar.displayInLargeType({\n\ttitle: c.name,\n\tstring: c.c,\n });\n}", "function show(obj,d){\n\tstr=\"\"\n\tfor(i in obj){\n\t\tstr+=i + \" : \" +String(obj[i])+\"\\n\"\n\t\t}\n\talert(str)\n\t}", "function display() {\n\t\t\t\t\t\t$(\"#uListPos\").html(\"Number: \" + (i+1) + \"/\" + (userList.length));\n\t\t\t\t\t\t$(\"#uListName\").html(\"User: \" + userList[i][1]);\n\t\t\t\t\t\t$(\"#uListFact\").html(\"Fact:<br>\" + userList[i][2]);\n\t\t\t\t\t}", "function display() {\n\twindow.print();\n}", "function displayPlayer() {\n\t$player = $('#player');\n\t$player.empty()\n\t\t.append(addHeader('PLAYER'))\n\t\t.append(`Health : ${player.health.now} / ${player.health.max}`)\n\t\t.append(`<br>Energy : ${player.energy.now} / ${player.energy.max}`)\n\t\t.append(`<br>Weight : ${player.weight.now} / ${player.weight.max}`);\n\n\tif(player.primary === 'None')\n\t\t$player.append('<br><br>Primary : None');\n\telse $player.append(`<br><br>Primary : ${itemLink(player.primary)}`);\n\t\n\tif(player.secondary === 'None')\n\t\t$player.append('<br>Secondary : None');\n\telse $player.append(`<br>Secondary : ${itemLink(player.secondary)}`);\n}", "display(){\r\n point(this.x,this.y);\r\n }", "get display() {\n return this._display.innerHTML;\n }", "function mjDisplay(theid,showit)\n{\n writeConsole(\"mjDisplay: name[\"+theid+\"] show[\"+showit+\"]\"); \n var foo = document.getElementById(theid);\n if (foo)\n {\n if (showit) foo.style.display = 'block';\n else foo.style.display = 'none';\n }\n else writeConsole(\"mjDisplay: name[\"+theid+\"] NOT FOUND\");\n}", "function displayDoubleTwo() {\n var output = \"\";\n var i = 2;\n while (i <= 65536) {\n output += i + \"\\n\";\n i *= 2;\n }\n return output;\n }", "function showOutput(text) {\n document.getElementById('output').innerHTML = text;\n}", "function showline(v) {\n showvalue(v);\n putline();\n}", "function displayString(result) {\n let output = document.getElementById(\"results\");\n output.innerText = `${result}`;\n\n }", "function display(ll){\n let currNode = ll.head;\n let output = 'head->';\n while (currNode !== null){\n output += `${currNode.value}->`;\n currNode = currNode.next;\n }\n output += 'null';\n console.log(output);\n return output;\n}", "function xDisplay(e,s)\r\n{\r\n if ((e=xGetElementById(e)) && e.style && xDef(e.style.display)) {\r\n if (xStr(s)) {\r\n try { e.style.display = s; }\r\n catch (ex) { e.style.display = ''; } // Will this make IE use a default value\r\n } // appropriate for the element?\r\n return e.style.display;\r\n }\r\n return null;\r\n}", "function display(k, a, x) {\n k(console.log(x));\n}", "function display(ll) {\n console.log(JSON.stringify(ll));\n}", "function printdisplay() {\n \"use strict\";\n\tdocument.getElementById(\"display\").innerHTML = varprint;\n}", "function func (){\n var element = document.getElementById('display_pane');\n element.innerHTML = printObj(object);\n }", "function display(output) {\n\tconsole.log(output);\n\tdocument.write(output);\n\tdocument.write(\"<br>\");\n\tclunkCounter = clunkCounter + 1;\n}", "function display(num){\n console.log('number as array', num.toString().split('.'),'length:', num.toString().split('').length)\n screen.innerText = num\n\n}", "function finalDisplay(a, b){\n\tword.display[a] = b;\n}", "function displayQuestion() {\n push();\n textAlign(LEFT, CENTER);\n textSize(28);\n fill(255);\n text(`lvl #2`, width / 20, height / 20);\n text(`On a scale from 'I got this' to 'AAAAAAH',\nhow confident do you feel about the future?`, width / 20, height / 10 * 2)\n pop()\n}", "function displayPlayer(name, number) {\n console.log(`this is the best player in the world ${name} and his number is ${number}`)\n}", "function display(board) {\n var element = document.createElement('pre');\n document.body.appendChild(element);\n\n setInterval(function () {\n element.innerText = board + '';\n board.next();\n }, 1000);\n }", "function display(stack) {\n let displayString = 'Top ->> ';\n let curr = stack.top;\n while (curr !== null) {\n displayString += curr.data + ', ';\n curr = curr.next;\n }\n return console.log(displayString);\n}", "function display(){\n document.getElementById(\"outline\").innerHTML = calcScreen;\n}", "function displayData(data){\n var html = `\n <h1>${data.number} people in space</h1>\n `;\n document.body.innerHTML = html;\n console.log(`There are ${data.number} people in space`);\n}", "function displayData (data {\n var html = `<h1>${data.number} people in space</h1>`;\n document.body.innerHTML = html;\n \n}" ]
[ "0.7217159", "0.7081442", "0.7027051", "0.7014715", "0.69218504", "0.683686", "0.6828447", "0.68092436", "0.67900914", "0.6785537", "0.67777014", "0.6762396", "0.6715106", "0.67006016", "0.6689735", "0.6689735", "0.667217", "0.66417915", "0.6608583", "0.65643364", "0.6560081", "0.6529872", "0.65297264", "0.65237606", "0.65139484", "0.65136564", "0.651286", "0.6512209", "0.6495318", "0.64833486", "0.6456551", "0.6449437", "0.6437373", "0.6435928", "0.641921", "0.63914895", "0.6369565", "0.63614035", "0.6325227", "0.63119775", "0.6307365", "0.62995124", "0.6295732", "0.62923646", "0.6284349", "0.6281515", "0.6277751", "0.6271938", "0.62706304", "0.6245248", "0.624272", "0.6239818", "0.62222433", "0.62184674", "0.6218318", "0.6213931", "0.62135744", "0.62105083", "0.62036526", "0.6196588", "0.61862105", "0.6171395", "0.6170866", "0.61652493", "0.6164341", "0.6162074", "0.6159606", "0.61538553", "0.61469764", "0.61374056", "0.61363137", "0.61301243", "0.6127485", "0.61269104", "0.61250705", "0.612483", "0.61104983", "0.6106426", "0.61040115", "0.6103858", "0.6097468", "0.6088437", "0.6079776", "0.6077175", "0.60767967", "0.6065865", "0.60582894", "0.60577834", "0.60562205", "0.6045604", "0.60314965", "0.6028039", "0.6025606", "0.6024778", "0.6022071", "0.60219574", "0.60170615", "0.6009589", "0.6005396", "0.59992313", "0.59938747" ]
0.0
-1
OK... This idea came to me in the shower (literally) so it might be dumb But I thought if I ahd the X,Y of when the mouse was pressed, and I had the current x,y of the image, I could calculate the slope of the line connecting those two points, which is just the ratio of y pixels over x pixels and add to the x y vectors based on that slope. I ended up having to have four special cases for each quadrant as referenced by the console.logs There has to be a better way for this, but this is the best I could do and it's still not perfect (I haven't yet, but I assume at some point I could accidentally divide by 0 for example)
move() { let slope = this.yDist / this.xDist; //y is negative, x is positive if (this.yDist < 0 && this.xDist > 0) { slope = this.xDist / this.yDist; console.log("-Y, X"); //FINALLY WORKING this.bulletXSpeed -= slope; this.bulletYSpeed -= 1; } //y is positive, x is positive if (this.yDist > 0 && this.xDist > 0) { console.log("Y, X"); //GOOD, WORKING this.bulletXSpeed += 1; this.bulletYSpeed += slope; } //y is negative, x is negative if (this.yDist < 0 && this.xDist < 0) { console.log("-Y, -X"); //GOOD, WORKING this.bulletXSpeed -= 1; this.bulletYSpeed -= slope; } //y is positive, x is negative if (this.yDist > 0 && this.xDist < 0) { slope = this.xDist / this.yDist; //GOOD, WORKING console.log("Y, -X"); this.bulletXSpeed += slope; this.bulletYSpeed += 1; } //then just move regularly this.bulletX += this.bulletXSpeed; this.bulletY += this.bulletYSpeed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLinePoints(p1,p2)\n{\n\tvar slope;\n var begin;\n var end;\n var original;\n \n var horiz = Math.abs(p1[0]-p2[0]) > Math.abs(p1[1]-p2[1]); //Find pixel increment direction\n \n //Get start x,y and ending y\n if(horiz) //if pixel increment is left to right\n {\n if(p1[0]<p2[0]){begin=p1[0];end=p2[0];original=p1[1];}\n else {begin=p2[0];end=p1[0];original=p2[1];}\n slope = (p1[1]-p2[1])/(p1[0]-p2[0]);\n\n }\n else\n {\n if(p1[1]<p2[1]){begin=p1[1];end=p2[1];original=p1[0];}\n else {begin=p2[1];end=p1[1];original=p2[0];}\n slope = (p1[0]-p2[0])/(p1[1]-p2[1]);\n }\n var nps = [];\n\tvar state = begin + 1;\n //(yn-yo)/(xn-xo)=slope\n // yn = slope*(xn-xo)+yo\n while(state<end)\n\t{\n\t if(horiz)nps.push([state,Math.round((state-begin)*slope+original)])\n else nps.push([Math.round((state-begin)*slope+original),state])\n\t state+= 1;\n\t}\n\treturn nps;\n \n}", "function lineBresenham(x1, y1, x2, y2){\n let dx, dy;\n let stepX, stepY;\n \n dx = x2 - x1;\n dy = y2 - y1;\n\n if (dy < 0) {\n dy = -dy;\n stepY = -totPixel;\n } else {\n stepY = totPixel;\n }\n if (dx < 0) {\n dx = -dx;\n stepX = -totPixel;\n } else {\n stepX = totPixel;\n }\n /* 2dy, 2dx */\n dy << 1;\n dx << 1;\n\n if ((0 <= x1) && (x1 < width) && (0 <= y1) && (y1 < height)) {\n setPixel(x1, y1);\n }\n /* slope between 1 and -1, greater than 1, less than -1 */\n if (dx > dy) {\n let fraction = dy - (dx >> 1);\n while(x1 < x2){\n x1 += stepX;\n if (fraction >= 0) {\n y1 += stepY;\n fraction -= dx;\n }\n fraction += dy;\n if ((0 <= x1) && (x1 < width) && (0 <= y1) && (y1 < height)) {\n setPixel(x1, y1);\n }\n }\n } else if (y1 > y2) {\n let fraction = dx - (dy >> 1);\n while(y1 > y2){\n if(fraction >= 0){\n x1 += stepX;\n fraction -= dy;\n }\n y1 += stepY;\n fraction += dx;\n if((0 <= x1) && (x1 < width) && (0 <= y1) && (y1 < height)){\n setPixel(x1, y1);\n }\n }\n } else {\n let fraction = dx - (dy >> 1);\n while(y1 < y2){\n if (fraction >= 0) {\n x1 += stepX;\n fraction -= dy;\n }\n y1 += stepY;\n fraction += dx;\n if ((0 <= x1) && (x1 < width) && (0 <= y1) && (y1 < height)) {\n setPixel(x1, y1);\n }\n }\n }\n}", "_drawLine(x1, y1, x2, y2, opt_boundRect) {\n if (opt_boundRect) {\n let minX = Math.min(x1, x2);\n let maxX = Math.max(x1, x2);\n let minY = Math.min(y1, y2);\n let maxY = Math.max(y1, y2);\n\n if (opt_boundRect.left <= minX && maxX < opt_boundRect.right &&\n opt_boundRect.top <= minY && maxY < opt_boundRect.bottom) {\n opt_boundRect = null; // the line is fully inside the drawing area\n } else if (opt_boundRect.left > maxX || minX >= opt_boundRect.right ||\n opt_boundRect.top > maxY || minY > opt_boundRect.bottom) {\n return; // the line is outside the drawing area\n }\n }\n\n let dx = x2 - x1;\n let dy = y2 - y1;\n\n if (dx !== 0 || dy !== 0) {\n if (Math.abs(dx) > Math.abs(dy)) {\n let a = dy / dx;\n let b = -a * x1 + y1;\n\n if (dx < 0) {\n let x0 = x1;\n x1 = x2;\n x2 = x0;\n }\n\n for (let x = x1; x <= x2; x++) {\n let y = Math.round(a * x + b);\n this._drawPixel(x, y, opt_boundRect);\n }\n } else {\n let a = dx / dy;\n let b = -a * y1 + x1;\n\n if (dy < 0) {\n let y0 = y1;\n y1 = y2;\n y2 = y0;\n }\n\n for (let y = y1; y <= y2; y++) {\n let x = Math.round(a * y + b);\n this._drawPixel(x, y, opt_boundRect);\n }\n }\n }\n }", "function calculatePoint(){\n var M = 40;\n var L = 3;\n var startPoint = vec2(115, 121);\n\n var currPoint_x = startPoint[0];\n var currPoint_y = startPoint[1];\n var nextPoint_x = startPoint[0];\n var nextPoint_y = startPoint[1];\n\n points = [];\n for( var i = 0; points.length < numberPoints; i++){\n nextPoint_x = M * (1 + 2*L) - currPoint_y + Math.abs(currPoint_x - L * M);\n nextPoint_y = currPoint_x;\n\n // to normalize this I think need to know the max value of x,y\n // instead of /canvas.width or /canvas.height\n points.push(vec2(nextPoint_x / canvas.width, nextPoint_y / canvas.height));\n // points.push(vec2(nextPoint_x, nextPoint_y));\n currPoint_x = nextPoint_x;\n currPoint_y = nextPoint_y;\n // console.log(points[i]);\n }\n}", "function drawLine(imageData, startVertexOrig, endVertexOrig, color) {\n\tvar startVertex = {};\n\tvar endVertex = {};\n\tcopyVertex(startVertex, startVertexOrig)\n\tcopyVertex(endVertex, endVertexOrig)\n\tif (startVertex.x > endVertex.x) {\n\t\tvar temp = startVertex;\n\t\tstartVertex = endVertex;\n\t\tendVertex = temp;\n\t}\n\tvar x0 = startVertex.x;\n\tvar y0 = startVertex.y;\n\tvar x1 = endVertex.x;\n\tvar y1 = endVertex.y;\n\tvar yInc = 1;\n\n\n\tvar dx = x1 - x0;\n\tvar dy = y1 - y0;\n\tvar d = 2 * dy - dx;\n\tvar delE = 2 * dy;\n\tvar delNE = 2 * (dy - dx)\n\tvar m = dy / dx;\n\tvar flag = false;\n\n\tif (m >= 0 && m < 1) { }\n\telse if (m >= 1) {\n\t\t//console.log('dx,dy swapped')\n\t\tflag = true;\n\t\tdx = dx + dy; dy = dx - dy; dx = dx - dy;\n\t\t//x0=x0+y0;y0=x0-y0;x0=x0-y0;\n\t\t//x1=x1+y1;y1=x1-y1;x1=x1-y1;\n\t}\n\telse if (m < 0 && m > -1) {\n\t\tyInc = -1\n\t\tdy = -dy;\n\t}\n\telse if (m <= -1) {\n\t\tyInc = -1\n\t\t//console.log('dx,dy swapped here')\n\t\tflag = true\n\t\tdy = -dy\n\t\tdx = dx + dy; dy = dx - dy; dx = dx - dy;\n\n\t}\n\n\td = (2 * dy - dx)\n\tdelE = 2 * dy\n\tdelNE = 2 * (dy - dx)\n\tm = dy / dx;\n\n\tvar newVertex = startVertex\n\tnewVertex.x = round(x0)\n\tnewVertex.y = round(y0)\n\tnewVertex.z = round(startVertex.z < endVertex.z ? startVertex.z : endVertex.z)//(startVertex.z + endVertex.z)/2\n\tnewVertex.nx = startVertex.nx\n\tnewVertex.ny = startVertex.ny\n\tnewVertex.nz = startVertex.nz\n\tnewVertex.r = color[0];\n\tnewVertex.g = color[1];\n\tnewVertex.b = color[2];\n\n\tshowPixel(imageData, newVertex)\n\tif (!flag) {//m<1 && m>-1){\n\t\twhile (newVertex.x <= x1) {\n\t\t\tif (d <= 0) {\n\t\t\t\td += delE\n\t\t\t\tnewVertex.x = newVertex.x + 1\n\t\t\t}\n\t\t\telse {\n\t\t\t\td += delNE\n\t\t\t\tnewVertex.x = newVertex.x + 1\n\t\t\t\tnewVertex.y = (newVertex.y + yInc)\n\t\t\t}\n\t\t\tif (m > 0)\n\t\t\t\tshowPixel(imageData, newVertex)\n\t\t\telse\n\t\t\t\tshowPixel(imageData, newVertex, false)\n\t\t}\n\t}\n\telse {\n\t\tif (y1 > y0) {\n\t\t\twhile (newVertex.y <= y1) {\n\t\t\t\tif (d <= 0) {\n\t\t\t\t\td += delE\n\t\t\t\t\tnewVertex.y = newVertex.y + yInc\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\td += delNE\n\t\t\t\t\tnewVertex.y = newVertex.y + yInc\n\t\t\t\t\tnewVertex.x = newVertex.x + 1\n\t\t\t\t}\n\t\t\t\tshowPixel(imageData, newVertex, false)\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\twhile (newVertex.y >= y1) {\n\t\t\t\tif (d <= 0) {\n\t\t\t\t\td += delE\n\t\t\t\t\tnewVertex.y = newVertex.y + yInc\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\td += delNE\n\t\t\t\t\tnewVertex.y = newVertex.y + yInc\n\t\t\t\t\tnewVertex.x = (newVertex.x + 1)\n\t\t\t\t}\n\t\t\t\tshowPixel(imageData, newVertex, false)\n\t\t\t}\n\t\t}\n\t}\n}", "getLineLengthBetweenPoints (x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n }", "function calculateSlope() {\n let x1 = 2;\n let x2 = 4;\n let firstPointY = 2 * x1 - 2;\n let secondPointY = 2 * x2 - 2;\n return (secondPointY - firstPointY) / (x2 - x1);\n}", "_drawLineLow( x1, y1, x2, y2, id ) {\n const dx = x2 - x1;\n let dy = y2 - y1;\n let yIncrement = 1;\n if ( dy < 0 ) {\n yIncrement = -1;\n dy = -dy;\n }\n\n let decision = 2 * dy - dx;\n let y = y1;\n\n for ( let x = x1; x <= x2; x += 1 ) {\n this.setPixel( x, y, id );\n\n if ( decision > 0 ) {\n y += yIncrement;\n decision = decision - ( 2 * dx );\n }\n\n decision = decision + ( 2 * dy );\n }\n }", "function DrawLine(x1, y1, x2, y2){\n let x, y, dx, dy, dx1, dy1, px, py, xe, ye, i;\n dx = x2 - x1;\n dy = y2 - y1;\n dx1 = Math.abs(dx);\n dy1 = Math.abs(dy);\n px = 2 * dy1 - dx1;\n py = 2 * dx1 - dy1;\n if (dy1 <= dx1) {\n if (dx >= 0) {\n x = x1; y = y1; xe = x2;\n } else {\n x = x2; y = y2; xe = x1;\n }\n if($('#'+y+'a'+x).attr('type') == 'tile')\n prev_pixels.push($('#'+y+'a'+x));\n for (i = 0; x < xe; i++) {\n x = x + 1;\n if (px < 0) {\n px = px + 2 * dy1;\n } else {\n if ((dx < 0 && dy < 0) || (dx > 0 && dy > 0)) {\n y = y + 1;\n } else {\n y = y - 1;\n }\n px = px + 2 * (dy1 - dx1);\n }\n if($('#'+y+'a'+x).attr('type') == 'tile')\n prev_pixels.push($('#'+y+'a'+x));\n }\n } else {\n if (dy >= 0) {\n x = x1; y = y1; ye = y2;\n } else { \n x = x2; y = y2; ye = y1;\n }\n if($('#'+y+'a'+x).attr('type') == 'tile')\n prev_pixels.push($('#'+y+'a'+x));\n for (i = 0; y < ye; i++) {\n y = y + 1;\n if (py <= 0) {\n py = py + 2 * dx1;\n } else {\n if ((dx < 0 && dy<0) || (dx > 0 && dy > 0)) {\n x = x + 1;\n } else {\n x = x - 1;\n }\n py = py + 2 * (dx1 - dy1);\n }\n if($('#'+y+'a'+x).attr('type') == 'tile')\n prev_pixels.push($('#'+y+'a'+x));\n }\n }\n}", "function mouseDragged(){\n\tif(mouseX > board[0] & mouseX < board[1] & mouseY > board[2] & mouseY < board[3]){ //verifica se o mouse ta dentro do quadro\n\t for (let i = 0; i < pointsX[curveIterator].length; i++) {\n\t\t if(lastX >= pointsX[curveIterator][i]-10 & lastX <= pointsX[curveIterator][i]+10 & lastY >= pointsY[curveIterator] [i]-10 & lastY <= pointsY[curveIterator][i]+10){ //varre todos os pontos e preocura o q o mouse ta dentro do circulo\n\t\t\tpointsX[curveIterator][i] += (mouseX - lastX)\n\t\t\tpointsY[curveIterator][i] += (mouseY - lastY)\n\t\t\tbreak\n\t\t }\n\t }\n\t lastX = mouseX\n\t lastY = mouseY\n }\n}", "function slope(a, b) {\n return (b.y - a.y) / (b.x - a.x);\n }", "function slope(a, b) {\n return (b.y - a.y) / (b.x - a.x);\n }", "function slope(a, b) {\n return (b.y - a.y) / (b.x - a.x);\n }", "function slope(a, b) {\n return (b.y - a.y) / (b.x - a.x);\n }", "_drawLineHigh( x1, y1, x2, y2, id ) {\n let dx = x2 - x1;\n const dy = y2 - y1;\n let xIncrement = 1;\n if ( dx < 0 ) {\n xIncrement = -1;\n dx = -dx;\n }\n\n let decision = 2 * dx - dy;\n let x = x1;\n\n for ( let y = y1; y <= y2; y += 1 ) {\n this.setPixel( x, y, id );\n\n if ( decision > 0 ) {\n x += xIncrement;\n decision = decision - ( 2 * dy );\n }\n\n decision = decision + ( 2 * dx );\n }\n }", "function getSlope(a, b) {\n return (b.y - a.y) / (b.x - a.x);\n}", "function line(x0, y0, x1, y1) {\n let dx = Math.abs(x1-x0);\n let dy = Math.abs(y1-y0);\n let sx = (x0 < x1) ? 1 : -1; // Step direction for pixels\n let sy = (y0 < y1) ? 1 : -1;\n let err = dx-dy; // Keep track of err as we go\n console.log(dx, dy);\n\n while(true) {\n // setPixel(x0,y0); // Do what you need to for this\n actions.push({type: 'set-pixel', x0, y0, err});\n\n // Exit once we've reached the end point\n if ((x0==x1) && (y0==y1)) {\n actions.push({type: 'done', x0, y0, x1, y1, sx, sy, err});\n break;\n }\n\n let e2 = 2*err;\n\n // Step in the x direction\n if (e2 > -dy) {\n err -= dy;\n x0 += sx;\n actions.push({type: 'x-step', err, x0, x1, y0, y1, sx, sy});\n }\n // Step in the y-direction\n if (e2 < dx) {\n err += dx;\n y0 += sy;\n actions.push({type: 'y-step', err, x0, x1, y0, y1, sx, sy});\n }\n }\n}", "function calcSlope(a, b) {\n return ((b.y - a.y)/(b.x - a.x));\n}", "getLineParameters() {\n if (this.x1 !== this.x2) {\n this.a = ((this.y2 - this.y1)) / ((this.x1 - this.x2))\n this.b = 1.0\n this.c = this.a * this.x1 + this.b * this.y1\n }\n else {\n this.a = 1.0\n this.b = ((this.x1 - this.x2)) / ((this.y2 - this.y1))\n this.c = this.a * this.x1 + this.b * this.y1\n }\n }", "function getDistance(x, y){\n return Math.pow((Math.pow((x - mouseX),2) + Math.pow((y - mouseY),2)),0.5);\n}", "function wuLine(x1, y1, x2, y2) {\n var canvas = document.getElementById(\"canvas3\");\n var context = canvas.getContext(\"2d\");\n var steep = Math.abs(y2 - y1) > Math.abs(x2 - x1);\n if (steep) {\n x1 = [y1, y1 = x1][0];\n x2 = [y2, y2 = x2][0];\n }\n if (x1 > x2) {\n x1 = [x2, x2 = x1][0];\n y1 = [y2, y2 = y1][0];\n }\n draw(context, colorFigure, steep ? y1 : x1, steep ? x1 : y1);\n draw(context, colorFigure, steep ? y2 : x2, steep ? x2 : y2);\n var dx = x2 - x1;\n var dy = y2 - y1;\n var gradient = dy / dx;\n var y = y1 + gradient;\n for (var x = x1 + 1; x < x2 - 1; x++) {\n colorFigure.a = (1 - (y - Math.floor(y))) * 10000;\n draw(context, colorFigure, x, Math.floor(y));\n colorFigure.a = (y - Math.floor(y)) * 10000;\n draw(context, colorFigure, x, Math.floor(y));\n y += gradient;\n }\n}", "function calcLine(x0, y0, x1, y1) {\n\tlet coords = [];\n let ix = x0 < x1 ? 1 : -1, dx = Math.abs(x1 - x0);\n let iy = y0 < y1 ? 1 : -1, dy = Math.abs(y1 - y0);\n let m = Math.max(dx, dy), cx = m >> 1, cy = m >> 1;\n\n for (i = 0; i < m; i++) {\n coords.push([x0, y0]);\n if ((cx += dx) >= m) { cx -= m; x0 += ix; }\n if ((cy += dy) >= m) { cy -= m; y0 += iy; }\n }\n\n\treturn coords;\n}", "function d4_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "visitLinePixels(visitor, line) {\n const vec = { dx: line.x1 - line.x0, dy: line.y1 - line.y0 }\n // If line is a point we're lazy (and eliminate some special cases)\n if (vec.dx === 0 && vec.dy === 0) {\n const x = Math.floor(line.x0);\n const y = Math.floor(line.y0);\n const idx = x + this.width * y;\n visitor(x, y, idx);\n return;\n }\n const len = Math.sqrt(Math.pow(vec.dx, 2) + Math.pow(vec.dy, 2));\n const unit = { dx: vec.dx / len, dy: vec.dy / len };\n const ortho = { dx: unit.dy, dy: -unit.dx };\n // Using a Set makes it easy to comply with the pixel uniqueness\n // requirement\n const indices = new Set();\n const addPixel = (x, y) => {\n x = Math.floor(x);\n y = Math.floor(y);\n if (x < 0 || x >= this.width)\n return\n if (y < 0 || y >= this.height)\n return;\n const idx = x + this.width * y;\n if (idx !== idx)\n throw new Error('Trying to add NaN as a line pixel index');\n indices.add(idx);\n };\n const pos = { x: line.x0, y: line.y0 };\n const sigX = line.x1 - line.x0;\n const sigY = line.y1 - line.y0;\n do {\n addPixel(pos.x, pos.y);\n for (let i = 0; i < this.strokeWidth; i++) {\n const xt = pos.x + .5 * ortho.dx;\n const yt = pos.y + .5 * ortho.dy;\n addPixel(xt, yt);\n const xb = pos.x - .5 * ortho.dx;\n const yb = pos.y - .5 * ortho.dy;\n addPixel(xb, yb);\n }\n pos.x += unit.dx;\n pos.y += unit.dy;\n } while((line.x1 - pos.x) * sigX > 0 || (line.y1 - pos.y) * sigY > 0);\n const iterator = indices.values();\n for (let i = 0; i < indices.size; i++) {\n const idx = iterator.next().value;\n const x = idx % this.width;\n const y = Math.floor(idx / this.width);\n if (x !== x || y !== y)\n throw new Error('Encountered line coordinates which are NaN');\n const res = visitor(x, y, idx);\n // Bailing mechanism\n if (res === false)\n break;\n }\n }", "function extendLine(p1, p2){\n //y = mx+b\n var m = (p2.y-p1.y)/(p2.x-p1.x);\n var b = p1.y - m*p1.x;\n var P = [];\n // 0, 0, canvas.width, canvas.height\n if(b >= 0 && b <= canvas.height){\n var newB = Math.floor(b);\n P.push({x:0, y:newB});\n }\n var temp = m*canvas.width+b;\n if(temp >= 0 && temp <= canvas.height){\n var newB = Math.floor(temp);\n P.push({x:canvas.width, y:newB});\n }\n //x = (y-b)/m\n temp = (b*-1)/m; \n if(temp >= 0 && temp <= canvas.width){\n var newB = Math.floor(temp);\n P.push({x:newB, y:0});\n }\n temp = (canvas.width-b)/m; \n if(temp >= 0 && temp <= canvas.width){\n var newB = Math.floor(temp);\n P.push({x:newB, y:canvas.height});\n }\n \n //finds corner points on wrong side of midline\n var cp = crossProduct(p1, findPoint, p2);\n var corners = [];\n corners.push({x:0, y:0});\n corners.push({x:0, y:canvas.height});\n corners.push({x:canvas.width, y:canvas.height});\n corners.push({x:canvas.width, y:0});\n for(var i = 0 ; i < corners.length; i++){\n if(cp < 0){\n if(crossProduct(p1, corners[i], p2) > 0){\n P.push(corners[i]);\n }\n }\n if(cp > 0){\n if(crossProduct(p1, corners[i], p2) < 0){\n P.push(corners[i]);\n }\n }\n }\n \n return convexHull(P); //reorders points so that I can draw lines and fill in the shape\n}", "function updateSnapPos() {\r\n snapX = mouseX;\r\n snapY = mouseY;\r\n snapType = 'none';\r\n if (snapToGrid) {\r\n snapType = 'grid';\r\n //determine first vertical gridline with x greater than mouseX\r\n for (snapX=CELL_SIZE; snapX<=canvas.width && snapX<mouseX; snapX+=CELL_SIZE) { }\r\n //snap to previous vertical gridline if mouseX is less than half way there\r\n if ((snapX - mouseX) > CELL_SIZE / 2) {\r\n snapX -= CELL_SIZE;\r\n }\r\n\r\n //determine first horizontal gridline with y greater than mouseY\r\n for (snapY=CELL_SIZE; snapY<=canvas.height && snapY<mouseY; snapY+=CELL_SIZE) { }\r\n //snap to previous horizontal gridline if mouseY is less than half way there\r\n if ((snapY - mouseY) > CELL_SIZE / 2) {\r\n snapY -= CELL_SIZE;\r\n }\r\n }\r\n var TOLERANCE = CELL_SIZE / 2;\r\n var mousePos = {x:mouseX,y:mouseY};\r\n if (snapToVertices) {\r\n for (var i=0; i<lineSegments.length; ++i) {\r\n //if mouse position is within TOLERANCE distance of one vertex of a line exactly\r\n if (Geometry.distance(mousePos, lineSegments[i].p1) < TOLERANCE) {\r\n snapX = lineSegments[i].p1.x;\r\n snapY = lineSegments[i].p1.y;\r\n snapType = 'vertex';\r\n return;\r\n } else if (Geometry.distance(mousePos, lineSegments[i].p2) < TOLERANCE) {\r\n snapX = lineSegments[i].p2.x;\r\n snapY = lineSegments[i].p2.y;\r\n snapType = 'vertex';\r\n return;\r\n }\r\n }\r\n }\r\n //ToDo: implement snap to implicit vertices created by intersecting line segments\r\n if (snapToEdges) {\r\n for (var i=0; i<lineSegments.length; ++i) {\r\n var closestPoint = Geometry.getClosestPointOnLineSegment(lineSegments[i].p1, lineSegments[i].p2, mousePos, TOLERANCE)\r\n if (closestPoint != false) {\r\n snapX = closestPoint.x;\r\n snapY = closestPoint.y;\r\n snapType = 'edge';\r\n return;\r\n }\r\n }\r\n }\r\n}", "function intersectLineLine(x1, y1, x2, y2, x3, y3, x4, y4) {\n \"use strict\";\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, num;\n var x, y;\n x = 0;\n y = 0;\n\n var result = null;\n\n a1 = y2 - y1;\n\n b1 = x1 - x2;\n c1 = (x2 * y1) - (x1 * y2);\n\n r3 = ((a1 * x3) + (b1 * y3) + c1);\n r4 = ((a1 * x4) + (b1 * y4) + c1);\n\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return result;\n }\n\n a2 = y4 - y3;\n b2 = x3 - x4;\n c2 = (x4 * y3) - (x3 * y4);\n\n r1 = (a2 * x1) + (b2 * y1) + c2;\n r2 = (a2 * x2) + (b2 * y2) + c2;\n\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return result;\n }\n\n denom = (a1 * b2) - (a2 * b1);\n\n if (denom === 0) {\n return result;\n }\n\n num = (b1 * c2) - (b2 * c1);\n x = (num) / denom;\n\n num = (a2 * c1) - (a1 * c2);\n y = (num) / denom;\n\n result = createVector(x, y);\n\n return result;\n}", "function slopeFromPoints([x1, y1], [x2, y2]) {\n return (y2 - y1) / (x2 - x1);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function disPoint(x1,y1,x2,y2){\n var distanceX=Math.pow((x1-x2),2)\n var distanceY=Math.pow((y1-y2),2)\n return Math.sqrt(distanceX+distanceY);\n \n}", "function intersectsLine(a,b,c,d,p,q,r,s) {\n var det, gamma, lambda;\n det = (c - a) * (s - q) - (r - p) * (d - b);\n if (det === 0) {\n return false;\n } else {\n lambda = ((s - q) * (r - a) + (p - r) * (s - b)) / det;\n gamma = ((b - d) * (r - a) + (c - a) * (s - b)) / det;\n\n if((0 < lambda && lambda < 1) && (0 < gamma && gamma < 1)) {\n \n // let dir = new THREE.Vector2(c-a, d-b);\n // // dir.normalize();\n\n // let px = a + lambda * dir.x; \n // let py = b + gamma * dir.y;\n \n let dir1 = new THREE.Vector2(c-a, d-b);\n // dir1.normalize();\n let dir2 = new THREE.Vector2(r-p, s-q);\n // dir2.normalize();\n\n let px = (a + lambda * dir1.x); // + (p + gamma * dir2.x); \n let py = (b + lambda * dir1.y); // + (q + gamma * dir2.y); \n \n\n\n return { px: px, py: py };\n }\n\n return false;\n }\n}", "function line(x0, y0, x1, y1){\n var dx = Math.abs(x1-x0);\n var dy = Math.abs(y1-y0);\n var sx = (x0 < x1) ? 1 : -1;\n var sy = (y0 < y1) ? 1 : -1;\n var err = dx-dy;\n var terminationConst = 1.1;\n\n while(true){\n // putPixel\n ctx.fillStyle = 'black';\n ctx.fillRect(x0, y0, 1, 1);\n\n if ((Math.abs(x0-x1) < terminationConst) && (Math.abs(y0-y1) < terminationConst)) break;\n var e2 = 2*err;\n if (e2 >-dy){ err -= dy; x0 += sx; }\n if (e2 < dx){ err += dx; y0 += sy; }\n }\n }", "function IsPointOnLine(linePointA, linePointB, point) {\n var isOn = false;\n //quick bounding check\n if ((point.x >= linePointA.x && point.x <= linePointB.x) || (point.x >= linePointB.x && point.x <= linePointA.x)) {\n if ((point.y >= linePointA.y && point.y <= linePointB.y) || (point.y >= linePointB.y && point.y <= linePointA.y)) {\n var a = (linePointB.y - linePointA.y) / (linePointB.x - linePointA.x);\n var b = linePointA.y - a * linePointA.x;\n //adjust the tolerance by the zoom level\n var delta = Math.abs(point.y - (a * point.x + b));\n var tolerance = (EPSILON * (zoomLevel / 100));\n //$('#line-data').text(delta.toFixed(4) + \",\" + tolerance.toFixed(4));\n if (delta <= tolerance) {\n // point is on line segment\n isOn = true;\n }\n if (!isOn) {\n //still not on, but check for other verticies\n a = (linePointB.x - linePointA.x) / (linePointB.y - linePointA.y);\n b = linePointA.x - a * linePointA.y;\n //adjust the tolerance by the zoom level\n var delta = Math.abs(point.x - (a * point.y + b));\n var tolerance = (EPSILON * (zoomLevel / 100));\n if (delta <= tolerance) {\n // point is on line segment\n isOn = true;\n }\n }\n // point not on line segment\n return isOn;\n } else {\n // y isn't in range of line segment\n return false;\n }\n } else {\n // x isn't in range of line segment\n return false;\n }\n\n}", "drawLineOnGrid(x1, y1, x2, y2) { \n\n let deltaX = x2 - x1;\n let deltaY = y2 - y1; \n \n // function to return one of \"-\" or \"X\" depending on line orientation\n let keyCharacter = this.getKeyCharacterForLine(deltaX, deltaY);\n \n // if the line has gradient < 1\n if (Math.abs(deltaY) <= Math.abs(deltaX)) { \n if (deltaX >= 0) {\n // line is drawn left to right\n this.drawShallowLine(x1, y1, x2, deltaX, deltaY, keyCharacter);\n } else {\n // line is drawn right to left\n this.drawShallowLine(x2, y2, x1, deltaX, deltaY, keyCharacter);\n } \n // if the line has gradient > 1 \n } else { \n if (deltaY >= 0) {\n // line is drawn downwards\n this.drawSteepLine(x1, y1, y2, deltaX, deltaY, keyCharacter)\n } else { \n // line is drawn upwards\n this.drawSteepLine(x2, y2, y1, deltaX, deltaY, keyCharacter)\n } \n }\n // log the end square so we can get the highlighting dimensions when required\n this.endSquare = this.filledSquares[this.filledSquares.length - 1];\n }", "function d3_v3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "tracePerimeter(p1, p2, includeOriginalPoints=false) {\n let points\n\n if ((p1.x === p2.x && Math.abs(p1.x) === this.sizeX) || (p1.y === p2.y && (Math.abs(p1.y) === this.sizeY))) {\n // on the same line; no connecting points needed\n points = []\n } else {\n // horizontal or vertical orientation; some gentle rounding to ensure we don't\n // end up within incorrect reading\n const lp1 = vertexRoundP(p1, 3)\n const lp2 = vertexRoundP(p2, 3)\n const o1 = Math.abs(lp1.x) === this.sizeX ? 'v' : 'h'\n const o2 = Math.abs(lp2.x) === this.sizeX ? 'v' : 'h'\n\n if (o1 !== o2) {\n // connects via a single corner\n points = (o1 === 'h') ?\n [new Victor(p2.x, p1.y)] :\n [new Victor(p1.x, p2.y)]\n } else {\n // connects via two corners; find the shortest way around\n if (o1 === 'h') {\n let d1 = -2*this.sizeX - p1.x - p2.x\n let d2 = 2*this.sizeX - p1.x - p2.x\n let xSign = Math.abs(d1) > Math.abs(d2) ? 1 : -1\n\n points = [\n new Victor(Math.sign(xSign)*this.sizeX, Math.sign(p1.y)*this.sizeY),\n new Victor(Math.sign(xSign)*this.sizeX, -Math.sign(p1.y)*this.sizeY)\n ]\n } else {\n let d1 = -2*this.sizeY - p1.y - p2.y\n let d2 = 2*this.sizeY - p1.y - p2.y\n let ySign = Math.abs(d1) > Math.abs(d2) ? 1 : -1\n\n points = [\n new Victor(Math.sign(p1.x)*this.sizeX, Math.sign(ySign)*this.sizeY),\n new Victor(-Math.sign(p1.x)*this.sizeX, Math.sign(ySign)*this.sizeY),\n ]\n }\n }\n }\n\n if (includeOriginalPoints) {\n points.unshift(p1)\n points.push(p2)\n }\n\n return points\n }", "function getPoints(event) {\n\n // offset window scrolling\n var top = this.scrollY;\n var left = this.scrollX;\n\n top *= 2;\n left *= 2;\n return vec2(((2 * event.clientX + left) / canvas.width - 1),\n (((2 * (canvas.height - event.clientY)) - top ) / canvas.height - 1));\n }", "function calculateSlope(segment){\r\n\tvar slope = (segment.b.y - segment.a.y)/(segment.b.x - segment.a.x);\r\n\treturn slope;\r\n}", "function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}", "function _f(x, y) {\n return (g.tx - x) * (g.tx - x) + (g.ty - y) * (g.ty - y);\n}", "function calculateSlope(point1, point2) {\n var deltaX = point2[0] - point1[0];\n var deltaY = point2[1] - point1[1];\n var slope = deltaY / deltaX;\n slope *= 100;\n return slope;\n}", "getDistancia(x, xi, xf, y, yi, yf) {\n\n let dist;\n\n if (xf === xi) {\n let yu = yf;\n let yd = yi;\n\n if (y >= yu) {\n dist = Math.abs(Math.sqrt((xi - x) * (xi - x) + (yu - y) * (yu - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if (y <= yd) {\n dist = Math.abs(Math.sqrt((xi - x) * (xi - x) + (yd - y) * (yd - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if ((y > yd) && (y < yu)) {\n dist = Math.abs(xi - x);\n dist = dist * DEGREE_TO_METER\n return dist;\n }\n }\n\n if (yf === yi) {\n\n let xr;\n let xl;\n if (xf > xi) {\n xr = xf;\n xl = xi;\n } else {\n xr = xi;\n xl = xf;\n }\n if (x >= xr) {\n dist = Math.abs(Math.sqrt((x - xr) * (x - xr) + (yi - y) * (yi - y)));\n dist = dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if (x <= xl) {\n dist = Math.abs(Math.sqrt((x - xl) * (x - xl) + (yi - y) * (yi - y)));\n dist = dist * DEGREE_TO_METER;\n return dist;\n }\n if ((x > xl) && (x < xr)) {\n dist = Math.abs(yi - y);\n dist = dist;\n return dist = Math.abs((yi - y) * DEGREE_TO_METER);\n }\n }\n\n let xr = xf;\n let yr = yf;\n let xl = xi;\n let yl = yi;\n\n let M = (yf - yi) / (xf - xi);\n let b = yi - M * xi;\n let bp = y + (1 / M) * x;\n let xs = (bp - b) / (M + 1 / M);\n let ys = b + M * xs;\n\n if (xs > xr) {\n dist = Math.abs(Math.sqrt((xr - x) * (xr - x) + (yr - y) * (yr - y)));\n } else {\n if (xs < xl) {\n dist = Math.abs(Math.sqrt((xl - x) * (xl - x) + (yl - y) * (yl - y)));\n } else {\n dist = Math.abs(Math.sqrt((xs - x) * (xs - x) + (ys - y) * (ys - y)));\n }\n }\n return dist = Math.abs(dist * DEGREE_TO_METER);\n }", "function distLineToPoint(a, b, p) {\n var n = vectDiff(b, a)\n n = vectScale(n, 1/Math.sqrt(n[0]*n[0]+n[1]*n[1]))\n \n var amp = vectDiff(a, p)\n var d = vectDiff(amp, vectScale(n,(dot(amp, n))))\n //return { d:d, a:amp, nn:n, n:dot(amp,n)}\n return Math.sqrt(d[0]*d[0]+d[1]*d[1])\n}", "function calcPoints(e) {\n var edge = g.edge(e.v, e.w),\n tail = g.node(e.v),\n head = g.node(e.w);\n var points = edge.points.slice(1, edge.points.length - 1);\n var afterslice = edge.points.slice(1, edge.points.length - 1)\n points.unshift(intersectRect(tail, points[0]));\n points.push(intersectRect(head, points[points.length - 1]));\n return d3.svg.line()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n })\n .interpolate(\"basis\")\n (points);\n}", "function mousemove(e){\n MX = e.clientX\n MY = e.clientY\n EX = (MX-rect.left)*ratio\n EY = (MY-rect.top)*ratio\n if (MOUSEDOWN){\n draw()\n }\n}", "function lineEq(y2, y1, x2, x1, currentVal) {\n // y = mx + b\n var m = (y2 - y1) / (x2 - x1),\n b = y1 - m * x1;\n\n return m * currentVal + b;\n }", "_setHitArea() {\n // todo [optimize] Update hit area only when dragging of element was done - no need to recalculate ti\n // To make sure our hit area box is nice and surrounds the connection curve we create\n // two parallel approximated curves besides the main one by introducing shifts for X and Y\n // coordinates.\n\n // We're adding Y shift pretty easily, But then there are several possible\n // cases for calculating X. So we calculate shifts for the case when source is to the\n // right and above the target. And in other cases simply switch \"polarity\"\n const curve1 = [], curve2 = [];\n\n // Create parallel approximated curves\n let fraction = 0;\n while (fraction <= 1) {\n fraction = (fraction > 1) ? 1 : fraction;\n const point = ConnectionHelper.GetBezierPoint(\n this.pointA, this.controlPointA, this.controlPointB, this.pointB,\n fraction,\n );\n\n let xShift = DEFAULT_HIT_AREA_SHIFT;\n // In case our source point is to the left of the end point we need to reduce the\n // X coordinate of the hitArea curve that have bigger Y (having a bigger Y means that\n // it is lower one) in order to have a nice hitArea box\n if (this.iconA.x < this.iconB.x) {\n xShift = -xShift;\n }\n\n // In case our source is lower that the target.\n // Important! Do not unite this condition with the previous one - there are\n // cases when both should work at the same time\n if (this.iconA.y > this.iconB.y) {\n xShift = -xShift;\n }\n curve1.push(point.x + xShift);\n curve1.push(point.y + DEFAULT_HIT_AREA_SHIFT);\n curve2.push(point.x - xShift);\n curve2.push(point.y - DEFAULT_HIT_AREA_SHIFT);\n fraction += DEFAULT_HIT_AREA_STEP;\n }\n\n // Create a polygon from two curves. To do it\n // we add the second curve in reverse order to the first\n for (let i = (curve2.length - 1); i >= 0; i -= 2) {\n curve1.push(curve2[i - 1]); curve1.push(curve2[i]);\n }\n\n // console.log('curve merged ');\n // for (let i = 0; i < curve1.length; i += 2) {\n // console.log(curve1[i], curve1[i+1]);\n // }\n\n // DEBUG functionality: Draw hit area box\n // this.graphics.moveTo(curve1[0], curve1[1]);\n // for (let i = 2; i < curve1.length; i += 2) {\n // this.graphics.lineTo(curve1[i], curve1[i+1]);\n // }\n // this.graphics.lineTo(curve1[0], curve1[1]);\n\n this.graphics.hitArea = new PIXI.Polygon(curve1);\n }", "place_on_slope(xcord,zcord) {\n var px = xcord % this.grid_spacing;\n var pz = zcord % this.grid_spacing;\n var cell_x = Math.trunc(xcord / this.grid_spacing) % this.grid_size;\n var cell_z = Math.trunc(zcord / this.grid_spacing) % this.grid_size;\n var normal;\n if(px + pz < this.grid_spacing) { //lower triangle\n var l11_index = cell_x + (cell_z+1) * (this.grid_size+1);\n var l12_index = cell_x + cell_z*(this.grid_size+1);\n var l21_index = (cell_x + 1) + cell_z * (this.grid_size+1);\n var l22_index = l12_index;\n normal = vec3.normalize(vec3.cross([this.verts[l21_index*3] - this.verts[l22_index*3],\n this.verts[l21_index*3+1] - this.verts[l22_index*3+1],\n this.verts[l21_index*3+2] - this.verts[l22_index*3+2]],\n [this.verts[l11_index*3] - this.verts[l12_index*3],\n this.verts[l11_index*3+1] - this.verts[l12_index*3+1],\n this.verts[l11_index*3+2] - this.verts[l12_index*3+2]],\n\n new Float32Array(3)\n ), new Float32Array(3)\n )\n } else { //higher triagnle\n var l11_index = (cell_x+1) + cell_z * (this.grid_size+1);\n var l12_index = (cell_x+1) + (cell_z+1)*(this.grid_size+1);\n var l21_index = cell_x + (cell_z+1) * (this.grid_size+1);\n var l22_index = l12_index;\n normal = vec3.normalize(vec3.cross([this.verts[l21_index*3] - this.verts[l22_index*3],\n this.verts[l21_index*3+1] - this.verts[l22_index*3+1],\n this.verts[l21_index*3+2] - this.verts[l22_index*3+2]],\n [this.verts[l11_index*3] - this.verts[l12_index*3],\n this.verts[l11_index*3+1] - this.verts[l12_index*3+1],\n this.verts[l11_index*3+2] - this.verts[l12_index*3+2]],\n\n new Float32Array(3)\n ), new Float32Array(3)\n )\n }\n //don't place on walls\n if(normal[1] <= 0.5) {\n return;\n }\n //find elevation of terrain\n var index = (cell_x + 1) + cell_z * (this.grid_size + 1);\n var ycord = -(((xcord - this.verts[index*3]) * normal[0] +\n (zcord- this.verts[index*3+2]) * normal[2])\n / normal[1]) + this.verts[index*3+1];\n //do not place under water\n if(ycord < 0) {\n return;\n }\n\n //var position = new Float32Array([this.parent.position[0] + xcord,this.parent.position[1] + ycord,this.parent.position[2] + zcord,0]);\n var position = new Float32Array([xcord,ycord,zcord,0]);\n var rotation = quaternion.getRotaionBetweenVectors([0,1,0],normal,new Float32Array(4));\n var model = null;\n if(ycord < 0.5) { //TODO: move measurements to shared place\n model = this.weighted_choice(this.beach_models)\n } else if(ycord < 3.0) {\n model = this.weighted_choice(this.grass_models);\n } else {\n //place less things on hills\n if( Math.random() < 0.75 ) return;\n model = this.weighted_choice(this.hill_models);\n }\n if(model in this.bakers){\n this.bakers[model].addInstance(position, rotation);\n }else{\n var baker = new InstanceBaker(new Float32Array(this.parent.position), new Float32Array(this.parent.rotation),model);\n baker.addInstance(position, rotation);\n this.bakers[model] = baker;\n }\n }", "function x (x,y){\n let p = sz * 0.10;\n line((sz * x + sz) - p,\n (sz * y) + p,\n (sz * x) + p,\n (sz * y + sz) - p);\n line((sz * x) + p,\n (sz * y) + p,\n (sz * x + sz) - p,\n (sz * y + sz) - p);\n \n}", "function draw_adjusted_linear_fn(){\n\n\tvar x_increments = parseFloat(document.getElementById('x_inc').value)\n\tvar y_increments = parseFloat(document.getElementById('y_inc').value)\n\teqslope = parseFloat(document.getElementById('slope').value);\n\teqintercept = parseFloat(document.getElementById('y-intercept').value);\n\n\tleft_intercept_adjusted = parseFloat(HEIGHT/2) - ((-1*eqslope*x_increments * 25 + eqintercept) * (20/y_increments))\n\twidth_intercept_adjusted = parseFloat(HEIGHT/2) - ((eqslope * x_increments * 25 + eqintercept) * (20/y_increments))\n\n\tif (eqslope == 0){\n\t\tLine(0,parseFloat(HEIGHT/2) - (eqintercept*(20/y_increments)),WIDTH,parseFloat(HEIGHT/2) - (eqintercept*(20/y_increments)))\n\t}\n\n\telse{\n\t\tLine(0,left_intercept_adjusted,WIDTH,width_intercept_adjusted)\n\t}\n}", "function onKeyup(evt) {\n var x1, y1, x2, y2, x1v, y1v, x2v, y2v, ratio;\n\n lastTarget = evt.source;\n\n x1 = $.x1;\n y1 = $.y1;\n x2 = $.x2;\n y2 = $.y2;\n\n x1v = x1.value;\n y1v = y1.value;\n x2v = x2.value;\n y2v = y2.value;\n\n // display new ratio\n ratio = reduceRatio(x1v, y1v);\n $.ratio.text = ratio;\n// $('#visual-ratio').css(ratio2css(x1v, y1v));\n// resizeSample();\n\n\tTi.API.info(evt.source + ' ' + x2);\n\n switch(evt.source) {\n case x1:\n if (!isInteger(x1v) || !isInteger(y1v) || !isInteger(y2v)) return;\n $.x2.value = solve(undefined, y2v, x1v, y1v);\n break;\n case y1:\n if (!isInteger(y1v) || !isInteger(x1v) || !isInteger(x2v)) return;\n $.y2.value = solve(x2v, undefined, x1v, y1v);\n break;\n case x2:\n if (!isInteger(x2v) || !isInteger(x1v) || !isInteger(y1v)) return;\n $.y2.value = solve(x2v, undefined, x1v, y1v);\n break;\n case y2:\n if (!isInteger(y2v) || !isInteger(x1v) || !isInteger(y1v)) return;\n $.x2.value = solve(undefined, y2v, x1v, y1v);\n break;\n }\n\n return false;\n}", "function brushLine(x,y,px,py) {\n var dis = dist(x,y,px,py);\n if (dis > 0) {\n var step = sidebar.sliders[1].val/dis;\n var myx,myy,t = 0;\n for (var i = 0; i <= dis; i+= step/5) {\n t = max(i / dis);\n myx = mouseX + (pmouseX-mouseX) * t;\n myy = mouseY + (pmouseY-mouseY) * t;\n mainBrush.show(myx,myy);\n }\n } else {\n mainBrush.show(x,y);\n }\n}", "function perpendicularBothFixedRight(eventData, data) {\n var longLine = {\n start: {\n x: data.handles.start.x,\n y: data.handles.start.y\n },\n end: {\n x: data.handles.end.x,\n y: data.handles.end.y\n }\n };\n\n var perpendicularLine = {\n start: {\n x: data.handles.perpendicularStart.x,\n y: data.handles.perpendicularStart.y\n },\n end: {\n x: data.handles.perpendicularEnd.x,\n y: data.handles.perpendicularEnd.y\n }\n };\n\n var intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine);\n\n var distanceFromPerpendicularP1 = cornerstoneMath.point.distance(data.handles.perpendicularStart, intersection);\n var distanceFromPerpendicularP2 = cornerstoneMath.point.distance(data.handles.perpendicularEnd, intersection);\n\n var distanceToLineP2 = cornerstoneMath.point.distance(data.handles.start, intersection);\n var newLineLength = cornerstoneMath.point.distance(data.handles.start, eventData.currentPoints.image);\n\n if (newLineLength <= distanceToLineP2) {\n return false;\n }\n\n var dx = (data.handles.start.x - eventData.currentPoints.image.x) / newLineLength;\n var dy = (data.handles.start.y - eventData.currentPoints.image.y) / newLineLength;\n\n var k = distanceToLineP2 / newLineLength;\n\n var newIntersection = {\n x: data.handles.start.x + ((eventData.currentPoints.image.x - data.handles.start.x) * k),\n y: data.handles.start.y + ((eventData.currentPoints.image.y - data.handles.start.y) * k)\n };\n\n data.handles.perpendicularStart.x = newIntersection.x + distanceFromPerpendicularP1 * dy;\n data.handles.perpendicularStart.y = newIntersection.y - distanceFromPerpendicularP1 * dx;\n\n data.handles.perpendicularEnd.x = newIntersection.x - distanceFromPerpendicularP2 * dy;\n data.handles.perpendicularEnd.y = newIntersection.y + distanceFromPerpendicularP2 * dx;\n\n return true;\n\n }", "line(x0, y0, x1, y1, c) {\n // evaluate runtime errors\n this.colorRangeError(c);\n x0 = Math.ceil(x0);\n y0 = Math.ceil(y0);\n x1 = Math.ceil(x1);\n y1 = Math.ceil(y1);\n let dx = Math.abs(x1 - x0);\n let dy = Math.abs(y1 - y0);\n let sx = x0 < x1 ? 1 : -1;\n let sy = y0 < y1 ? 1 : -1;\n let err = dx - dy;\n for (let x = 0; x <= dx; x++) {\n for (let y = 0; y <= dy; y++) {\n this.pix(x0, y0, c);\n if (x0 == x1 && y0 == y1) {\n break;\n }\n let e2 = 2 * err;\n if (e2 >= -dy) {\n err -= dy;\n x0 += sx;\n }\n if (e2 < dx) {\n err += dx;\n y0 += sy;\n }\n }\n }\n }", "function lineLength(x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n}", "function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign(s0)+sign(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}", "drawLine(){\n for (var index in this.draw){\n this.draw[index] = this.fracToPixel(this.draw[index])\n }\n canvas.beginPath();\n canvas.moveTo(this.draw[\"rightX\"],this.draw[\"rightY\"]);\n canvas.lineTo(this.draw[\"leftX\"],this.draw[\"leftY\"]);\n canvas.stroke();\n }", "function bres(x1, y1, x2, y2) {\r\n\tloadPixels();\r\n\t\r\n\tvar m_new = 2 * (y2 - y1);\r\n\tvar slope_error_new = m_new - (x2 - x1);\r\n\t\r\n\tvar y = y1\r\n\tfor(var x = x1; x <= x2; x++) {\r\n\t\tpixel[4 * (x + (y * 500))] = 255;\r\n\t\t\r\n\t\tslope_error_new += m_new;\r\n\t\t\r\n\t\tif(slope_error_new >= 0) {\r\n\t\t\ty++;\r\n\t\t\tslope_error_new -= 2 * (x2 - x1);\r\n\t\t}\r\n\t}\r\n\t\r\n\tupdatePixels();\r\n}", "function drawLine(img, line, c) {\n\tconst m = -line[0] / line[1];\n\tif(Math.abs(m) > 1) {\n\t\t// Iterate over y\n\t\tfor(let y = 0; y < img.shape[0]; y++) {\n\t\t\tconst x = -Math.round((line[1]*y + line[2]) / line[0])\n\t\t\tif(x >= 0 && x < img.shape[1])\n\t\t\t\tfor(let i = 0; i < c.length; i++)\n\t\t\t\t\timg.set(c[i], y, x, i)\n\n\t\t}\n\t} else {\n\t\t// Iterate over x\n\t\tfor(let x = 0; x < img.shape[1]; x++) {\n\t\t\tconst y = -Math.round((line[0]*x + line[2]) / line[1])\n\t\t\tif(y >= 0 && y < img.shape[0])\n\t\t\t\tfor(let i = 0; i < c.length; i++)\n\t\t\t\t\timg.set(c[i], y, x, i)\n\n\t\t}\n\t}\n\n\treturn img\n}", "function draw_A () {\n\t\n\tpomf=mouseX*0.1\n\t\n\t\n\tline (16-pomf,0-pomf, 60+pomf,-100+pomf);\n\tline (60-pomf,-100-pomf, 108+pomf, 0+pomf);\n\t\n\tline (6-pomf,0,26+pomf,0);\n\tline (98-pomf,0,118+pomf,0);\n\tline (52-pomf,-50,72+pomf,-50);\n\n\treturn 75;\n}", "function drawPerpendicularLine(context, eventData, element, data, color, lineWidth) {\n\n // mid point of long-axis line\n var mid = {\n x: (data.handles.start.x + data.handles.end.x) / 2,\n y: (data.handles.start.y + data.handles.end.y) / 2\n };\n\n // Length of long-axis\n var dx = (data.handles.start.x - data.handles.end.x) * (eventData.image.columnPixelSpacing || 1);\n var dy = (data.handles.start.y - data.handles.end.y) * (eventData.image.rowPixelSpacing || 1);\n var length = Math.sqrt(dx * dx + dy * dy);\n\n var vectorX = (data.handles.start.x - data.handles.end.x) / length;\n var vectorY = (data.handles.start.y - data.handles.end.y) / length;\n\n var perpendicularLineLength = length / 2;\n\n var startX = mid.x + (perpendicularLineLength / 2) * vectorY;\n var startY = mid.y - (perpendicularLineLength / 2) * vectorX;\n var endX = mid.x - (perpendicularLineLength / 2) * vectorY;\n var endY = mid.y + (perpendicularLineLength / 2) * vectorX;\n\n if (data.handles.perpendicularStart.locked) {\n data.handles.perpendicularStart.x = startX;\n data.handles.perpendicularStart.y = startY;\n data.handles.perpendicularEnd.x = endX;\n data.handles.perpendicularEnd.y = endY;\n }\n\n // Draw perpendicular line\n var perpendicularStartCanvas = cornerstone.pixelToCanvas(element, data.handles.perpendicularStart);\n var perpendicularEndCanvas = cornerstone.pixelToCanvas(element, data.handles.perpendicularEnd);\n\n context.beginPath();\n context.strokeStyle = color;\n context.lineWidth = lineWidth;\n context.moveTo(perpendicularStartCanvas.x, perpendicularStartCanvas.y);\n context.lineTo(perpendicularEndCanvas.x, perpendicularEndCanvas.y);\n context.stroke();\n\n }", "update() {\n\n //c.clearRect(0, 0, canvas.width, canvas.height); \n //console.log(Math.sqrt(Math.pow((mouse.x - this.x), 2) + Math.pow((mouse.y - this.y), 2)));\n // Math.abs(mouse.x - this.x);\n\n if (this.x > canvas.width - this.r || this.x < this.r)\n this.dx = -this.dx;\n if (this.y > canvas.height - this.r || this.y < this.r)\n this.dy = -this.dy;\n\n this.y += this.dy;\n this.x += this.dx;\n\n if ((mouse.x - this.x) < 150 && (mouse.x - this.x) > -150 &&\n (mouse.y - this.y) < 150 && (mouse.y - this.y) > -150) {\n if (this.r < this.MaxRadius)\n this.r += 1.3;\n\n }\n else if (this.r > this.MinRadius)\n this.r--;\n\n this.draw();\n }", "function calculateThesholdLinePoints() {\n\tconst xCoords = [];\n\tconst step = (maxX - minX) / NUM_POINTS_ON_CURVE;\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet x = minX + i * step;\n\t\txCoords.push(x);\n\t}\n\tconst yLows = [];\n\tconst yHighs = [];\n\tconst floatLambda = parseFloat(lambda);\n\tconst exponent = 1.0 / floatLambda;\n\tconsole.log(\"lambda: \" + floatLambda);\n\tconsole.log(\"exponent: \" + exponent);\n\tconsole.log(\"cutoff residual: \" + cutoffResidual);\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet y = computeY(xCoords[i], intercept);\n\t\t//console.log(\"y: \" + y);\n\t\tlet yLow = Math.pow((y - cutoffResidual) * floatLambda + 1, exponent);\n\t\tlet yHigh = Math.pow((y + cutoffResidual) * floatLambda + 1, exponent);\n\t\t//console.log(\"yHigh: \" + yHigh);\n\t\tyLows.push(yLow);\n\t\tyHighs.push(yHigh);\n\t}\n\tconst threshPoints = {};\n\tthreshPoints.low = \"\";\n\tthreshPoints.high = \"\";\n\tlet lowCount = 0;\n\tlet highCount = 0;\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet x = xCoords[i];\n\t\tlet yLow = yLows[i];\n\t\tif (yLow >= minY && yLow <= maxY) {\n\t\t\tlowCount++;\n\t\t\tlet coord = xScale(x) + \",\" + yScale(yLow);\n\t\t\tif (lowCount > 1) {\n\t\t\t\tcoord = \" \" + coord;\n\t\t\t}\n\t\t\tthreshPoints.low += coord;\n\t\t}\n\t\tlet yHigh = yHighs[i];\n\t\t//console.log(yHigh);\n\t\tif (yHigh >= minY && yHigh <= maxY) {\n\t\t\thighCount++;\n\t\t\tlet coord = xScale(x) + \",\" + yScale(yHigh);\n\t\t\tif (highCount > 1) {\n\t\t\t\tcoord = \" \" + coord;\n\t\t\t}\n\t\t\tthreshPoints.high += coord;\n\t\t}\n\t}\n\treturn threshPoints;\n}", "function imageSpaceAligned(A,a,B){\n var otherextreme3D=a.clone().add(DirectionalVector);\n var DirectionalVector2D=threeDToScreenSpace(otherextreme3D);\n DirectionalVector2D.sub(A);\n var otherExtreme=A.clone().add(DirectionalVector2D);\n //drawLine(project2DVectorToFarPlane(A),project2DVectorToFarPlane(otherExtreme));\n // Get line passing by A and the Diretional Vector\n var slope=(A.y-otherExtreme.y)/(A.x-otherExtreme.x);\n var b=(A.x*otherExtreme.y-otherExtreme.x*A.y)/(A.x-otherExtreme.x);\n // avaliacao B\n var test=signo(B.y-slope*B.x-b);\n if(slope>0){\n var distance=Math.abs(B.y-slope*B.x-b)/Math.sqrt(1+Math.pow(slope,2));\n if(test==1) return distance*(-1);\n if(test==-1) return distance;\n else return 0;\n } \n else{\n var distance=Math.abs(B.y-slope*B.x-b)/Math.sqrt(1+Math.pow(slope,2));\n if(test==1) return distance;\n if(test==-1) return distance*(-1);\n else return 0;\n }\n}", "function translate (slope, x0, y0, points){\n // defines each point relative to the line with a given slope passing through (x0,y0)\n var closest_points = []; // closest points along surface line\n var leftmost_point = [];\n var leftmost_x = 10000000; // arbitrarily large number\n for (var i = 0; i < points.length; i++){\n var current_point = points[i];\n var distance = Math.abs(-slope*current_point[0] + current_point[1] + slope*x0 - y0) / Math.sqrt(slope*slope + 1);\n var x = (current_point[0] + slope*current_point[1] + slope*(slope*x0-y0)) / (slope*slope + 1);\n var y = (-slope*(-current_point[0] - slope*current_point[1]) - slope*x0 + y0) / (slope*slope + 1);\n closest_points.push([x,y,distance]);\n if (x < leftmost_x){\n leftmost_point = [x,y];\n leftmost_x = x;\n }\n }\n // define points on new coordinate system with leftmost point along the surface line as the origin\n var new_points = [];\n for (var i = 0; i < closest_points.length; i++){\n var new_x = Math.sqrt(Math.pow(closest_points[i][0]-leftmost_point[0], 2) + Math.pow(closest_points[i][1]-leftmost_point[1], 2)); // distance from leftmost point\n var new_y = -closest_points[i][2];\n new_points.push([new_x,new_y]);\n }\n return new_points;\n}", "findxy(res, e) \n {\n let offLeft = 0, offTop = 0, el = this.canvas.current;\n while(el)\n {\n offLeft += el.offsetLeft;\n offTop += el.offsetTop;\n el = el.offsetParent;\n }\n let scaleWidth = this.canvas.current.clientWidth, scaleHeight = this.canvas.current.clientHeight;\n let actualWidth = this.canvas.current.width, actualHeight = this.canvas.current.height;\n if (res === 'down') {\n this.setState({prevX: this.state.currX,\n prevY: this.state.currY, \n currX: (e.clientX - offLeft + document.documentElement.scrollLeft)*actualWidth/scaleWidth, //Scaling the co-ordinates \n currY: (e.clientY - offTop + document.documentElement.scrollTop)*actualHeight/scaleHeight, // of mouse pointer.\n flag: true\n });\n this.state.ctx.beginPath(); \n this.state.ctx.strokeStyle = this.state.x;\n this.state.ctx.lineWidth = this.state.y-1;\n this.state.ctx.rect(this.state.currX, this.state.currY, this.state.y-1, this.state.y-1);\n this.state.ctx.stroke();\n }\n if (res === 'up' || res === \"out\"){\n this.setState({flag: false});\n }\n if (res === 'move') {\n if (this.state.flag) {\n this.setState({prevX: this.state.currX, \n prevY: this.state.currY, \n currX: (e.clientX - offLeft + document.documentElement.scrollLeft)*actualWidth/scaleWidth,\n currY: (e.clientY - offTop + document.documentElement.scrollTop)*actualHeight/scaleHeight,\n });\n this.draw();\n }\n }\n }", "function slope(x1, y1, x2, y2) {\n\n var dx = (x2 - x1);\n var dy = (y2 - y1);\n\n return Math.atan2(dy, dx);\n}", "function nearestPointOnLine( x, y, x1, y1, x2, y2 ) {\n let vx = x2 - x1,\n vy = y2 - y1,\n ux = x1 - x,\n uy = y1 - y,\n vu = vx * ux + vy * uy,\n vv = vx * vx + vy * vy,\n t = -vu / vv\n return { t, x: t * x2 + ( 1 - t ) * x1, y: t * y2 + ( 1 - t ) * y1 }\n}", "calculateCircleEdgePoint(currPosition, prevPosition, r, r_diff) {\n r = r + r_diff\n var a = (prevPosition.y - currPosition.y) / (prevPosition.x - currPosition.x);\n\n var x_diff = Math.sqrt((r * r) / (1 + a * a));\n var y_diff = Math.sqrt((a * a * r * r) / (1 + a * a));\n\n if (currPosition.x < prevPosition.x && currPosition.y < prevPosition.y) {\n return {\n new_x: -Math.sqrt((r * r) / (1 + a * a)),\n new_y: -Math.sqrt((a * a * r * r) / (1 + a * a))\n }\n } else if (currPosition.x < prevPosition.x && currPosition.y > prevPosition.y) {\n return {\n new_x: -Math.sqrt((r * r) / (1 + a * a)),\n new_y: Math.sqrt((a * a * r * r) / (1 + a * a))\n }\n }\n if (currPosition.x > prevPosition.x && currPosition.y < prevPosition.y) {\n return {\n new_x: Math.sqrt((r * r) / (1 + a * a)),\n new_y: -Math.sqrt((a * a * r * r) / (1 + a * a))\n }\n } else if (currPosition.x > prevPosition.x && currPosition.y > prevPosition.y) {\n return {\n new_x: Math.sqrt((r * r) / (1 + a * a)),\n new_y: Math.sqrt((a * a * r * r) / (1 + a * a))\n }\n } else if (currPosition.x == prevPosition.x && currPosition.y < prevPosition.y) {\n return {\n new_x: 0,\n new_y: -r\n }\n } else if (currPosition.x == prevPosition.x && currPosition.y > prevPosition.y) {\n return {\n new_x: 0,\n new_y: r\n }\n } else if (currPosition.x < prevPosition.x && currPosition.y == prevPosition.y) {\n return {\n new_x: -r,\n new_y: 0\n }\n } else if (currPosition.x > prevPosition.x && currPosition.y == prevPosition.y) {\n return {\n new_x: r,\n new_y: 0\n }\n }\n\n\n return {\n new_x: 0,\n new_y: 0\n }\n\n }", "function m_distancia(px, py, dx1, dy1, dx2, dy2) {\r\n\r\n\tif (dx2 == dx1) {\r\n\t\tdx2 += 0.00001;\r\n\t}\r\n\r\n\tvar a = (dy2 - dy1) / (dx2 - dx1);\r\n\tvar b = -1;\r\n\tvar c = dy1 - a * dx1;\r\n\r\n\tvar dis = Math.abs((a * px + b * py + c) / Math.sqrt(a * a + b * b));\r\n\r\n\treturn dis;\r\n\r\n}", "function perpendicularRightFixedPoint(eventData, data) {\n var fudgeFactor = 1;\n\n var fixedPoint = data.handles.perpendicularStart;\n var movedPoint = eventData.currentPoints.image;\n\n var distanceFromFixed = cornerstoneMath.lineSegment.distanceToPoint(data.handles, fixedPoint);\n var distanceFromMoved = cornerstoneMath.lineSegment.distanceToPoint(data.handles, movedPoint);\n\n var distanceBetweenPoints = cornerstoneMath.point.distance(fixedPoint, movedPoint);\n\n var total = distanceFromFixed + distanceFromMoved;\n\n if (distanceBetweenPoints <= distanceFromFixed) {\n return false;\n }\n\n var length = cornerstoneMath.point.distance(data.handles.start, data.handles.end);\n var dx = (data.handles.start.x - data.handles.end.x) / length;\n var dy = (data.handles.start.y - data.handles.end.y) / length;\n\n var adjustedLineP1 = {\n x: data.handles.start.x - fudgeFactor * dx,\n y: data.handles.start.y - fudgeFactor * dy\n };\n var adjustedLineP2 = {\n x: data.handles.end.x + fudgeFactor * dx,\n y: data.handles.end.y + fudgeFactor * dy\n };\n\n data.handles.perpendicularStart.x = movedPoint.x + total * dy;\n data.handles.perpendicularStart.y = movedPoint.y - total * dx;\n data.handles.perpendicularEnd.x = movedPoint.x;\n data.handles.perpendicularEnd.y = movedPoint.y;\n\n var longLine = {\n start: {\n x: data.handles.start.x,\n y: data.handles.start.y\n },\n end: {\n x: data.handles.end.x,\n y: data.handles.end.y\n }\n };\n\n var perpendicularLine = {\n start: {\n x: data.handles.perpendicularStart.x,\n y: data.handles.perpendicularStart.y\n },\n end: {\n x: data.handles.perpendicularEnd.x,\n y: data.handles.perpendicularEnd.y\n }\n };\n\n var intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine);\n if (!intersection) {\n if (cornerstoneMath.point.distance(movedPoint, data.handles.start) > cornerstoneMath.point.distance(movedPoint, data.handles.end)) {\n data.handles.perpendicularEnd.x = adjustedLineP2.x - distanceFromMoved * dy;\n data.handles.perpendicularEnd.y = adjustedLineP2.y + distanceFromMoved * dx;\n data.handles.perpendicularStart.x = data.handles.perpendicularEnd.x + total * dy;\n data.handles.perpendicularStart.y = data.handles.perpendicularEnd.y - total * dx;\n\n return true;\n\n } else {\n data.handles.perpendicularEnd.x = adjustedLineP1.x - distanceFromMoved * dy;\n data.handles.perpendicularEnd.y = adjustedLineP1.y + distanceFromMoved * dx;\n data.handles.perpendicularStart.x = data.handles.perpendicularEnd.x + total * dy;\n data.handles.perpendicularStart.y = data.handles.perpendicularEnd.y - total * dx;\n\n return true;\n }\n\n }\n\n return true;\n }", "function calcPoints(e) {\n var edge = g.edge(e.v, e.w),\n tail = g.node(e.v),\n head = g.node(e.w);\n var points = edge.points.slice(1, edge.points.length - 1);\n var afterslice = edge.points.slice(1, edge.points.length - 1)\n points.unshift(intersectRect(tail, points[0]));\n points.push(intersectRect(head, points[points.length - 1]));\n return d3.line()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n })\n .curve(d3.curveBasis)(points);\n}", "function slope(x1, y1, x2, y2) {\n\n var dx = (x2 - x1);\n var dy = (y2 - y1);\n\n return Math.atan2(dy, dx);\n}", "function calculate_line(mp, point) {\n var a = mp[0] - point[0];\n var b = mp[1] - point[1];\n var omegaFirst = tanh(a/b);\n \n var aPrime1 = 30*Math.sin(omegaFirst);\n var bPrime1 = 30*Math.cos(omegaFirst);\n \n var omegaSecond = tanh(a/b);\n \n var aPrime2 = 30*Math.sin(omegaSecond);\n var bPrime2 = 30*Math.cos(omegaSecond);\n \n var start=[];\n var end = [];\n \n if (a>0 && b>0){\n start = [mp[0]-aPrime1, mp[1]-bPrime1];\n end = [point[0]+aPrime2, point[1]+bPrime2];\n }\n else if(a<0 && b>0) {\n start = [mp[0]-aPrime1, mp[1]-bPrime1];\n end = [point[0]+aPrime2, point[1]+bPrime2];\n }\n else if(a>0 && b<0) {\n start = [mp[0]+aPrime1, mp[1]+bPrime1];\n end = [point[0]-aPrime2, point[1]-bPrime2];\n }\n else {\n // a<0 && b<0\n start = [mp[0]+aPrime1, mp[1]+bPrime1];\n end = [point[0]-aPrime2, point[1]-bPrime2];\n }\n \n return [start,end];\n}", "function getSlope(A, B){\n return (B.coorPt.y - A.coorPt.y)/(B.coorPt.x - A.coorPt.x);\n}", "function computeHalfTexCoord(tex1x, tex1y, tex2x, tex2y)\n{\n var newT = [];\n newT.push((tex1x + tex2x) * 0.5);\n newT.push((tex1y + tex2y) * 0.5);\n return newT;\n}", "function lineEq(y2, y1, x2, x1, currentVal) {\n\t\t// y = mx + b\n\t\tvar m = (y2 - y1) / (x2 - x1),\n\t\t\tb = y1 - m * x1;\n\n\t\treturn m * currentVal + b;\n\t}", "function findPolygonPointsCorrectPosition(line) {\n var lengthOfCathetusFirstTriangle = Math.sqrt(line.getLength() * line.getLength() - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius());\n var lengthOfCathetusSecondTriangle = Math.sqrt(line.getLength() * line.getLength() - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius());\n var ya, yb, xa, xb, ya2, yb2, xa2, xb2;\n var center = {\n x: line.getPoints().firstPoint.getPosition().x - svgOffset.left,\n y: line.getPoints().firstPoint.getPosition().y - svgOffset.top\n };\n var point = {\n x: line.getPoints().secondPoint.getPosition().x - svgOffset.left,\n y: line.getPoints().secondPoint.getPosition().y - svgOffset.top\n };\n var result = {\n xa: null,\n xb: null,\n ya: null,\n yb: null,\n xa2: null,\n xb2: null,\n ya2: null,\n yb2: null\n };\n var e = center.x - point.x;\n var c = center.y - point.y;\n var q = (lengthOfCathetusFirstTriangle * lengthOfCathetusFirstTriangle - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius() + center.y * center.y - point.y * point.y + center.x * center.x - point.x * point.x) / 2;\n var A = c * c + e * e;\n var B = (center.x * e * c - c * q - center.y * e * e) * 2;\n var C = center.x * center.x * e * e - 2 * center.x * e * q + q * q + center.y * center.y * e * e - line.getPoints().firstPoint.getRadius() * line.getPoints().firstPoint.getRadius() * e * e;\n var e2 = point.x - center.x;\n var c2 = point.y - center.y;\n var q2 = (lengthOfCathetusSecondTriangle * lengthOfCathetusSecondTriangle - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius() + point.y * point.y - center.y * center.y + point.x * point.x - center.x * center.x) / 2;\n var A2 = c2 * c2 + e2 * e2;\n var B2 = (point.x * e2 * c2 - c2 * q2 - point.y * e2 * e2) * 2;\n var C2 = point.x * point.x * e2 * e2 - 2 * point.x * e2 * q2 + q2 * q2 + point.y * point.y * e2 * e2 - line.getPoints().secondPoint.getRadius() * line.getPoints().secondPoint.getRadius() * e2 * e2;\n\n result.ya = (Math.sqrt(B * B - 4 * A * C) - B) / (2 * A);\n result.yb = (-Math.sqrt(B * B - 4 * A * C) - B) / (2 * A);\n result.xa = (q - result.ya * c) / e;\n result.xb = (q - result.yb * c) / e;\n result.ya2 = (Math.sqrt(B2 * B2 - 4 * A2 * C2) - B2) / (2 * A2);\n result.yb2 = (-Math.sqrt(B2 * B2 - 4 * A2 * C2) - B2) / (2 * A2);\n result.xa2 = (q2 - result.ya2 * c2) / e2;\n result.xb2 = (q2 - result.yb2 * c2) / e2;\n\n return result;\n}", "addPoint(x, y) {\n // console.log('addpoint', x, y)\n this.xPoints[this.nPoints] = x\n this.yPoints[this.nPoints] = y\n this.nPoints++\n // Update bounding rectangle\n if (x < this.x1) this.x1 = x\n if (x > this.x2) this.x2 = x\n if (y < this.y1) this.y1 = y\n if (y > this.y2) this.y2 = y\n }", "function distPointToSegmentSquared(lineX1,lineY1,lineX2,lineY2,pointX,pointY){\n\tvar vx = lineX1 - pointX;\n\tvar vy = lineY1 - pointY;\n\tvar ux = lineX2 - lineX1;\n\tvar uy = lineY2 - lineY1;\n\n\tvar len = ux*ux + uy*uy;\n\tvar det = (-vx*ux) + (-vy*uy);\n\tif( det<0 || det>len ){\n\t\tux = lineX2 - pointX;\n\t\tuy = lineY2 - pointY;\n\t\treturn Math.min( (vx*vx)+(vy*vy) , (ux*ux)+(uy*uy) );\n\t}\n\n\tdet = ux*vy - uy*vx;\n\treturn (det*det) / len;\n}", "function getTwoPointsDistance(x1, y1, x2, y2) {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }", "function draw_line(p1, p2) {\n var dist = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x)\n + (p1.y - p2.y) * (p1.y - p2.y));\n var line = document.createElement(\"div\");\n line.className = \"line\";\n line.style.width = dist + \"px\";\n line.style.backgroundColor = \"#bbbbbb\";\n lines_div.appendChild(line);\n var m = (p1.y - p2.y) / (p1.x - p2.x);\n var ang = Math.atan(m);\n var ps = [p1, p2];\n var left = ps[0].x < ps[1].x ? 0 : 1;\n var top = ps[0].y < ps[1].y ? 0 : 1;\n if (left == top) {\n line.style.transformOrigin = \"top left\";\n line.style.left = ps[left].x + 2.5 + \"px\";\n line.style.top = ps[top].y + 2.5 + \"px\";\n line.style.transform = \"rotate(\" + ang + \"rad)\";\n }\n else {\n line.style.transformOrigin = \"bottom left\";\n line.style.left = ps[left].x + 2.5 + \"px\";\n line.style.top = ps[1 - top].y + 2.5 + \"px\";\n line.style.transform = \"rotate(\" + ang + \"rad)\";\n }\n}", "constructor(x1, y1, x2, y2) {\n this.a = (y1 - y2) / (x1 - x2);\n this.b = y2 - this.a * x2;\n }", "function calculeDistance(x1, y1, x2, y2) {\r\n return Math.sqrt(Math.pow((y2 - y1),2) + Math.pow((x2 - x1),2));\r\n}", "function mouse_coords(evt) {\r\n\tlet t = evt.currentTarget;\r\n\tlet x = evt.clientX - t.clientLeft - t.getBoundingClientRect().left + t.scrollLeft;\r\n\tlet y = evt.clientY - t.clientTop - t.getBoundingClientRect().top + t.scrollTop;\r\n\tx = 2*(x/t.width) - 1;\r\n\ty = 1 - 2*(y/t.height);\r\n\treturn vec2(x, y);\r\n}", "function getAproxResult() {\n return ((insidePoints.length + 1) / cant_points) * (x_to - x_from) * y_to;\n }", "function draw(e) {\n if(isDragging) {\n var rect = canvas.getBoundingClientRect();\n var x1 = e.clientX-rect.left, y1 = e.clientY-rect.top;\n if(smoothLines) {\n var x0 = (lastX == null) ? x1 : lastX;\n var y0 = (lastY == null) ? y1 : lastY;\n //bresenham? hopefully http://stackoverflow.com/questions/4672279/bresenham-algorithm-in-javascript\n var dx = Math.abs(x1-x0);\n var dy = Math.abs(y1-y0);\n var sx = (x0 < x1) ? 1 : -1;\n var sy = (y0 < y1) ? 1 : -1;\n var err = dx-dy;\n\n while(true){\n\n socket.emit('isDrawing', {x: x0, y: y0, color: currentColor});\n\n if ((x0==x1) && (y0==y1)) break;\n var e2 = 2*err;\n if (e2 >-dy){ err -= dy; x0 += sx; }\n if (e2 < dx){ err += dx; y0 += sy; }\n }\n }\n else {\n socket.emit('isDrawing', {x: x1, y: y1, color: currentColor});\n }\n }\n lastX = x1;\n lastY = y1;\n}", "function compareLineSlopes(origin, endPoint1, endPoint2) {\n return ((endPoint2.x - origin.x) * (endPoint1.y - origin.y)) - ((endPoint1.x - origin.x) * (endPoint2.y - origin.y));\n}", "function midXYBetweenTwoPoints(p1, p2) {\n\treturn [ (p1.x + p2.x) / 2 , (p1.y + p2.y) / 2 ];\n}", "function drawSlope(slope, container, width, height, lineWidth) {\n\t//Set up the container and canvas.\n\t$(container).css(\"width\", width);\n\t$(container).css(\"height\", height);\n\tvar c = document.createElement(\"canvas\");\n\t$(c).prop(\"width\", width)\n\t$(c).prop(\"height\", height)\n\t$(c).css(\"width\", width);\n\t$(c).css(\"height\", height);\n\tvar ctx=c.getContext(\"2d\");\n\n\t//Set background color based on slope with some fun color math :)\n\tmaxSlope = 100.0;\n\tmaxLog = Math.log(maxSlope);\n\tcolorSlope = Math.log(Math.abs(slope)); //We use the log to accelerate the transition from green to red.\n\tintensity = 225 - Math.round((Math.min(colorSlope, maxSlope) * 110.0) / maxLog); \n\tctx.fillStyle = (slope < 0) ? 'rgb(225,' + intensity + ',0)' : 'rgb(' + intensity + ',225,0)';\n\tctx.fillRect(0, 0, width, height);\n\t\n\t//Scale slope for better viewing - this means a slope of 5 will run the diagonal.\n\tslope = slope / 5\n\t\n\t//Calculate start and end points depending on the slope.\n\tif (Math.abs(slope) > 1) {\n\t\tvar y1 = height;\n\t\tvar y2 = 0;\n\t\tvar x1 = (width/2)-((1/slope) * (width/2))\n\t\tvar x2 = (width/2)+((1/slope) * (width/2))\n\t} else {\n\t\tvar y1 = (height/2) + (slope * (height/2));\n\t\tvar y2 = (height/2) - (slope * (height/2));\n\t\tvar x1 = 0;\n\t\tvar x2 = width;\n\t}\n\t\n\t//Draw the line.\n\tctx.beginPath();\n\tctx.moveTo(x1, y1);\n\tctx.lineTo(x2, y2);\n\tctx.lineWidth = lineWidth;\n\tctx.stroke();\n\t$(container).append(c);\n\treturn c;\n}", "function width_at_depth (points, percent_depth){\n var lowest = 1000000;\n var highest = -1000000;\n for (var i = 0; i < points.length; i++){\n if (points[i][1] < lowest){\n lowest = points[i][1];\n }\n if (points[i][1] > highest){\n highest = points[i][1];\n }\n }\n var pair1 = [];\n var pair2 = []; // defines the line segments that intersect with y = -max_depth/2\n var target_y = highest - (Math.abs(highest-lowest)*percent_depth);\n console.log(target_y);\n for (var i = 0; i < points.length; i++){\n if (i === 0){\n // if on the first point, compare with the last point\n if (((points[points.length-1][1]-target_y) * (points[0][1]-target_y)) <= 0){\n // if the differences between the y-coordinates and half of max_depth have opposite signs\n if (pair1.length === 0) {\n pair1 = [points[0], points[points.length - 1]];\n } else{\n pair2 = [points[0], points[points.length - 1]];\n }\n }\n } else {\n if (((points[i-1][1]-target_y) * (points[i][1]-target_y)) <= 0){\n if (pair1.length === 0) {\n pair1 = [points[i-1], points[i]];\n } else{\n pair2 = [points[i-1], points[i]];\n }\n }\n }\n }\n // find x-coordinates of intersections\n var slope1 = (pair1[1][1]-pair1[0][1]) / (pair1[1][0]-pair1[0][0]);\n var slope2 = (pair2[1][1]-pair2[0][1]) / (pair2[1][0]-pair2[0][0]);\n var intersection1 = (target_y-pair1[0][1]) / slope1 + pair1[0][0];\n var intersection2 = (target_y-pair2[0][1]) / slope2 + pair2[0][0];\n return Math.abs(intersection1-intersection2);\n}", "function calcTranslateDiff(point){\n var toReturn = {x: 0, y: 0};\n var drawWidth = $('#drawingArea')[0].clientWidth;\n var drawHeight = $('#drawingArea')[0].clientHeight;\n var canvasWidth = manipulationCanvas.width;\n var canvasHeight = manipulationCanvas.height;\n\n toReturn.x = (drawWidth-canvasWidth)*(point.x/canvasWidth);\n toReturn.y = (drawHeight-canvasHeight)*(point.y/canvasHeight);\n toReturn.z = 0;\n\n return toReturn;\n }", "function drawline() {\n\n if (isDrawing) {\n linePoint2 = d3.mouse(this);\n gContainer.select('line').remove();\n gContainer.append('line')\n .attr(\"x1\", linePoint1.x)\n .attr(\"y1\", linePoint1.y)\n .attr(\"x2\", linePoint2[0] - 2) //arbitary value must be substracted due to circle cursor hover not working\n .attr(\"y2\", linePoint2[1] - 2); // arbitary values must be tested\n\n }\n }", "function drawLine() {\n ctx.beginPath();\n // handle simple clicks\n if (points.length == 1) {\n y2 += simple_click_offset;\n }\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n ctx.closePath();\n}", "function distanceFromMouse(x, y, mX, mY){\n\treturn Math.sqrt(Math.pow( Math.pow(x - mX, 2) + y - mY, 2))\n}", "function directCrossing(L1P1, L1P2, L2P1, L2P2) {\n var temp, k1, k2, b1, b2, x, y;\n if (L2P1.x === L2P2.x) {\n temp = L2P1;\n L2P1 = L1P1;\n L1P1 = temp;\n temp = L2P2;\n L2P2 = L1P2;\n L1P2 = temp;\n }\n if (L1P1.x === L1P2.x) {\n k2 = (L2P2.y - L2P1.y) / (L2P2.x - L2P1.x);\n b2 = (L2P2.x * L2P1.y - L2P1.x * L2P2.y) / (L2P2.x - L2P1.x);\n x = L1P1.x;\n y = x * k2 + b2;\n return new Point(x, y);\n } else {\n k1 = (L1P2.y - L1P1.y) / (L1P2.x - L1P1.x);\n b1 = (L1P2.x * L1P1.y - L1P1.x * L1P2.y) / (L1P2.x - L1P1.x);\n k2 = (L2P2.y - L2P1.y) / (L2P2.x - L2P1.x);\n b2 = (L2P2.x * L2P1.y - L2P1.x * L2P2.y) / (L2P2.x - L2P1.x);\n x = (b1 - b2) / (k2 - k1);\n y = x * k1 + b1;\n return new Point(x, y);\n }\n }", "function perpendicularBothFixedLeft(eventData, data) {\n var longLine = {\n start: {\n x: data.handles.start.x,\n y: data.handles.start.y\n },\n end: {\n x: data.handles.end.x,\n y: data.handles.end.y\n }\n };\n\n var perpendicularLine = {\n start: {\n x: data.handles.perpendicularStart.x,\n y: data.handles.perpendicularStart.y\n },\n end: {\n x: data.handles.perpendicularEnd.x,\n y: data.handles.perpendicularEnd.y\n }\n };\n\n var intersection = cornerstoneMath.lineSegment.intersectLine(longLine, perpendicularLine);\n\n var distanceFromPerpendicularP1 = cornerstoneMath.point.distance(data.handles.perpendicularStart, intersection);\n var distanceFromPerpendicularP2 = cornerstoneMath.point.distance(data.handles.perpendicularEnd, intersection);\n\n var distanceToLineP2 = cornerstoneMath.point.distance(data.handles.end, intersection);\n var newLineLength = cornerstoneMath.point.distance(data.handles.end, eventData.currentPoints.image);\n\n if (newLineLength <= distanceToLineP2) {\n return false;\n }\n\n var dx = (data.handles.end.x - eventData.currentPoints.image.x) / newLineLength;\n var dy = (data.handles.end.y - eventData.currentPoints.image.y) / newLineLength;\n\n var k = distanceToLineP2 / newLineLength;\n\n var newIntersection = {\n x: data.handles.end.x + ((eventData.currentPoints.image.x - data.handles.end.x) * k),\n y: data.handles.end.y + ((eventData.currentPoints.image.y - data.handles.end.y) * k)\n };\n\n data.handles.perpendicularStart.x = newIntersection.x - distanceFromPerpendicularP1 * dy;\n data.handles.perpendicularStart.y = newIntersection.y + distanceFromPerpendicularP1 * dx;\n\n data.handles.perpendicularEnd.x = newIntersection.x + distanceFromPerpendicularP2 * dy;\n data.handles.perpendicularEnd.y = newIntersection.y - distanceFromPerpendicularP2 * dx;\n\n return true;\n\n }", "function addAlongLine(startX, startY, range, xstep, ystep){\n for (let i = 0; i <= range; i++){\n mouseAddAt(startX + int(i * xstep), startY + int(i * ystep));\n }\n}", "rasterize () {\n // TODO: Complete this function to do the following\n // - Transform and round the endpoints\n // > You can round a point by calling 'P1.round()'\n // > This rounds both the x and y components in place\n // - Call Line.bresenham (defined below) with the ROUNDED points\n\n // NOTE: This line is temporary. It should be different in the\n // final version of this function.\n Line.bresenham(this.P1, this.P2, this.color)\n }" ]
[ "0.66716516", "0.66179675", "0.6589086", "0.6438045", "0.63898146", "0.6386042", "0.6368306", "0.62642664", "0.6229038", "0.6210238", "0.6186974", "0.6186974", "0.6075937", "0.6075937", "0.606271", "0.60574704", "0.60378623", "0.6033128", "0.6014169", "0.6009087", "0.5991708", "0.59912604", "0.59674424", "0.59485525", "0.59144765", "0.5905132", "0.59002364", "0.58840775", "0.5874013", "0.5874013", "0.5874013", "0.5872234", "0.58695537", "0.5868497", "0.5834137", "0.58307236", "0.5809901", "0.5798598", "0.5766151", "0.5750156", "0.57447124", "0.57405174", "0.5739974", "0.5733231", "0.57255757", "0.57239777", "0.57239133", "0.57068014", "0.5698852", "0.5685701", "0.56767535", "0.56757426", "0.56741714", "0.56712854", "0.56583107", "0.5635055", "0.5634704", "0.56341493", "0.5629526", "0.56284165", "0.5622393", "0.5607049", "0.5600945", "0.5600466", "0.56000054", "0.5594809", "0.5586737", "0.55849284", "0.558199", "0.55754626", "0.5574782", "0.5573929", "0.5573164", "0.5566067", "0.55638415", "0.5557328", "0.554883", "0.5547627", "0.5546489", "0.55395687", "0.553145", "0.5530156", "0.5529926", "0.55240864", "0.5520805", "0.5517186", "0.5511656", "0.54995716", "0.54982865", "0.5496919", "0.54948217", "0.549251", "0.5485764", "0.54748714", "0.547409", "0.54687434", "0.5463598", "0.54633677", "0.54595864", "0.5458485", "0.5457015" ]
0.0
-1
build me a badboi
constructor(x, y, image, speed) { this.xPos = x; this.yPos = y; this.sprite = image; this.xDest = random(10, width-10); this.speed = speed; this.destroyed = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "build () {}", "function buildProject(framework){\n const config = loadConfig(framework);\n fetchProjectSeed(config.seedName, () =>{\n let filefixer = fixAFileFn(Project.name, Project.description);\n costumizeSeed(config.filesToFix, filefixer); \n spinner.stop();\n successMsg('DONE!\\n');\n printInstructions(config.instructions);\n printFunRandomLittleSomething();\n });\n}", "function build(cb) {\n cb();\n}", "build(app) {\n throw Error('Build method required');\n }", "function buildIcecreamBoat(a) { // 1 parameter\n return a\n}", "function builderAI(){\n\t// have empty spots\n\tif (getBuildingsByType(BUILDING_TYPE.EMPTY) == 0)\n\t\treturn;\n\t\n\tif (needForrests()){\n\t\tif (canBuild(BUILDING_TYPE.FORREST)){\n\t\t\tbuildBuilding(BUILDING_TYPE.FORREST, getOpenLand());\n\t\t\tconsole.log(\"Building forrest...\");\n\t\t}\n\t}\n\telse if (needHouses()){\n\t\tif (canBuild(BUILDING_TYPE.STONE_HOUSE)){\n\t\t\tbuildBuilding(BUILDING_TYPE.STONE_HOUSE, getOpenLand());\n\t\t\tconsole.log(\"Building stone house...\");\n\t\t} \n\t\telse if (canBuild(BUILDING_TYPE.WOODEN_HOUSE)) {\n\t\t\tbuildBuilding(BUILDING_TYPE.WOODEN_HOUSE, getOpenLand());\n\t\t\tconsole.log(\"Building wooden house...\");\n\t\t}\n\t}\n\telse if (needFarms()){\n\t\tif (canBuild(BUILDING_TYPE.FARM)){\n\t\t\tbuildBuilding(BUILDING_TYPE.FARM, getOpenLand());\n\t\t\tconsole.log(\"Building farm...\");\n\t\t} else {\n\t\t\tconsole.log(\"cannot build\");\n\t\t}\n\t}\n\telse if (needQuarries()){\n\t\tif (canBuild(BUILDING_TYPE.QUARRY)){\n\t\t\tbuildBuilding(BUILDING_TYPE.QUARRY, getOpenLand());\n\t\t\tconsole.log(\"Building quarries...\");\n\t\t}\n\t}\n}", "function build(builder) {\n return RSVP.Promise.resolve()\n .then(function() {\n return builder.build();\n })\n .then(function(hash) {\n return /^0\\./.test(broccoliVersion) ? hash.directory : builder.outputPath;\n })\n }", "function build(builder) {\n return RSVP.Promise.resolve()\n .then(function() {\n return builder.build()\n })\n .then(function(hash) {\n return /^0\\./.test(broccoliVersion) ? hash.directory : builder.outputPath\n })\n }", "function Builder() {}", "function Builder() {}", "function build(cb) {\n // body omitted\n cb();\n}", "function build(cb) {\n // body omitted\n cb();\n}", "function buildUI(){\t\n\t\t\n\t\treturn;\n\t\t\n\t}", "buildBrio() {\n let objectBuild = {\n carBrand: 'Brio',\n numberOfDoor: `${this.numberOfDoor}`,\n numberOfSeat: `${this.numberOfSeat}`,\n tyre: `${this.tyre.tyreBrand}`, // yang di bawah ini masudnya jika production tahunnya samaketat maka keluar aktive dan jika tidak maka keluar expired\n warranty: `${this.warrantyCalculation() - this.productionYear >= 0 ? 'Active' : 'Expired'}`\n }\n return objectBuild;\n }", "function Bevy() {}", "function bunnyBuild() \n{\n \n for(var i=0; i < bunny_faces.length-3; i+=3)\n\t\tbuildEdges(bunny_faces[i], bunny_faces[i+1], bunny_faces[i+2]);\n \n for(var i = 0; i < bunny_points.length; i++)\n\t\tbunny_normals.push(vec3(0.0, 0.0, 0.0));\n \n for(var i = 0; i < bunny_normals.length-3; i+=3) {\n\t\tvar normal = calculateNormal(bunny_faces[i], bunny_faces[i+1], bunny_faces[i+2]);\n\t\tbunny_normals[i] = add(bunny_normals[i],normal);\n\t\tbunny_normals[i+1] = add(bunny_normals[i+1],normal);\n\t\tbunny_normals[i+2] = add(bunny_normals[i+2],normal);\n\t}\n\t\t\n for(var i = 0; i < bunny_normals.length; i++)\n\t\tbunny_normals[i] = normalize(bunny_normals[i], false);\n\t\n}", "function generateBuild(bump, cb) {\n runSequence(\n 'check:git',\n 'lint:js',\n 'test:js',\n 'clean:before',\n bump,\n 'update:build',\n 'annotate:js',\n 'uglify:js',\n 'header:js',\n 'doc:js', cb);\n}", "function ninja() {}", "build() {\n throw new BlockBuilderError(`Builder ${this.constructor.name} must have a declared 'build' method`);\n }", "function bunnyInit(gl) {\n bunnyBuild();\n bunnyUploadData(gl);\n}", "build() {\n var $this = this;\n\n // Carregar parametros\n var version = this.config('build.version', '0.0.0');\n var name = this.config('build.config.js.name', 'nws-sdk');\n var internal_name = this.config('build.config.js.internal_name', 'nws');\n var keyword = this.config('build.config.js.keyword', 'netforce');\n var github = this.config('build.config.js.github', '[email protected]:netforcews/sdk-js.git');\n\n // Preparar diretorios\n var pathBase = this.getPath('js', { version: this.config('build.version', '0.0.0') });\n var pathStubs = __dirname + '/js/src/stubs';\n\n // Se pasta existir deve limpar\n if (fs.existsSync(pathBase)) {\n rimraf.sync(pathBase);\n }\n\n var pathModels = path.resolve(pathBase, 'src', 'Models');\n var pathResources = path.resolve(pathBase, 'src', 'Resources');\n var pathServices = path.resolve(pathBase, 'src');\n\n // Arquivos /root\n //this.copyStub(__dirname + '/js/.gitignore', pathBase + '/.gitignore');\n this.copyStub(__dirname + '/js/.babelrc', pathBase + '/.babelrc');\n this.copyStub(__dirname + '/js/.npmrc.txt', pathBase + '/.npmrc');\n this.copyStub(__dirname + '/js/package.json', pathBase + '/package.json', {\n version : version,\n name : name,\n keyword : keyword,\n github : github,\n });\n this.copyStub(__dirname + '/js/webpack.config.js', pathBase + '/webpack.config.js', { 'version' : version });\n this.copyStub(__dirname + '/js/browser.js', pathBase + '/browser.js', { 'internal_name' : internal_name });\n\n // Arquivos /src/Base\n this.copyStub(__dirname + '/js/src/Client.js', pathBase + '/src/Base/Client.js', { 'version' : version });\n this.copyStub(__dirname + '/js/src/Global.js', pathBase + '/src/Base/Global.js');\n this.copyStub(__dirname + '/js/src/Consts.js', pathBase + '/src/Base/Consts.js', {\n 'env_production' : this.config('build.endpoints.production', '???'),\n 'env_sandbox' : this.config('build.endpoints.sandbox', '???'),\n 'env_local' : this.config('build.endpoints.local', '???'),\n });\n this.copyStub(__dirname + '/js/src/Model.js', pathBase + '/src/Base/Model.js');\n this.copyStub(__dirname + '/js/src/Resource.js', pathBase + '/src/Base/Resource.js');\n this.copyStub(__dirname + '/js/src/ApiClient.js', pathServices + '/ApiClient.js');\n\n // Models /src/Models\n Arr.each(this.models, (key, model) => {\n $this.buildModel(pathModels, model, pathStubs);\n });\n\n // Resources /src/Resources\n Arr.each(this.resources, (key, resource) => {\n $this.buildResource(pathResources, resource, pathStubs);\n });\n\n // Services /src\n var services = [];\n Arr.each(this.services, (key, service) => {\n services.push($this.buildService(pathServices, service, pathStubs));\n });\n\n // Gerar arquivo index.js\n this.copyIndex(services, pathBase);\n }", "function WidgetBuilder() {\r\n}", "function makeBuilding() {\n let height = rand(MIN_BLDG_HEIGHT, MAX_BLDG_HEIGHT); \n let width = rand(MIN_BLDG_WIDTH, MAX_BLDG_WIDTH); \n let color = \"hsl(\" + rand(0, 255) + \",\" + \n rand(10, 90) + \"%,\" + \n rand(10, 90) + \"%)\";\n let speed = Math.random() * (MAX_BLDG_SPEED - MIN_BLDG_SPEED) + MIN_BLDG_SPEED;\n return new Building(canvas.width, canvas.height - height,\n height, width, -speed, color);\n} // end makeBuilding", "function build(cb) {\n clean();\n reduceCSS.scan();\n css();\n copyImage();\n cb();\n}", "function Bundler () {\n}", "function buildNPCBaddie(name, ref, cellWidth, cellHeight, numCells, speed, posX, posY, offsetY, velX, velY, bbWidth, bbHeight, bbOffsetX, bbOffsetY, parent)\n{\n //console.log(\"[BuilderFunctions.buildNPCBaddie] ref=\"+ref);\n\n displayFactory.finishWithElementInUseByRef(document.getElementById(ref), ref);\n var baddieAsset = displayFactory.getElementByRef(ref);\n parent.appendChild(baddieAsset.object);\n baddieAsset.object.appendChild(baddieAsset.img);\n //Create sprite sheet\n //var sheet = new Spritesheet(pDiv, cellWidth, cellHeight, numCells, 2, npcWrapper, -cellWidth*0.5, -cellHeight, speed);\n var sheet = new Spritesheet(baddieAsset.img, baddieAsset.width, baddieAsset.height, baddieAsset.columns, baddieAsset.rows, baddieAsset.object, -cellWidth*0.5, -cellHeight, speed, \"image\");\n//console.log(\"pos:\"+posX+\",\"+posY+\" cell dims:\"+cellWidth+\",\"+cellHeight);\n var npc = new NPCBaddie(name, new Point(posX-cellWidth*0.5, posY+(cellHeight)), offsetY, new Point(velX,velY), bbWidth, bbHeight, sheet, player);\n if(velX<0)npc.displayFaceLeft();//Face left\n\n return npc;\n}", "build() {\n var $this = this;\n\n // Carregar parametros\n var version = this.config('build.version', '0.0.0');\n var name = this.config('build.config.php.name', 'netforce/sdk-php');\n var description = this.config('build.config.php.description', 'NetForce SDK PHP');\n var keyword = this.config('build.config.php.keyword', 'netforce');\n var ns = this.config('build.config.php.namespace', 'NetForce\\Sdk');\n\n // Preparar diretorios\n var pathBase = this.getPath('php', { version: this.config('build.version', '0.0.0') });\n var pathStubs = __dirname + '/php/src/stubs';\n\n // Se pasta existir deve limpar\n if (fs.existsSync(pathBase)) {\n rimraf.sync(pathBase);\n }\n\n var pathModels = path.resolve(pathBase, 'src', 'Models');\n var pathResources = path.resolve(pathBase, 'src', 'Resources');\n var pathServices = path.resolve(pathBase, 'src');\n\n // Arquivos /root\n //this.copyStub(__dirname + '/php/.gitignore', pathBase + '/.gitignore');\n this.copyStub(__dirname + '/php/composer.json', pathBase + '/composer.json', {\n ns : Str.replaceAll('\\\\\\\\', '\\\\\\\\', ns),\n version,\n name,\n description,\n keyword,\n });\n\n // Arquivos /src/Base\n this.copyStub(__dirname + '/php/src/Client.txt', pathBase + '/src/Base/Client.php', {\n ns : ns, \n version : version,\n env_production : this.config('build.endpoints.production', '???'),\n env_sandbox : this.config('build.endpoints.sandbox', '???'),\n env_local : this.config('build.endpoints.local', '???'),\n });\n this.copyStub(__dirname + '/php/src/Response.txt', pathBase + '/src/Base/Response.php', { ns });\n this.copyStub(__dirname + '/php/src/Resource.txt', pathBase + '/src/Base/Resource.php', { ns });\n this.copyStub(__dirname + '/php/src/Model.txt', pathBase + '/src/Base/Model.php', { ns });\n this.copyStub(__dirname + '/php/src/ApiClient.txt', pathServices + '/ApiClient.php', { ns });\n\n // Models /src/Models\n Arr.each(this.models, (key, model) => {\n $this.buildModel(pathModels, model, pathStubs, { ns });\n });\n \n // Resources /src/Resources\n Arr.each(this.resources, (key, resource) => {\n $this.buildResource(pathResources, resource, pathStubs, { ns });\n });\n \n // Services /src\n var services = [];\n Arr.each(this.services, (key, service) => {\n services.push($this.buildService(pathServices, service, pathStubs, { ns }));\n });\n }", "function Brewbuilder(name, style, abv, rating) {\n\tthis.brewName = name;\n\tthis.brewStyle = style;\n\tthis.brewABV = abv;\n\tthis.brewRating = rating;\n}", "rebuild() {\n this.built = false;\n this.build();\n }", "function make_bundle () {\n\t\tconsole.log( chalk.blue('Building Javascript') );\n\n\n\n\t\treturn bundler.bundle()\n\t\t .pipe(source('main.js'))\n\t\t .pipe(bufferify())\n\t\t .pipe(gulpif( args.prod, uglify() ))\n\t\t .pipe(gulp.dest(dir.compiled.js));\n\t}", "function build(){ // function has created a scope within its code block so the variable var is local scoped and cannot be accessed outside its scope\n var tools = 'nails';\n return \"I need \" + tools + \".\";\n }", "function build(sample, done) {\n\n console.log('');\n console.log(' --- build sample: ' + sample + ' ---');\n console.log('');\n\n // Recycle local haxelib directory to prevent having to redownload libs for each sample\n var dotHaxelibPath = path.join(__dirname, sample, '.haxelib');\n if (prevDotHaxelibPath != null) {\n if (!fs.existsSync(dotHaxelibPath)) {\n command('mv', [\n prevDotHaxelibPath,\n dotHaxelibPath\n ]);\n }\n }\n prevDotHaxelibPath = dotHaxelibPath;\n\n command(\n 'ceramic',\n ['clay', 'build', 'web', '--setup', '--assets', '-D', 'ceramic_web_minify', '-D', 'ceramic_no_skip', '-D', 'ceramic_allow_default_mouse_wheel', '-D', 'ceramic_allow_default_touches'],\n {\n cwd: path.join(__dirname, sample)\n }\n );\n\n command('mv', [\n path.join(__dirname, sample, 'project', 'web'),\n path.join(__dirname, '_export', sample)\n ]);\n\n var gitignorePath = path.join(__dirname, '_export', sample, '.gitignore');\n if (fs.existsSync(gitignorePath)) {\n fs.unlinkSync(gitignorePath);\n }\n\n var screenshotPath = path.join(__dirname, sample, 'screenshot.png');\n var exportScreenshotPath = path.join(__dirname, '_export', sample, 'screenshot.png');\n var exportScreenshot400Path = path.join(__dirname, '_export', sample, 'thumbnail.png');\n if (fs.existsSync(screenshotPath)) {\n console.log('Copy screenshot');\n command('cp', [\n screenshotPath,\n exportScreenshotPath\n ]);\n sharp(screenshotPath)\n .resize({ width: 320 })\n .toFile(exportScreenshot400Path)\n .then(function() {\n done();\n });\n }\n else {\n var screenshotGifPath = path.join(__dirname, sample, 'screenshot.gif');\n var exportScreenshotGifPath = path.join(__dirname, '_export', sample, 'screenshot.gif');\n if (fs.existsSync(screenshotGifPath)) {\n console.log('Copy screenshot (gif)');\n command('cp', [\n screenshotGifPath,\n exportScreenshotGifPath\n ]);\n done();\n }\n else {\n done();\n }\n }\n\n}", "static buildForms() {\r\n const bld = new Immeuble()\r\n let forms = []\r\n forms.push(\r\n bld.Batiment1(),\r\n bld.Porte(),\r\n bld.Batiment2(),\r\n bld.Porte1(),\r\n bld.Batiment3(),\r\n bld.Porte2(),\r\n bld.Batiment4(),\r\n bld.Porte3(),\r\n bld.Batiment5(),\r\n bld.Porte4()\r\n )\r\n\r\n const builds = forms\r\n return builds\r\n\r\n }", "cowboy(args) {\n return this.createGameObject(\"Cowboy\", cowboy_1.Cowboy, args);\n }", "function bomb() {\n \t\t// Create the end crash sample from a dump of about 1MB of Atari Falcon 030 low memory!!\n sampleWave = new RIFFWAVE();\n sampleWave.header.numChannels = 2;\t\t\t// Sample is stereo\n sampleWave.header.bitsPerSample = 8;\t\t// ... 8 bit\n sampleWave.header.sampleRate = 25*1024;\t\t// ... 25KHz\n // Copy the binary dump into an array of sample data for the sample player\n var sampleLength = 65536*8;\n var sampleDataSrc = new Uint8Array(endSample, 0, sampleLength);\n var sampleData = new Array();\n for (var i = 0; i<sampleLength; i++)\n \tsampleData[i] = sampleDataSrc[i];\n // Now make the sample player from the sample data, and hook it up to the HTML5 AUdio.\n sampleWave.Make(sampleData);\n samplePlayer = new Audio(sampleWave.dataURI);\n // Now play the \"crash\" sample.\n samplePlayer.play();\n // Now to plot Atari TOS bombs on the screen!\n\t \tvar bomber = new SeniorDads.Bomb();\n\t\t\tbomber.bombCanvas(copperScreen, 14);\t\t// 14 bombs = \"Format error\". (Obvious joke)\n\t demoWindow.WaitVbl(100, end);\t\t\t\t// Wait a bit before ending\n \t}", "bandelall() {\n\n }", "function build (cb) {\n var nw = new NwBuilder(builderOptions);\n\n nw.on('log', console.log);\n console.log(binaryDir);\n nw.build().then(function () {\n\n fs.renameSync(binaryDir + '/node-webkit.app', binaryDir + '/pbjs.app');\n console.log('Build created');\n cb();\n }).catch(function (error) {\n console.error(error);\n });\n\n}", "function buildABear(name, age, fur, clothes, specialPower) {\n //Declares the varible greeting. It is a string with name interpolated in it.\n var greeting = `Hey partner! My name is ${name} - will you be my friend?!`;\n // Declares the varible demographics. It is an array with name and age\n var demographics = [name, age];\n // declares the varible powerSaying. It is string with concatenation two strings with the varible specialPower\n var powerSaying = \"Did you know that I can \" + specialPower + \" ?\";\n // Declares the varible builtBear with 5 key value pairs\n var builtBear = {\n//Keyvalue pair basicInfo with demographics varible\n basicInfo: demographics,\n//Keyvalue pairs clothes clothes with clothes\n clothes: clothes,\n//Keyvalue pairs exterior with fur parameters\n exterior: fur,\n//Keyvalue pairs cost the cost parameter\n cost: 49.99,\n//Keyvalue pairs sayings with the array greeting, powerSaying, and the string: \"Goodnight my Friend\"\n sayings: [greeting, powerSaying, \"Goodnight my friend!\"],\n//Keyvalue pairs the boolean isCuddly with true\n isCuddly: true,\n };\n//When function is called, it will return the bultBear values\n return builtBear\n}", "function buildUnit(unitName)\r\n{\r\n\tvar barracks = me.game.world.getChildByName(\"cBarracks\");\r\n}", "function buildBio() {\n var formattedName = HTMLheaderName.replace(\"%data%\", bio.name)\n var formattedRole = HTMLheaderRole.replace(\"%data%\", bio.role);\n var formattedWelcomeMsg = HTMLwelcomeMsg.replace(\"%data%\", bio.welcomeMessage);\n var formattedBioPic = HTMLbioPic.replace(\"%data%\", \"images/Omari_vineyard.jpg\")\n $(\"#header\").prepend(formattedRole);\n $(\"#header\").prepend(formattedName);\n $(\"#header\").append(formattedWelcomeMsg);\n $(\"#header\").append(formattedBioPic)\n}", "function bld_buildFW(strBldFldr, rptObj, strBldType, strFlags)\n{\n\t\tvar fso = new ActiveXObject(\"Scripting.FileSystemObject\");\n\t\tvar strBldCmdStr = fso.BuildPath(strBldFldr, \"bin\\\\mkallbld.bat\");\n\t\trptObj.reportProgress(\"Starting \" + strBldType + \" build...\");\n\t\trptObj.closeLog();\t// Close so the external process can append to the log file.\n\t\ttry\n\t\t{\n\t\t\tmisc_RunExtProg(strBldCmdStr, strFlags, null, rptObj, rptObj.strLogFileName, true);\n\t\t} catch (err)\n\t\t{\n\t\t\trptObj.reopenLog (); // Re-open the log file for appending.\n\t\t\trptObj.reportFailure(strBldType + \" build failed, \" + err.description, true);\n\t\t\tmisc_ExitScript();\n\t\t}\n\t\trptObj.reopenLog(); // Re-open the log file for appending\n\t\trptObj.reportProgress(\"Finished building \" + strBldType +\" build.\");\n}", "function Builder()\n{\n //trace(\"constructor\")\n // constructor\n // in memory representation only, builds command lists.\n // the root of all Builder objects.\n this.commands = []\n}", "function buildPanelUib1(cb) {\n try {\n src('src/editor/uibuilder/editor.js')\n // .pipe(debug({title:'1', minimal:true}))\n // .pipe(once())\n // .pipe(debug({title:'2', minimal:true}))\n .pipe(uglify())\n .pipe(rename('editor.min.js'))\n .pipe(dest('src/editor/uibuilder'))\n } catch (e) {\n console.error('buildPanelUib1 failed', e)\n }\n cb()\n}", "function buildUI() { // eslint-disable-line no-unused-vars\n fetchBooks();\n}", "function crearBolas() {\n bolas = [];\n for (let i = 1; i <= 7; i++) {\n bolas.push(new Bola(35, \"url(#pattern\" + i + \")\", 50 * (i + 1) * 2, 40 * i + 40, 2, 2, i, \"black\"));\n }\n}", "function build(done) {\n runSequence('clean', ['html', 'htmlTemplate', 'static', 'styles', 'transpile'], done);\n}", "function build_with_env() {\n\t\tModule.asm = asm(glb, env, buf);\n\n\t\treturn Module.asm;\t\n\t}", "function doBuild(builder) {\n if (builder.isAvailable) {\n return builder\n .build()\n .then(() => {\n return apputils_1.showDialog({\n title: 'Build Complete',\n body: 'Build successfully completed, reload page?',\n buttons: [\n apputils_1.Dialog.cancelButton(),\n apputils_1.Dialog.warnButton({ label: 'RELOAD' })\n ]\n });\n })\n .then(result => {\n if (result.button.accept) {\n location.reload();\n }\n })\n .catch(err => {\n apputils_1.showDialog({\n title: 'Build Failed',\n body: React.createElement(\"pre\", null, err.message)\n });\n });\n }\n return Promise.resolve();\n}", "function createBuilder(ip, platform, options) {\r\n let builder;\r\n helper_1.validateIp(ip);\r\n if (!helper_1.isPlatformSupported(platform)) {\r\n throw new errors_1.supportedError(messages_1.ERROR_MESSAGES.PLATFORM_NOT_SUPPORTED.replace('platform', platform));\r\n }\r\n if (platform === 'win32') {\r\n builder = windows_1.default(ip, options); //creates and builds commands for windows\r\n }\r\n else if (platform === 'darwin') {\r\n builder = mac_1.default(ip, options); //creates and builds commands for mac\r\n }\r\n else {\r\n builder = linux_1.default(ip, options); //creates and builds commands for linux\r\n }\r\n return builder;\r\n}", "function generateGemini() {\n\tprint(\"\\x1b[90m->\\x1b[0m generating gemini site...\");\n\t// sanity\n\tlet files = {};\n\n\t// generate index\n\tlet _books = [\"📕\", \"📗\", \"📘\", \"📙\", \"📓\"].sort(() => Math.random() - .5); // random book emojis\n\tlet _wikiRecent = pages\n\t\t// remove stubs\n\t\t.filter(page => !page.category.includes(\"stub\"))\n\t\t// first five\n\t\t.slice(0, 5)\n\t\t// render\n\t\t.map((p, i) => {\n\t\t\tlet book = _books[i]; // get random book emoji\n\t\t\tlet category = prependRelevantEmoji(p.category[0]);\n\t\t\treturn `=> /wiki/${p.page}.xyz ${book} wiki/${p.title}`\n\t\t\t\t+ \"\\n```\\n \" + `[${p.modified}] [${category}]` + \"\\n```\";\n\t\t})\n\t\t// stringify\n\t\t.join(\"\\n\");\n\tfiles[\"index\"] = templates[\"index.gmi\"].replace(\"{wiki_recent}\", _wikiRecent);\n\n\t// generate wiki index\n\tlet _wikiAll = pages\n\t\t// remove stubs\n\t\t.filter(page => !page.category.includes(\"stub\"))\n\t\t// render\n\t\t.map(p => {\n\t\t\tlet category = p.category.map(prependRelevantEmoji).join(\", \");\n\t\t\treturn `=> /wiki/${p.page}.xyz ${p.title}` +\n\t\t\t\t\"\\n```\\n \" + `[${p.modified}] [${category}]` + \"\\n```\";\n\t\t})\n\t\t// stringify\n\t\t.join(\"\\n\");\n\tfiles[\"wiki/index\"] = templates[\"wiki-index.gmi\"].replace(\"{wiki_all}\", _wikiAll);\n\n\tfiles[\"stats\"] = templates[\"stats.gmi\"];\n\n\t// generate wiki pages\n\tpages.forEach(p => {\n\t\tfiles[\"wiki/\" + p.page] = templates[\"wiki-page.gmi\"].replace(\"{content}\", p.content);\n\t});\n\n\t// write pages\n\tlet x = 0;\n\tlet _files = Object.keys(files);\n\t_files.forEach((f) => new Promise((resolve, reject) => {\n\t\tlet content = files[f]\n\t\t\t// remove html-only templates\n\t\t\t.replace(/{html[a-z_]*}\\n/g, \"\")\n\t\t\t// add filenames to thumbnails\n\t\t\t.replace(/(\\w*)\\.(png|jpg) (thumbnail|cover|image)/gi, \"$1.$2 $3 ($1.$2)\")\n\t\t\t// replace ambiguous links\n\t\t\t.replace(/\\.xyz/g, \".gmi\");\n\n\t\tlet _f = std.open(\"out/gemini/\" + f + \".gmi\", \"w\");\n\t\tif (_f.error()) return reject(_f.error());\n\t\t_f.puts(content);\n\n\t\t// update terminal readout\n\t\tstd.printf(`\\r\\x1b[32m-->\\x1b[0m wrote gemini page ${x + 1}/${_files.length}`);\n\t\t// if all pages have been written\n\t\tif (++x == _files.length) {\n\t\t\tstd.printf(\"\\n\");\n\t\t\tgenerateHTML(files);\n\t\t}\n\t\tresolve();\n\t}).catch(print));\n}", "function bleh() {}", "function Billonaire() { }", "build(builder) {\n // the director assembles then returns a new product\n builder.step1();\n builder.step2();\n return builder.get();\n }", "function generateRecItemBuilder(saveBuild, itemBuildSlug) {\r\n\tif (saveInProgress == false && isBuildSaved == false) {\r\n\t\tsaveInProgress = true;\r\n\t\t\r\n\t\t$('div.generate-button-container').append('<i id=\"loading-save-build\" class=\"icon-spinner icon-spin\"></i>');\r\n\t\t\r\n\t\tsaveBuild = saveBuild == undefined ? false : saveBuild;\r\n\r\n\t\tvar $champions = $('div.champion-container li.champion.active');\r\n\r\n\t\tvar gameMode = $('div.game-mode-container div.game-mode.active').first().data('game-mode');\r\n\t\tvar buildName = $('input#build-name').val();\r\n\t\tvar buildDescription = $('textarea#build-description').val();\r\n\t\tvar isBuildPrivate = $('input#build-private').prop('checked');\r\n\t\tvar path = $('#modal-lol-path').val();\r\n\r\n\t\tif (isBuildValid()) {\r\n\t\t\t\r\n\t\t\tchampionsSlugs = new Array();\r\n\t\t\t$champions.each(function(){\r\n\t\t\t\tchampionsSlugs.push($(this).attr('id'));\r\n\t\t\t});\r\n\r\n\t\t\tvar itemsSlugs = new Array();\r\n\t\t\t$itemSidebarList.find('li.item-sidebar-block-li').each(function () {\r\n\t\t\t\tvar blockName = $(this).find('input.item_sidebar_block_input').val();\r\n\t\t\t\tvar blockDescription = $.trim($(this).attr('data-description'));//TODO ESCAPE\r\n\t\t\t\tif(blockName != undefined && blockName != '' && ! (blockName in itemsSlugs)) {\r\n\t\t\t\t\tvar blockArray = new Array();\r\n\t\t\t\t\t$that = $(this);\r\n\t\t\t\t\t$(this).find('div.item-sidebar-block-div div.portrait').each(function() {\r\n\t\t\t\t\t\tvar $itemCount = $(this).find('span.item-count');\r\n\t\t\t\t\t\tvar itemCount = 1;\r\n\t\t\t\t\t\tif ($itemCount.length > 0) {\r\n\t\t\t\t\t\t\titemCount = $itemCount.html() *1;\r\n\t\t\t\t\t\t\titemCount = itemCount >= 1 ? itemCount : 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tblockArray.push({slug: $(this).data('slug'), count: itemCount, order: ($($that.find('.portrait')).index($(this)) + 1)});\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (blockArray.length > 0) {\r\n\t\t\t\t\t\titemsSlugs.push({name:blockName, items:blockArray, description: blockDescription});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tvar data = {championsSlugs : championsSlugs, itemsSlugs: itemsSlugs, gameMode: gameMode, buildName: buildName, path: path, description: buildDescription, isBuildPrivate: isBuildPrivate};\r\n\t\t\tif (saveBuild) {\r\n\t\t\t\tdata.saveBuild = 'true';\r\n\t\t\t}\t\t\t\t\t\r\n\t\t\tif(itemBuildSlug != undefined) {\r\n\t\t\t\tdata.itemBuildSlug = itemBuildSlug;\r\n\t\t\t}\r\n\t\t\t$.ajax({\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\turl: Routing.generate('item_builder_generate_rec_item_file', {_locale: locale}),\r\n\t\t\t\tdata: data,\r\n\t\t\t\tdataType: 'json'\r\n\t\t\t}).done(function(data){\r\n\t\t\t\t//Si c'est une édition\r\n\t\t\t\tif(itemBuildSlug != undefined) {\r\n\t\t\t\t\tisBuildSaved = true;\r\n\t\t\t\t\tif (locale == 'en') {\r\n\t\t\t\t\t\tdisplayMessage('Modifications have been saved successfully.', 'success');\r\n\t\t\t\t\t}else {\r\n\t\t\t\t\t\tdisplayMessage('Les modifications ont bien été enregistrées.', 'success');\r\n\t\t\t\t\t}\r\n\t\t\t\t\twindow.location = Routing.generate('pmri_list_detail', {_locale: locale, slug: data});\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//si c'est un nouveau build\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Si c'est une simple génération\r\n\t\t\t\t\tif (!saveBuild) {\r\n\t\t\t\t\t\t$('#modal-dl-build').modal('hide');\r\n\t\t\t\t\t\twindow.location = Routing.generate('item_builder_download_file', {_locale: locale, itemBuildSlug: data});\r\n\t\t\t\t\t\tif (locale == 'en') {\r\n\t\t\t\t\t\t\tdisplayMessage('The file has been successfully generated.', 'success');\r\n\t\t\t\t\t\t}else {\r\n\t\t\t\t\t\t\tdisplayMessage('Le fichier a bien été généré.', 'success');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tisBuildSaved = true;\r\n\t\t\t\t\t\t//si c'est un enregistrement suivi d'un téléchargement\r\n\t\t\t\t\t\twindow.location = Routing.generate('pmri_list_detail', {_locale: locale, slug: data, dl: 'dl'});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$('#loading-save-build').remove();\r\n\t\t\t\t}\r\n\t\t\t\tsaveInProgress = false;\r\n\t\t\t}).fail(function(){\r\n\t\t\t\t$('#loading-save-build').remove();\r\n\t\t\t\tif (locale == 'en') {\r\n\t\t\t\t\tdisplayMessage('Impossible to create the build.', 'success');\r\n\t\t\t\t}else {\r\n\t\t\t\t\tdisplayMessage('Impossible de créer le build.', 'error');\r\n\t\t\t\t}\r\n\t\t\t\tsaveInProgress = false;\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\t$('#loading-save-build').remove();\r\n\t\t\tsaveInProgress = false;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}", "function build() {\n\treturn function(cb) {\n\n\t\t///////////////////////////////////////////////////////////////////////////\n\t\t// TODO hardcoding mocks for now but after dev cloud we need to remove this\n\t\targs.mocks = true;\n\t\t///////////////////////////////////////////////////////////////////////////\n\n\t\targs.dest = config.build.app;\n\t\targs.optimize = args.optimize || true;\n\t\targs.env = args.env || 'local';\n\n\t\tlog([\n\t\t\t'ARGS FOR THE BUILD.JS',\n\t\t\t'dest: ' + args.dest,\n\t\t\t'optimize: ' + args.optimize,\n\t\t\t'env: ' + args.env\n\t\t]);\n\n\t\tvar parallelTasks = [\n\t\t\t'index',\n\t\t\t'styles',\n\t\t\t'scripts',\n\t\t\t'templates',\n\t\t\t'fonts',\n\t\t\t'images'\n\t\t];\n\n\t\tif (args.mocks) {\n\t\t\tparallelTasks.push('mocks');\n\t\t}\n\n\t\trunSequence('conductor', parallelTasks, cb);\n\t};\n}", "function build(rocket, amount=1){\n if (checkIfCanBuy(rocket, amount)){\n rockets[rocket]['amount'] += amount;\n for (dolan in rockets[rocket]['cost']){\n currency[dolan]['amount'] -= rockets[rocket]['cost'][dolan] * amount;\n }\n for (dolan in rockets[rocket]['aps']){\n currency[dolan]['aps'] += rockets[rocket]['aps'][dolan] * amount;\n }\n $('#amnt'+rocket).text(rockets[rocket]['amount']);\n gameLog('Bought x' + amount + ' ' + rocket + 's');\n updateInfo();\n greyOutRocket(rocket);\n }\n}", "static get tag(){return\"haxcms-site-builder\"}", "function addBulb() {\n physical.bulb = {};\n\n const type = qlcPlusPhysical.Bulb[0].$.Type;\n if (![``, `Other`, getOflFixturePhysicalProperty(`bulb`, `type`)].includes(type)) {\n physical.bulb.type = type;\n }\n\n const colorTemperature = Number.parseFloat(qlcPlusPhysical.Bulb[0].$.ColourTemperature);\n if (colorTemperature && getOflFixturePhysicalProperty(`bulb`, `colorTemperature`) !== colorTemperature) {\n physical.bulb.colorTemperature = colorTemperature;\n }\n\n const lumens = Number.parseFloat(qlcPlusPhysical.Bulb[0].$.Lumens);\n if (lumens && getOflFixturePhysicalProperty(`bulb`, `lumens`) !== lumens) {\n physical.bulb.lumens = lumens;\n }\n }", "function buildApp() {\n const date = new Date();\n let hh = date.getHours();\n let mm = date.getMinutes();\n let month = date.getMonth() + 1;\n hh = hh < 10 ? '0' + hh : hh;\n mm = mm < 10 ? '0' + mm : mm;\n month = month < 10 ? '0' + month : month;\n const day = `${date.getDate()}.${month}.${date.getFullYear()}`;\n const hour = `${hh}:${mm}`;\n $('.alert').fadeOut('slow');\n clearInterval(addInterval);\n $('body').empty().append(navbar).append($pageContent);\n $pageContent.empty().append(addnew(day, hour)).css(('margin-top'), $('.navbar').outerHeight());\n }", "function buildUmd(namespace, builder) {\n\t var body = [];\n\t body.push(t.variableDeclaration(\"var\", [t.variableDeclarator(namespace, t.identifier(\"global\"))]));\n\n\t builder(body);\n\n\t var container = util.template(\"umd-commonjs-strict\", {\n\t FACTORY_PARAMETERS: t.identifier(\"global\"),\n\t BROWSER_ARGUMENTS: t.assignmentExpression(\"=\", t.memberExpression(t.identifier(\"root\"), namespace), t.objectExpression({})),\n\t COMMON_ARGUMENTS: t.identifier(\"exports\"),\n\t AMD_ARGUMENTS: t.arrayExpression([t.literal(\"exports\")]),\n\t FACTORY_BODY: body,\n\t UMD_ROOT: t.identifier(\"this\")\n\t });\n\t return t.program([container]);\n\t}", "function buildUmd(namespace, builder) {\n\t var body = [];\n\t body.push(t.variableDeclaration(\"var\", [t.variableDeclarator(namespace, t.identifier(\"global\"))]));\n\n\t builder(body);\n\n\t var container = util.template(\"umd-commonjs-strict\", {\n\t FACTORY_PARAMETERS: t.identifier(\"global\"),\n\t BROWSER_ARGUMENTS: t.assignmentExpression(\"=\", t.memberExpression(t.identifier(\"root\"), namespace), t.objectExpression({})),\n\t COMMON_ARGUMENTS: t.identifier(\"exports\"),\n\t AMD_ARGUMENTS: t.arrayExpression([t.literal(\"exports\")]),\n\t FACTORY_BODY: body,\n\t UMD_ROOT: t.identifier(\"this\")\n\t });\n\t return t.program([container]);\n\t}", "function buildExperiment(cb) {\n var args = [IOWA.urlPrefix + IOWA.experimentUrl];\n var build = spawn('./bin/build', args, {cwd: IOWA.experimentDir, stdio: 'inherit'});\n build.on('close', cb);\n}", "function buildUI() {\n showForms();\n const config = {removePlugins: [ 'Heading', 'List' ]};\n ClassicEditor.create(document.getElementById('message-input'), config );\n fetchAboutMe();\n}", "bottle(args) {\n return this.createGameObject(\"Bottle\", bottle_1.Bottle, args);\n }", "markAsBuilt() { this._built = true }", "function ImageBuilder (name) {\n this.path = './assets/' + name + '.jpg';\n this.name = name;\n this.displayed = 0;\n this.picked = 0;\n this.color = Math.floor(Math.random() * 16777215).toString(16);\n}", "constructor(builder) {\n this.builder = builder;\n }", "function BBCodeGen() {\n\t\n\t// Vérifie présence champs\n\tif($(\"#titre\").val()!=\"\" && $(\"#categories\").val()!=\"\" && $(\"#resume\").val()!=\"\" && $(\"#url\").val()!=\"\") {\n\t\t\n\t\t// Détermine la réponse juste \n\t\tvar ReponseJuste = 1 \n\t\tif ($(\"#reponsejuste1\").val()==\"vrai\") ReponseJuste=1;\n\t\tif ($(\"#reponsejuste2\").val()==\"vrai\") ReponseJuste=2;\n\t\tif ($(\"#reponsejuste3\").val()==\"vrai\") ReponseJuste=3;\t\t\t\n\t\t\n\t\t// Générer le bbcode\n\t\tvar bbcode = $(\"#titre\").val()+\"\\n\\n\";\n\t\tbbcode += \"[b]Catégories :[/b]\"+$(\"#categories\").val()+\"\\n\";\n\t\tbbcode += \"\\n[hr]\\n\";\n\t\tbbcode += \"[b]Fiche :[/b]\\n\";\n\t\tbbcode += $(\"#resume\").val()+\"\\n\";\n\t\tbbcode += \"[url=\"+$(\"#url\").val()+\"]\"+$(\"#url\").val()+\"[/url]\\n\";\n\t\tbbcode += \"\\n[hr]\\n\";\t\t\n\t\tbbcode += \"[img]\"+$(\"#urlimage\").val()+\"[/img]\";\t\t\n\t\tbbcode += \"\\n[hr]\\n\";\n\t\tbbcode += \"[b]Quizz :[/b]\\n\";\n\t\tbbcode += \"Question : \"+$(\"#question\").val()+\"\\n\\n\";\n\t\tbbcode += \"Réponse1 : \"+$(\"#reponse1\").val()+\"\\n\";\n\t\tbbcode += \"Réponse2 : \"+$(\"#reponse2\").val()+\"\\n\";\n\t\tbbcode += \"Réponse3 : \"+$(\"#reponse3\").val()+\"\\n\\n\";\n\t\tbbcode += \"Réponse juste : \"+$(\"#reponsejuste:checked\").val()+\"\\n\\n\";\n\t\t\n\t\t// Afficher le BBCode \n\t\tvar message=\"BBCode à copier dans votre sujet : \\n\\n\"+bbcode;\n\t\talert(message);\n\t\t\t\t\t\t\t\t\n\t}\n}", "function buildMap() {\n\t// https://maps.google.com/maps?q=225+delaware+avenue,+Buffalo,+NY&hl=en&sll=42.746632,-75.770041&sspn=5.977525,8.591309&t=h&hnear=225+Delaware+Ave,+Buffalo,+Erie,+New+York+14202&z=16\n\t// API key console\n\t// https://code.google.com/apis/console\n\t// BfloFRED API Key : key=AIzaSyBMSezbmos0W2n6BQutkFvNjkF5NTPd0-Q\n\n\tif (sw > bp) {\n\t\t// If map doesn't already exist\n\t\tif ($('.map-container').length < 1) {\n\t\t\tbuildEmbed();\n\t\t}\n\t} else {\n\t\t// If static image doesn't exist\n\t\tif ($('.static-map-img').length < 1) {\n\t\t\tbuildStatic();\n\t\t}\n\t}\n}", "function buildSub() {\n console.log('button click moved to buildsub()');\n userinput = $('#ipt').val();\n console.log('expecting callGiphy html return as: '+ima)\n $('#gifsgohere').prepend().html('<img src='+ima+'/>');\n }", "function runAll() {\r\n\tfor(let bldg in IO.buildings) run(bldg);\r\n}", "function handleBuildError() {\n\t// TODO: Error handling\n\tconsole.log(\"Build errored\")\n}", "function Burnisher () {}", "function _beeswarm () {} // constructor ???", "static build()\n\t{\n\t\tIndex.buildeNotifications();\n\t\tIndex.buildePersonalPanel();\n\t\tIndex.buildePageContent();\n\t\t\n\t\taddCollapseFunction();\n\t}", "function buildThing() {\n let init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : createThing();\n let thing = isThing(init) ? init : createThing(init);\n function getAdder(adder) {\n return (property, value) => {\n thing = adder(thing, property, value);\n return builder;\n };\n }\n function getSetter(setter) {\n return (property, value) => {\n thing = setter(thing, property, value);\n return builder;\n };\n }\n function getRemover(remover) {\n return (property, value) => {\n thing = remover(thing, property, value);\n return builder;\n };\n }\n const builder = {\n build: () => thing,\n addUrl: getAdder(addUrl),\n addIri: getAdder(addIri),\n addBoolean: getAdder(addBoolean),\n addDatetime: getAdder(addDatetime),\n addDate: getAdder(addDate),\n addTime: getAdder(addTime),\n addDecimal: getAdder(addDecimal),\n addInteger: getAdder(addInteger),\n addStringNoLocale: getAdder(addStringNoLocale),\n addStringEnglish: (property, value) => {\n thing = addStringWithLocale(thing, property, value, \"en\");\n return builder;\n },\n addStringWithLocale: (property, value, locale) => {\n thing = addStringWithLocale(thing, property, value, locale);\n return builder;\n },\n addNamedNode: getAdder(addNamedNode),\n addLiteral: getAdder(addLiteral),\n addTerm: getAdder(addTerm),\n setUrl: getSetter(setUrl),\n setIri: getSetter(setIri),\n setBoolean: getSetter(setBoolean),\n setDatetime: getSetter(setDatetime),\n setDate: getSetter(setDate),\n setTime: getSetter(setTime),\n setDecimal: getSetter(setDecimal),\n setInteger: getSetter(setInteger),\n setStringNoLocale: getSetter(setStringNoLocale),\n setStringEnglish: (property, value) => {\n thing = setStringWithLocale(thing, property, value, \"en\");\n return builder;\n },\n setStringWithLocale: (property, value, locale) => {\n thing = setStringWithLocale(thing, property, value, locale);\n return builder;\n },\n setNamedNode: getSetter(setNamedNode),\n setLiteral: getSetter(setLiteral),\n setTerm: getSetter(setTerm),\n removeAll: property => {\n thing = removeAll(thing, property);\n return builder;\n },\n removeUrl: getRemover(removeUrl),\n removeIri: getRemover(removeIri),\n removeBoolean: getRemover(removeBoolean),\n removeDatetime: getRemover(removeDatetime),\n removeDate: getRemover(removeDate),\n removeTime: getRemover(removeTime),\n removeDecimal: getRemover(removeDecimal),\n removeInteger: getRemover(removeInteger),\n removeStringNoLocale: getRemover(removeStringNoLocale),\n removeStringEnglish: (property, value) => buildThing(removeStringWithLocale(thing, property, value, \"en\")),\n removeStringWithLocale: (property, value, locale) => buildThing(removeStringWithLocale(thing, property, value, locale)),\n removeNamedNode: getRemover(removeNamedNode),\n removeLiteral: getRemover(removeLiteral)\n };\n return builder;\n}", "function buildABear(name, age, fur, clothes, specialPower) { // takes in a name parameter, age, fur color, clothes array, and special power string.\n var greeting = `Hey partner! My name is ${name} - will you be my friend?!`; //greeting using string interpolation\n var demographics = [name, age]; //set demographics variable with the name and age arguments passed in.\n var powerSaying = \"Did you know that I can \" + specialPower + \" ?\"; //string concatenation used to set variable powerSaying\n var builtBear = { //set builtBear object key value pairs\n basicInfo: demographics, //set to demographics\n clothes: clothes, //set clothes to clothes array\n exterior: fur, //set exterior fur color\n cost: 49.99, //set price\n sayings: [greeting, powerSaying, \"Goodnight my friend!\"], //set the things the bear can say\n isCuddly: true, //default boolean setting all buildABear values to true.\n };\n\n return builtBear // after all the arguments are passed in and assigned correctly return the bear object\n}", "function buildLua() {\n return buildGenerator('lua', 'Lua');\n}", "function buildABear(name, age, fur, clothes, specialPower) {\n //define variable greeting as string with interpolation of name argument\n var greeting = `Hey partner! My name is ${name} - will you be my friend?!`;\n //declare and define variable demographics as array\n var demographics = [name, age];\n // declaer and define variable powerSaying as string concatenated with parameter specialPower\n var powerSaying = \"Did you know that I can \" + specialPower + \"?\";\n // declare object builtBear\n var builtBear = {\n // add key value pair, key basicInfo assigned dynamic value demographics\n basicInfo: demographics,\n // add key value pair, key clothes assigned dynamic value clothes\n clothes: clothes,\n // add key value pair, key exterior assigned dynamic value fur\n exterior: fur,\n // add key value pair, key cost assigned static number value 49.99\n cost: 49.99,\n // add key value pair, key sayings assigned array with dynamic elements greeting and powerSaying and static string\n sayings: [greeting, powerSaying, \"Goodnight my friend!\"],\n // add key value pair, key is isCuddly assigned static boolean value true\n isCuddly: true,\n };\n // return to console object builtBear\n return builtBear\n}", "makeCommand()\n\t{\n\t\tlet command = configs.javaBin + ' -jar -Xss2048k';\n\t\t//Ajouter le binaire\n\t\tcommand += ' ' + __dirname + '/bin/yuicompressor-2.4.8.jar';\n\t\t//Fichier de sortie\n\t\tcommand += ' --type js -o ' + this.rootDir + this.configs.outputDir + this.targetDirPath + configs.outputFilename.replace('$1', this.savedFileName);\n\t\t//Fichier d'entree\n\t\tcommand += ' ' + this.savedFilePath;\n\t\t\n//\t\tconsole.log(command);\n\t\t//Retourner la commande complete\n\t\treturn command;\n\t}", "function createNewbuildLnk() {\n\t//TS_debug(\"createNewbuildLnk\");\n\tcrtvillagedid = currentID();\n\tbuildnextlevel=\"1\";\n\tbuildidss = window.location.href.match(/[^d]id=\\d{1,2}/);\n\tbuildidid = buildidss.toString().match(/\\d{1,2}/);\n switch ( aTravianVersion ) {\n\t\tcase \"3.6\":\n\t\t\txpathNewBuildContract = './/div[@id=\"build\"]/table[@class=\"new_building\"]';\n\t\t\txpathSoonNewBuildContract = './/div[@id=\"build_list_soon\"]/table[@class=\"new_building\"]';\n\t\t\txpathMoreNewBuildContract = './/div[@id=\"build_list_all\"]/table[@class=\"new_building\"]';\n\t\t\tbreak;\n\t\tcase \"4.0\":\n\t\t\txpathNewBuildContract = './/div[@id=\"build\"]/div[@class=\"contract contractNew contractWrapper\"]';\n\t\t\txpathSoonNewBuildContract = './/div[@id=\"build_list_soon\"]/div[@class=\"contract contractNew contractWrapper\"]';\n\t\t\txpathMoreNewBuildContract = './/div[@id=\"build_list_all\"]/div[@class=\"contract contractNew contractWrapper\"]';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrowLogicError ( \"createNewbuildLnk():: Travian Version not set!!\" );\n\t}\n\tvar allnewbuilds = document.evaluate ( xpathNewBuildContract, document, null, XPSnap, null );\n\tfor (var i = 0; i < allnewbuilds.snapshotLength; i++) {\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": var buildName = allnewbuilds.snapshotItem(i).previousSibling.previousSibling.innerHTML; break;\n\t\t\tcase \"4.0\": var buildName = allnewbuilds.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.innerHTML; break;\n\t\t}\n\t\t//buildName=(buildName.indexOf(aLangAllBuildWithId[10])!=-1)?aLangAllBuildWithId[10]:((buildName.indexOf(aLangAllBuildWithId[11])!=-1)?aLangAllBuildWithId[11]:buildName);\n\t\t// when we build more than 1 of warehouse, granary or cranny, the name displayed in build page contains a number along with the name which must be removed.\n\t\t// for example if building 2nd warehouse, build name displayed in build.php will be something like '2. Warehouse'.\n\t\tbuildName = buildName.replace(/\\d\\./g,\"\").replace(/\\s*$/g,\"\");\n\t\t\n\t\t/*if ( buildName.indexOf(aLangAllBuildWithId[10]) != -1 ) { // warehouse\n\t\t\tbuildName = aLangAllBuildWithId[10];\n\t\t}\n\t\telse if ( buildName.indexOf(aLangAllBuildWithId[11]) != -1 ) { // granary\n\t\t\tbuildName = aLangAllBuildWithId[11];\n\t\t}\n\t\telse if ( buildName.indexOf(aLangAllBuildWithId[23]) != -1 ) { // cranny\n\t\t\tbuildName = aLangAllBuildWithId[23];\n\t\t}*/\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): Creating link for: \" + buildName );\n\n\t\tbuildgid=getGidFromName(buildName);\n\t\tbuildmaxlevel = parseInt(maxlevel[buildgid],10);\n\t\t//theposition = allnewbuilds.snapshotItem(i).lastChild;\n\t\ttheposition = allnewbuilds.snapshotItem(i);\n\n\t\tvar createUrl = document.createElement(\"a\");\n\t\tcreateUrl.id = \"createnewurl\";\n\t\tcreateUrl.href = \"#\";\n\t\tcreateUrl.innerHTML = \"&#160;&#160;\" + aLangTaskOfText[1]+\"&#160;&#160;\" ;\n\t\tcreateUrl.setAttribute(\"crtvillage\", crtvillagedid);\n\t\tcreateUrl.setAttribute(\"buildName\", buildName);\n\t\tcreateUrl.setAttribute(\"buildnextlevel\", buildnextlevel);\n\t\tcreateUrl.setAttribute(\"buildmaxlevel\", buildmaxlevel);\n\t\tcreateUrl.setAttribute(\"buildgid\", buildgid);\n\t\tcreateUrl.setAttribute(\"buildidid\", buildidid);\n\t\tcreateUrl.addEventListener(\"click\", createUpdateFloat, false);\n\t\ttheposition.appendChild(createUrl);\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): \" + allnewbuilds.snapshotItem(i).innerHTML );\n\t}\n\tvar allsoonnewbuilds = document.evaluate ( xpathSoonNewBuildContract, document, null, XPSnap, null );\n\tfor (var i = 0; i < allsoonnewbuilds.snapshotLength; i++) {\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": buildName = allsoonnewbuilds.snapshotItem(i).previousSibling.previousSibling.innerHTML; break;\n\t\t\tcase \"4.0\": buildName = allsoonnewbuilds.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.innerHTML; break;\n\t\t}\n\t\tvar JbName = cleanString(buildName);\n\t\t/*buildName=(buildName.indexOf(aLangAllBuildWithId[10])!=-1)?aLangAllBuildWithId[10]:((buildName.indexOf(aLangAllBuildWithId[11])!=-1)?aLangAllBuildWithId[11]:buildName)*/\n\t\tbuildName=(JbName == JOINEDaLangAllBuildWithId[10])?aLangAllBuildWithId[10]:((JbName == JOINEDaLangAllBuildWithId[11])?aLangAllBuildWithId[11]:buildName)\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): Creating link for (soon): \" + buildName );\n\n\t\tbuildgid=getGidFromName(buildName);\n\t\tbuildmaxlevel = parseInt(maxlevel[buildgid],10);\n\t\t//theposition = allsoonnewbuilds.snapshotItem(i).lastChild;\n\t\ttheposition = allsoonnewbuilds.snapshotItem(i);\n\n\t\tvar createUrl = document.createElement(\"a\");\n\t\tcreateUrl.id = \"createnewurl\";\n\t\tcreateUrl.href = \"#\";\n\t\tcreateUrl.innerHTML = \"&#160;&#160;\" + aLangTaskOfText[1]+\"&#160;&#160;\" ;\n\t\tcreateUrl.setAttribute(\"crtvillage\", crtvillagedid);\n\t\tcreateUrl.setAttribute(\"buildName\", buildName);\n\t\tcreateUrl.setAttribute(\"buildnextlevel\", buildnextlevel);\n\t\tcreateUrl.setAttribute(\"buildmaxlevel\", buildmaxlevel);\n\t\tcreateUrl.setAttribute(\"buildgid\", buildgid);\n\t\tcreateUrl.setAttribute(\"buildidid\", buildidid);\n\t\tcreateUrl.addEventListener(\"click\", createUpdateFloat, false);\n\t\ttheposition.appendChild(createUrl);\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): Trying to insert after: \" + allsoonnewbuilds.snapshotItem(i).innerHTML );\n\t}\n\tvar allmorenewbuilds = document.evaluate ( xpathMoreNewBuildContract, document, null, XPSnap, null );\n\tfor (var i = 0; i < allmorenewbuilds.snapshotLength; i++) {\n\t\tswitch ( aTravianVersion ) {\n\t\t\tcase \"3.6\": buildName = allmorenewbuilds.snapshotItem(i).previousSibling.previousSibling.innerHTML; break;\n\t\t\tcase \"4.0\": buildName = allmorenewbuilds.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.innerHTML; break;\n\t\t}\n\t\t/*buildName=(buildName.indexOf(aLangAllBuildWithId[10])!=-1)?aLangAllBuildWithId[10]:((buildName.indexOf(aLangAllBuildWithId[11])!=-1)?aLangAllBuildWithId[11]:buildName)*/\n\t\tvar JbName = cleanString(buildName);\n\t\tbuildName=(bJbName == JOINEDaLangAllBuildWithId[10])?aLangAllBuildWithId[10]:((JbName == JOINEDaLangAllBuildWithId[11])?aLangAllBuildWithId[11]:buildName)\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): Creating link for (all): \" + buildName );\n\t\tbuildgid=getGidFromName(buildName);\n\t\tbuildmaxlevel = parseInt(maxlevel[buildgid],10);\n\t\t//theposition = allmorenewbuilds.snapshotItem(i).lastChild;\n\t\ttheposition = allmorenewbuilds.snapshotItem(i);\n\n\t\tvar createUrl = document.createElement(\"a\");\n\t\tcreateUrl.id = \"createnewurl\";\n\t\tcreateUrl.href = \"#\";\n\t\tcreateUrl.innerHTML = \"&#160;&#160;\" + aLangTaskOfText[1]+\"&#160;&#160;\" ;\n\t\tcreateUrl.setAttribute(\"crtvillage\", crtvillagedid);\n\t\tcreateUrl.setAttribute(\"buildName\", buildName);\n\t\tcreateUrl.setAttribute(\"buildnextlevel\", buildnextlevel);\n\t\tcreateUrl.setAttribute(\"buildmaxlevel\", buildmaxlevel);\n\t\tcreateUrl.setAttribute(\"buildgid\", buildgid);\n\t\tcreateUrl.setAttribute(\"buildidid\", buildidid);\n\t\tcreateUrl.addEventListener(\"click\", createUpdateFloat, false);\n\t\ttheposition.appendChild(createUrl);\n\t\t//TS_debug(\"GotGs 2011.01.15 -- createNewbuildLnk(): \" + allmorenewbuilds.snapshotItem(i).innerHTML );\n\t}\n}", "function Gb(){}", "function buildUmd(namespace, builder) {\n var body = [];\n body.push(t.variableDeclaration(\"var\", [t.variableDeclarator(namespace, t.identifier(\"global\"))]));\n\n builder(body);\n\n var container = util.template(\"umd-commonjs-strict\", {\n FACTORY_PARAMETERS: t.identifier(\"global\"),\n BROWSER_ARGUMENTS: t.assignmentExpression(\"=\", t.memberExpression(t.identifier(\"root\"), namespace), t.objectExpression({})),\n COMMON_ARGUMENTS: t.identifier(\"exports\"),\n AMD_ARGUMENTS: t.arrayExpression([t.literal(\"exports\")]),\n FACTORY_BODY: body,\n UMD_ROOT: t.identifier(\"this\")\n });\n return t.program([container]);\n}", "function build () {\n var env = new nunjucks.Environment(new nunjucks.FileSystemLoader(), {\n noCache: true\n });\n /***\n * Nunjucks Filters\n *\n * Additional filters built into Nunjucks to help generate the styleguide.\n */\n require('./nunjucksFilters/dump')(env);\n require('./nunjucksFilters/split')(env);\n require('./nunjucksFilters/join')(env);\n require('./nunjucksFilters/markdown')(env);\n require('./nunjucksFilters/luminance')(env);\n require('./nunjucksFilters/addModifier')(env);\n require('./nunjucksFilters/contains')(env);\n require('./nunjucksFilters/wrap')(env);\n require('./nunjucksFilters/colors')(env);\n require('./nunjucksFilters/highlightSyntax')(env);\n\n return env;\n}", "get bakeIK() {}", "function buildMain() {\n const wrapper = fs.readFileSync('src/.wrapper.js', { encoding: 'utf8' })\n .split('@@js\\n');\n\n const files_to_load = [\n ...CORE_JS,\n ...Object.values(ALL_PLUGINS_JS),\n ];\n\n const output = BANNER()\n + '\\n\\n'\n + wrapper[0]\n + files_to_load.map(f => fs.readFileSync(f, { encoding: 'utf8' })).join('\\n\\n')\n + '\\n\\n'\n + getLang('en')\n + wrapper[1];\n\n const outpath = `${DIST}js/query-builder.js`;\n console.log(`MAIN (${outpath})`);\n fs.writeFileSync(outpath, output);\n}", "function rollupBuild() {\r\n return gulp.src([\"../appl/index.js\"])\r\n .pipe(removeCode({production: isProduction}))\r\n .pipe(isProduction ? stripCode({pattern: regexPattern}) : noop())\r\n .pipe(gulpRollup({\r\n allowRealFiles: true,\r\n input: \"../appl/index.js\",\r\n output: {\r\n format: \"iife\",\r\n name: \"acceptance\",\r\n // intro: \"\"\r\n },\r\n plugins: [\r\n commonjs(),\r\n alias(aliases()),\r\n resolve(),\r\n postcss(),\r\n progress({\r\n clearLine: isProduction ? false : true\r\n }),\r\n buble(),\r\n rollupBabel({\r\n presets: [[\"env\", {/*targets: {\"uglify\":true},*/ modules: false}]],\r\n plugins: [\"external-helpers\"]\r\n })\r\n ],\r\n }))\r\n .on(\"error\", log)\r\n .pipe(rename(\"bundle.js\"))\r\n .pipe(isProduction ? uglify() : noop())\r\n // .pipe(sourcemaps.init({ loadMaps: !isProduction }))\r\n // .pipe(sourcemaps.write('../dist_test/rollup/maps'))\r\n .pipe(gulp.dest(\"../../\" + dist));\r\n}", "function GenerateBoeingBuildingName() {\n\tvar names = [\"Mezzanine\", \"Delivery Center\", \"Harbour Pointe\", \"Wire Shop\", \"Atlas Rocket\",\n\t\t\t\t\"Skylab\", \"Twin Towers\", \"Tower of Power\", \"House of Paine\"];\n\n\tvar startName = \"\";\n\t// Pick a name, Boeing or not, and a building number (or not)\n\tvar nameIdx = Math.floor(Math.random() * (names.length * 1.5));\n\tif ( nameIdx < names.length )\n\t\tstartName = names[nameIdx];\n\n\tvar theBo = \"\";\n\t// Pick a name, Boeing or not, and a building number (or not)\n\tnameIdx = Math.floor(Math.random() * 10);\n\tif ( nameIdx & 1 )\n\t\ttheBo = \"Boeing\";\n\n\tvar buildingNbr = Math.floor(Math.random() * 100).toString() + \"-\" + Math.floor(Math.random() * 400).toString();\n\n\tvar fullName = theBo + \" \" + startName + \" \" + buildingNbr;\n\tif ( fullName.length > gMaxTitleLen )\n\t{\n\t\tfullName = ReplaceWordBreak(fullName, gMaxTitleLen, \"<br/>\");\n\t}\n\n\treturn fullName;\n}", "function _build() {\n _genHtml();\n\n containerStr = '#' + settings.imageContainer;\n container = $(containerStr);\n allImgs = '#' + settings.imageContainer + ' IMG';\n allLIs = '#' + settings.imageContainer + ' LI';\n\n $(allLIs).css({opacity:0});\n $(allLIs + ':first').css({opacity:1}).addClass('bgs-current');\n\n if(!container.length) {\n return;\n }\n $(window).resize(_resize);\n\n if(settings.slideShow && $(allImgs).length > 1) {\n startTimer();\n _paused = false;\n }\n _resize();\n }", "function assembleBanner(item) {\n // sidebarMessageEXT = [sidebarMessage.slice(0)];\n var sidebarMessageEXT = sidebarMessage.slice(0);\n var EXTOption = false;\n for (var NHix = 0; NHix < Object.keys(NH_Bann).length; NHix++ ) {\n var tempKey = Object.keys(NH_Bann)[NHix];\n if (NH_Bann[tempKey].active) {\n sidebarMessageEXT.push(NH_Bann[tempKey].bannText + '<input class=\"PHbutton\" id=\"' + NH_Bann[tempKey].id + '\" type=\"button\" value=\"' + NH_Bann[tempKey].value + '\">');\n EXTOption = true;\n }\n }\n displayBanners(sidebarMessageEXT.join(\"<li>\"), severity);\n setupButtons(item);\n // if (EXTOption) {\n // \tsidebarMessageEXT = sidebarMessageEXT.join(\"<li>\");\n // \tdisplayBanners(sidebarMessageEXT,severity);\n // \tsetupButtons();\n // } else {\n // \tdisplayBanners(sidebarMessage,severity);\t\n // \tsetupButtons();\n // }\n }", "async function buildPart(cb) {\n const components = [];\n // 通过项目配置获取组件样式\n cfg.components.forEach(name => {\n const dir = path.resolve(__dirname, `./components/${name}`);\n\n if (fs.existsSync(`${dir}/${name}.less`)) {\n components.push(name);\n }\n });\n\n console.log('buildPart:', {components});\n // 根据项目配置生成 转换 less 文件\n const lessContent = createPartLess(components);\n const outputFileName = `f7.${_prj}${cfg.rtl ? '.rtl' : ''}`;\n\n let cssContent;\n try {\n cssContent = await autoprefixer(\n await less(lessContent, path.resolve(__dirname, '.'))\n );\n } catch (err) {\n console.log(err);\n }\n\n // Write file\n fs.writeFileSync(\n `${output}/${outputFileName}.css`,\n `${banner}\\n${cssContent}`\n );\n\n // if (dev) {\n // if (cb) cb();\n // return;\n // }\n\n // Minified\n const minifiedContent = await cleanCSS(cssContent);\n\n // Write file\n fs.writeFileSync(`${output}/${outputFileName}.min.css`, `${minifiedContent}`);\n\n if (cb) cb();\n}", "function buildBouncer(ref, parent, posX, posY, cellWidth, cellHeight, numCells, bounceYAmt, bbWidth, bbHeight, bbOffsetX, bbOffsetY, speed)\n{\n //console.log(className, parent, posX, posY, cellWidth, cellHeight, numCells, bounceYAmt, bbWidth, bbHeight, bbOffsetX, bbOffsetY, speed)\n console.log(\"[BuilderFunctions.buildBouncer] ref=\"+ref);\n //Get element from factory\n var element = displayFactory.getElementByRef(ref);\n applySpritesheetCSSProperties(element, posX, posY);\n var object = element.object;\n var img = element.img;\n object.appendChild(img);\n //Add to parent\n parent.appendChild(object);\n //Create spritesheet\n var sheet = new Spritesheet(img, element.width, element.height, numCells, 2, object, 0, 0, speed, \"image\");\n //Build bouncer object\n var bouncer = new Bouncer(sheet, posX+(cellWidth-bbWidth)*0.5+bbOffsetX, posY+(cellHeight-bbHeight)*0.5+bbOffsetY, bbWidth,bbHeight, bounceYAmt, player);\n\n return bouncer;\n}", "function makeProject(tittle, synopsis, tumbnailURL, numbLikes, numbViews, dateOri, dateModi) {\n let project = {\n tittle: tittle,\n synopsis: synopsis,\n tumbnailURL: tumbnailURL,\n assets: [],\n numbLikes: numbLikes,\n numbViews: numbViews,\n dateOri: dateOri,\n dateModi: dateModi,\n //function adds objects in \"assets\"\n addingAssets: function (...asset) {\n this.assets = asset //misshcine veranderen naar argumetns\n }\n }\n //returns an object\n return project\n\n }", "function genereerBosjes() {\n\tlet genereerBosjesData = [];\n\tlet bosjeX = 0;\n\tlet bosjeAfbeelding;\n\twhile (bosjeX < (2 * CANVAS_BREEDTE)) {\n\t\tif (Math.random() >= 0.5) {\n\t\t\tbosjeAfbeelding = bosje_1_Afbeelding;\n\t\t} else {\n\t\t\tbosjeAfbeelding = bosje_2_Afbeelding;\n\t\t}\n\t\tgenereerBosjesData.push({\n\t\t\tx: bosjeX,\n\t\t\ty: 80 + (Math.random() * 20),\n\t\t\timage: bosjeAfbeelding\n\t\t});\n\t\tbosjeX += 150 + (Math.random() * 200);\n\t}\n\treturn genereerBosjesData;\n}", "static BoneFromMuscle() {}", "function v1_0_bobs( aoz )\n{\n\tthis.manifest=JSON.parse(atob('eyJ2ZXJzaW9uIjoiOSIsInZlcnNpb25Nb2R1bGUiOiIxIiwiaW5mb3MiOnsiYXBwbGljYXRpb25OYW1lIjoiVGhlIEJvYiBJbnN0cnVjdGlvbnMiLCJhdXRob3IiOiJCeSBGcmFuY29pcyBMaW9uZXQiLCJ2ZXJzaW9uIjoiVmVyc2lvbiAwLjk5IiwiZGF0ZSI6IjExLzExLzIwMTkiLCJjb3B5cmlnaHQiOiIoYykgQU9aIFN0dWRpbyAyMDE5Iiwic3RhcnQiOiJib2JzLmFveiIsIm9iamVjdCI6ImJvYnMifSwiY29tcGlsYXRpb24iOnsibm9XYXJuaW5nIjpbImluc3RydWN0aW9uX25vdF9pbXBsZW1lbnRlZCJdLCJlcnJvcnMiOnsiZW4iOltdLCJmciI6W119LCJkaXNwbGF5RW5kQWxlcnQiOmZhbHNlLCJkaXNwbGF5RXJyb3JBbGVydCI6dHJ1ZX0sImJvb3RTY3JlZW4iOnsiYWN0aXZlIjpmYWxzZSwid2FpdFNvdW5kcyI6ZmFsc2UsImNsaWNrU291bmRzIjpmYWxzZX0sImVycm9ycyI6e319'));\n\tthis.parent=this;\n\tthis.root=this;\n\tthis.aoz=aoz;\n\tthis.contextName='v1_0_bobs';\n\tthis.aoz.use[\"bobs\"]=this;\n\tthis.aoz.useSounds|=false;\n\tthis.aoz.finalWait++;\n\n\tthis.blocks=[];\n\tthis.blocks[0]=function()\n\t{\n\t\t// Javascript\n\t\tthis.aoz.moduleBobs = this;\n\t\t// End Javascript\n\t\t// End\n\t\tthis.aoz.sourcePos=\"0:523:0\";\n\t\treturn{type:0}\n\t};\n\tthis.blocks[1]=function()\n\t{\n\t\treturn{type:0}\n\t};\n\tthis.aoz.run(this,0,null);\n}", "build() {\n\n // instanciation de la classe Hoover\n this.hoover = new Hoover();\n\n // création de l'élement DOM hoover\n var p = document.createElement(\"p\");\n p.innerHTML = this.hoover.card;\n\n var y = this.hoover.y;\n var x = this.hoover.x;\n\n // initialisation du hoover sur la balise <td id = 5-5>\n document.getElementById(y + '-' + x).appendChild(p);\n }", "function createBuds(){\n var buds = [];\n var packCount = 5;\n\n for (var i = 0; i < packCount; ++i) {\n buds[i] = {\n strain: state.stats.supply.strains[Math.floor(Math.random()*state.stats.supply.strains.length)],\n xp: 50,\n traits: ['patreon genesis bud'],\n terps: [],\n pollinated: false,\n father: 'sensimilla'\n }\n }\n if(from=='hashkings'){state.users[json.to].buds.push(buds)}\n return buds;\n }", "function buildBricks(){\n\t\tvar arrLen = mapper.length;\n\t\t\n\t\tfor(var i=0; i< arrLen; i++){\n\t\t\tvar colLen = mapper[i].length;\n\t\t\t\n\t\t\tfor(var j=0; j< colLen; j++){\n\t\t\t\tvar val = mapper[i][j];\n\t\t\t\t\n\t\t\t\tif (val){\n\t\t\t\t\tvar b = new Brick({\n\t\t\t\t\t\tctx: ctx,\n\t\t\t\t\t\tx: (j * bSize),\n\t\t\t\t\t\ty: (i * bSize),\n\t\t\t\t\t\twidth: bSize,\n\t\t\t\t\t\theight: bSize,\n\t\t\t\t\t\tcolor: color,\n\t\t\t\t\t\tvalue: val\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\tbricks.push(b);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function buildABear(name, age, fur, clothes, specialPower) { // Created a function with parameters\n var greeting = `Hey partner! My name is ${name} - will you be my friend?!`;// created a variable with a string plus conjunction that has a greet.\n var demographics = [name, age];// created a variable with a value of array\n var powerSaying = \"Did you know that I can \" + specialPower + \" ?\"; // created a variable with a string and conjunction with another variable\n var builtBear = { // created a object builtBear and has key and values assigned\n basicInfo: demographics, // declared a key basicInfo and has a value of demographics which is a variable\n clothes: clothes,// declared a key clothes and has a value of variable clothes\n exterior: fur,//declared a key of exterior and has a value of fur variable\n cost: 49.99,//declared a key of cost and has a value of interger\n sayings: [greeting, powerSaying, \"Goodnight my friend!\"],//declared a key of saying and has a value of arrays that includes strings inside\n isCuddly: true,//declared a key isCuddly and has a value of a booelan expression\n };\n\n return builtBear // prints the object with all of its key-values\n}", "function build() {\r\n let options = require('../config').building\r\n console.log('\\x1b[34mBuilding electron app(s)...\\n\\x1b[0m')\r\n packager(options, (err, appPaths) => {\r\n if (err) {\r\n console.error('\\x1b[31mError from `electron-packager` when building app...\\x1b[0m')\r\n console.error(err)\r\n } else {\r\n console.log('Build(s) successful!')\r\n console.log(appPaths)\r\n console.log('\\n\\x1b[34mDONE\\n\\x1b[0m')\r\n }\r\n })\r\n}" ]
[ "0.6830166", "0.5791775", "0.57777995", "0.57323384", "0.565408", "0.5641167", "0.56114775", "0.5577755", "0.55452543", "0.55452543", "0.5522975", "0.5522975", "0.5514708", "0.5504475", "0.54798406", "0.54051936", "0.53570324", "0.5321873", "0.5311903", "0.5309624", "0.5306665", "0.52639383", "0.52439475", "0.5237685", "0.52316266", "0.52199864", "0.5216954", "0.5197326", "0.5178456", "0.51489127", "0.514409", "0.514222", "0.51405454", "0.5133982", "0.5132771", "0.51083505", "0.51078117", "0.51010853", "0.50916874", "0.50585884", "0.504505", "0.50387824", "0.5032804", "0.503167", "0.5031086", "0.50206435", "0.5018655", "0.5016047", "0.5011975", "0.501171", "0.5004174", "0.50010455", "0.49984235", "0.49948397", "0.4972929", "0.49674067", "0.4949383", "0.4938785", "0.4928267", "0.49161753", "0.49161753", "0.4908987", "0.49079373", "0.49066052", "0.490574", "0.4904823", "0.48961806", "0.4895702", "0.489569", "0.4885528", "0.48804274", "0.4878843", "0.48694694", "0.4867111", "0.48652536", "0.4863386", "0.48573935", "0.48547828", "0.48503968", "0.48421472", "0.48380053", "0.48319286", "0.4819469", "0.48190346", "0.48122677", "0.48052898", "0.47962886", "0.47949374", "0.4782013", "0.4775513", "0.4774111", "0.4772239", "0.4768402", "0.47624382", "0.47513187", "0.47481638", "0.47471306", "0.47455078", "0.4739365", "0.47367013", "0.4734293" ]
0.0
-1
this was the easiest way I could "delete" them, send them way offscreen and turn off their image... again, probably not the best way to do this.
display() { if (!this.destroyed) { image(this.sprite, this.xPos, this.yPos); } else { this.xPos = -999; this.yPos = -999; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deletePicture() {\n symbols = [];\n drawBG();\n }", "function reset_image_pod() {\n\tpod_photo = '';\n\tvar image = document.getElementById('imagepod');\n\timage.src = '';\n\timage.style.visibility = \"hidden\";\n}", "function removePicture () {\n document.getElementById(\"swayze\").style.display = \"none\";\n document.getElementById(\"keanu\").style.display = \"none\";\n document.getElementById(\"skydive\").style.display = \"none\";\n document.getElementById(\"reagan\").style.display = \"none\";\n document.getElementById(\"kiedis\").style.display = \"none\";\n document.getElementById(\"poster\").style.display = \"none\";\n}", "function eraseLocalImages(){\n\tvar characterizedImagesPath = appDataPath + \"\\\\characterized-images\";\n\tvar relativeImageFilePaths = jetpack.find(characterizedImagesPath, {files: true, matching: \"*.png\" } );\n\t//Erase images one by one\n\trelativeImageFilePaths.forEach( (path) =>{\n\t\tjetpack.remove(path);\n\t});\n}", "function action_removeImgFromBoard(board_id, url){\n // Send request of add image to board to the server..\n var msgObj = {\n boardID : board_id,\n from: userSelf.email,\n url: url\n };\n\n $('#modal-imageView').modal('hide');\n socket.emit(\"removeFromBoard\", msgObj);\n}", "function removePlayerImage(playerNum) {\r\n\tMCClient.getTicket(savedRoomID, function(uuid) {\r\n\t\ttickets[uuid] = playerNum;\r\n\t\t$(\"#qr\" + playerNum).html(MCClient.getQRCode(controllerHandURL + \"?id=\" + uuid, 2));\r\n\t});\r\n}", "function deleteAvatar(){\n scene.remove(avatar);\n mixers = [];\n AvatarMoveDirection = { x: 0, z: 0 };\n avatarLocalPos = { x: 0, z: 0 };\n}", "function onClearAll() {\n gMeme.txts = [];\n showImg();\n}", "function adminHide(text,image) {\n $('.inline-alert:contains('+AndroidBot+'),#WikiChatList li[data-user='+AndroidBot+']').remove();\n $('div.chat-whos-here > img[src='+image+']').remove();\n}", "function stopslide(){\n $(\"#homecityimage\").removeAttr();\n $(\"image\").removeAttr();\n $(\"#homecityimage\").attr('src','img.jpg');\n $(\"#newdiv\").empty();\n $(\"#newdiv\").removeData();\n }", "function stopdreamslide(){\n $(\"#dreamcityimage\").removeAttr();\n $(\"image\").removeAttr();\n $(\"#dreamcityimage\").attr('src','img.jpg');\n $(\"#newdiv1\").empty();\n $(\"#newdiv1\").removeData();\n //$(\"#dream-location\").removeData();\n }", "function clearPictures() {\n $.each($('.tweet_pic'), function(prop, val) {\n $(val.firstChild).attr('src', 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=')\n })\n return false\n }", "function clearClickedCardsImageURLs() {\n firstCardClickedImageURL = null;\n secondCardClickedImageURL = null;\n}", "function buttonReset() {\n image(imgReset, 350, 550);\n}", "function resetEverything(){\n resetImages();\n resetPlay();\n resetPause();\n }", "async onRemoveImage() {\n await activity.resetImage(this.state.activityInfo.ActivityCode);\n this.onClose();\n this.refresh();\n }", "function cleanLightbox() {\n\t\timages.length = 0;\n\t\tcurrentImageOrder = 0;\n\t\tisClosed = true;\n\t\tloading.hide();\n\t}", "function C999_Common_Achievements_ResetImage() {\n C999_Common_Achievements_Image = \"\";\n}", "function removeLife (){\n Images.frog.src = '../images/icons8-Poison-96.png'\n frogImages[lives - 1].remove()\n setTimeout(function(){\n Images.frog.src = '../images/frog.png'\n }, 700)\n x = 225\n y = 560\n counter = 60\n}", "function toggle_off() {\n\t$(document).off(\"load\", \"img\");\n\t$(\"img[old-src]\").each(function() {\n\t\tdeconvert($(this));\n\t});\n}", "function resetPreviousImageMatch() {\n chrome.runtime.sendMessage({\n type: \"reset-previous-image\",\n tabId: tabId\n });\n}", "resetGame() {\n const ul = document.querySelector('ul');\n const li = ul.querySelectorAll('li');\n const qwertyDiv = document.getElementById('qwerty');\n const buttons = qwertyDiv.querySelectorAll('button');\n const img = document.querySelectorAll('img');\n this.missed = 0;\n for (let i = 0; i < li.length; i++) {\n li[i].remove(); \n }\n \n this.activePhrase = this.getRandomPhrase();\n this.activePhrase.addPhraseToDisplay();\n\n for (let i = 0; i < buttons.length; i++) {\n buttons[i].disabled = false;\n buttons[i].className = 'key';\n }\n\n img.forEach(image => image.src = 'images/liveHeart.png'); \n }", "function removeImage () {\n vis.selectAll('image').attr('xlink:href', null)\n vis2.selectAll('image').attr('xlink:href', null)\n }", "function changeImageChillBack() {\n document.images['white-duck-chill'].src ='./assets/images/white-duck-chill.png'\n }", "function noLives() {\n getId('hearts1').src= \"images/heartempty.png\";\n getId('hearts2').src= \"images/heartempty.png\";\n getId('hearts3').src= \"images/heartempty.png\";\n}", "function cleargifs() {\n $(\"#gif-div\").empty();\n }", "function removeUnseenImages() {\r\n\t\tvar images = $(\"#images img\");\r\n\t\t$.each(images, function(i,item) {\r\n\t\t\tvar $item=$(item);\r\n\t\t\tvar pos = $item.attr('class').replace('file','').split('-');\r\n\t\t\tvar point = new Point(parseInt($item.css('left')), parseInt($item.css('top')));\r\n\t\t\tif(notInRange(pos[0],point)) {\r\n\t\t\t\t$item.remove();\r\n\t\t\t\t$['mapsettings'].loaded[pos[0]+\"-\"+pos[1]+\"-\"+pos[2]+\"-\"+pos[3]] = false;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "resetGhost() {}", "function removeKilledIcons() {\n\n icons.forEach(function(icon) {\n if (!icon.alive) {\n setIconPos(icon, -1,-1);\n }\n });\n\n}", "function unstar() {\n $(\"#chat>h1>img\").attr(\"src\", \"http://ip.lfe.mw.tum.de/sections/star.png\");\n}", "function clrImgTags() {\n var node = document.getElementById(\"playback\");\n var child = node.firstChild;\n while (child) {\n node.removeChild(child);\n child = node.firstChild;\n }\n}", "function removeImage() { //Exists to remove the Image when the randomButton is clicked, to make place for a new image. Used in function changeHash(). See chapter 7. \n //<<<NOTE: Might put this with the creation of new image? Though that might be a step in the wrong direction considering it'll lessen the\n //reusability of the function.\n\n let selectImg = document.querySelector(\"img\"); //Selects the image-element.\n selectImg.parentNode.removeChild(selectImg); //Removes the image from the div.\n}", "function removeGameNotClick(){\n\tfor(var i = 0; i < images.length; i++){\n\t\timages[i].removeEventListener(\"click\", gameNotStarted);\n\t}\n}", "function remover_img() {\n\tvar src = assets + \"/admin/img/no-image.png\";\n\t$(\"#image\").val('');\n\t$(\"#prevImg\").attr('src', src);\n}", "function del() {\n\t\tif( $( '#img' ).data( 'pngPath' ) !== undefined ) {\n\t\t\t$.post( \"delete.php\", { path: $( '#img' ).data( 'path' ), pngPath : $( '#img' ).data( 'pngPath' ) } ); \n\t\t}\n\t\telse {\n\t\t\t$.post( \"delete.php\", { path: $( '#img' ).data( 'path' ) } ); \n\t\t}\n\t}", "function cleanup() {\n importedEntityIDs.forEach(function(id) {\n Entities.deleteEntity(id);\n });\n Camera.mode = \"first person\";\n Controller.disableMapping(\"Handheld-Cam-Space-Bar\");\n MyAvatar.skeletonModelURL = originalAvatar;\n }", "function gearRemoveElements(){\n\tdocument.getElementById(\"gearImages\").innerHTML = \"\";\n}", "function addPics () {\r\n\te.classList.remove(\"hidebox\")\r\n\tf.classList.remove(\"hidebox\")\r\n\ta.classList.remove(\"pulse1\")\r\n\ta.classList.remove(\"cursor\")\r\n\ta.classList.remove(\"grey\")\r\n\ta.classList.remove(\"shadow\")\r\n}", "function unload() {\r\n if (document.images) {\r\n document.floatimg.src = eval(\"caption.src\");\r\n }\r\n }", "function reset() {\n gameState = PLAY\n \n bike1.addImage( bike1Img);\n\n c1G.destroyEach();\n c2G.destroyEach();\n c3G.destroyEach();\n \n distance=0\n}", "function clearImgSrc(x) {\n x.src = \"\";\n\n}", "function resetAll(){\n\t\n\tfor(var x in images){\n\t\timages[x].src = \"img/down.png\";\n\t}\n\n}", "function replaceImages() {\n var shownBefore = [];\n\n for(var i = 0; i < Product.allProducts.length; i++) {\n var elem = document.getElementById(Product.allProducts[i].name);\n\n if (Product.allProducts[i].previouslyShown === true) {\n elem = document.getElementById(Product.allProducts[i].name);\n elem.remove(elem);\n shownBefore.push(Product.allProducts[i]);\n }\n }\n pushRandomProduct();\n shownBefore[0].previouslyShown = false;\n shownBefore[1].previouslyShown = false;\n shownBefore[2].previouslyShown = false;\n}", "function changeImageGlassesBack() {\n document.images['white-duck-glasses'].src ='./assets/images/white-duck-glasses.png'\n }", "function removeOverlayingEmojiCanvases() {\r\n $(\".emoji-canvas-container\").each(function () {\r\n $(this).remove();\r\n });\r\n emojiArray = [];\r\n emojiCanvasCounter = 1;\r\n }", "function Delete_Image() {\n //try to delete the file (image)\n //success = delete_helper.Delete_Image_File(image_files_in_dir[image_index-1])\n success = delete_helper_IDB.Delete_Image_File(image_files_in_dir[image_index-1])\n if(success == 1){\n Refresh_File_List()\n tagging_view_annotate.Meme_View_Fill(image_files_in_dir)\n //refresh the image view to the next image (which is by defaul the 'next' +1)\n New_Image_Display( 0 ) \n //perform the house cleaning for the image references in the DB and the rest of the annotations\n //delete_helper.Image_Delete_From_DB_And_MemeRefs() \n }\n}", "resetGame(){\r\n document.querySelector('#phrase ul').innerHTML = '';\r\n document.querySelector('.main-container').classList.remove('onelife');\r\n document.querySelectorAll('#qwerty button').forEach(button => {\r\n button.className = 'key';\r\n button.disabled = false;\r\n })\r\n document.querySelectorAll('#scoreboard img').forEach(li => {\r\n li.src = \"images/liveHeart.png\";\r\n })\r\n }", "function unturnAllCardsTurned (item){\n\tfor (var i = 0; i < memoryCards.length; i++){\n\t\tif (memoryCards[i].turned === true){\n\t\t\tmemoryCards[i].turned = false;\n\t\t}\n\t}\n\titem.src = card;\n\tpreviousItem = document.getElementById(idOfHtmlCards[0]);\n\tpreviousItem.src = card;\n\tidOfHtmlCards = [];\n\treturn true;\n\n\n}", "function resetPreviewImg(){\n $('#edit-previewing').attr('src', 'img/noimage.png');\n $('#previewing').attr('src', 'img/noimage.png');\n }", "function resetGame() {\n\t //select all images\n\t\tlet allCards = document.querySelectorAll('img');\n\t\t//for every card, reset image attribute to back of card\n\t\tfor (let i = 0; i < allCards.length; i++) {\n\t\t allCards[i].setAttribute('src', 'images/back.png');\n\t}\n}", "removeLife() {\r\n const hearts = $('img[src = \"images/s-l300.png\"]');\r\n const arr = [...hearts];\r\n\r\n let lastHeart = arr.slice(-1);\r\n\r\n $(lastHeart).removeAttr(\"src\");\r\n $(lastHeart).attr(\"src\", \"images/lostHeart.png\");\r\n this.missed++;\r\n if (this.missed == 5) {\r\n this.gameOver(false);\r\n }\r\n }", "function cancelshame(e) {\n $('#shame').off('click', 'img.close', cancelshame).hide(300);\n return false;\n }", "function clearImgs() {\n imgCardPanel.clear();\n}", "function disableCorrectCards(){\n $(selectedCards[0]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[1]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[0]).find('.card-front').removeClass('active');\n $(selectedCards[1]).find('.card-front').removeClass('active');\n $(selectedCards[0]).off('click');\n $(selectedCards[1]).off('click');\n flipCardsBackDown();\n}", "function clear_meta_images(){\n $('.meta-thumbs').html(\"\");\n }", "function ocultarMegusta(){\n /*var titulo=document.getElementById(\"tituloLike\");\n titulo.remove();\n var contenedorImagenes=document.getElementsByClassName('contenImag')[0].className;\n contenedorImagenes.remove(); */\n $(\"#tituloLike\").remove();\n $(\".contenImag\").remove();\n\n document.getElementById('buttonLike').style.display='block';\n document.getElementById('cerrarLike').style.display='none'; \n \n}", "function deleteImage(){\r\n var i = 0;\r\n while(i<pictureArray.length){\r\n pictureArray[i][5] = i\r\n if(i == editingPic){\r\n pictureArray.splice(i, 1);\r\n editingPic = -1;\r\n }else{\r\n i++;\r\n }\r\n }\r\n update()\r\n}", "function changeImageMonocleBack() {\n document.images['white-duck-monocle'].src ='./assets/images/white-duck-monocle.png'\n }", "resetGame(){\n let phraseElement = document.querySelector('#phrase').firstElementChild;\n let buttonElements = document.querySelectorAll('.key');\n let heartImages = document.querySelectorAll(\"img[src='images/lostHeart.png\");\n\n while (phraseElement.children.length > 0) {\n phraseElement.removeChild(phraseElement.firstElementChild);\n }\n\n for (let i = 0; i < buttonElements.length; i++){\n buttonElements[i].disabled = false;\n buttonElements[i].classList.remove('chosen', 'wrong');\n }\n\n for (let i = 0; i < heartImages.length; i++){\n heartImages[i].src = 'images/liveHeart.png';\n }\n}", "function removePicture(item){\n\t$(item).remove();\n\tif(!$('#pictures_shareTag').html()){\n\t\t$('#title_pictures_shareTag').fadeOut('slow');\n\t}\n\tcheckboxPublicPrivateTag();\n}", "function cancelFreeDraw() {\n mainDiagram.toolManager.panningTool.isEnabled = true;\n mainDiagram.toolManager.mouseMoveTools.remove(globalState.tool);\n globalState.tool = null;\n this.onclick = freeDraw;\n document.getElementById(\"freedraw\").innerHTML = '<img id=\"freedraw_img\" width=\"20\" height=\"20\" style=\"margin:2px\"/>' + \" 圈選同住者\"\n document.getElementById(\"freedraw_img\").src = APPLICATION_ROOT + \"Content/together.png\";\n reRender();\n}", "function hideImages () {\n document.getElementById(\"win-image\").style.display = \"none\";\n document.getElementById(\"lose-image\").style.display = \"none\";\n}", "function removeLogo() {\n if (!canvasClicked) {\n var bg = $(\"canvas\").css(\"background-image\");\n var bgs = bg.split(',');\n bgs.splice(0, 1);\n $(\"canvas\").css(\"background-image\", bgs.concat());\n $(\"canvas\").css(\"background-repeat\", \"repeat\");\n canvasClicked = true;\n }\n }", "function clearThumbs() {\n var msgBox = document.getElementById('msgs');\n if ( msgBox.hasChildNodes() ) {\n while ( msgBox.childNodes.length >= 1 ) {\n msgBox.removeChild( msgBox.firstChild );\n }\n }\n}", "function removeBlackScreensFromAllImageDisplays(){\n imageDisplays.forEach((imageDisplay, index) => {\n if(index === indexOfCurrentImageDisplay) return;\n const blackScreen = imageDisplay.querySelector('.img-display__black-screen');\n gsap.to(blackScreen, {duration: 1, opacity: 0, overwrite: true});\n });\n}", "function unlockImages() {\n\t//Randomly select images from the Unlock arrays and links them to the newFace/Body/Hand/Feet varaiable\n\tlet newFace = facesUnlock[ Math.floor( Math.random() * facesUnlock.length ) ];\n\tlet newBody = bodiesUnlock[ Math.floor( Math.random() * bodiesUnlock.length ) ];\n\tlet newHand = handsUnlock[ Math.floor( Math.random() * handsUnlock.length ) ];\n\tlet newFeet = feetsUnlock[ Math.floor( Math.random() * feetsUnlock.length ) ];\n\n\t//This template is repeated for all the other body parts\n\t//Faces: Number of clicks to unlock 30\n\tif ( numClick == 3 || numClick == 6 || numClick == 9 || numClick == 12 || numClick == 15 || numClick == 18 || numClick == 21 || numClick == 24 || numClick == 27 || numClick == 30 || numClick == 33 || numClick == 36 || numClick == 39 || numClick == 42 || numClick == 45 || numClick == 48 || numClick == 51 || numClick == 54 || numClick == 57 || numClick == 60 || numClick == 63 || numClick == 66 || numClick == 69 || numClick == 72 || numClick == 75 || numClick == 78 || numClick == 81 || numClick == 84 || numClick == 87 || numClick == 90 || numClick == 93 || numClick == 96 || numClick == 99 ) {\n\n\t\t//Pushing new unlock into active array & removing new unlock from unlock array\n\t\tfaces.push( newFace );\n\t\tfacesUnlock.splice( $.inArray( newFace, facesUnlock ), 1 );\n\n\t\t//Play Unlock sound effect\n\t\tunlockSFX.play();\n\n\t\t//Unlock div set source to first frame\n\t\t$( '#unlock' ).attr( 'src', 'assets/images/text/new-unlock-available-animation_0000_NEW-UNLOCK-AVAILABLE.png' );\n\n\t\t//Link animation to notif so we can cancel it later\n\t\t//call the unlockNotify function\n\t\tnotif = setInterval( unlockNotify, 100 );\n\t}\n\t//BODIES\n\tif ( numClick == 1 || numClick == 4 || numClick == 8 || numClick == 10 || numClick == 14 || numClick == 18 || numClick == 20 || numClick == 24 || numClick == 28 || numClick == 30 || numClick == 34 || numClick == 38 || numClick == 41 || numClick == 44 || numClick == 48 || numClick == 50 || numClick == 54 || numClick == 58 || numClick == 61 || numClick == 64 || numClick == 68 || numClick == 70 || numClick == 74 || numClick == 88 ) {\n\t\tbodies.push( newBody );\n\t\tbodiesUnlock.splice( $.inArray( newBody, bodiesUnlock ), 1 );\n\t}\n\t//HANDS\n\tif ( numClick == 2 || numClick == 12 || numClick == 18 || numClick == 22 || numClick == 26 || numClick == 29 || numClick == 31 || numClick == 33 || numClick == 39 || numClick == 43 || numClick == 46 || numClick == 49 || numClick == 51 || numClick == 54 || numClick == 58 || numClick == 60 || numClick == 62 || numClick == 65 || numClick == 67 || numClick == 69 || numClick == 72 || numClick == 78 || numClick == 83 || numClick == 93 ) {\n\t\thands.push( newHand );\n\t\thandsUnlock.splice( $.inArray( newHand, handsUnlock ), 1 );\n\t}\n\t//LEGS\n\tif ( numClick == 5 || numClick == 10 || numClick == 15 || numClick == 20 || numClick == 25 || numClick == 30 || numClick == 35 || numClick == 40 || numClick == 45 || numClick == 50 || numClick == 55 || numClick == 65 || numClick == 70 || numClick == 75 || numClick == 60 || numClick == 80 || numClick == 85 || numClick == 90 || numClick == 95 || numClick == 100 ) {\n\t\tfeets.push( newFeet );\n\t\tfeetsUnlock.splice( $.inArray( newFeet, feetsUnlock ), 1 );\n\t}\n\n}", "function onRemove() {\n $(PanelManager).off(\"editorAreaResize\", _onEditorAreaResize);\n $(DocumentManager).off(\"fileNameChange\", _onFileNameChange);\n $(\"#img\").off(\"mousemove\", \"#img-preview\", _showImageTip)\n .off(\"mouseleave\", \"#img-preview\", _hideImageTip);\n }", "function finalPicture() {\n\tif (gameOver === true) {\n\t\tdocument.getElementById(\"winImage\").style.background = \"url('winImage.jpeg')\";\n\t\tdocument.getElementById(\"North\").disabled = true;\n\t\tdocument.getElementById(\"South\").disabled = true;\n\t\tdocument.getElementById(\"East\").disabled = true;\n\t\tdocument.getElementById(\"West\").disabled = true;\n\t\tdocument.getElementById(\"HelpButton\").disabled = true;\n\t\tdocument.getElementById(\"go\").disabled = true;\n\t}\n}", "unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }", "unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }", "board_changeImage(currentBoard){\n // make image and color changes persistent?\n this.backdialog=false;\n }", "function changeImageLoveBack() {\n document.images['white-duck-love'].src ='./assets/images/white-duck-love.png'\n }", "function resetCards(){\n\t\t\t\tselectedOdd.src = \"bearback.jpg\"\n\t\t\t\tselectedEven.src = \"bearback.jpg\"\n\t\t\t\tselectedOdd = null;\n selectedEven = null; \n timerOn = false; \n //Will remove timer, then user can resume the game. \n window.clearInterval(timerReset); \n\t\t}", "function socktopus() {\n\tif (socktopusClicked == false) {\n\t\tdocument.getElementById('socktopusGo').src=socktopusGif.src;\n\t\tsocktopusClicked = true;\n\t} else {\n\t\tdocument.getElementById('socktopusGo').src=socktopusJpeg.src;\n\t\tsocktopusClicked = false;\n\t}\n}", "function removeReplyImage(reply) {\n let files = []\n\n if(reply && reply.file) {\n files.push(reply.file)\n\n //takes an array of files\n cloud.remove(files)\n }\n}", "function unveil() {\r\n var $screenshots = $('#screenshots');\r\n var $unveilParent = isMobile ? $screenshots.parent() : $screenshots; \r\n $('img.lazy-load').unveil({view: $unveilParent});\r\n}", "function delete_all() {\r\n\t$('#drag_resize').css({\"display\":\"none\"});\r\n\t$('.note').css({\"display\":\"none\"});\r\n}", "function onDeleteAll() {\n\t\t$.get(url, function (response) {\n\t\t\tresponse.forEach(function (record) {\n\t\t\t\tvar newUrl = url + record._id;\n\t\t\t\t$.ajax({\n\t\t\t\t\turl: newUrl,\n\t\t\t\t\tmethod: 'DELETE'\n\t\t\t\t});\n\t\t\t});\n\t\t}, 'json');\n\t\t$imageUrl.val('');\n\t\t$imageCaption.val('');\n\t\t$gallery.html('');\n\t\t$gallery.hide();\n\t}", "function hideContextImages(e) {\n e.parent().find('.delete-image').hide();\n e.parent().find('.check-image').hide();\n e.parent().find('.rtab-image').hide(); \n\t}", "function ceramics() {\n\tif (ceramicsClicked == false) {\n\t\tdocument.getElementById('ceramicsGo').src=ceramicsGif.src;\n\t\tceramicsClicked = true;\n\t} else {\n\t\tdocument.getElementById('ceramicsGo').src=ceramicsJpeg.src;\n\t\tceramicsClicked = false;\n\t}\n}", "function clearBreed() {\n $('#breed_image').attr('src', \"\");\n $(\"#breed_data_table tr\").remove();\n}", "function setImgOff(htmlId, imgIds) {\r\n _.times(imgIds.length, function (id) {\r\n var $elem = $(htmlId + id);\r\n $elem.find('img').attr('src', config.srcImg + '/vorschlag.svg');\r\n\r\n });\r\n }", "function undo() {\n canDraw.erase();\n canOverlay.erase();\n canDraw.context.drawImage(canDraw.backupImageArray.pop().canvas, 0, 0);\n doneDrawing();\n updateScore();\n}", "function colonne(a) {\n\twindow.document.body.className=window.document.body.className.replace(/ *noImage/gi, ' ');\n\tCookie.del('noImage');\n\tvar win=window.parent;\n\tif (!win.frames['side']) return true;\n\ta.target='side';\n\tif (a.href.search(/image.php/) != -1) return true;\n\ta.href='image.php?id='+a.href.substr(a.href.search(/\\/[A-Z]\\//)+1);\n\treturn true;\n}", "function removeDislikedElements() {\n $(\".js-new-blob-submit\").remove();\n $(\".signup-prompt-bg\").remove();\n $(\".toolbar-help\").remove();\n $(\"a[href^=github-mac]\").remove();\n}", "function clearGameField() {\n for (var celnum = 0; celnum < 9; celnum++) {\n GAME_FIELD_ELEMENT[celnum].src = PLAYER_IMAGES[0];\n }\n}", "function reset_image_box() {\n\tbox_photos = new Array();\n\tvar image = document.getElementById('imagebox');\n\timage.src = '';\n\timage.style.visibility = \"hidden\";\n\t$('#photos-small img').remove();\n\t$('#photos-small-second img').remove();\n\t$('#album_wrapper div').remove();\n}", "function SendColonyShipsSuccess(){\r\n\tsendingFleet.img.src = chrome.extension.getURL('ressources/colonisationSuccess.png');\r\n\r\n\tsendingFleet = null;\r\n}", "removeSprite(body) {\n const index = this.spriteList.findIndex(s => s.id === body.id)\n this.spriteList.splice(index, 1)\n body.sprite.destroy()\n try {\n body.stopWork()\n } catch (e) {\n console.log(body + 'dont have stopwork fn')\n }\n }", "function resetimage(){\n upload();\n}", "function Reset_Image(){\n tagging_view_annotate.Reset_Image_View(image_files_in_dir)\n}", "function out() {\n\tif (this.id == 0)\n\tthis.src = \"box.png\";\n}", "static turnOff(pix){\r\n\t\tpix.on = false;\r\n\t}", "function C012_AfterClass_Amanda_StopPleasureFromAmanda() {\n\tOverridenIntroImage = \"\";\n}", "function _224XClick() {\n\tvar x = document.getElementById('224window');\n\tx.style.display = \"none\";\n\n\tvar ifrm = document.getElementById('224doc');\n\tx.removeChild(ifrm);\n}", "function eliminar_img_foto(tab,camp)\n{\n\t$1('image_'+camp+'_controles1');\n\t$0('image_'+camp+'_copiando');\n\t$1('image_'+camp+'_default');\n\t$('image_'+camp+'_img').src=USU_IMG_DEFAULT;\n\t$('form_'+camp).reset();\n\t$0('image_'+camp+'_img_cerrar');\n\t$('upload_in_'+camp).value='eliminar';\n\n}", "resetGame() {\n // empty the phrase UL\n document.querySelector('#phrase ul').innerHTML = ''\n\n const keys = document.querySelectorAll('.keyrow button')\n keys.forEach((key) => {\n key.disabled = false;\n key.className = 'key'\n })\n\n const tries = document.querySelectorAll('.tries img')\n for (let i = 0; i < tries.length; i++) {\n tries[i].src = 'images/fullHeart.png'\n }\n }", "function erase() {\nvar m = confirm(\"Sure to clear the Board?\");\nif (m) {\n ctx.clearRect(0, 0, w, h);\n socket.emit(\"clear_wb\"); //Announce to everyone in room to clear the board\n}\n}", "function clearGameField() {\n for(var celnum = 0; celnum < 9; celnum++) {\n GAME_FIELD_ELEMENT[celnum].src = PLAYER_IMAGES[0];\n }\n}", "function removeAvatarFromBackstage() {\n $(\"#content\").children('div').each(function(i) { \n if ($(this).attr('id').indexOf('avatar' + sessionStorage.getItem('name')) != -1) {\n $(this).remove();\n }\n });\n}", "function port_on_disconnect() {\n player = {}; // Clear player state\n time_played = 0;\n num_scrobbles = 0;\n curr_song_title = '';\n chrome.browserAction.setIcon({'path': SETTINGS.main_icon});\n}" ]
[ "0.64858234", "0.6345992", "0.61264706", "0.6115912", "0.6114024", "0.611349", "0.6086371", "0.60614", "0.60431176", "0.6022043", "0.60099113", "0.59966797", "0.5977463", "0.5976565", "0.5967888", "0.5967557", "0.59592104", "0.5956257", "0.5946442", "0.5928878", "0.5922517", "0.5907405", "0.59026223", "0.59013146", "0.5899427", "0.5894176", "0.58895224", "0.5866958", "0.58655083", "0.5861142", "0.5852612", "0.58420223", "0.5833506", "0.5832485", "0.5830976", "0.58234954", "0.5819007", "0.58173656", "0.58150125", "0.58124435", "0.5802724", "0.57957274", "0.57937384", "0.5792786", "0.5790382", "0.5788177", "0.5781147", "0.577262", "0.57658154", "0.5755714", "0.57538885", "0.57528275", "0.57331586", "0.57329756", "0.5715306", "0.5714903", "0.5709994", "0.570147", "0.5699937", "0.56986356", "0.56958014", "0.569344", "0.56898177", "0.5687999", "0.5684998", "0.5679114", "0.56783956", "0.5678119", "0.5671359", "0.5671359", "0.5670952", "0.5668832", "0.5667436", "0.56620055", "0.56617916", "0.56592625", "0.56584144", "0.5656782", "0.5651333", "0.56465393", "0.56462026", "0.5641901", "0.563749", "0.5635409", "0.5628289", "0.56251574", "0.5622506", "0.5622238", "0.56182593", "0.5617382", "0.56154895", "0.56132925", "0.56116575", "0.5607365", "0.56069785", "0.5606637", "0.5604956", "0.56036335", "0.5602932", "0.5602478", "0.5599182" ]
0.0
-1
move! Use the kapp notes movement from Zelda to randomly choose positions and get closer to them by the "Speed" which was instantiated as I think .02 which was what we used in the notes (move 2% fo the distance etc.)
move() { if (abs(this.xPos - this.xDest) < 100) { this.xDest = random(10, width - 10); } let xDist = this.xDest - this.xPos; this.xPos += this.speed * xDist; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move() {\n var dirx = Math.random() > 0.5 ? 1 : -1;\n var diry = Math.random() > 0.5 ? 1 : -1;\n var L = int((Math.random() * 20));\n var L2 = int((Math.random() * 20));\n this.endx = this.posx + (L * dirx);\n this.endy = this.posy + (L2 * diry);\n }", "move() {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n // Handle wrapping\n this.handleWrapping();\n }", "move(sp) {\n \n // change speeds: \n this.xv += randomGaussian() * sp;\n this.yv += randomGaussian() * sp;\n\n // if speed too high in one direction, or off screen, accelerate in other direction:\n let v_constraint = 15;\n if(this.xv > sp * v_constraint | this.x > width){\n this.xv -=sp;\n }\n if(this.xv < -sp * v_constraint | this.x < (-width)){\n this.xv += sp;\n }\n if(this.yv > sp * v_constraint | this.y > height){\n this.yv -= sp;\n }\n if(this.yv < -sp * v_constraint | this.y < (-height)){\n this.yv += sp;\n }\n\n // Change location based on the speed\n this.x += this.xv;\n this.y += this.yv;\n }", "move() {\n if (this.isAvailable) {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n // Handle wrapping\n this.handleWrapping();\n }\n }", "function move() {\n\tvar radius = 50;\n\tvar x = Math.floor(Math.random() * radius - radius/2);\n\tvar y = Math.floor(Math.random() * radius - radius/2);\n\n\tsendMove (\"move\",x,y)\n}", "updatePositon() {\n this.pos = this.pos + Math.random() * this.speed;\n this.trailPos = this.trailPos + Math.random() * this.speed;\n\n this.bodyPos = this.isSqueezing\n ? this.bodyPos + (this.speed * .1)\n : this.bodyPos - (this.speed * .1);\n\n if (this.bodyPos <= 0 || this.bodyPos >= 5) {\n this.isSqueezing = !this.isSqueezing;\n }\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "randomSpeed() {\n this.sp = movementMultip * Math.floor(Math.random() * 10+1);\n }", "function move() {\n orb.roll(60, Math.floor(Math.random() * 360));\n }", "move() {\n\n\t\tthis.x += random(-5, 5);\n\t\tthis.y += random(-5, 5);\n\n\t}", "move() {\n let xDiff = this.xTarget - this.x + 5; // Blumenmitte\n let yDiff = this.yTarget - this.y;\n if (Math.abs(xDiff) < 1 && Math.abs(yDiff) < 1)\n this.setRandomFlowerPosition();\n else {\n this.x += xDiff * this.speed;\n this.y += yDiff * this.speed;\n }\n }", "move() {\n this.x = this.x + random(-10,10);\n this.y = this.y + random(-10,10);\n }", "function determineMove() {\n \n return chooseRandomItem(cardinalPoints);\n}", "move() {\n this.x += random(-5, 5);\n this.y += random(-5, 5);\n }", "move(){\n this.x=this.x+random(-3,3)\n this.y=this.y+random(-3,3)\n }", "function getRandomSpikeMovement(model, maxBelow, maxAbove, velocity)\n{\n var direction = Math.floor(Math.random() * 2);\n if(direction == 0)\n {\n model.TransX = 1.0;\n model.Rotation = -Math.PI/2;\n model.Physics.xy_velocity[0] = -velocity;\n }\n else\n {\n model.TransX = -1.0;\n model.Rotation = Math.PI/2;\n model.Physics.xy_velocity[0] = velocity;\n }\n\n // If the random number gives a number greater than maxAbove, negate it\n // Valid range determined by highest y_value of given environment object\n var valid_range = Math.round( (maxAbove - maxBelow) * 100 );\n var pos = (Math.random() * valid_range) / 100;\n pos += maxBelow;\n if(pos > maxAbove)\n {\n pos = (-1) * (pos - maxAbove);\n }\n\n model.TransY = pos;\n model.Physics.crossedScreen = false;\n}", "move() {\n this.x = this.x + random(-2, 2);\n this.y = this.y + random(-2, 2);\n }", "_moveTo (ox, oy, px, py, stage, puck) {\n // be random\n var speed = stage.width / (50.0 + Math.floor(Math.random() * 20));\n\n var oldpx = px;\n var oldpy = py;\n\n // calculate deltas\n var dx = px - ox;\n var dy = py - oy;\n\n // calculate distance between puck and paddle position (we use Pythagorean theorem)\n var distance = Math.sqrt(dx * dx + dy * dy);\n\n // if total distance is greater than the distance, of which we can move in one step calculate new x and y coordinates somewhere between current puck and paddle position.\n if (distance > speed) {\n // x = current padle x position + equally part of speed on x axis\n px = ox + speed / distance * dx;\n py = oy + speed / distance * dy;\n }\n\n /*if(Math.pow(oldpx - px, 2) + Math.pow(oldpy - py, 2) < this.radius() + puck.getComponent(\"Ball\").radius()){\n px = ox;\n py = oy;\n }*/\n\n // move paddle to the new position\n this.setPlayerPosition(cc.v2(px, py));\n return true;\n }", "function movement_Pattern_Random (thing) {\n\n if (thing.moveCounter > 15) {\n\n var chance = Math.random() * 5;\n\n if (chance <= 1 && (thing.X > playerList[0].X + 100 || thing.X < playerList[0].X - 100)) { \n thing.movement = \"left\"; \n }\n else if (chance <= 2 && (thing.X < playerList[0].X + 100 || thing.X < playerList[0].X - 100)) { \n thing.movement = \"right\";\n }\n else if (chance <= 3 && (thing.Y < playerList[0].Y + 100 || thing.Y < playerList[0].Y - 100)) { \n thing.movement = \"up\"; \n }\n else if (chance <= 4 && (thing.Y < playerList[0].Y + 100 || thing.Y < playerList[0].Y - 100)) { \n thing.movement = \"down\"; \n }\n else { thing.movement = \"stopped\"; }\n\n thing.moveCounter = 0;\n }\n\n if (thing.movement == \"up\") { thing.Y -= thing.speed / 2; }\n if (thing.movement == \"left\") { thing.X -= thing.speed / 2; }\n if (thing.movement == \"down\") { thing.Y += thing.speed / 2; }\n if (thing.movement == \"right\") { thing.X += thing.speed / 2; }\n\n thing.moveCounter++;\n}", "function move() {\n //array for possible locations on playing field x, y\n const playingField = [[101, 202, 303, 404, 505, 606], [60, 143, 226, 309]];\n // create random numbers in the range of the indexes of the two arrays within playingField\n let randomCoordinateX = playingField[0][Math.floor(Math.random() * 5)]; \n let randomCoordinateY = playingField[1][Math.floor(Math.random() * 4)];\n let coordinates = [randomCoordinateX, randomCoordinateY];\n return coordinates; \n}", "function movePrey() {\n // Change the prey's velocity at random intervals\n preyVX = map(noise(tx),0,1,-preyMaxSpeed,preyMaxSpeed);\n preyVY = map(noise(ty),0,1,-preyMaxSpeed,preyMaxSpeed);\n\n // Update prey position based on velocity\n preyX += preyVX;\n preyY += preyVY;\n\n // Screen wrapping\n if (preyX < 0) {\n preyX += width;\n }\n else if (preyX > width) {\n preyX -= width;\n }\n\n if (preyY < 0) {\n preyY += height;\n }\n else if (preyY > height) {\n preyY -= height;\n }\n\nif (0 <= preyEaten && preyEaten < 10) {\n displayMotivation('TIK TOK', height/2);\n tx += 0.8;\n ty += 0.8;\n } else if ( 10 <= preyEaten && preyEaten < 15) {\n displayMotivation(\"I'M IMPRESSED\", height/2);\n preyMaxSpeed = 4;\n tx += 0.5;\n ty += 0.5;\n } else if (15 <= preyEaten && preyEaten < 20) {\n displayMotivation(\"THEY KNOW\\n YOU ARE AFTER THEM\", height/2);\n tx += 0.1;\n ty += 0.1;\n } else if (20 <= preyEaten && preyEaten < 25) {\n displayMotivation(\"TRY HARDER\", height/2);\n preyMaxSpeed = 10;\n tx += 0.05;\n ty += 0.05;\n } else if (25 <= preyEaten && preyEaten < 30) {\n displayMotivation(\"CALM \\n BEFORE THE STORM\", height/2);\n preyMaxSpeed = 2;\n tx += 0.2;\n ty += 0.2;\n } else if (30 <= preyEaten) {\n displayMotivation(\"STAY DILIGENT\", height*0.45);\n displayMotivation(\"FROM NOW ON\", height*0.55);\n preyMaxSpeed = 17;\n tx += 0.07;\n ty += 0.07;\n }\n\n}", "move() \n\t{\n\t\tthis.raindrop.nudge(0,-1,0);\n\n\t\tif (this.raindrop.getY() <= this.belowplane ) \n\t\t{\n\t\t\t//setting the y value to a certain number\n\t\t\tthis.raindrop.setY(random(200,400))\n\t\t}\n\t}", "move() {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n\n if (this.x + this.vx < 0 + this.size / 2 || this.x + this.vx > width - this.size / 2) {\n this.vx = -this.vx;\n }\n\n if (this.y + this.vy < 0 + this.size || this.y + this.vy > cockpitVerticalMask - this.size) {\n //this.speed = -this.speed;\n this.vy = -this.vy;\n }\n\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n //increases enemy's size every frame,\n this.size += this.speed / 10;\n //constrain enemies on screen\n this.x = constrain(this.x, 0, width);\n this.y = constrain(this.y, 0, height * 75 / 100);\n }", "function moveSphero(position) {\n\tlet speed = position.coords.speed;\n let heading = position.coords.heading;\n\n // *DLE*\n let b = document.querySelector('#message-window');\n b.innerHTML = \"speed: \" + speed + \"<br/>\"\n + \"heading: \" + heading + \"<br/>\";\n\n // *DLE* if (speed > 0.2 && heading) \n if (speed > 0.02) \n {\n // *DLE*\n \t\t//Speed conversion from m/s to 0 to SPHERO_MAX_SPEED range\n \t\t//console.log(speed,heading);\n \t\t//let spheroSpeed = SPHERO_MAX_SPEED * speed / 2.0; //2.0 mps is the maximum speed of Sphero Bolt\n \t\t//spheroSpeed < SPHERO_MAX_SPEED ? spheroSpeed = Math.round(speed) : spheroSpeed = SPHERO_MAX_SPEED; \n\n // *DLE* bolt.roll(spheroSpeed, heading, []);\t\n bolt.roll(255, heading, []);\t\n\t}\n\telse {\n\t\tbolt.roll(0, bolt.heading, []);\n\t}\n}", "function movePrey() {\n // Change the prey-firefly's velocity at random intervals\n // random() will be < 0.05 5% of the time, so the prey-firefly\n // will change direction on 5% of frames\n if (random() < 0.05) {\n // Set velocity based on random values to get a new direction\n // and speed of movement\n //\n //I changed random() to noise ()\n //Map()will convert the 0-1 range of the noise function\n // to the appropriate range of velocities for the prey-firefly\n preyVX = map(noise(preytx), 0, 1, -preyMaxSpeed, preyMaxSpeed);\n preyVY = map(noise(preyty), 0, 1, -preyMaxSpeed, preyMaxSpeed);\n }\n // Changed it make the prey-firefly move in a less\n // symetrical way.\n preytx += 0.1\n preyty += 0.5\n\n // Update prey-firefly position based on velocity\n preyX = preyX + preyVX;\n preyY = preyY + preyVY;\n\n // Screen wrapping\n if (preyX < 0) {\n preyX = preyX + width;\n } else if (preyX > width) {\n preyX = preyX - width;\n }\n\n if (preyY < 0) {\n preyY = preyY + height;\n } else if (preyY > height) {\n preyY = preyY - height;\n }\n}", "function simulate() {\n var dist = Math.random()*speed*360/(2*Math.PI*6378);\n var dir = Math.random()*360;\n database.ref('/games/-KUiOLBGV53ABRAt2PlY/positions/-KUhOs2OYEWhkeJVJxmB/position_history/').push({\n latitude: lastLat[\"KUhOs2OYEWhkeJVJxmB\"]+dist*Math.sin(dir),\n longitude: lastLong[\"KUhOs2OYEWhkeJVJxmB\"]+dist*Math.cos(dir)\n });\n lastLat[\"KUhOs2OYEWhkeJVJxmB\"] +=dist*Math.sin(dir);\n lastLong[\"KUhOs2OYEWhkeJVJxmB\"]+=dist*Math.cos(dir);\n dist = Math.random()*speed*360/(2*Math.PI*6378);\n dir = Math.random()*360;\n database.ref('/games/-KUiOLBGV53ABRAt2PlY/positions/-KUiZhR2_umqLt3x2G5z/position_history/').push({\n latitude: lastLat[\"KUiZhR2_umqLt3x2G5z\"]+dist*Math.sin(dir),\n longitude: lastLong[\"KUiZhR2_umqLt3x2G5z\"]+dist*Math.cos(dir)\n });\n lastLat[\"KUiZhR2_umqLt3x2G5z\"] +=dist*Math.sin(dir);\n lastLong[\"KUiZhR2_umqLt3x2G5z\"]+=dist*Math.cos(dir);\n dist = Math.random()*speed*360/(2*Math.PI*6378);\n dir = Math.random()*360;\n database.ref('/games/-KUiOLBGV53ABRAt2PlY/positions/-KUiZhyn8SoDUkfEdJam/position_history/').push({\n latitude: lastLat[\"KUiZhyn8SoDUkfEdJam\"]+dist*Math.sin(dir),\n longitude: lastLong[\"KUiZhyn8SoDUkfEdJam\"]+dist*Math.cos(dir)\n });\n lastLat[\"KUiZhyn8SoDUkfEdJam\"] +=dist*Math.sin(dir);\n lastLong[\"KUiZhyn8SoDUkfEdJam\"]+=dist*Math.cos(dir);\n dist = Math.random()*speed*360/(2*Math.PI*6378);\n dir = Math.random()*360;\n database.ref('/games/-KUiOLBGV53ABRAt2PlY/positions/-KUid7MHTlIuox2uzQUN/position_history/').push({\n latitude: lastLat[\"KUid7MHTlIuox2uzQUN\"]+dist*Math.sin(dir),\n longitude: lastLong[\"KUid7MHTlIuox2uzQUN\"]+dist*Math.cos(dir)\n });\n lastLat[\"KUid7MHTlIuox2uzQUN\"] +=dist*Math.sin(dir);\n lastLong[\"KUid7MHTlIuox2uzQUN\"]+=dist*Math.cos(dir);\n}", "move() {\n if(difficulty === 1){\n this.speed = 5;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n else if(difficulty === 2 || difficulty === 4){\n this.speed = 10;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n else if(difficulty === 3){\n this.speed = 15;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n this.y += this.vy;\n }", "function moveStep(){\n megamanXPos += megamanXSpeed;\n megamanYPos += megamanYSpeed;\n }", "move()\n {\n if (keys !== null)\n {\n //if \"w\" or \"arrow up\" pressed\n if (keys[38] || keys[87])\n {\n this.velY -= 1.5;\n }\n //if \"s\" or \"arrow down\" pressed\n if (keys[40] || keys[83])\n {\n this.velY += 3;\n }\n //if \"a\" or \"arrow left\" pressed\n if (keys[37] || keys[65])\n {\n this.velX -= 2;\n }\n //if \"d\" or \"arrow right\" pressed\n if (keys[39] || keys[68])\n {\n this.velX += 1.5;\n }\n }\n\n //decceleration based on drag coefficient\n this.velX *= this.drag;\n this.velY *= this.drag;\n\n //position change based on velocity change\n this.xPos += this.velX;\n this.yPos += this.velY;\n\n if (winCondition === undefined || winCondition === true)\n {\n //in bounds x axis\n if (this.xPos > WIDTH - 70)\n {\n this.xPos = WIDTH - 70;\n }\n else if (this.xPos < 0)\n {\n this.xPos = 0;\n }\n }\n\n //in bounds y axis\n if (this.yPos > HEIGHT - balloonGround - 120)\n {\n this.yPos = HEIGHT - balloonGround - 120;\n this.hitGround++;\n }\n else if (this.yPos < 0)\n {\n this.yPos = 0;\n }\n }", "move() {\n this.DTT = dist(this.pp.x, this.pp.y, this.target.x, this.target.y);\n let closeMult;\n\n // If the distance is close enough to target, then it will get slower. \n if (this.DTT < enoughTarget) {\n closeMult = this.DTT / enoughTarget;\n this.velocity.mult(0.9);\n } else {\n closeMult = 1;\n this.velocity.mult(0.95);\n }\n\n // If the distance is far away from target, it will move toward target.\n if (this.DTT > 1) {\n let controller = new p5.Vector(this.target.x, this.target.y);\n controller.sub(this.pp);\n controller.normalize();\n controller.mult(this.speedMax * closeMult * speedSlider.slider.value());\n this.acceleration.add(controller);\n }\n\n // Interaction with mouse.\n\n let MD = dist(this.pp.x, this.pp.y, mouseX, mouseY);\n //MD = Mouse Distance from partical position\n\n if (MD < mouseSizeSlider.slider.value()) {\n // Push away from mouse.\n let push = new p5.Vector(this.pp.x, this.pp.y);\n push.sub(new p5.Vector(mouseX, mouseY));\n push.normalize();\n push.mult((mouseSizeSlider.slider.value() - MD) * 0.05);\n this.acceleration.add(push);\n }\n\n // Move arguments\n this.velocity.add(this.acceleration);\n this.velocity.limit(this.forceMax * speedSlider.slider.value());\n this.pp.add(this.velocity);\n this.acceleration.mult(0);\n }", "move() {\n const skier = Players.getInstance(\"skier\").getPlayer(\"skier\");\n this.direction = skier.direction;\n if (!this.eating) {\n if (skier.checkIfSkierStopped()) {\n this.y += this.speed;\n this.distance_gained_on_stop += this.speed;\n this.checkIfRhinoHitsSkier(skier);\n } else {\n this.y = skier.y - Constants.RHINO_SKIER_DISTANCE;\n this.y += this.distance_gained_on_stop;\n this.x = skier.x;\n }\n }\n }", "function makeRandomMove () {\n var step = Math.floor(Math.random() * 9);\n return [Math.floor(step / 3), step % 3];\n}", "function move() {\t\n\t\t\t\tcar1Pos += car1Speed;\n\t\t\t\tcar1.style.marginLeft = car1Pos.toString() + '%';\n\t\t\t\tcar2Pos += car2Speed;\n\t\t\t\tcar2.style.marginLeft = car2Pos.toString() + '%';\n\t\t}", "function moveSprikes() {\n setInterval(spikesComing, 4000);\n }", "function changeSnakePosition() {\r\n console.log(ySpeed);\r\n headX = headX + xSpeed;\r\n headY = headY + ySpeed;\r\n}", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }", "move() {\n let r = random(0, 1);\n if (r < this.jitteriness) {\n this.vx = random(-this.speed, this.speed);\n this.vy = random(-this.speed, this.speed);\n }\n\n this.x = this.x + this.vx;\n this.y = this.y + this.vy;\n\n this.x = constrain(this.x, 0, width);\n this.y = constrain(this.y, height/5, height);\n }", "function moveDucks() {\n\tfor (i=0; i < ducks.length; i++) {\n\t\tvar differenceX = ducks[i].targetX - ducks[i].posX;\n\t\tvar differenceY = ducks[i].targetY - ducks[i].posY;\n\n\t\tducks[i].posX = ducks[i].posX + differenceX/20;\n\t\tducks[i].posY = ducks[i].posY + differenceY/20;\n\t}\n}", "move(direction) {\n\n direction = spiel.moveDirection;\n\n if (direction == \"R\" && !this.isExploding) {\n\n this.posX++;\n let newBild = this.images[Math.floor(Math.random() * this.images.length)];\n if (newBild != null)\n this.img.src = newBild;\n }\n\n else if (direction == \"L\" && !this.isExploding) {\n this.posX--;\n let newBild = this.images[Math.floor(Math.random() * this.images.length)];\n if (newBild != null)\n this.img.src = newBild;\n }\n }", "moveControl() {\n const { view } = this;\n const size = this.sizeShip;\n const bufferY = 3;\n\n this.y += this.speed;\n\n if (this.x < size || this.x >= view.width + size) {\n this.x = view.getRandomPositionX(size);\n }\n if (this.y >= view.height + size) {\n this.y = -view.getRandomPositionY(size) / 2;\n }\n }", "move() {\n this.leader.move();\n for (let i = 0; i < this.followers.length; i++) {\n if (i == 0) {\n let deltaX = this.leader.position.x - this.followers[i].position.x;\n let deltaY = this.leader.position.y - this.followers[i].position.y;\n\n deltaX *= this.springing;\n deltaY *= this.springing;\n this.followers[i].speed.x += deltaX;\n this.followers[i].speed.y += deltaY;\n\n this.followers[i].move();\n\n this.followers[i].osc.add(createVector(random(0.1, 0.5)*deltaY, random(0.1, 0.5)*deltaX))\n\n this.followers[i].speed.x *= this.damping;\n this.followers[i].speed.y *= this.damping;\n \n noStroke();\n // this.leader.draw();\n this.followers[i].draw();\n } else {\n let deltaX = this.followers[i - 1].position.x - this.followers[i].position.x;\n let deltaY = this.followers[i - 1].position.y - this.followers[i].position.y;\n\n deltaX *= this.springing;\n deltaY *= this.springing;\n this.followers[i].speed.x += deltaX;\n this.followers[i].speed.y += deltaY;\n\n this.followers[i].osc.add(createVector(random(0.1, 0.5)*deltaY, random(0.1, 0.5)*deltaX))\n\n this.followers[i].move();\n\n this.followers[i].speed.x *= this.damping;\n this.followers[i].speed.y *= this.damping;\n\n // this.leader.draw();\n this.followers[i].draw();\n\n }\n }\n }", "getMove() {\n if (this.infected) {\n let nearby = this.world.characters.filter((character) => Math.abs(character.x - this.x) <= 2 && Math.abs(character.y - this.y) <= 2 && character != this)\n for (let c of nearby) {\n let probability = 1 / (Math.sqrt((c.x - this.x) * (c.x - this.x) + (c.y - this.y) * (c.y - this.y))) * this.world.outsideInfectionRate\n if (Math.random() < probability) {\n c.particlesIn()\n }\n }\n }\n\n let distances = this.currentBuilding.distancesFrom;\n if (distances[this.x][this.y] == 1) {\n this.world.intoBuilding(this.currentBuilding, this)\n return\n }\n\n // Make sure every coordinate is in the map and valid\n let possibleValues = moves.map((diff) => [this.x + diff[0], this.y + diff[1]]).filter((coord) => this.world.isEmpty(coord[0], coord[1]))\n\n // Sort by rating\n possibleValues.sort((first, second) => distances[second[0]][second[1]] - distances[first[0]][first[1]])\n\n if (possibleValues.length == 0) {\n return\n }\n\n var distancing = this.world.sdRange\n let nearbies = this.world.characters.filter((character) => Math.abs(character.x - this.x) <= 3 && Math.abs(character.y - this.y) <= 3).filter((c) => c != this)\n\n let maxVal = distances[possibleValues[0][0]][possibleValues[0][1]]\n // score based on how it can get to the home\n let scores = possibleValues.map((coord) => Math.abs(distances[coord[0]][coord[1]] - maxVal - 1))\n\n\n scores = scores.map(function (currentScore, i) {\n let [x, y] = possibleValues[i]\n if (nearbies.length == 0) {\n return currentScore\n }\n let closestDistance = Math.sqrt(nearbies.map((char) => (char.x - x) * (char.x - x) + (char.y - y) * (char.y - y)).reduce((last, current) => Math.min(last, current)))\n\n let multiplier = Math.pow(1 - distancing / 3 / (Math.pow(2, 2 * (closestDistance - 2.5)) + 1), 2)\n return currentScore * multiplier\n })\n\n let maxScore = scores.reduce((last, cur) => Math.max(last, cur))\n for (let i = 0; i < scores.length; ++i) {\n if (scores[i] == maxScore) {\n this.world.move(this, possibleValues[i][0], possibleValues[i][1])\n }\n }\n }", "function changeSpeed() {\r\n timerText++;\r\n if (timerText % 5 == 0) {\r\n ellipse1Speed = random(1,10);\r\n ellipse2Speed = random(1, 10);\r\n circle1Speed= random(1,10);\r\n circle2Speed = random(1,10);\r\n circle3Speed = random(1,10);\r\n circle4Speed = random(1,10);\r\n rect1Speed = random(1,10);\r\n rect2Speed = random(1,10);\r\n rect3Speed = random(1,10);\r\n rect4Speed = random(1,10);\r\n\r\n }\r\n }", "function makeRandomMove() {\n log(\"stockfish made a random move\", \"stockfish\");\n var moves = board.moves({ verbose: true });\n var move = moves[Math.floor(Math.random() * moves.length)];\n board.move(move);\n highlightLastOpponentMove({ from: move.from, to: move.to });\n updateBoardUI();\n }", "move() {\n // compute how the particle should move\n\n // the particle should randomly move in the x & z directions\n var xMovement = map(noise(this.xOffset), 0, 1, -0.01, 0.01);\n var yMovement = map(noise(this.yOffset), 0, 1, -0.01, 0.01);\n var zMovement = map(noise(this.zOffset), 0, 1, -0.01, 0.01);\n\n // update our poistions in perlin noise space\n this.xOffset += 0.01;\n this.yOffset += 0.01;\n\n // set the position of our box (using the 'nudge' method)\n this.myBox.nudge(xMovement, yMovement, zMovement);\n }", "move() {\n this.x += 3;\n this.y += 0;\n if (this.x > 50) {\n this.x += 0;\n this.y += 4;\n }\n if (this.x > 1200) {\n this.y = this.dy;\n this.x = this.dx;\n }\n }", "move(foodLocation) {\n this._setNewSpeed();\n\n let temp = Object.assign({}, this.positions[0]);\n\n temp.x += this.speed.xspeed;\n temp.y += this.speed.yspeed;\n\n if (this.positions\n .filter(pos => pos.x === temp.x && pos.y === temp.y).length > 0 ||\n temp.x < 0 || this.boardWidth <= temp.x ||\n temp.y < 0 || this.boardHeight <= temp.y\n ) {\n this.gameOver = true;\n }\n if (this.gameOver) return;\n\n\n this.positions.unshift(temp)\n\n let distToFood = Math.sqrt(\n Math.pow(this.positions[0].x - foodLocation.x, 2) +\n Math.pow(this.positions[0].y - foodLocation.y, 2)\n );\n if (distToFood === 0) {\n return true;\n } else {\n this.positions.pop();\n return false;\n }\n }", "move(){\n if (keyIsDown (LEFT_ARROW) ) {\n this.pos.x -= this.speed;\n } \n if (keyIsDown(RIGHT_ARROW) ) {\n this.pos.x += this.speed;\n } \n if (keyIsDown (UP_ARROW) ) {\n this.pos.y -= this.speed;\n } \n if (keyIsDown (DOWN_ARROW) ) {\n this.pos.y += this.speed;\n }\n }", "function updateMotors() {\n //printf(\"%li %li %li %li %ld\\n\\r\", spikeFL, spikeBL, spikeFR, spikeBR, maxspikes);\n if (spikeFL >= spikeBL) // If more forward then back, direction is forward\n {\n // Debugging\n dirL = 0;\n // Multiply by 8.0 since maxspikes is actually maxspikes * 2 since if a neuron does spike it won't spike twice in a row because of the refractory period\n v2 = (((spikeFL - spikeBL) / maxspikes) * 2.0 * 8.0);\n // Debugging (comment out t2 change)\n // t2 = (0.332485 / v2 * 1000.0);\n // time2 = t2;\n } else {\n // Debugging\n dirL = 1;\n v2 = (((spikeBL - spikeFL) / maxspikes) * 2.0 * 8.0);\n // Debugging\n // t2 = (0.332485 / v2 * 1000.0);\n // time2 = t2;\n }\n if (spikeFR >= spikeBR) // If more forward then back, direction is forward\n {\n // Debugging\n dirR = 0;\n v3 = (((spikeFR - spikeBR) / maxspikes) * 2.0 * 8.0);\n // Debugging\n // t3 = (0.332485 / v3 * 1000.0);\n // time3 = t3;\n } else {\n // Debugging\n dirR = 1;\n v3 = (((spikeBR - spikeFR) / maxspikes) * 2.0 * 8.0);\n // Debugging\n // t3 = (0.332485 / v3 * 1000.0);\n // time3 = t3;\n } // } Motor Speed update\n\n // Set tsk4cnt to be the greater of the times 350>tsk4cnt>60\n // if (t2 > t3 && t2 <= 350) {\n // tsk4cnt = t2 + 10;\n // } else if (t3 > t2 && t3 <= 350) {\n // tsk4cnt = t3 + 10;\n // } else tsk4cnt = 60;\n //printf(\"%li %li\\n\\r\", t2, t3);\n}", "function moveCPUStriker() {\n var yDelta = puckPosY - cpuStrikerPosY;\n if (yDelta !== 0) {\n cpuStrikerPosY += cpuStrikerSpeed * (yDelta / Math.abs(yDelta));\n }\n }", "update() {\n\t\tlet prob = Math.random().toFixed(2);\n\n\t\tif (prob < 0.5) {\n\t\t\t//move randomly\n\t\t\tthis.moveRandomly();\n\t\t} else {\n\t\t\t//work out direction of the mouse from current position and move towards it.\n\t\t\tthis.moveToMouse();\n\t\t}\n\t}", "rollSpeed() {\n this.xSpeed = Math.random() * (this.maxSpeed * 2) - this.maxSpeed;\n this.ySpeed = Math.random() * (this.maxSpeed * 2) - this.maxSpeed;\n }", "move(){\r\n if((this.timing) % (this.depth+1) == 0){\r\n this.hide()\r\n this.y ++\r\n if (this.y >= 5){\r\n this.y = randint(-10, 0)\r\n this.depth = randint(0, 4)\r\n this.timing= 0\r\n this.x = randint(0, 4)\r\n } \r\n this.show()\r\n } \r\n this.timing++\r\n }", "function movePieces() {\n timeLeft.textContent = --currentTime\n moveCars();\n moveLogs();\n\n moveWithLogRight();\n moveWithLogLeft();\n Lose()\n}", "update() {\n this.pos1 = Math.floor(this.y);\n this.pos2 = Math.floor(this.x);\n this.speed = mappedImage[this.pos1][this.pos2].cellBrightness;\n let movement = 2.5 - this.speed + this.velocity;\n // console.log(this.speed);\n this.y += movement;\n\n // Give it a random position and check if it has reached the end of the canvas.\n this.y += this.velocity;\n if (this.y >= canvas.height) {\n this.y = 0;\n this.x = Math.random() * canvas.width;\n }\n }", "moveWords() {\n if(this.x < 0 || this.x > width){\n this.xSpeed*=-1;}\n if(this.y < 0 || this.y > height){\n this.ySpeed*=-1;}\n this.x+=this.xSpeed;\n this.y+=this.ySpeed;\n }", "function movePieces() {\n currentTime--\n timeLeft.textContent = currentTime\n autoMoveCars()\n autoMoveLogs()\n moveWithLogLeft()\n moveWithLogRight()\n lose()\n }", "move() {\n let frameTime = fc.Loop.timeFrameGame / 1000;\n let distance = fc.Vector3.SCALE(this.velocity, frameTime);\n this.translate(distance);\n }", "function moveBody(moveDone) {\n const body = document.getElementsByClassName(\"snake-body\");\n for (var i = 0; i < body.length; i++) {\n if(!moveDone) {\n //Determine which direction to move\n var xDir = false;\n var yDir = false;\n var moveDir = \"\";\n if(i == 0) {\n bodyPos[0].yPos == headPos.yPos ? xDir = true : yDir = true;\n if(xDir) bodyPos[0].xPos < headPos.xPos ? moveDir = \"right\" : moveDir = \"left\";\n if(yDir) bodyPos[0].yPos < headPos.yPos ? moveDir = \"down\" : moveDir = \"up\"; \n } else {\n bodyPos[i].yPos == bodyPos[i-1].yPos ? xDir = true : yDir = true;\n if(xDir) bodyPos[i].xPos < bodyPos[i-1].xPos ? moveDir = \"right\" : moveDir = \"left\";\n if(yDir) bodyPos[i].yPos < bodyPos[i-1].yPos ? moveDir = \"down\" : moveDir = \"up\"; \n }\n switch(moveDir) {\n case \"left\":\n body[i].style.left = parseFloat(body[i].style.left) - speed + 'px'\n break;\n case \"up\":\n body[i].style.top = parseFloat(body[i].style.top) - speed + 'px'\n break;\n case \"right\":\n body[i].style.left = parseFloat(body[i].style.left) + speed + 'px'\n break;\n case \"down\":\n body[i].style.top = parseFloat(body[i].style.top) + speed + 'px'\n break;\n }\n } else {\n if (i == 0) {\n for (var j = bodyPos.length - 1; j > 0; j--) {\n bodyPos[j] = new Position(bodyPos[j - 1].xPos, bodyPos[j - 1].yPos);\n }\n bodyPos[0] = new Position(headPos.xPos, headPos.yPos);\n body[i].style.top = (headPos.yPos) * 40 + topStart + 'px';\n body[i].style.left = (headPos.xPos) * 40 + leftStart + 'px';\n } else {\n body[i].style.top = (bodyPos[i].yPos) * 40 + topStart + 'px';\n body[i].style.left = (bodyPos[i].xPos) * 40 + leftStart + 'px';\n }\n }\n } \n}", "function move_fly() {\n fly.x = (Math.random() * (canvas.width));\n fly.y = Math.floor((Math.random() * 485));\n m = fly.x;\n\tn = fly.y;\n\tdraw_fly();\n}", "function DogOneRandomMovingXandY(){\n for (var i = 0; i < dogOne.move; i++){\n var boardX = boardPos[i][0] + \"px\"\n var boardY = boardPos[i][1] + 'px';\n setTimeout(function(){\n $(\"#dogOne\").css({transform: 'translate(' + boardX + ',' + boardY + ')'});\n }, 3000);\n }\n return;\n }", "function addNewRandomMove() {\n var randomNumber = Math.random();\n console.log('random number: '+ randomNumber);\n if (randomNumber < 0.25) {\n game.sequence.push(\"p\");\n } else if (randomNumber >= 0.25 && randomNumber < 0.5) {\n game.sequence.push(\"y\");\n } else if (randomNumber >= 0.5 && randomNumber < 0.75) {\n game.sequence.push(\"w\");\n } else if (randomNumber >= 0.75) {\n game.sequence.push(\"b\");\n }\n console.log('game.sequence:', game.sequence);\n}", "move() {\n this.y = this.y +this.fallSpeed;\n if(this.y>height+100){\n \n this.y = -100;\n\n this.x = random(width);\n }\n \n }", "function moveManually(data) {\r\n //Get values \r\n w_r = data.w_right;\r\n w_l = data.w_left;\r\n //Command variables \r\n var cmd_start;\r\n var cmd_v_l;\r\n var cmd_v_r;\r\n var cmd_traction_mode;\r\n //Commands transformation:\r\n cmd_start = 0; \r\n cmd_v_r = Math.round(50 * (1 + w_r/100));\r\n cmd_v_l = Math.round(50 * (1 + w_l/100));\r\n if (w_r === 0 && w_l === 0) {\r\n cmd_traction_mode = 0; //0 -> STOP\r\n } else {\r\n cmd_traction_mode = 10; //10 -> Manual control\r\n }\r\n var trac_manual = [cmd_start, cmd_v_r, cmd_v_l, cmd_traction_mode];\r\n // Send UDP Mesage:\r\n stopExo();\r\n sendUDP(trac_manual,TRACTION_PORT, CPWALKER_IP); \r\n}", "function randomizeMovement() {\n environment.edgeType = 1;\n selection = 0;\n}", "function spiderMoveWhitchWay() {\n spidersArr.forEach(function(ele) {\n let n = Math.ceil(Math.random() * 4);\n let time = Math.ceil(Math.random() * 3);\n switch(time) {\n case 1: time = 500;\n break;\n case 2: time = 1000;\n break;\n case 3: time = 2000;\n break;\n }\n if (ele.canChangeSide) {\n ele.canChangeSide = false;\n setTimeout(function() {\n ele.canChangeSide = true;\n }, time)\n ele.side = n;\n }\n })\n setTimeout(spiderMoveWhitchWay, 1000);\n}", "move () {\n this.position.x += this.speed.x;\n this.position.y += this.speed.y;\n \n if(\n this.position.x + this.radius > canvas.width ||\n this.position.x - this.radius < 0\n )\n this.speed.x *= -1;\n\n if(\n this.position.y + this.radius > canvas.height ||\n this.position.y - this.radius < 0\n )\n this.speed.y *= -1;\n }", "computerMove() {\n const emptySpaces = document.getElementsByClassName('free');\n const move = Math.floor(Math.random() * emptySpaces.length);\n\n document.getElementsByClassName('free')[move].click();\n }", "function MovetoXYCoordinates() {\n y_offset = 0\n // screens < 15 - only moves within a current raw\n //\n // Cursor can move on entire screen\n //\n if (screen < 15) {\n // Identify if raw has changed - then choose new place\n // for cursor\n if (new_y != total_tries) {\n new_y = total_tries\n ocupiedDot = false\n x_offset = 1\n while (!(ocupiedDot)) {\n new_x = Math.random(5)\n ocupiedDot = !(led.point((new_x + x_offset) % 5, new_y))\n }\n direction = Math.randomBoolean()\n } else {\n // Move in one direction for entire screen from left\n // to right\n //\n // Move or from right to left or vice versa\n //\n // Move continuously from right to left to right etc.\n //\n // Select to move to right or left for every move in a\n // raw\n //\n // Select dot randomly in a raw\n //\n if (screen < 3) {\n x_offset = 1\n } else if (screen < 6) {\n if (direction) {\n x_offset = 1\n } else {\n x_offset = -1\n if (new_x == 0) {\n new_x = 5\n }\n }\n } else if (screen < 9) {\n if (new_x == 0) {\n x_offset = 1\n } else if (new_x == 4) {\n x_offset = -1\n }\n } else if (screen < 12) {\n if (new_x == 0) {\n x_offset = 1\n } else if (new_x == 4) {\n x_offset = -1\n } else {\n if (Math.randomBoolean()) {\n x_offset = 1\n } else {\n x_offset = -1\n }\n }\n } else if (screen < 15) {\n ocupiedDot = true\n while (ocupiedDot) {\n new_x = Math.random(5)\n x_offset = 0\n if ((new_x + x_offset) % 5 != selectedDots[(new_y + y_offset) % 5]) {\n ocupiedDot = false\n }\n }\n }\n }\n } else if (screen < 18) {\n ocupiedDot = true\n while (ocupiedDot) {\n if (Math.randomBoolean()) {\n y_offset = 0\n if (new_x == 0) {\n x_offset = 1\n } else if (new_x == 4) {\n x_offset = -1\n } else {\n if (Math.randomBoolean()) {\n x_offset = 1\n } else {\n x_offset = -1\n }\n }\n } else {\n x_offset = 0\n if (new_y == 0) {\n y_offset = 1\n } else if (new_y == 4) {\n y_offset = -1\n } else {\n if (Math.randomBoolean()) {\n y_offset = 1\n } else {\n y_offset = -1\n }\n }\n }\n if ((new_x + x_offset) % 5 != selectedDots[(new_y + y_offset) % 5]) {\n ocupiedDot = false\n }\n }\n } else {\n // Random jump on entire screen\n while (ocupiedDot) {\n new_x = Math.random(5)\n new_y = Math.random(5)\n x_offset = 0\n y_offset = 0\n if ((new_x + x_offset) % 5 != selectedDots[(new_y + y_offset) % 5]) {\n ocupiedDot = false\n }\n }\n }\n new_x = (new_x + x_offset) % 5\n new_y = (new_y + y_offset) % 5\n}", "function moveHikers() {\n\n for (i = 0; i <= 3; i++) {\n // get hiker x and y coordinates\n var hikerX = hikerXs[i];\n var hikerY = hikerYs[i];\n\n // change x direction when a hiker gets to x max\n if (hikerX > CANVAS_WIDTH - 15) {\n hikerXSpeed[i] *= (-[1]);\n }\n\n // change y direction when a hiker gets to y max\n if (hikerY > CANVAS_HEIGHT - 50) {\n hikerYSpeed[i] *= (-[1]);\n }\n\n // change x direction when a hiker gets to x = 0\n if (hikerX < 10) {\n hikerXSpeed[i] *= (-[1]);\n }\n\n // change y direction when a hiker gets to y = 0\n if (hikerY < 5) {\n hikerYSpeed[i] *= (-[1]);\n }\n\n // update the x and y coordinates\n hikerXs[i] = hikerX + hikerXSpeed[i];\n hikerYs[i] = hikerY + hikerYSpeed[i];\n }\n}", "aiMove() {\n if (DATA.difficultyMode === \"hard\") {\n return this.smartMove(DATA.boardCells, DATA.ai).index;\n } else if (DATA.difficultyMode === \"easy\") {\n return this.easyMove();\n } else {\n let toss = Math.random() * 2;\n if (toss > 1.2) {\n return this.easyMove();\n } else {\n return this.smartMove(DATA.boardCells, DATA.ai).index;\n }\n }\n\n }", "move() {\n\t\tthis.x = this.x + random(-2, 2);\n\t\tthis.y = this.y + random(-2, 2);\n\t\tthis.width = this.width + random(-3, 3);\n\t\tthis.height = this.height + random(-3, 3);\n\t}", "move()\n {\n //contain logic within borders\n if (this.xPos + this.sprite.width > width)\n {\n this.xSpeed = 0;\n this.collided = true;\n this.xPos = width - this.sprite.width\n }\n if (this.xPos < 0)\n {\n this.xSpeed = 0;\n this.collided = true;\n this.xPos = 0;\n }\n if (this.yPos > height-238-this.sprite.height)\n {\n this.ySpeed = 0;\n this.collided = true;\n this.yPos = height-238 - this.sprite.height;\n }\n if (this.yPos < 0)\n {\n this.ySpeed = 0;\n this.collided = true;\n this.yPos = 0;\n }\n //kapp notes helpful as always\n // move left?\n if (keyIsDown(LEFT_ARROW) || keyIsDown(65))\n {\n // subtract from character's xSpeed\n this.xSpeed -= this.accel;\n this.left = true;\n this.right = false;\n }\n // move right?\n if (keyIsDown(RIGHT_ARROW) || keyIsDown(68))\n {\n // add to character's xSpeed\n this.xSpeed += this.accel;\n this.right = true;\n this.left = false;\n }\n //reload, basic\n if (keyIsDown(82))\n {\n this.ammoCapacity = 8;\n }\n // fuel!!\n if (keyIsDown(32))\n {\n if (this.fuel > 0)\n {\n //if you still have fuel, then use it\n this.ySpeed -= this.accel;\n }\n if (this.fuel > -250)\n {\n //250 is the threshold under 0 to simulate a \"delay\" since idk how millis() works\n this.fuel -= 15;\n }\n }\n //look at this sad commented out failure of a feature... maybe one day\n /*\n if (keyCode == SHIFT)\n {\n if (cooldown)\n {\n let yDistance = this.yPos - this.jumpSize;\n this.yPos -= this.jumpSpeed * yDistance;\n jumping = true;\n }\n }*/\n //this I felt I wanted to do so that the left and right speeds\n //would naturally slow down over time. Felt unnatural otherwise.\n if (this.right)\n {\n this.xSpeed -= this.gravity;\n if (this.xSpeed < 0)\n {\n this.right = false;\n this.left = true;\n }\n }\n else if (this.left)\n {\n this.xSpeed += this.gravity;\n if (this.xSpeed > 0)\n {\n this.right = true;\n this.left = false;\n }\n }\n\n //the standard movement. Add gravity, speed to position\n this.ySpeed += this.gravity;\n this.xPos += this.xSpeed;\n this.yPos += this.ySpeed;\n\n //gradually grow your fuel overtime. A counter would've been great but I couldn't learn it in time...\n //no pun intended.\n if (this.fuel < this.fuelCapacity)\n {\n this.fuel += 5;\n }\n\n // speed limit! prevent the user from moving too fast\n this.xSpeed = constrain(this.xSpeed, -this.xLimit, this.xLimit);\n this.ySpeed = constrain(this.ySpeed, -25, 25);\n }", "function moveRandomly(bot) {\n toMoveX = Math.floor(Math.random() * 3 - 1) + bot.x;\n toMoveY = Math.floor(Math.random() * 3 - 1) + bot.y;\n bot.moveTo({x: toMoveX, y: toMoveY});\n}", "function autoMove() {\t\n\tif (auto_move_flag !== false) {\n\t\tgameManager.move(Math.floor(Math.random()*4));\n\t\tsetTimeout(\"autoMove()\", auto_move_wait);\n\t\tmoves++;\n\t}\n//\tvar timeTotal = ((performance.now() - startTime)/1000);\n//\tif (auto_move_flag !== false && (timeTotal<TIME_TEST || TIME_TEST==0)) {\n//\t\tgameManager.move(Math.floor(Math.random()*4));\n//\t\tsetTimeout(\"autoMove()\", auto_move_wait);\n//\t\tmoves++;\n//\t}\n//\telse {\n//\t\talert(\"Moves = \"+moves+\"\\nTime = \"+timeTotal+\"\\nMoves/s = \"+(moves/timeTotal));\n//\t}\n}", "function movesnitch() {\n //noise time values\n tx = tx + .005;\n ty = ty + .015;\n nx = noise(tx);\n ny = noise(ty);\n //map noise to correspond to snitch XY velocity\n snitchVX = map(nx,0,1,-snitchMaxSpeed,snitchMaxSpeed);\n snitchVY = map(ny,0,1,-snitchMaxSpeed,snitchMaxSpeed);\n\n // Update snitch position based on velocity\n snitchX += snitchVX;\n snitchY += snitchVY;\n // Screen wrapping\n if (snitchX < 0) {\n snitchX += width;\n }\n else if (snitchX > width) {\n snitchX -= width;\n }\n\n if (snitchY < 0) {\n snitchY += height;\n }\n else if (snitchY > height) {\n snitchY -= height;\n }\n}", "function movementRandom() {\r\n var windowWidth = $(window).width();\r\n var windowHight = $(window).height();\r\n\r\n\r\n var butterflyWidth = $(\"#butterfly\").width();\r\n var butterflyHight = $(\"#butterfly\").height();\r\n\r\n var xMovement = windowWidth - butterflyWidth;\r\n var yMovement = windowHight - butterflyHight;\r\n\r\n var moveX = Math.floor(Math.random() * xMovement);\r\n var moveY = Math.floor(Math.random() * yMovement);\r\n\r\n return [moveX, moveY];\r\n}", "function movePieces() {\n currentTime--;\n timeLeft.textContent = currentTime;\n autoMoveCars();\n autoMoveLogs();\n moveWithLogLeft();\n moveWithLogRight();\n lose();\n \n }", "easyMove() {\n let emptyCells = this.emptyCells();\n let random = Math.floor(Math.random() * (emptyCells.length - 1));\n return emptyCells[random];\n // return emptyCells.length <= 0 ? null : emptyCells[random];\n }", "move() {\n\t\tthis.lastPosition = [ this.x, this.y ];\n\n\t\tthis.x += this.nextMove[0];\n\t\tthis.y += this.nextMove[1];\n\t}", "function adjustMountains() {\n $(\"#mtn-left\").css({ \"left\": \"-15%\" });\n $(\"#mtn-right\").css({ \"right\": \"-15%\" });\n\n $(\"#mtn-left\").velocity({ \"bottom\": \"10%\" }, Math.floor(((Math.random() * 8) + 5) * 100), \"easeOutBack\");\n $(\"#mtn-right\").velocity({ \"bottom\": \"10%\" }, Math.floor(((Math.random() * 8) + 5) * 100), \"easeOutBack\");\n\n}", "moveTo(pos) {\n moving++;\n let actual_pos = {\n x: pos.x,\n y: pos.y,\n }\n let speed = {\n x: (this.x - actual_pos.x) / 12,\n y: (this.y - actual_pos.y) / 12,\n }\n\n let self = this;\n let c = 0;\n\n let operation = () => {\n drawSquares();\n self.x -= speed.x;\n self.y -= speed.y;\n if (c >= 12) {\n self.x = actual_pos.x;\n self.y = actual_pos.y;\n moving--;\n }\n else {\n \n setTimeout(operation, 15);\n c++;\n }\n \n \n \n};\n setTimeout(operation, 15);\n }", "function positionFood() {\n food.x = random(0,width);\n food.y = random(0,height);\n ////NEW CODE: Set a random velocity for food based on iits max speed////\n food.vx = random(-food.maxSpeed, food.maxSpeed);\n food.vy = random(-food.maxSpeed, food.maxSpeed);\n ////END NEW CODE////\n}", "function getAutoMove(b) {\n return Math.floor(Math.random() * 4);\n}", "move() {\n this.center.x += this.speed.x;\n this.center.y += this.speed.y;\n \n wrapAround(this.center);\n }", "function move() {\n\n // loop over all DIV elements\n divs.forEach((div) => {\n\n // Balls can be the width of the constraint \n // or less\n let w = 50;\n\n // x and y position limited to screen space\n let x = rand(500);\n let y = rand(500);\n\n // apply styles\n div.style.width = w + 'px';\n div.style.height = w + 'px';\n div.style.top = y + 'px';\n div.style.left = x + 'px';\n\n // 'move' dot with 900ms or more\n div.style.transition = (rand(100) + 900) + 'ms';\n\n // apply random colour\n div.style.background = `rgba(\n ${rand(255)},\n ${rand(255)},\n ${rand(255)},\n ${Math.random() + 0.5}\n )`;\n });\n}", "function moveRandomWord(array, times){\n var index = 0;\n function move(){\n index++;\n var randomIndex = Math.round( Math.random() * (array.length - 1) );\n var randomNewIndex = Math.round( Math.random() * (array.length - 1) );\n console.log(array[randomIndex]);\n array.move(randomIndex, randomNewIndex);\n if(index < times){\n move();\n }\n }\n move();\n }", "function moveT(){\n var t = timeStep / 1000;\n this.x += this.xSpeed * timeStep / 1000;\n this.y = this.y + this.ySpeed * timeStep / 1000;\n this.coll();\n}", "move() {\n// Set velocity\n this.vx = -5, -this.speed, this.speed;\n// Update position\n this.x += this.vx;\n// Handle wrapping\n this.handleWrapping();\n }", "function move(){\n let speed = 0.3\n let maxSpeed = 4\n if (keyIsDown(LEFT_ARROW)) {\n player1.addSpeed(speed, 180);\n }\n\n if (keyIsDown(RIGHT_ARROW)) {\n player1.addSpeed(speed, 0);\n\n }\n\n if (keyIsDown(UP_ARROW)) {\n player1.addSpeed(speed, 270);\n\n }\n\n if (keyIsDown(DOWN_ARROW)) {\n player1.addSpeed(speed, 90);\n\n }\n if (keyIsDown(65)) {\n player2.addSpeed(speed, 180);\n\n }\n\n if (keyIsDown(68)) {\n player2.addSpeed(speed, 0);\n\n }\n\n if (keyIsDown(87)) {\n player2.addSpeed(speed, 270);\n\n }\n\n if (keyIsDown(83)) {\n player2.addSpeed(speed, 90);\n\n }\n\n if (keyIsDown(75)) {\n player3.addSpeed(speed, 180);\n\n }\n\n if (keyIsDown(186)) {\n player3.addSpeed(speed, 0);\n\n }\n\n if (keyIsDown(79)) {\n player3.addSpeed(speed, 270);\n\n }\n\n if (keyIsDown(76)) {\n player3.addSpeed(speed, 90);\n }\n}", "autoMove() {\n this.x += this.dx * this.dxv;\n if( this.x > 535) {\n this.x += -540;\n } else if (this.x < -40) {\n this.x =+ 500;\n }\n this.y += this.dy * this.dyv;\n }", "tweenMovement() {\n\t\tlet difference = new Phaser.Math.Vector2(this.targetPos.x - this.startPos.x, this.targetPos.y - this.startPos.y);\n\t\t\n\t\tlet stepX = this.go.x + difference.x / this.walkSpeed * this.walkMultiplier * this.scene.game.loop.delta;\n\t\tif (this.targetPos.x > this.startPos.x) {\n\t\t\tthis.go.x = Math.min(stepX, this.targetPos.x);\n\t\t}\n\t\telse {\n\t\t\tthis.go.x = Math.max(stepX, this.targetPos.x);\n\t\t}\n\n\t\tlet stepY = this.go.y + difference.y / this.walkSpeed * this.walkMultiplier * this.scene.game.loop.delta;\n\t\tif (this.targetPos.y > this.startPos.y) {\n\t\t\tthis.go.y = Math.min(stepY, this.targetPos.y);\n\t\t}\n\t\telse {\n\t\t\tthis.go.y = Math.max(stepY, this.targetPos.y);\n\t\t}\n\t}", "function MoveTo(targetPos: Vector3, speed : float, maxTime: float) { //move obj to the position pos, with a maximum time. if time <= 0, no limit of time.\n\tvar time : float = 0.0; //MoveTo\n\tvar step : float;\n\tvar direction : Vector3;\n\tvar distance : float;\n\t\n\tyield StartMoving(speed);\n\t\n\t//RotateTo(targetPos, walkSpeed) without StartMoving and EndMoving. //transform.LookAt(targetPos);\n\tstep = rotateSpeed * Time.deltaTime;\n\tvar targetRotation = Quaternion.LookRotation(targetPos - transform.position);\n\ttargetRotation.x = transform.rotation.x; //we only want to change the y component, so x and z will be no modified\n\ttargetRotation.z = transform.rotation.z;\t\n\twhile (true) {\n\t\ttransform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, step);\n\t\tif (Mathf.Abs(AngleToPosition(targetPos)) <= angleLookAt) {\n\t\t\t//print(\"rotateTo tagetPosition breakk\");\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tyield;\n\t}\n\t\n\t//Move:\n\tstep = speed * Time.deltaTime;\n\twhile (time < maxTime) { \n\t\ttime += Time.deltaTime;\t\n\t\t\n\t\t/*transform.position = Vector3.MoveTowards(transform.position, targetPos, step); //move position a step closer to the target\n\t\tif (transform.position == targetPos) { //reach to position. MoveTowards returns the target position when is closer than step\n\t\t\tprint(\"MoveTo: reach to position\");\n\t\t\tbreak;\n\t\t}*/\n\t\t\n\t\t//rotate again for safety: if he finds obstacles we need this\n\t\ttargetRotation = Quaternion.LookRotation(targetPos - transform.position);\n\t\ttargetRotation.x = transform.rotation.x;\n\t\ttargetRotation.z = transform.rotation.z;\n\t\ttransform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, step); \n\t\t\n\t\t//move\n\t\tdirection = transform.TransformDirection(Vector3.forward * speed); //in m/s, no need to use deltaTime\n\t\tcharacterController.SimpleMove(direction);\n\t\t\n\t\t//check if enough close\n\t\tdistance = Vector3.Distance(transform.position, targetPos); //(transform.position - targetPos).magnitude\n\t\tif ((distance <= step) || (distance <= reachDistance))\n\t\t\tbreak; //we have reached, so finish*/\n\t\t\t\t\t\t\n\t\tif ( ((maxTime > 0) && (time >= maxTime)) || (time >= MAX_TIME))\n\t\t\tbreak; //end of while\n\t\t\t\n\t\tyield;\n\t\t// We are not actually moving forward. This probably means we ran into a wall or something. Stop moving\n\t\t//if (characterController.velocity.magnitude < stopSpeed) break;\n\t}\n\t\n\ttransform.position = targetPos; //IMove: in case of no reach before, set the target position right now\n\tyield EndMoving();\n}", "function make_move() {\n\n // get state of board this turn\n var board = get_board(),\n\n // get my position\n myX = get_my_x(),\n myY = get_my_y(),\n\n // get opponents position\n hisX = get_opponent_x(),\n hisY = get_opponent_y();\n\n get_current_counts();\n\n // if we found an item and it isn't dead\n if (board[myX][myY] > 0 && !deadFruits[board[myX][myY]]) {\n return TAKE;\n }\n\n var rand = Math.random() * 10;\n\n if (rand < 1) return NORTH;\n if (rand < 2) return SOUTH;\n if (rand < 3) return EAST;\n if (rand < 4) return WEST;\n\n return move_toward(hisX, hisY);\n}", "function move(){\n\tif(left){\n\t\tif(player1.x >= 450){\n\t\t\tdiff -= speed;\n\t\t}else{\n\t\t\tplayer1.x += speed;\n\t\t}\n\t\tlastKey = \"left\";\n\t}\t\n\tif(right){\n\t\tif(player1.x <= 10){\n\t\t\tdiff += speed;\n\t\t}else{\n\t\t\tplayer1.x -= speed;\n\t\t}\n\t\tlastKey = \"right\";\n\t}\n}", "function downPropogate(){\n newPosition = ghostPosition + options[3]\n newGhostDirection = directions[3]\n if (!canMove()) {\n let randomIndex = Math.floor(Math.random()*2)+1\n newPosition = ghostPosition + options[randomIndex]\n newGhostDirection = directions[randomIndex]\n if (!canMove()){\n randomIndex = (randomIndex===1) ? 2:1\n newPosition = ghostPosition + options[randomIndex]\n newGhostDirection = directions[randomIndex]\n if (!canMove()){\n newPosition = ghostPosition + options[0]\n newGhostDirection = directions[0]\n }\n }\n }\n }", "move() {\n\n this.reset();\n\n const x = Math.floor(Math.random() * SnakeGame.NUM_COLS);\n const y = Math.floor(Math.random() * SnakeGame.NUM_ROWS);\n this.position = { x, y };\n\n this.cell = this.game.boardCells[y][x];\n\n if(this.cell.classList.contains('snake')) {\n move();\n }\n\n this.cell.classList.add('food');\n\n }", "function speed() {\n\tif (count < 5) {\n\t\treturn 700;\n\t} else if (count < 13) {\n\t\treturn 650;\n\t} else {\n\t\treturn 600;\n\t}\n}", "function startAnimation(){ // Codes nang pagpagalaw nang box\n\n\n\n\tvar decideMove = Math.floor(Math.random() * 3) +1; // mag generate nang number between 1 - 3;\n\n\t// \tvar snd1 = new Howl({\n\t// \t\tsrc:['../assets/sounds/switching-box.mp3'],\n\t// \t\tvolume:0.5,\n\t// });\n\t\t\n\t// \tsnd1.play();\n\t\n\tif (decideMove == 1) { // and number na generated is = 1\n\n\n\n\t\t$(positionA).animate({\n\t\t\t'left' : b2pos,\n\t\t},200); // change position nang left box to center box\n\n\t\t$(positionB).animate({\n\t\t\t'left' : b1pos,\n\t\t},200); // change position nang center box to left box\n\n\t\tvar pos1 = positionA; // mag set nang variable para sa new position\n\t\tvar pos2 = positionB; // mag set nang variable para sa new position\n\n\t\tpositionA = pos2; // pag palitin yung position ni #box-object-1 at #box-object-2\n\t\tpositionB = pos1; // pag palitin yung position ni #box-object-2 at #box-object-1\n\n\t\t// !NOTE need i change ang result so may track kung saan yung box na may laman\n\n\n\n\t}else if (decideMove == 2) { // and number na generated is = 2\n\n\t\t$(positionB).animate({\n\t\t\t'left' : b3pos,\n\t\t},200);\n\t\t$(positionC).animate({\n\t\t\t'left' : b2pos,\n\t\t},200);\n\n\t\tvar pos1 = positionB;\n\t\tvar pos2 = positionC;\n\n\t\tpositionB = pos2;\n\t\tpositionC = pos1;\n\n\n\n\n\t}else if (decideMove == 3) { // and number na generated is = 3\n\t\t$(positionA).animate({\n\t\t\t'left' : b3pos,\n\t\t},200);\n\t\t$(positionC).animate({\n\t\t\t'left' : b1pos,\n\t\t},200);\n\n\t\tvar pos1 = positionA;\n\t\tvar pos2 = positionC;\n\n\t\tpositionA = pos2;\n\t\tpositionC = pos1;\n\n\t}\n\n\tsetTimeout(function(){ // Kada 0.3 seconds \n\t\t\n\t\tif (runtimes < 20 ) { // compare yung value ni runtimes kung mas maliit pa sya kay 20\n\t\t\truntimes++; // pag nag true plus 1 kay runtimes\n\t\t\t\n\t\t\treturn startAnimation(); // run nya ulit yung startAnimation\n\t\t\n\t\t} else { // if runtimes is = 20\n\t\t\t\n\n \n showResult(); // para lumabas ang result\n\t\tsetTimeout(function(){\n\t\tresetgame(); // resetNa yung game back to normal layour\n\t\t},11000)\n\t\t}\n\t},300);\n\n}" ]
[ "0.69563997", "0.69024277", "0.68271327", "0.67059875", "0.6642084", "0.6587403", "0.6583635", "0.6583635", "0.65718764", "0.6566902", "0.65660465", "0.6489874", "0.6487074", "0.6462558", "0.6410705", "0.6395876", "0.6361665", "0.6357746", "0.6345826", "0.6327667", "0.6319998", "0.6318124", "0.63051015", "0.6266332", "0.6260547", "0.62539464", "0.6253932", "0.6231685", "0.6226216", "0.6216974", "0.6213502", "0.61933804", "0.61922383", "0.6184078", "0.61785245", "0.61755836", "0.616053", "0.6147233", "0.61444074", "0.61344004", "0.6131562", "0.61286443", "0.6128624", "0.61206156", "0.61137736", "0.6110718", "0.61003995", "0.6085078", "0.60771555", "0.60767215", "0.6075705", "0.60711086", "0.606173", "0.60523385", "0.6050787", "0.6048614", "0.6042779", "0.6028957", "0.60259944", "0.6019581", "0.6017098", "0.6016123", "0.6013501", "0.60064155", "0.6000016", "0.5991611", "0.5991106", "0.5987838", "0.59864897", "0.5983955", "0.5981501", "0.59797347", "0.5969573", "0.5968368", "0.59667873", "0.5962268", "0.59606075", "0.5953492", "0.59526753", "0.5952453", "0.59453005", "0.5943006", "0.5938376", "0.5935994", "0.59346306", "0.5929012", "0.59251124", "0.592329", "0.59216917", "0.58991784", "0.58979577", "0.58943987", "0.5884307", "0.5881938", "0.5871818", "0.5862448", "0.5862273", "0.5861026", "0.5858111", "0.58576435" ]
0.6861847
2
copied the random function from
function index (max){ return Math.floor(Math.random() * max) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SeededRandom(){}", "_random() {\n return Math.rnd();\n }", "function rng () {\n return random()\n }", "function rand(){\n return Math.random()\n}", "function rng() {\n return random();\n }", "function rng() {\n return random();\n }", "function random() {\n\t\tseed = Math.sin(seed) * 10000;\n\t\treturn seed - Math.floor(seed);\n\t}", "function rand(){\n return Math.random()-0.5;\n }", "function r(){return Math.random().toString().slice(2,7)}", "function rng() {\n return random();\n }", "function rng() {\n return random();\n }", "function gen_random(){\r\n\treturn 0.3\r\n}", "function random () {\n\t\n\tseed = 312541332155 * (4365216455 + seed) % 7654754253243312;\n\t\n\treturn 0.0000001 * (seed % 10000000);\n\t\n}", "function random() {\n return Math.random();\n}", "function getRandom() {\n\treturn Math.random();\n}", "function random() {\n var x = Math.sin(seed++) * 10000;\n return x - Math.floor(x);\n}", "function rand() {\r\n if(!gnt--) {\r\n prng(); gnt = 255;\r\n }\r\n return r[gnt];\r\n }", "function getRandomNumber () {}", "function random() {\n\t\tr = (r + 0.1) % 1\n\t\treturn r\n\t}", "function getRandom() {\n return Math.random();\n}", "function getRandom() {\n return Math.random();\n}", "function getRandom() {\n return Math.random();\n}", "function random () {\n return MIN_FLOAT * baseRandInt();\n }", "function sample() {\n return Math.sqrt(-2 * Math.log(Math.random())) * Math.cos(2 * Math.PI * Math.random());\n}", "static random () {\n return getRandomNumberFromZeroTo(500);\n }", "function randomizer(){\n\treturn Math.floor(Math.random() * 256);\n}", "next_rand() {\n\t\tthis.jitter_pos *= 10;\n\t\tif (this.jitter_pos > 10000000000)\n\t\t\tthis.jitter_pos = 10;\n\t\treturn (this.jitter * this.jitter_pos) % 1;\n\t}", "function random() {\r\n return Math.round(Math.random() * 10);\r\n}", "next_rand() {\n this.jitter_pos *= 10;\n if (this.jitter_pos > 10000000000)\n this.jitter_pos = 10;\n return (this.jitter * this.jitter_pos) % 1;\n }", "function randomNumber() {\r\n return Math.random;\r\n}", "function rnd() \n{\n\t\t\n rnd.seed = (rnd.seed*9301+49297) % 233280;\n return rnd.seed/(233280.0);\n}", "function rng() {\n return random();\n } // updates generator with a new instance of a seeded pseudo random number generator", "function random()\n {\n m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;\n m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;\n var result = ((m_z << 16) + m_w) & mask;\n result /= 4294967296;\n return result + 0.5;\n }", "function seededRandom()\n{\n m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;\n m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;\n var result = ((m_z << 16) + m_w) & mask;\n result /= 4294967296;\n return result + 0.5;\n}", "function generateRandomSeed(){\n return Math.random() * 0.73 + 0.27;\n}", "function randomNumber(){\n return Math.random\n}", "function randomNumber(){\r\n return Math.random();\r\n}", "function random() { // different sequence to Math.random()\n var T16 = 0x10000, T32 = T16*T16,\n cons = 0x0808, tant = 0x8405, // cons*T16 + tant = 134775813\n X = RandSeed*cons % T16 * T16 + RandSeed*tant + 1; // Exact 32=bit arithmetic\n return (RandSeed = X % T32) / T32;\n }", "function random() {\n randomNum = Math.random();\n}", "function randomize (){\n\tvar random = Math.floor(Math.random()*4);\n\treturn ligth(random);\n}", "doubleRandom() {\n return this.random() * 2\n }", "function random() {\n rndCnt++; // console.log(rndCnt);\n\n return rndFunc();\n }", "function random() {\n\treturn ((Math.random()*99)+1).toFixed();\n}", "function des()\n {\n\treturn (0|(Math.random()*12)+1);\n }", "function random(){\n\t return random.get();\n\t }", "function random(){\n\t return random.get();\n\t }", "function crndf() {\n return (Math.random()-0.5)*2;\n}", "function randomNotReally() {\n var x = Math.sin(seed++);\n return x - Math.floor(x);\n}", "function srandom() {\n randomSeed = (randomSeed * 9301 + 49297) % 233280;\n return randomSeed / 233280;\n}", "random(): number {\n let u: number = (prng.random(): any);\n return this._random(u);\n }", "function randStart() {\n return Math.random() - .5;\n}", "function locRnd() {\n return (Math.random() - 0.5) / 50;\n}", "function rand() {\n return Math.round(Math.random() * 20) - 10;\n}", "function rand() {\n return Math.round(Math.random() * 20) - 10;\n}", "function r(r){return (\"0\"+Math.floor(Math.random()*r).toString(16)).substr(-2)}", "function generaRandom(){\n return Math.floor(Math.random() * 5 + 1);\n}", "function getRandom(){\r\n\treturn Math.floor(Math.random() * 10);\r\n}", "selectRand() {\n\t}", "function getRandom(min,max){return Math.floor(Math.random()*(max+1-min))+min;}////", "function rng(){\n return Math.floor(Math.random() * 3);\n}", "rando() {\n randomNum = Math.floor(Math.random() * 20);\n }", "function random() {\n if(Math.random() < s_random / 100)\n return Math.random();\n else\n return 1;\n}", "function inning(){\n \n //DEBUGGING\n //console.log( Math.round(Math.random() * 2 ) );\n \n return Math.round(Math.random() * 2);\n }", "function identity(random) {\n return random\n}", "function random(a, b) {\n const alpha = Math.random();\n return a * (1.0 - alpha) + b * alpha;\n }", "function rnd(min=0,max=1){return Math.random()*(max-min)+min;}", "function rando() {\n return Math.floor(Math.random() * (people.length));\n }", "function rand(){\n\t\treturn(\n\t\t\tMath.floor(Math.random() * 4));\n\t}", "function RandFloat() {\n\treturn Math.random();\n}", "function random_generate() {\r\n let ran_num = Math.floor(Math.random() * sq.length);\r\n if (sq.ran_num % 2)\r\n }", "function replaceMathRandom() {\n Math.random = seededRandom(6);\n }", "function random() {\n return Math.round(Math.random() * 20);\n}", "random() {\n return Math.floor( Math.random() * 100 )\n }", "function randomGenerator() {\r\n var random = Math.floor(6 * Math.random()) + 1;\r\n return random;\r\n}", "function random() {\n return (Math.floor(Math.random() * 3));\n }", "function randomizer() {\n target = Math.floor(Math.random() * 100) + 19;\n gem1rando = Math.floor(Math.random() * 13) + 2;\n gem2rando = Math.floor(Math.random() * 13) + 2;\n gem3rando = Math.floor(Math.random() * 13) + 2;\n gem4rando = Math.floor(Math.random() * 13) + 2;\n }", "random() {\n return (Math.random() >= this.zeroToOneRatio ? 1 : 0);\n }", "function generateTarget(){\n return Math.floor(Math.random()*10)\n \n}", "static randFloat () {\n return Math.random();\n }", "function random(){\n\treturn Math.floor((Math.random() * 255) + 1);\n}", "function generateRandomNumber(){\n return Math.random();\n}", "function getRand() {\n return Math.floor(Math.random() * (52));\n}", "function randomOrder(){\n\t\treturn ( Math.round( Math.random()) -0.5 ); \t\n\t}", "function genRand () {\n var random = Math.ceil(Math.random()*52)\n return random\n}", "function getRandomValue() {\n return (Math.random() * (0.9 - 0.2) + 0.2)\n}", "random() {\n this.m_z = (36969 * (this.m_z & 65535) + (this.m_z >> 16)) & this.mask;\n this.m_w = (18000 * (this.m_w & 65535) + (this.m_w >> 16)) & this.mask;\n var result = ((this.m_z << 16) + (this.m_w & 65535)) >>> 0;\n result /= 4294967296;\n return result;\n }", "randomColor()\n {\n function r()\n {\n return Math.floor(Math.random() * 255)\n }\n return 'rgba(' + r() + ',' + r() + ',' + r() + ', 0.2)'\n }", "function random() {\n return Math.floor((Math.random() * 12) + 1);\n}", "function R(n) { return Math.floor(n*Math.random()); }", "function randomNumber() {\n return Math.random() * 10; \n}", "function randomOffset() {\r\n\r\n\t\treturn ( Math.random() - 0.5 ) * 2 * 1e-6;\r\n\r\n\t}", "function randomizer() {\n return Math.floor((Math.randon() * 3) + 1)\n}", "function randomizer() {\n return Math.floor((Math.randon() * 3) + 1)\n}", "function i(){return Math.random().toString().slice(2,7)}", "function random(){\n return random.get();\n }", "function random(){\n return random.get();\n }", "function RandomPrimitive() {}", "function randomNumber(){\n return (Math.round(1 * Math.random()) + 1);\n }", "function randomColor () {\nreturn Math.floor (Math.random() * 256) ;\n}", "function random() {\n return Math.floor((Math.random() * 1000000)+1);\n}", "function generateTarget(){\n\treturn Math.floor(Math.random()*10);\n}" ]
[ "0.82018715", "0.80747074", "0.7944747", "0.79162353", "0.79158795", "0.79158795", "0.7891814", "0.78527", "0.78275573", "0.7821998", "0.7821998", "0.7784265", "0.77749586", "0.7752856", "0.7642491", "0.760407", "0.7581026", "0.75545657", "0.7548074", "0.75476843", "0.75476843", "0.75069517", "0.747096", "0.74589115", "0.7455657", "0.7444501", "0.74411696", "0.7438881", "0.74342483", "0.74082106", "0.7385698", "0.7352797", "0.734631", "0.7340396", "0.73344564", "0.7330499", "0.7320415", "0.7309656", "0.73060983", "0.73035616", "0.7301077", "0.72706914", "0.7264308", "0.7247596", "0.7246522", "0.7246522", "0.723937", "0.7239092", "0.7236035", "0.72351366", "0.72331077", "0.7231236", "0.72236097", "0.72236097", "0.7223182", "0.7216272", "0.719982", "0.7196122", "0.7192949", "0.7184126", "0.7183705", "0.7182953", "0.71826553", "0.7182169", "0.7173796", "0.7165506", "0.7161206", "0.71597636", "0.71554947", "0.7146243", "0.7139003", "0.70975536", "0.7088671", "0.7087453", "0.70694727", "0.7053126", "0.7042731", "0.70284814", "0.7025503", "0.70250016", "0.702379", "0.7019281", "0.7018502", "0.7015841", "0.70138997", "0.70113933", "0.7009677", "0.70051306", "0.7003633", "0.69918567", "0.6981928", "0.69769025", "0.69769025", "0.6970886", "0.69699836", "0.69699836", "0.69678843", "0.69651455", "0.69636863", "0.6959151", "0.6955986" ]
0.0
-1
Run logic in schema at dataModelChange
_checkSchemaLogic(changedData) { changedData = changedData || {}; const model = this.exo.dataBinding.model; if (model && model.logic) { if (typeof (model.logic) === "function") { this.applyJSLogic(model.logic, null, model, changedData) } else if (model.logic && model.logic.type === "JavaScript") { let script = this.assembleScript(model.logic) this.applyJSLogic(null, script, model, changedData) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleModelDataChanged(dataObj) {\n //console.log('handleModelDataChanged', dataObj.payload);\n }", "function blockCall(change, dataModelName, entityName, data) {\n if (change.hasError === 0) {\n checkForPreviousError(change, dataModelName, entityName, data);\n _.forEach(LocalDBManager.getStore(dataModelName, entityName).schema.columns, function (col) {\n if (col.targetEntity) {\n if (data[col.sourceFieldName]) {\n blockCall(change, dataModelName, col.targetEntity, data[col.sourceFieldName]);\n } else if (data[col.fieldName]) {\n checkForPreviousError(change, dataModelName, col.targetEntity, data, col.fieldName);\n }\n }\n });\n }\n }", "function handleUpdateModelData(dataObj) {\n //console.log('handleUpdateModelData', dataObj.payload);\n }", "__applyModelChanges() {\n this.buildLookupTable();\n this._applyDefaultSelection();\n }", "onDatabaseEvent(changeType, recordType, record, causedBy) {\n const dataTypesArray = causedBy === 'sync' ? this.props.dataTypesSynchronised\n : this.props.dataTypesLinked;\n if ((dataTypesArray && dataTypesArray.indexOf(recordType) >= 0) ||\n (recordType === this.props.finalisableDataType && record.isFinalised)) {\n this.props.refreshData();\n }\n }", "afterValidChange() { }", "blockCall(store, change, dataModelName, entityName, data) {\n if (change.hasError === 0) {\n this.checkForPreviousError(store, change, dataModelName, entityName, data);\n store.entitySchema.columns.forEach(col => {\n if (col.foreignRelations) {\n col.foreignRelations.some(foreignRelation => {\n if (data[foreignRelation.sourceFieldName]) {\n this.blockCall(store, change, dataModelName, foreignRelation.targetEntity, data[foreignRelation.sourceFieldName]);\n }\n else if (data[col.fieldName]) {\n this.checkForPreviousError(store, change, dataModelName, foreignRelation.targetEntity, data, col.fieldName);\n }\n return change.hasError === 1;\n });\n }\n });\n }\n }", "_runProcessChanges() {\n // Don't run this functionality if the element has disconnected.\n if (!this.isConnected) return;\n\n store.dispatch(ui.reportDirtyForm(this.formName, this.isDirty));\n this.dispatchEvent(new CustomEvent('change', {\n detail: {\n delta: this.delta,\n commentContent: this.getCommentContent(),\n },\n }));\n }", "fireChanged () {\n this.$emit ( 'input', this.model );\n }", "function inputChanged() {\n parseInput(this);\n getDataFromTable();\n }", "preCall(change) {\n if (change && change.service === 'DatabaseService') {\n const entityName = change.params.entityName;\n const dataModelName = change.params.dataModelName;\n switch (change.operation) {\n case 'insertTableData':\n case 'insertMultiPartTableData':\n case 'updateTableData':\n case 'updateMultiPartTableData':\n return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {\n this.blockCall(store, change, dataModelName, entityName, change.params.data);\n });\n case 'deleteTableData':\n return this.localDBManagementService.getStore(dataModelName, entityName).then(store => {\n this.blockCall(store, change, dataModelName, entityName, change.params);\n });\n }\n }\n }", "OnBatchModified() { this.Trigger(\"BatchModified\", new tp.DataTableEventArgs()); }", "function dataChanged(uiWidget) {\n getPipeline(uiWidget).trigger('dataChanged');\n }", "onChange() {\n this.validate();\n this.triggerContextUpdate();\n }", "onDataChange() {}", "onStoreUpdate({ changes, record }) {\n const { editorContext } = this;\n\n if (editorContext && editorContext.editor.isVisible) {\n if (record === editorContext.record && editorContext.editor.dataField in changes) {\n editorContext.editor.refreshEdit();\n }\n }\n }", "_schemaChanged() {\n //make sure the content is there first\n setTimeout(() => {\n let itemLabel = this.schema.items.itemLabel;\n if (this.schema && Array.isArray(this.schema.value)) {\n this.schema.value.forEach(val => {\n this.push(\"__headings\", val[itemLabel]);\n });\n }\n this.shadowRoot.querySelectorAll(\".item-fields\").forEach(item => {\n let index = item.getAttribute(\"data-index\"),\n propertyName = `${this.propertyPrefix}${this.propertyName}`,\n prefix = `${propertyName}.${index}`,\n //path = `${propertyName}.properties.${index}`,\n val = this.schema.value[index];\n //for each array item, request the fields frrom eco-json-schema-object\n this.dispatchEvent(\n new CustomEvent(\"build-fieldset\", {\n bubbles: false,\n cancelable: true,\n composed: true,\n detail: {\n container: item,\n path: propertyName,\n prefix: prefix,\n properties: this.schema.properties.map(prop => {\n let newprop = JSON.parse(JSON.stringify(prop));\n newprop.value = val[prop.name];\n return newprop;\n }),\n type: EcoJsonSchemaArray.tag,\n value: this.schema.value || []\n }\n })\n );\n });\n }, 0);\n }", "function valueChanged() {\n debug && console.log( \"ManageWorkOrderRepairDetails: value changed\" );\n JSONData.setUnsavedChanges( true, \"manageWorkOrderSave\" );\n }", "onMasterDataChanged({ action, changes }) {\n const me = this;\n\n if (action === 'update') {\n // if a field not defined in chainedFields is changed, ignore the change.\n // there is no need to refilter the store in such cases, the change will be available anyhow since data is\n // shared\n const refilter = me.chainedFields && me.chainedFields.some((field) => field in changes);\n\n if (!refilter) return;\n }\n\n me.fillFromMaster();\n }", "modelChanged(newValue, oldValue) {\n this.changes.model = newValue;\n requestUpdate(this);\n }", "function onChanged() {\n let g = getGlobal();\n\n //When the add-in creates the table, it will generate 4 events that we must ignore.\n //We only want to respond to the change events from the user.\n if (g.tableEventCount > 0) {\n g.tableEventCount--;\n return; //count down to throw away events caused by the table creation code\n }\n\n //check if dirty flag was set (flag avoids extra unnecessary ribbon operations)\n if (!g.isTableDirty) {\n g.isTableDirty = true;\n\n //Enable the Refresh and Submit buttons\n setSyncButtonEnabled(true);\n }\n}", "afterChange(toSet, wasSet, silent, fromRelationUpdate, skipAccessors) {\n this.stores.forEach(store => {\n store.onModelChange(this, toSet, wasSet, silent, fromRelationUpdate);\n });\n }", "elementUpdated() {\n this.model.trigger('el:change');\n }", "onRestore() {\n this._updateModels();\n }", "onRecordChanged() {\n var record = this.record;\n // Calls to get foreign key records\n var calls = [];\n // Clear inputs\n this.inputs.clear();\n if (record) {\n // Call form creating\n //TODO: onFormCreating should com from an interface or something\n if (record['onFormCreating']) {\n record['onFormCreating'](this);\n }\n // Extract metadata\n var metadata = record.getMetadata();\n // Scan metadata\n if (metadata && metadata.fields) {\n for (var i in metadata.fields) {\n var field = metadata.fields[i];\n if (latte._isString(this.category) && this.category.length == 0 && !field['category']) {\n }\n else if (latte._isString(this.category) && (field['category'] != this.category)) {\n // debugger;\n continue;\n }\n var input = latte.InputItem.fromIInput(field, i);\n var value = latte._undef(record[i]) ? null : record[i];\n // input.text = field.text ? field.text : i;\n // input.type = field.type ? field.type : 'string';\n // input.name = i;\n // input.readOnly = field['readonly'] === true || field['readOnly'] === true;\n // input.options = field['options'];\n input.tag = i;\n input.visible = field['visible'] !== false;\n input.separator = field['separator'] === true;\n if (latte._isString(field['visible'])) {\n if (field['visible'] === 'if-inserted') {\n input.visible = record.inserted();\n }\n else if (field['visible'] === 'if-not-inserted') {\n input.visible = !record.inserted();\n }\n }\n // Check for fieldString declaration when read-only\n if (input.readOnly && record[i + 'String']) {\n input.value = record[i + 'String'];\n }\n else {\n input.value = value; //value !== null ? value : field['defaultValue'];\n }\n if (field.type == 'record') {\n // Get record value item\n var d = input.valueItem;\n // Assign loader function\n d.loaderFunction = field.loaderFunction;\n // If not record as value, load it in call\n if (value && field['recordType'] && !(value instanceof latte.DataRecord)) {\n ((d, input) => {\n var params = {\n name: field['recordType'],\n id: value\n };\n var dummy = new latte[params.name]();\n if (latte._isString(dummy['_moduleName'])) {\n params['module'] = dummy['_moduleName'];\n }\n calls.push(new latte.RemoteCall('latte.data', 'DataLatteUa', 'recordSelect', params).withHandlers((r) => {\n //log(\"Arrived foreign key record:\")\n //log(r)\n if (r && r.recordId) {\n d.setRecordSilent(r);\n input.value = input.value;\n }\n }));\n })(d, input);\n }\n }\n this.inputs.add(input);\n }\n }\n //TODO: onFormCreated should come from an interface or something\n if (record['onFormCreated']) {\n record['onFormCreated'](this);\n }\n /**\n * Send calls if any\n */\n if (calls.length > 0) {\n latte.Message.sendCalls(calls);\n }\n }\n if (this._recordChanged) {\n this._recordChanged.raise();\n }\n }", "function updateWhenChangeType(e){\n\t$inputs = $(e).parents('table').find('input.dataInput');\n\t$.each($inputs,function(){\n\t\tcalculateInput($(this));\n\t});\n}", "static onUpdateData(col, fn) {\n db.collection(col).onSnapshot(snapshot => {\n snapshot.docChanges().forEach(change => {\n if (change.type === 'modified') fn();\n });\n });\n }", "validateBeforeUpdate (id, newData, prevData) { return true }", "handleChange() {\n this.forceUpdate();\n }", "on_update_data(data, meta) {\n time_error(`Widget ${this.name} (${this.typename}) does not implement on_update_data()`)\n }", "onStoreUpdate({\n changes,\n record\n }) {\n const {\n editorContext\n } = this;\n\n if (editorContext && editorContext.editor.isVisible) {\n if (record === editorContext.record && editorContext.editor.dataField in changes) {\n editorContext.editor.refreshEdit();\n }\n }\n }", "attributeChangedCallback(attrName, oldVal, newVal) {\n let isDirty = false;\n if (!this.connected) {\n return;\n }\n if (attrName.toLowerCase() == 'modulename' && newVal && newVal != '') {\n this.moduleName = newVal;\n if (this.moduleName) {\n isDirty = true;\n }\n }\n if (this && attrName.toLowerCase() == 'objectname' && newVal && newVal != '') {\n this.objectname = newVal;\n if (this.objectname) {\n isDirty = true;\n }\n }\n if (this && attrName.toLowerCase() == 'objectwhere' && newVal && newVal != '') {\n this.objectwhere = newVal;\n if (this.objectwhere) {\n isDirty = true;\n }\n }\n if (this.connected === true && (isDirty === true)) {\n this.refresh();\n }\n }", "_applyModelType(value, old) {\n if (old) {\n this.getStateManager().setState(\"modelId\", 0);\n }\n // if (value) {\n // this.getStateManager().setState(\"modelType\", value);\n // } else {\n // this.getStateManager().removeState(\"modelType\");\n // }\n }", "onChangeDelay_() {\n this.save();\n this.dispatchEvent(ColumnMappingEventType.MAPPINGS_CHANGE);\n }", "function dataWatchFn(newData, oldData) {\n if (newData !== oldData){\n if (!scope._config.disabled) {\n scope._config.refreshDataOnly ? scope.api.update() : scope.api.refresh(); // if wanted to refresh data only, use update method, otherwise use full refresh.\n }\n }\n }", "function dataWatchFn(newData, oldData) {\n if (newData !== oldData){\n if (!scope._config.disabled) {\n scope._config.refreshDataOnly ? scope.api.update() : scope.api.refresh(); // if wanted to refresh data only, use update method, otherwise use full refresh.\n }\n }\n }", "onGenericChange() {\n this.contentChanged.emit(void 0);\n }", "function onDocumentDataChanged() {\n //TODO now do this on editing all input fields\n let changes = documentHasUnsavedChanges();\n if (changes) {\n showUnsavedDocumentSpan();\n } else {\n hideUnsavedDocumentSpan();\n }\n}", "_beforeChange () {\n // nop\n }", "_beforeChange () {\n // nop\n }", "function dataWatchFn(newData, oldData) {\n\t if (newData !== oldData){\n\t if (!scope._config.disabled) {\n\t scope._config.refreshDataOnly ? scope.api.update() : scope.api.refresh(); // if wanted to refresh data only, use update method, otherwise use full refresh.\n\t }\n\t }\n\t }", "notifyDataChanged() {\n this.hasDataChangesProperty = true;\n this.dataChanged.raiseEvent();\n }", "function onViewModelChange(e) {\r\n\r\n\t}", "onChange(document) {\n if (fspath.basename(document.uri.fsPath) == \"property.json\") {\t\t\n this.refreshProperty.updateFolder(serve.opeParam.rootPath,serve.opeParam.workspacePath,document.uri.fsPath);\n this.refreshProperty.updatePrjInfo(serve.opeParam.rootPath,document.uri.fsPath);\n return;\n }\n if (!this.getHDLDocumentType(document)) {\n return;\n }\n else if (this.getHDLDocumentType(document) == 1 ) {\n this.HDLparam = this.parser.removeCurrentFileParam(document, this.HDLparam);\n this.parser.get_HDLfileparam(document, null, 0, null, this.HDLparam);\n this.parser.get_instModulePath(this.HDLparam);\n this.refresh();\n }\n }", "onInvalidation(changeInfo) {}", "$onChanges(change){}", "_onChangeType(dataType, timePeriod) {return this.componentDidUpdate();}", "function onViewModelChange(e) {\r\n\r\n }", "function DateFilterOnchange() {\n BindOrReloadPurchaseTable('Apply');\n}", "onAfterSaveEntity(data_obj) {\n\t\t//TODO: Override this as needed;\n\t}", "setData() {\r\n this.fireSlimGridEvent(\"onBeforeDataUpdate\", {});\r\n\r\n this.generateColumns();\r\n this.generateFilters();\r\n this.setOptions();\r\n\r\n this.dataView.beginUpdate();\r\n this.setDataViewData();\r\n this.dataView.endUpdate();\r\n\r\n this.fireSlimGridEvent(\"onDataViewUpdate\", {});\r\n this.fireSlimGridEvent(\"onAfterDataUpdate\", {});\r\n }", "reTriggerChanges() {\n for (const attr in this.attributes) {\n this.trigger(`change:${attr}`, this, this.get(attr), {});\n }\n this.trigger(\"change\", this, {});\n }", "onMasterDataChanged({\n action,\n changes\n }) {\n const me = this;\n\n if (action === 'update') {\n // if a field not defined in chainedFields is changed, ignore the change.\n // there is no need to refilter the store in such cases, the change will be available anyhow since data is\n // shared\n const refilter = me.chainedFields && me.chainedFields.some(field => field in changes);\n if (!refilter) return;\n }\n\n me.fillFromMaster();\n }", "function handler_designDocumentOnChange() {\n let designDoc = $(\"#couchdb_designDocument\").val();\n getCouchdbViews(designDoc, DOM_fillCouchdbViews);\n }", "async validateModels(initialModels, readOtherIndexers) {\n let models = await crawlModels(initialModels, readOtherIndexers);\n let schemaTypes = this.schemaLoader.ownTypes();\n let [schemaModels, dataModels] = partition(models, model => schemaTypes.includes(model.type));\n let schema = await this.schemaLoader.loadFrom(schemaModels);\n for (let model of dataModels) {\n await schema.validate(new PendingChange(null, model, () => {}), { session: INTERNAL_PRIVILEGED });\n }\n }", "function handleDataChange(event) {\n console.log(\"event.target value is \", event.target.id, event.target.value)\n const { error, value } = Schema.validate({ ...data, [event.target.id]: event.target.value, });\n console.log(\"value is\", value)\n if (error) {\n console.log(\"error is\", error)\n check = true\n } else {\n console.log(\"value is\", value)\n check = false;\n }\n setData({ ...data, [event.target.id]: event.target.value })\n console.log(\"data state is\", data)\n if (event.target.value == null) {\n console.log(\"yes\")\n }\n }", "function editModel(data) {\n /// start edit form data prepare\n /// end edit form data prepare\n dataSource.one('sync', function(e) {\n /// start edit form data save success\n /// end edit form data save success\n\n app.mobileApp.navigate('#:back');\n });\n\n dataSource.one('error', function() {\n dataSource.cancelChanges(itemData);\n });\n\n dataSource.sync();\n app.clearFormDomData('edit-item-view');\n }", "function optionChanged(id) {\n charting(id);\n meta(id);\n}// change(id)", "applyBackendResult(data) {\n this.setValues(data.new_values);\n\n const roChanges = Immutable.fromJS(data.ro_changes);\n roChanges.forEach((new_ro, id) => {\n this.setReadability(id, new_ro);\n });\n\n const mandChanges = Immutable.fromJS(data.mandatory_changes);\n mandChanges.forEach((new_mand, id) => {\n this.setFieldMandatory(id, new_mand === 1);\n });\n\n this.wizardProgress = Immutable.fromJS(data.wizard_progress);\n }", "$beforeUpdate(opt, queryContext) {\r\n // The existence of the column must be checked as the user could create the database schema in the 1.0 version\r\n if (this.updated_at) {\r\n this.updated_at = knex.fn.now();\r\n }\r\n }", "function onCurrentModelChange() {\n // Set the current model handle variable.\n currentModelHandle = currentModelSelect.value;\n \n // Change the property display values.\n onCurrentPropertyChange();\n}", "_updateInternalSchemas () {\n this.get('getSchemaTask').perform()\n .then(({model, view, plugins, validators, propagateValidation}) => {\n this.setProperties({\n propagateValidation,\n validationResult: {}\n })\n\n if (model && !_.isEqual(this.get('internalBunsenModel'), model)) {\n this.set('internalBunsenModel', model)\n }\n\n if (view && !_.isEqual(this.get('internalBunsenView'), view)) {\n this.set('internalBunsenView', view)\n }\n\n this.setProperties({\n internalValidators: validators,\n internalPlugins: plugins\n })\n })\n .catch((err) => {\n this.set('localError', err.message)\n })\n }", "changedInput() {\n\n\t\tlet {isValid, error} = this.state.wasInvalid ? this.validate() : this.state;\n\t\tlet onChange = this.props.onChange;\n\t\tif (onChange) {\n\t\t\tonChange(this.getValue(), isValid, error);\n\t\t}\n\t\tif (this.context.validationSchema) {\n\t\t\tlet value = this.getValue();\n\t\t\tif (this.state.isMultiSelect && value === '') {\n\t\t\t\tvalue = [];\n\t\t\t}\n\t\t\tif (this.shouldTypeBeNumberBySchemeDefinition(this.props.pointer)) {\n\t\t\t\tvalue = Number(value);\n\t\t\t}\n\t\t\tthis.context.validationParent.onValueChanged(this.props.pointer, value, isValid, error);\n\t\t}\n\t}", "onTaskDataGenerated() {}", "function changed(change) {\n if (change.changeType === \"property\" && change.property === property) {\n fn(change);\n }\n }", "function modelReady() \n{\n print(\"Model REady\");\n loadData(); \n}", "function updateSchema() {\n var properties = {};\n var required = [];\n $scope.defaultValues = {};\n var schema = {\n type: \"object\",\n required: required,\n properties: properties\n };\n var inputClass = \"span12\";\n var labelClass = \"control-label\";\n //var inputClassArray = \"span11\";\n var inputClassArray = \"\";\n var labelClassArray = labelClass;\n var metaType = $scope.metaType;\n if (metaType) {\n var pidMetadata = Osgi.configuration.pidMetadata;\n var pid = metaType.id;\n schema[\"id\"] = pid;\n schema[\"name\"] = Core.pathGet(pidMetadata, [pid, \"name\"]) || metaType.name;\n schema[\"description\"] = Core.pathGet(pidMetadata, [pid, \"description\"]) || metaType.description;\n var disableHumanizeLabel = Core.pathGet(pidMetadata, [pid, \"schemaExtensions\", \"disableHumanizeLabel\"]);\n angular.forEach(metaType.attributes, function (attribute) {\n var id = attribute.id;\n if (isValidProperty(id)) {\n var key = encodeKey(id, pid);\n var typeName = asJsonSchemaType(attribute.typeName, attribute.id);\n var attributeProperties = {\n title: attribute.name,\n tooltip: attribute.description,\n 'input-attributes': {\n class: inputClass\n },\n 'label-attributes': {\n class: labelClass\n },\n type: typeName\n };\n if (disableHumanizeLabel) {\n attributeProperties.title = id;\n }\n if (attribute.typeName === \"char\") {\n attributeProperties[\"maxLength\"] = 1;\n attributeProperties[\"minLength\"] = 1;\n }\n var cardinality = attribute.cardinality;\n if (cardinality) {\n // lets clear the span on arrays to fix layout issues\n attributeProperties['input-attributes']['class'] = null;\n attributeProperties.type = \"array\";\n attributeProperties[\"items\"] = {\n 'input-attributes': {\n class: inputClassArray\n },\n 'label-attributes': {\n class: labelClassArray\n },\n \"type\": typeName\n };\n }\n if (attribute.required) {\n required.push(id);\n }\n var defaultValue = attribute.defaultValue;\n if (defaultValue) {\n if (angular.isArray(defaultValue) && defaultValue.length === 1) {\n defaultValue = defaultValue[0];\n }\n //attributeProperties[\"default\"] = defaultValue;\n // TODO convert to boolean / number?\n $scope.defaultValues[key] = defaultValue;\n }\n var optionLabels = attribute.optionLabels;\n var optionValues = attribute.optionValues;\n if (optionLabels && optionLabels.length && optionValues && optionValues.length) {\n var enumObject = {};\n for (var i = 0; i < optionLabels.length; i++) {\n var label = optionLabels[i];\n var value = optionValues[i];\n enumObject[value] = label;\n }\n $scope.selectValues[key] = enumObject;\n Core.pathSet(attributeProperties, ['input-element'], \"select\");\n Core.pathSet(attributeProperties, ['input-attributes', \"ng-options\"], \"key as value for (key, value) in selectValues.\" + key);\n }\n properties[key] = attributeProperties;\n }\n });\n // now lets override anything from the custom metadata\n var schemaExtensions = Core.pathGet(Osgi.configuration.pidMetadata, [pid, \"schemaExtensions\"]);\n if (schemaExtensions) {\n // now lets copy over the schema extensions\n overlayProperties(schema, schemaExtensions);\n }\n }\n // now add all the missing properties...\n var entity = {};\n angular.forEach($scope.configValues, function (value, rawKey) {\n if (isValidProperty(rawKey)) {\n var key = encodeKey(rawKey, pid);\n var attrValue = value;\n var attrType = \"string\";\n if (angular.isObject(value)) {\n attrValue = value.Value;\n attrType = asJsonSchemaType(value.Type, rawKey);\n }\n var property = properties[key];\n if (!property) {\n property = {\n 'input-attributes': {\n class: inputClass\n },\n 'label-attributes': {\n class: labelClass\n },\n type: attrType\n };\n properties[key] = property;\n if (rawKey == 'org.osgi.service.http.port') {\n properties[key]['input-attributes']['disabled'] = 'disabled';\n properties[key]['input-attributes']['title'] = 'Changing port of OSGi http service is not possible from Hawtio';\n }\n }\n else {\n var propertyType = property[\"type\"];\n if (\"array\" === propertyType) {\n if (!angular.isArray(attrValue)) {\n attrValue = attrValue ? attrValue.split(\",\") : [];\n }\n }\n }\n if (disableHumanizeLabel) {\n property.title = rawKey;\n }\n //comply with Forms.safeIdentifier in 'forms/js/formHelpers.ts'\n key = key.replace(/-/g, \"_\");\n entity[key] = attrValue;\n }\n });\n // add default values for missing values\n angular.forEach($scope.defaultValues, function (value, key) {\n var current = entity[key];\n if (!angular.isDefined(current)) {\n //log.info(\"updating entity \" + key + \" with default: \" + value + \" as was: \" + current);\n entity[key] = value;\n }\n });\n //log.info(\"default values: \" + angular.toJson($scope.defaultValues));\n $scope.entity = entity;\n $scope.schema = schema;\n $scope.fullSchema = schema;\n }", "onResourceUpdate({\n record,\n changes\n }) {\n const change = changes[this.field];\n\n if (change) {\n // Ignore \"normalization\" of id -> instance, wont affect our appearance\n if (typeof change.oldValue === 'string' && change.value.id === change.oldValue) {\n return;\n }\n\n this.refreshCell(record);\n }\n }", "componentDidUpdate() { //triggered if data changed in the database\n this.setData()\n }", "function DataChanged(dataObj) {\n OnLoad(dataObj);\n}", "function optionChanged(changed){\n charts(changed);\n metadata(changed);\n}", "_setOnChanges(){\n\t\tthis.inputs.forEach(i => i.addEventListener('change', this._onChange.bind(this)));\t\n\t}", "function rKDownlinkExecuteCustomValidationConstraints(objectType, currentEntityId) {\n}", "function periodicJSONFeedUpdateCompleteFn( dataType ) {\n if ( dataType && dataType == \"workOrders\" ) {\n ManageWorkOrder.loadWorkOrder();\n debug && console.log( \"ManageWorkOrderRepairDetails.periodicJSONFeedUpdateCompleteFn: Local changes retained after JSON feed update\" );\n }\n }", "change(/*event*/) {\n this._super(...arguments);\n this._parse();\n }", "function transformModel(options,data){var prop=options.model&&options.model.prop||'value';var event=options.model&&options.model.event||'input';(data.props||(data.props={}))[prop]=data.model.value;var on=data.on||(data.on={});if(isDef(on[event])){on[event]=[data.model.callback].concat(on[event]);}else{on[event]=data.model.callback;}}", "function transformModel(options,data){var prop=options.model&&options.model.prop||'value';var event=options.model&&options.model.event||'input';(data.props||(data.props={}))[prop]=data.model.value;var on=data.on||(data.on={});if(isDef(on[event])){on[event]=[data.model.callback].concat(on[event]);}else{on[event]=data.model.callback;}}", "_dataImportHandler() {\n this.refresh();\n }", "refreshDuckSchema() {\n this.duckSchema = this.createDuckSchema();\n }", "onStoreDataChange(data) {\n const store = data.source;\n\n // Grouping mixin needs to process data which then makes sure UI is refeshed\n if (store.isGrouped && store.count > 0) return;\n\n this.overridden.onStoreDataChange(data);\n }", "attributeChangedCallback(attrName, oldVal, newVal) {\n let needInit = false;\n if (attrName.toLowerCase() == 'modulename' && newVal && newVal != '') {\n this.moduleName = newVal;\n needInit = true;\n }\n else if (attrName.toLowerCase() == 'objectname' && newVal && newVal != '') {\n this.objectName = newVal;\n needInit = true;\n }\n else if (attrName.toLowerCase() == 'objectwhere' && newVal && newVal != '') {\n this.objectWhere = newVal;\n needInit = true;\n }\n else if (attrName.toLowerCase() == 'value' && newVal && newVal != '') {\n this.value = newVal;\n if (this.connected) {\n this.setValue(newVal);\n }\n }\n if (this.connected && needInit) {\n this.init();\n }\n }", "onRowsChanged(dataset) {\n super.onRowsChanged(dataset);\n for (var i = 0; i < dataset.rows.count; i++) {\n var row = dataset.rows.item(i);\n var record = row.tag;\n this.applyValues(row, record);\n record.update(function () { latte.sprintf(\"Updated: \" + record.recordId); });\n }\n this.confirmRowsChanged();\n }", "onRecordChanged() {\n if (this._recordChanged) {\n this._recordChanged.raise();\n }\n this.onLoadChildren();\n }", "onRecordChanged() {\n if (this._recordChanged) {\n this._recordChanged.raise();\n }\n this.onLoadChildren();\n }", "function syncValidator(schema, data, _) {\n console.log('**** syncValidator got schema=', schema);\n console.log('**** syncValidator got data=', data);\n return true;\n}", "setData(data){\r\n this.model.setData(data);\r\n }", "_fieldUpdated(e) {\n // Ensure the VIN is valid, and update the year and make accordingly\n if(e.propertyName === VehicleFields.vin){\n const value = this.VIN.value;\n\n if (value === \"\"){\n this._vin.error = null;\n this.Make.value = \"\";\n this.Year.value = \"\";\n }\n else if (Vehicle._validateVIN(value)) {\n this._vin.error = null;\n this.Make.value = Vehicle._getMake(value);\n this.Year.value = Vehicle._getYear(value);\n }\n else {\n this._vin.error = \"Invalid VIN\";\n this.Make.value = \"INVALID\";\n this.Year.htmlObj.value = \"INVALID\";\n }\n }\n\n this.__sendPropChangeEvent(e.propertyName);\n }", "updateSchema(schema) {\n // to avoid cyclic reference error, use flatted string.\n const schemaFlatted = (0, _flatted.stringify)(schema);\n this.run((0, _http.POST)(this.ws_url + '/schema/', schemaFlatted, 'text/plain')).then(data => {\n console.log(\"collab server's schema updated\"); // [FS] IRAD-1040 2020-09-08\n\n this.schema = schema;\n this.start();\n }, err => {\n this.report.failure('error');\n });\n }", "onRecordChanged() {\n this.form.record = this.record;\n this.btnSave.enabled = false;\n if (this._recordChanged) {\n this._recordChanged.raise();\n }\n }", "handleStaticResDataChange(event)\n\t{\n\t\tif(!r3IsSafeTypedEntity(this.state.editingStaticRes, 'object')){\n\t\t\treturn;\n\t\t}\n\t\t// set data\n\t\tlet\tnewStaticRes\t= r3DeepClone(this.state.editingStaticRes);\n\t\tif('object' == newStaticRes.type){\n\t\t\tnewStaticRes.editingObjectData = event.target.value;\n\t\t}else{\n\t\t\tnewStaticRes.editingStringData = event.target.value;\n\t\t}\n\n\t\t// update state\n\t\tthis.setState({\n\t\t\teditingStaticRes:\tnewStaticRes,\n\t\t\tstaticResMessage:\tnull\n\t\t});\n\t}", "fillDb() {\n if (this.options.before) this.options.before();\n this._schemaRecursuveAdd('', this.schema);\n if (this.options.after) this.options.after();\n }", "function rsTypeChanged(){\n\t\n}", "function onDataBinding(e) {\n console.log(\"onDataBinding\");\n}", "function fieldChanged(type, name, linenum)\r\n{\r\n\t/* On field changed:\r\n\t - PURPOSE\r\n\t FIELDS USED:\r\n\t --Field Name--\t\t\t\t--ID--\r\n\t */\r\n\t// LOCAL VARIABLES\r\n\t\r\n\t\r\n\t// FIELD CHANGED CODE BODY\r\n\r\n}", "function handleOnChange(obj) {\r\n var selectedDataGrid = getXMLDataForGridName(getCurrentlySelectedGridId());\r\n if (obj.name == 'policyFormCode') {\r\n if (getObjectValue(\"policyFormCode\") != 'OCCURRENCE') {\r\n selectedDataGrid.recordset(\"CISRETRODATEEDITABLE\").value = \"Y\";\r\n selectedDataGrid.recordset(\"CUNDRETROACTIVEDATE\").value = policyHeader.termEffectiveFromDate;\r\n }\r\n else {\r\n selectedDataGrid.recordset(\"CISRETRODATEEDITABLE\").value = \"N\";\r\n selectedDataGrid.recordset(\"CUNDRETROACTIVEDATE\").value = \"\";\r\n }\r\n var functionExists = eval(\"window.pageEntitlements\");\r\n if (functionExists) {\r\n pageEntitlements(true, getCurrentlySelectedGridId());\r\n }\r\n }\r\n if (obj.name == \"effectiveToDate\") {\r\n var effectiveToDate = obj.value;\r\n var policyExpirationDate = policyHeader.policyExpirationDate;\r\n resetRenewIndicator(effectiveToDate, policyExpirationDate, \"renewB\", \"underlyingCoverageListGrid\");\r\n }\r\n return true;\r\n}", "onStoreChanged({ action, changes }) {\n let shouldUpdate = true;\n\n if (action === 'update') {\n // only update summary when a field that affects summary is changed\n // TODO: this should maybe be removed, another column might depend on the value for its summary?\n shouldUpdate = Object.keys(changes).some((field) => {\n const colField = this.grid.columns.get(field);\n // check existence, since a field not used in a column might have changed\n return Boolean(colField) && (Boolean(colField.sum) || Boolean(colField.summaries));\n });\n }\n\n if (shouldUpdate) {\n this.updateSummaries();\n }\n }", "constructor() {\n super();\n this._cachedData = {};\n this.EVENT_DATA_CHANGED = 'aims.model.data.changed';\n }", "initializeNewModel() {\n\n }", "viewModelChanged(newValue, oldValue) {\n this.changes.viewModel = newValue;\n requestUpdate(this);\n }", "createSchema() {\n this.schema = this.extensionManager.schema;\n }" ]
[ "0.6944443", "0.623674", "0.61815137", "0.6136637", "0.60225576", "0.59741586", "0.59573615", "0.57878226", "0.57763386", "0.5747086", "0.57308257", "0.5724112", "0.572185", "0.56812304", "0.56565136", "0.55925477", "0.558366", "0.5545544", "0.5545084", "0.5531364", "0.5515506", "0.54882646", "0.5483407", "0.54736537", "0.54714715", "0.5468218", "0.54531026", "0.54454064", "0.5430955", "0.5420578", "0.5404172", "0.5402981", "0.540058", "0.5394392", "0.537043", "0.537043", "0.5367973", "0.53587866", "0.53558975", "0.53558975", "0.5354746", "0.53438145", "0.5333609", "0.5325503", "0.53216857", "0.5314715", "0.531078", "0.5297923", "0.5297262", "0.52833617", "0.52793497", "0.5263443", "0.52610815", "0.5239262", "0.5227754", "0.5225509", "0.5224758", "0.52189875", "0.5218071", "0.5213507", "0.52134764", "0.52047986", "0.51990026", "0.5195898", "0.519215", "0.51825833", "0.51797116", "0.5175971", "0.5172349", "0.516923", "0.5162412", "0.51607525", "0.51470083", "0.5139884", "0.5134749", "0.5130704", "0.5130704", "0.5124408", "0.51233524", "0.51143515", "0.51123804", "0.51076615", "0.51025236", "0.51025236", "0.50957847", "0.50955296", "0.5094723", "0.5090434", "0.5085897", "0.5084381", "0.50806373", "0.5079568", "0.506904", "0.50653124", "0.5062033", "0.506116", "0.50559664", "0.5050062", "0.50497437", "0.5043043" ]
0.6816064
1
seems like grainrpc does not correctly send undefined over the wire for defaults args we can just use null instead. this may bite me in the future. maybe this is my fault due to json serialization
launchSmodemOptions(wd, options) { const name = './modem_main'; if( options === null || typeof options === 'undefined') { throw(new Error('launchSmodemOptions() requires options argument')); } // pick a unique input using a hash let hashInput = " " + Date.now() + " " + Math.random(); let suffix = crypto.createHash('sha1').update(hashInput).digest('hex').slice(0,8); let tmppath = "/tmp/init_" + suffix + ".json"; fs.writeFileSync(tmppath, JSON.stringify(options)); return this.launchSmodemConfigPath(wd, tmppath); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepArgumentsObject(args,defaultArgs){\r\n var argList = [].slice.call(args);\r\n var outArgs = {};\r\n // print('Default args:',defaultArgs);\r\n //See if first argument is an ee object instead of a vanilla js object\r\n var firstArgumentIsEEObj = false;\r\n var argsAreObject = false;\r\n try{\r\n var t=argList[0].serialize();\r\n firstArgumentIsEEObj = true;\r\n }catch(err){\r\n \r\n }\r\n \r\n if(typeof(argList[0]) === 'object' && argList.length === 1 && !firstArgumentIsEEObj){\r\n argsAreObject = true;\r\n outArgs = argList[0];\r\n }\r\n //Iterate through each expected argument to create the obj with all parameters\r\n Object.keys(defaultArgs).forEach(function(key, i) {\r\n var value;\r\n if(argsAreObject){\r\n value = argList[0][key];\r\n }else{value = argList[i]}\r\n \r\n //Fill in default value if non is provided or it is null\r\n if(value === undefined || value === null){\r\n value = defaultArgs[key];\r\n }\r\n // console.log(value)\r\n outArgs[key] = value;\r\n });\r\n \r\n // //Merge any remaining variables that were provided\r\n // if(argsAreObject){\r\n \r\n // }\r\n // print('Out args:',outArgs);\r\n return outArgs;\r\n}", "stripDefaultParams(params, defaults) {\n if(defaults) {\n let stripped =_.pick(params, (value, key) => {\n // setting the default value of a term to null in a state definition is a very explicit way to ensure it will NEVER generate a search tag, even with a non-default value\n return defaults[key] !== value && key !== 'order_by' && key !== 'page' && key !== 'page_size' && defaults[key] !== null;\n });\n let strippedCopy = _.cloneDeep(stripped);\n if(_.keys(_.pick(defaults, _.keys(strippedCopy))).length > 0){\n for (var key in strippedCopy) {\n if (strippedCopy.hasOwnProperty(key)) {\n let value = strippedCopy[key];\n if(_.isArray(value)){\n let index = _.indexOf(value, defaults[key]);\n value = value.splice(index, 1)[0];\n }\n }\n }\n stripped = strippedCopy;\n }\n return _(strippedCopy).map(this.decodeParam).flatten().value();\n }\n else {\n return _(params).map(this.decodeParam).flatten().value();\n }\n }", "function _defaultValues(payload) {\n if (!payload.host) { payload.host = hostname; }\n if (!payload.time) { payload.time = new Date().getTime()/1000; }\n if (typeof payload.metric !== \"undefined\" && payload.metric !== null) {\n payload.metric_f = payload.metric;\n delete payload.metric;\n }\n return payload;\n}", "defaultArgs(options) {\r\n return this.pptr.defaultArgs(options);\r\n }", "getDefault() {\n return JSON.parse(JSON.stringify(this.default))\n }", "function fillIn(obj, var_defaults){\n\t forEach(slice(arguments, 1), function(base){\n\t forOwn(base, function(val, key){\n\t if (obj[key] == null) {\n\t obj[key] = val;\n\t }\n\t });\n\t });\n\t return obj;\n\t }", "function argumentOrDefault(key){var args=customizations; return args[key]===undefined ? _defaultParams2.default[key] : args[key];}", "function defaults(var_args){\n\t return find(toArray(arguments), nonVoid);\n\t }", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "default() {\n return {};\n }", "defaults () {\n }", "defaults(resource = {}) {\n return resource;\n }", "defaults() {\n return {\n address: String,\n ssl_grade: String,\n country: String,\n owner: String,\n }\n }", "created() {\n for (const arg of this.body.args) {\n arg['value'] = \"\"; // args: [{\"name\": '', \"type\": '', \"value\": ''}]\n this.args.push(arg);\n }\n }", "_defaultParams(name, params) {\n const handlers = this.recognizer.handlersFor(name);\n let paramNames = [];\n for (let i = 0, len = handlers.length; i < len; i++) {\n paramNames = paramNames.concat(handlers[i].names);\n }\n params = Object.assign(pick(this.store.state.params, paramNames), params);\n this._cleanParams(params);\n return params;\n }", "function foo( { a = 10, b = 20 } = {} ) {\n console.log( `[defaults for function arguments] a = ${a}, b = ${b}` );\n}", "beforeUpdate() {\n this.args.splice(0, this.args.length);\n for (const arg of this.body.args) {\n arg['value'] = \"\";\n this.args.push(arg);\n }\n }", "Null(options = {}) {\r\n return { ...options, kind: exports.NullKind, type: 'null' };\r\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "_setParamIfEmpty(param){\r\n\t\t\r\n\t\tif(param == null) param = {};\r\n\t\t\r\n\t\tif(param['ajax_url'] == null) param['ajax_url'] = 'dummy';\r\n\t\t\r\n\t\treturn param;\r\n\t}", "function defaultArgs( tweak )\r\n\t{\r\n\t\tvar defArgs = [];\r\n\t\tfor( var i = 0; i < tweak.args.length; i++ )\r\n\t\t\tdefArgs.push( tweak.args[i].value );\r\n\t\treturn defArgs;\r\n\t}", "function defaults(a, b, c) {\n\tif (a != null) {\n\t\treturn a;\n\t}\n\tif (b != null) {\n\t\treturn b;\n\t}\n\treturn c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function argumentOrDefault(key) {\n\t var args = customizations;\n\t return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n\t }", "static getDefaults() {\n return {};\n }", "Undefined(options = {}) {\r\n return { ...options, type: 'undefined', kind: exports.UndefinedKind };\r\n }", "function defaultParams(a, b, c = 0) {\n console.log(a, b, c);\n}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "*processParametersDefaultValues(parameters) {\n for (let param of parameters) {\n switch (param.type) {\n case utils_1.ParameterType.BOOLEAN:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"false\")\n };\n break;\n case utils_1.ParameterType.INTEGER:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"0\")\n };\n break;\n case utils_1.ParameterType.JSON:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"{}\")\n };\n break;\n case utils_1.ParameterType.LIST:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"[]\")\n };\n break;\n case utils_1.ParameterType.NUMBER:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"0\")\n };\n break;\n case utils_1.ParameterType.STRING:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : '\"\"')\n };\n break;\n case utils_1.ParameterType.VHOST:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : '\"\"')\n };\n break;\n }\n }\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "constructor(defaultOptions) {\n this.defaultOptions = defaultOptions;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "_setParamIfEmpty(param){\r\n\t\t\r\n\t\tif(param == null) param = {};\r\n\t\t\r\n\t\tif(param['ja_flg'] == null) param['ja_flg'] = 1; \r\n\t\tif(param['datetimepicker_f'] == null) param['datetimepicker_f'] = 0; \r\n\t\t\r\n\t\treturn param;\r\n\t}", "function _defaultParams ( user_name )\n\t{\n\t\treturn {\n\t\t\tname : user_name,\n\t\t\tpath : _defaultPath,\n\t\t\tfileTypes : _defaultFileTypes,\n\t\t\tlock : _DEFAULT.loop,\n\t\t\tvolume : _DEFAULT.volume,\n\t\t\tstart : _DEFAULT.start,\n\t\t\tend : _DEFAULT.end,\n\t\t\tloop : _DEFAULT.loop,\n\t\t\tautoplay : _DEFAULT.autoplay,\n\t\t\tonLoad : _DEFAULT.onLoad,\n\t\t\tonEnd : _DEFAULT.onEnd,\n\t\t\tdata : _DEFAULT.data\n\t\t};\n\t}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function argumentOrDefault(key) {\r\n var args = customizations;\r\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\r\n }", "getArgPropertiesWithoutName() {\n return {\n type: this.type,\n alias: this.alias,\n description: this.description,\n nargs: this.nargs,\n demand: this.demand,\n default: this.default,\n }\n }", "_defaults() {\n return {\n name: \"\",\n teams: []\n };\n }", "function _defaultParams ( name )\n\t{\n\t\treturn {\n\t\t\tname : name,\n\t\t\tpath : _defaultPath,\n\t\t\tfileTypes : _defaultFileTypes,\n\t\t\tlock : _DEFAULT.loop,\n\t\t\tvolume : _DEFAULT.volume,\n\t\t\tstart : _DEFAULT.start,\n\t\t\tend : _DEFAULT.end,\n\t\t\tloop : _DEFAULT.loop,\n\t\t\tautoplay : _DEFAULT.autoplay,\n\t\t\tonLoad : _DEFAULT.onLoad,\n\t\t\tonPlay : _DEFAULT.onPlay,\n\t\t\tonEnd : _DEFAULT.onEnd,\n\t\t\tdata : _DEFAULT.data\n\t\t};\n\t}", "function defaultValues (def, query) {\n def = def || {};\n query = query || {};\n\n // `apiVersion`\n if (def.apiVersion) {\n query.apiVersion = query.apiVersion || def.apiVersion;\n }\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}" ]
[ "0.65109086", "0.6413269", "0.6271986", "0.6107597", "0.59349865", "0.58801085", "0.57775956", "0.57756746", "0.5773383", "0.5773383", "0.5773383", "0.5748266", "0.57292587", "0.5718133", "0.5711709", "0.56869704", "0.5684806", "0.5644212", "0.5635559", "0.5628659", "0.562508", "0.562508", "0.562508", "0.562508", "0.5594901", "0.55916476", "0.5577842", "0.556005", "0.55560255", "0.55536896", "0.5535399", "0.5516426", "0.55151224", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.55145425", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.5507549", "0.55053186", "0.55053186", "0.55053186", "0.55030847", "0.54892254", "0.5479711", "0.54699653", "0.5460243", "0.54419833", "0.5434633", "0.5433019", "0.5433019", "0.5414062", "0.5414062", "0.5414062", "0.5414062", "0.5411525", "0.53798133", "0.5376706", "0.53764176", "0.5375184", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236", "0.53729236" ]
0.0
-1
seems like grainrpc does not correctly send undefined over the wire for defaults args we can just use null instead. this may bite me in the future. maybe this is my fault due to json serialization
launchSmodemConfigPath(wd, path1=null, path2=null) { const name = './modem_main'; console.log("launchSmodemConfigPath " + path1 + " " + path2); const defaults = { cwd: wd, env: process.env }; const args = []; if( path1 !== null) { args.push('--config'); args.push(path1); } if( path2 !== null) { args.push('--patch'); args.push(path2); } this.smodemHandle = spawn(name, args, defaults); // find.stdout.pipe(wc.stdin); this.smodemHandle.stdout.on('data', (data) => { let asStr = data.toString('ascii'); process.stdout.write(asStr); // without newline // console.log(`Number of files ${data}`); }); this.status = 'running'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepArgumentsObject(args,defaultArgs){\r\n var argList = [].slice.call(args);\r\n var outArgs = {};\r\n // print('Default args:',defaultArgs);\r\n //See if first argument is an ee object instead of a vanilla js object\r\n var firstArgumentIsEEObj = false;\r\n var argsAreObject = false;\r\n try{\r\n var t=argList[0].serialize();\r\n firstArgumentIsEEObj = true;\r\n }catch(err){\r\n \r\n }\r\n \r\n if(typeof(argList[0]) === 'object' && argList.length === 1 && !firstArgumentIsEEObj){\r\n argsAreObject = true;\r\n outArgs = argList[0];\r\n }\r\n //Iterate through each expected argument to create the obj with all parameters\r\n Object.keys(defaultArgs).forEach(function(key, i) {\r\n var value;\r\n if(argsAreObject){\r\n value = argList[0][key];\r\n }else{value = argList[i]}\r\n \r\n //Fill in default value if non is provided or it is null\r\n if(value === undefined || value === null){\r\n value = defaultArgs[key];\r\n }\r\n // console.log(value)\r\n outArgs[key] = value;\r\n });\r\n \r\n // //Merge any remaining variables that were provided\r\n // if(argsAreObject){\r\n \r\n // }\r\n // print('Out args:',outArgs);\r\n return outArgs;\r\n}", "stripDefaultParams(params, defaults) {\n if(defaults) {\n let stripped =_.pick(params, (value, key) => {\n // setting the default value of a term to null in a state definition is a very explicit way to ensure it will NEVER generate a search tag, even with a non-default value\n return defaults[key] !== value && key !== 'order_by' && key !== 'page' && key !== 'page_size' && defaults[key] !== null;\n });\n let strippedCopy = _.cloneDeep(stripped);\n if(_.keys(_.pick(defaults, _.keys(strippedCopy))).length > 0){\n for (var key in strippedCopy) {\n if (strippedCopy.hasOwnProperty(key)) {\n let value = strippedCopy[key];\n if(_.isArray(value)){\n let index = _.indexOf(value, defaults[key]);\n value = value.splice(index, 1)[0];\n }\n }\n }\n stripped = strippedCopy;\n }\n return _(strippedCopy).map(this.decodeParam).flatten().value();\n }\n else {\n return _(params).map(this.decodeParam).flatten().value();\n }\n }", "function _defaultValues(payload) {\n if (!payload.host) { payload.host = hostname; }\n if (!payload.time) { payload.time = new Date().getTime()/1000; }\n if (typeof payload.metric !== \"undefined\" && payload.metric !== null) {\n payload.metric_f = payload.metric;\n delete payload.metric;\n }\n return payload;\n}", "defaultArgs(options) {\r\n return this.pptr.defaultArgs(options);\r\n }", "getDefault() {\n return JSON.parse(JSON.stringify(this.default))\n }", "function fillIn(obj, var_defaults){\n\t forEach(slice(arguments, 1), function(base){\n\t forOwn(base, function(val, key){\n\t if (obj[key] == null) {\n\t obj[key] = val;\n\t }\n\t });\n\t });\n\t return obj;\n\t }", "function argumentOrDefault(key){var args=customizations; return args[key]===undefined ? _defaultParams2.default[key] : args[key];}", "function defaults(var_args){\n\t return find(toArray(arguments), nonVoid);\n\t }", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "function defaults(a,b,c){if(a!=null){return a;}if(b!=null){return b;}return c;}", "default() {\n return {};\n }", "defaults () {\n }", "defaults(resource = {}) {\n return resource;\n }", "defaults() {\n return {\n address: String,\n ssl_grade: String,\n country: String,\n owner: String,\n }\n }", "created() {\n for (const arg of this.body.args) {\n arg['value'] = \"\"; // args: [{\"name\": '', \"type\": '', \"value\": ''}]\n this.args.push(arg);\n }\n }", "_defaultParams(name, params) {\n const handlers = this.recognizer.handlersFor(name);\n let paramNames = [];\n for (let i = 0, len = handlers.length; i < len; i++) {\n paramNames = paramNames.concat(handlers[i].names);\n }\n params = Object.assign(pick(this.store.state.params, paramNames), params);\n this._cleanParams(params);\n return params;\n }", "function foo( { a = 10, b = 20 } = {} ) {\n console.log( `[defaults for function arguments] a = ${a}, b = ${b}` );\n}", "beforeUpdate() {\n this.args.splice(0, this.args.length);\n for (const arg of this.body.args) {\n arg['value'] = \"\";\n this.args.push(arg);\n }\n }", "Null(options = {}) {\r\n return { ...options, kind: exports.NullKind, type: 'null' };\r\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "_setParamIfEmpty(param){\r\n\t\t\r\n\t\tif(param == null) param = {};\r\n\t\t\r\n\t\tif(param['ajax_url'] == null) param['ajax_url'] = 'dummy';\r\n\t\t\r\n\t\treturn param;\r\n\t}", "function defaultArgs( tweak )\r\n\t{\r\n\t\tvar defArgs = [];\r\n\t\tfor( var i = 0; i < tweak.args.length; i++ )\r\n\t\t\tdefArgs.push( tweak.args[i].value );\r\n\t\treturn defArgs;\r\n\t}", "function defaults(a, b, c) {\n\tif (a != null) {\n\t\treturn a;\n\t}\n\tif (b != null) {\n\t\treturn b;\n\t}\n\treturn c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function argumentOrDefault(key) {\n\t var args = customizations;\n\t return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\n\t }", "static getDefaults() {\n return {};\n }", "Undefined(options = {}) {\r\n return { ...options, type: 'undefined', kind: exports.UndefinedKind };\r\n }", "function defaultParams(a, b, c = 0) {\n console.log(a, b, c);\n}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t }", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n\t if (a != null) {\n\t return a;\n\t }\n\t if (b != null) {\n\t return b;\n\t }\n\t return c;\n\t}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "*processParametersDefaultValues(parameters) {\n for (let param of parameters) {\n switch (param.type) {\n case utils_1.ParameterType.BOOLEAN:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"false\")\n };\n break;\n case utils_1.ParameterType.INTEGER:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"0\")\n };\n break;\n case utils_1.ParameterType.JSON:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"{}\")\n };\n break;\n case utils_1.ParameterType.LIST:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"[]\")\n };\n break;\n case utils_1.ParameterType.NUMBER:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : \"0\")\n };\n break;\n case utils_1.ParameterType.STRING:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : '\"\"')\n };\n break;\n case utils_1.ParameterType.VHOST:\n yield {\n name: param.name,\n type: param.type,\n value: (param.default ? param.default : '\"\"')\n };\n break;\n }\n }\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "constructor(defaultOptions) {\n this.defaultOptions = defaultOptions;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "_setParamIfEmpty(param){\r\n\t\t\r\n\t\tif(param == null) param = {};\r\n\t\t\r\n\t\tif(param['ja_flg'] == null) param['ja_flg'] = 1; \r\n\t\tif(param['datetimepicker_f'] == null) param['datetimepicker_f'] = 0; \r\n\t\t\r\n\t\treturn param;\r\n\t}", "function _defaultParams ( user_name )\n\t{\n\t\treturn {\n\t\t\tname : user_name,\n\t\t\tpath : _defaultPath,\n\t\t\tfileTypes : _defaultFileTypes,\n\t\t\tlock : _DEFAULT.loop,\n\t\t\tvolume : _DEFAULT.volume,\n\t\t\tstart : _DEFAULT.start,\n\t\t\tend : _DEFAULT.end,\n\t\t\tloop : _DEFAULT.loop,\n\t\t\tautoplay : _DEFAULT.autoplay,\n\t\t\tonLoad : _DEFAULT.onLoad,\n\t\t\tonEnd : _DEFAULT.onEnd,\n\t\t\tdata : _DEFAULT.data\n\t\t};\n\t}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n\n if (b != null) {\n return b;\n }\n\n return c;\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function defaults(a, b, c) {\r\n if (a != null) {\r\n return a;\r\n }\r\n if (b != null) {\r\n return b;\r\n }\r\n return c;\r\n }", "function argumentOrDefault(key) {\r\n var args = customizations;\r\n return args[key] === undefined ? _defaultParams2['default'][key] : args[key];\r\n }", "getArgPropertiesWithoutName() {\n return {\n type: this.type,\n alias: this.alias,\n description: this.description,\n nargs: this.nargs,\n demand: this.demand,\n default: this.default,\n }\n }", "function _defaultParams ( name )\n\t{\n\t\treturn {\n\t\t\tname : name,\n\t\t\tpath : _defaultPath,\n\t\t\tfileTypes : _defaultFileTypes,\n\t\t\tlock : _DEFAULT.loop,\n\t\t\tvolume : _DEFAULT.volume,\n\t\t\tstart : _DEFAULT.start,\n\t\t\tend : _DEFAULT.end,\n\t\t\tloop : _DEFAULT.loop,\n\t\t\tautoplay : _DEFAULT.autoplay,\n\t\t\tonLoad : _DEFAULT.onLoad,\n\t\t\tonPlay : _DEFAULT.onPlay,\n\t\t\tonEnd : _DEFAULT.onEnd,\n\t\t\tdata : _DEFAULT.data\n\t\t};\n\t}", "_defaults() {\n return {\n name: \"\",\n teams: []\n };\n }", "function defaultValues (def, query) {\n def = def || {};\n query = query || {};\n\n // `apiVersion`\n if (def.apiVersion) {\n query.apiVersion = query.apiVersion || def.apiVersion;\n }\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}", "function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}" ]
[ "0.65101206", "0.64128906", "0.62715596", "0.6108013", "0.5934983", "0.58800656", "0.57783073", "0.5775649", "0.5774528", "0.5774528", "0.5774528", "0.57475924", "0.5729939", "0.5718175", "0.5712314", "0.56857914", "0.5685447", "0.56456333", "0.56346846", "0.5630044", "0.5625899", "0.5625899", "0.5625899", "0.5625899", "0.5595636", "0.5591806", "0.5578096", "0.5560848", "0.5556913", "0.555453", "0.5535882", "0.5517519", "0.5516346", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5515248", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.5508419", "0.55062157", "0.55062157", "0.55062157", "0.5502369", "0.54899514", "0.54800814", "0.5470686", "0.546023", "0.54431885", "0.54353887", "0.54337907", "0.54337907", "0.54148334", "0.54148334", "0.54148334", "0.54148334", "0.54124147", "0.53805566", "0.53772634", "0.5376461", "0.53748214", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382", "0.537382" ]
0.0
-1
searches for entries and displays results matching the typed letters
function search(value){ // console.log("search: " + value); showSection(null, '#section-searchresults'); $('#section-searchresults h1').html("Results for: '" + value + "'"); controller.search(value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchUserLocal()\n {\n var typed = this.value.toString().toLowerCase(); \n var results = document.getElementById(\"results-cont\").children;\n\n if(typed.length >= 2)\n { \n for(var j=0; j < results.length; j++)\n {\n if(results[j].id.substr(0, typed.length).toLocaleLowerCase() !== typed)\n results[j].style.display = \"none\";\n else\n results[j].style.display = \"flex\";\n }\n } \n else\n {\n for(var i=0; i < results.length; i++)\n results[i].style.display = \"flex\";\n } \n }", "function searchEngine(e){\n\n let input = document.getElementById('search-input');\n let html = '';\n let matchingResults = [];\n let heading = document.querySelector('.search-heading');\n\n// Find Matching Results\n if(input.value === ''){\n\n searchResults.forEach(function(obj){\n heading.textContent = 'Most Visited';\n\n if(obj.frequent === true){\n matchingResults.push(obj);\n }\n })\n } else {\n\n heading.textContent = 'Search Results';\n searchResults.forEach(function(obj){\n if(obj.title.toUpperCase().includes(input.value.toUpperCase())){\n matchingResults.push(obj);\n }\n })\n }\n\n\n\n if(matchingResults.length > 0){\n\n matchingResults.forEach(function(el){\n html += `<li><a class=\"grey-text\" href=\"${el.link}\">${boldString(el.title, input.value)}</a></li>`\n })\n document.querySelector('.popup-list').innerHTML = html;\n } else{\n html = `<li>There are no suggestions for your query.</li>`\n document.querySelector('.popup-list').innerHTML = html;\n }\n\n}", "function showResults () {\n const value = this.value\n const results = index.search(value, 8)\n // console.log('results: \\n')\n // console.log(results)\n let suggestion\n let childs = suggestions.childNodes\n let i = 0\n const len = results.length\n\n for (; i < len; i++) {\n suggestion = childs[i]\n\n if (!suggestion) {\n suggestion = document.createElement('div')\n suggestions.appendChild(suggestion)\n }\n suggestion.innerHTML = `<b>${results[i].tablecode}</>: ${results[i].label}`\n // `<a href = '${results[i].tablecode}'> ${results[i]['section-name']} ${results[i].title}</a>`\n\n // console.log(results[i])\n }\n\n while (childs.length > len) {\n suggestions.removeChild(childs[i])\n }\n //\n // // const firstResult = results[0].content\n // // const match = firstResult && firstResult.toLowerCase().indexOf(value.toLowerCase())\n // //\n // // if (firstResult && (match !== -1)) {\n // // autocomplete.value = value + firstResult.substring(match + value.length)\n // // autocomplete.current = firstResult\n // // } else {\n // // autocomplete.value = autocomplete.current = value\n // // }\n }", "function displayMatches() {\n // don't start matching until user has typed in two letters\n if (this.value.length >= 2) {\n const matches = findMatches(this.value, movies);\n\n // first remove all existing options from list\n suggestions.innerHTML = \"\";\n\n // now add current suggestions to <datalist>\n matches.forEach( m => {\n var option = document.createElement('option');\n option.textContent = m.title;\n suggestions.appendChild(option);\n })\n\n }\n }", "function find() {\n const searchInput = document\n .querySelector('#search-bar')\n .value.toUpperCase();\n const fullList = document.querySelectorAll('.pokedex-list__item');\n\n fullList.forEach(function (entry) {\n if (entry.innerText.toUpperCase().indexOf(searchInput) > -1) {\n entry.style.display = '';\n } else {\n entry.style.display = 'none';\n }\n });\n }", "function search() {\n //Get the user input text -> convert to lower case\n var txt = $.trim($txt.val()).toLowerCase();\n\n //If the text is empty then complete clear the search and exit the function\n if (txt.length == 0) {\n console.log(\"clear\");\n clear();\n return;\n }\n \n //Create an array of the user input keywords (delimited by a space)\n //We will ensure each keyword exists in the record\n var arr = txt.split(\" \");\n \n //Variable b will determine if the record meets all keyword criteria\n var b = 0; \n \n //Create an empty tr variable to represent the full text of the record in question\n var tr;\n \n //Search through each <tr> in the tbody of the table\n $tbl.children(\"tbody\").find(\"tr\").each(function() {\n \n //Set the initial check value to 1\n b = 1;\n \n //Get the record text => convert to lower-case\n tr = $.trim($(this).text()).toLowerCase();\n \n //Loop through the keywords and check to see if tr contains ALL keywords in question. \n for (var i = 0; i < arr.length; i++) {\n //If any keyword does NOT match the record, b will be 0 and will remain 0 until the next record is searched\n b *= (tr.indexOf(arr[i]) >= 0) ? 1 : 0;\n } \n \n //If b is NOT 0 then the record meets all search criteria - show it, else hide it\n if (b > 0) {\n $(this).show();\n }\n else {\n $(this).hide();\n }\n }); \n }", "function search() {\n const text = this.value;\n if (text === '') {\n rows.forEach(row => row.style.display = null);\n return;\n }\n const length = names.length;\n const regex = new RegExp(text, 'gi');\n for (let i = 0; i < length; i++) {\n if (names[i].match(regex)) rows[i].style.display = null;\n else rows[i].style.display = 'none';\n }\n}", "function filterByLetter() {\n clearSearchbar();\n const letter = this.innerText;\n const allTerms = Array.from(document.querySelectorAll(\".term\"));\n allTerms.forEach(term => {\n if (term.textContent[0] !== letter) {\n term.parentElement.parentElement.parentElement.classList.add(\"hidden\");\n }\n else(term.parentElement.parentElement.parentElement.classList.remove(\"hidden\"));\n });\n checkAllTermsHidden();\n}", "function keyboardHandler(e) {\n const key = String.fromCharCode( e.which || e.keyCode ).toLowerCase();\n //console.log( \"[%s] pressed\", key );\n let query = document.getElementById( \"searchBox\" ).value;\n query = query.replace( /[^0-9a-z ]+/g, \"\" )\n //console.log( \"query=[%s]\", query );\n searchElements( query.split( \" \" ), recipeIndex );\n}", "function query() {\n //reset text area\n $('#searchResults').text(\"\");\n\n contacts = getContacts(); //get existing list of contacts\n var searchCat = $('#selectSearch').val(); //search category (ie. Name)\n var query = $('#selectQuery').val().toLowerCase(); //user query\n var temp = 0; //counter to indicate if matches found\n if (query && query != '' && query != undefined) {\n for (var i = 0; i < contacts.length; i++) {\n var contact = contacts[i][searchCat]; //go through each contact\n if (contact.toLowerCase().indexOf(query) >= 0) {\n $('<ul>', { text: formatItem(contacts[i]) }).appendTo($('#searchResults'));\n temp++;\n }\n //end of loop\n }\n if (temp == 0) { $('#searchResults').text(\"No matches found\"); }\n } else {\n $('#searchResults').text('ERROR: query not valid.');\n }\n}", "function handleSearch(event) {\n //This tweets holds all 10 tweets\n let tweets = document.querySelector(\".tweet-container\").children\n\n //searchString holds the text that the user types inside the search bar \n let searchString = event.target.value.trim().toLowerCase()\n\n //Check if the user has typed anything and if they fetched any tweets yet\n if( searchString === \"\" && tweets.length > 0 ){\n for( let tweet of tweets ){\n //If no text inside search bar, show all 10 tweets\n tweet.style.display = \"flex\"\n }\n\n //If the user typed something inside the search bar and there are tweets to show\n }else if( searchString !== \"\" && tweets.length > 0 ){\n for( let tweet of tweets ){\n let text = tweet.querySelector('.tweetText').innerHTML\n let words = text.toLowerCase().split(/\\W+/)\n\n //Start matching user typed text with the content of each tweet\n if ( words.some( keyword => keyword === searchString) ){\n //If matches, show the tweet\n tweet.style.display = \"flex\"\n }else{\n //If doesn't match, don't show the tweet\n tweet.style.display = \"none\"\n }\n }\n }\n}", "function searchAlts(keyword) {\n keyword = keyword.toLowerCase().trim();\n\n let contained = false;\n Object.keys(alts).forEach((key) => {\n if (key === keyword) {\n contained = true;\n }\n });\n\n let choice = [];\n if (contained) {\n choice = alts[keyword];\n } else {\n choice = [\"No results found for query '\" + keyword + \"'\"];\n }\n\n result = \"\";\n choice.forEach((i) => {\n result += \"<li>\" + i + \"</li>\";\n });\n\n document.getElementById(\"results\").innerHTML = result;\n}", "function searchNameText(e) {\n\tcardsList.innerHTML = ''; // clear the container for the new filtered cards\n\tbtnLoadMore.style.display = 'none';\n\tlet keyword = e.target.value;\n\tlet arrByName = dataArr.filter(\n\t\t(card) => { \n\t\t\treturn( \n\t\t\t\tcard.name.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.artist.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.setName.toLowerCase().indexOf(keyword.toLowerCase()) > -1 \n\t\t\t\t)\n\t\t}\t\n\t);\n\trenderCardList(arrByName);\n\tconsole.log(arrByName);\n}", "function displayMatches() {\n const matches = findMatches(this.value, entries);\n const searchReg = new RegExp(this.value, 'gi');\n const html = matches.map(entry => {\n const matchedTerm = entry.term.toUpperCase().replace(searchReg, `<span class='highlight1'>${this.value.toUpperCase()}</span>`);\n const matchedDef = entry.definition.replace(searchReg, `<span class='highlight2'>${this.value}</span>`);\n const matchedLinks = entry.link.split(\" \").map(link => {return `</br><a href=\"${link}\" target=\"_blank\">${link}</a>`}).join(\"\");\n return `\n <li>\n <!--<span><b>${entry.term}:</b> ${entry.definition}</span>-->\n <span><b>${matchedTerm}:</b> ${matchedDef}</span></br>\n <span><b>links:</b> ${matchedLinks}</span>\n </li>\n `;\n }).join(\"\");\n suggestions.innerHTML = html;\n}", "showMatchedLetter(inputLetter) {\r\n const gameLetterElements = document.querySelectorAll('#phrase li');\r\n console.log(gameLetterElements)\r\n gameLetterElements.forEach(current => {\r\n console.log(`Current phrase letter: ${current.innerText}`);\r\n console.log(`keyed letter: ${inputLetter}`);\r\n if (current.innerText.toLowerCase() == inputLetter) {\r\n current.classList.remove(\"hide\");\r\n current.classList.add(\"show\");\r\n }\r\n })\r\n }", "function search( input ){\n // select chat list -> contacts -> each( user name ? search input )\n $('.chat-list .contact').each( function() {\n //var filter = this.innerText; // < - You, Me , I ( for log user )\n //var _val = input[0].value.toUpperCase();\n\n if ( this.innerText.indexOf( input[0].value.toUpperCase() ) > -1)\n this.style.display = \"\";\n else this.style.display = \"none\";\n\n });\n\n}", "function onKeyPressed () {\n\n // Gets the current text in the space bar\n const currInput = searchBar.firstElementChild.value;\n\n // Gets all matching links\n const nameMatches = findNameMatches(currInput);\n\n // Hides extra buttons\n hideLinks(nameMatches.length);\n\n // Sets the linksToDisplay to the matches for output\n linksToDisplay = nameMatches;\n\n // Shows first page of output\n placePaginatedLinks(1, linksToDisplay);\n\n}", "function runSearch(e) {\n if (e.target.value === \"\") {\n // On empty string, remove all search results\n // Otherwise this may show all results as everything is a \"match\"\n applySearchResults([]);\n } else {\n const tokens = e.target.value.split(\" \");\n const moddedTokens = tokens.map(function (token) {\n // \"*\" + token + \"*\"\n return token;\n })\n const searchTerm = moddedTokens.join(\" \");\n const searchResults = idx.search(searchTerm);\n const mapResults = searchResults.map(function (result) {\n const resultUrl = docMap.get(result.ref);\n return { name: result.ref, url: resultUrl };\n })\n\n applySearchResults(mapResults);\n }\n\n}", "function searchEmployee(e) {\r\n\r\n e.preventDefault();\r\n\r\n // get the term that a user typed \r\n var term = form.elements[0].value.toUpperCase();\r\n\r\n // console.log(term);\r\n\r\n // get all element whose class name is card\r\n var employees = document.querySelectorAll('.card');\r\n\r\n // traverse all element of employees to find matching employee\r\n employees.forEach(emp => {\r\n\r\n // get the name of employee\r\n const name = emp.querySelector('.card-name').innerText.toUpperCase();\r\n\r\n // if the name includes the term\r\n if (name.indexOf(term) > -1) {\r\n // show the employee\r\n emp.style.display = 'flex';\r\n\r\n } else { // if the name does not include the term\r\n // set the employee unvisible\r\n emp.style.display = 'none';\r\n }\r\n })\r\n}", "function fetchResults(txt) {\n\tconsole.log(searchStr);\n}", "executeSearch(term) {\n var results;\n try {\n results = this.search.fuse.search(term); // the actual query being run using fuse.js\n } catch (err) {\n if (err instanceof TypeError) {\n console.log(\"hugo-fuse-search: search failed because Fuse.js was not instantiated properly.\")\n } else {\n console.log(\"hugo-fuse-search: search failed: \" + err)\n }\n return;\n }\n let searchitems = '';\n\n if (results.length === 0) { // no results based on what was typed into the input box\n this.resultsAvailable = false;\n searchitems = '';\n } else { // we got results, show 5\n for (let item in results.slice(0,5)) {\n let result = results[item];\n if ('item' in result) {\n let item = result.item;\n searchitems += this.itemHtml(item);\n }\n }\n this.resultsAvailable = true;\n }\n\n this.element_results.innerHTML = searchitems;\n if (results.length > 0) {\n this.top_result = this.element_results.firstChild;\n this.bottom_result = this.element_results.lastChild;\n }\n }", "function displaySearchAnimey() {\n var input, filter, table1, trr, txtValue;\n input = document.getElementById(\"input\");\n filter = input.value.toUpperCase();\n table1 = document.getElementById(\"tab\");\n trr = table1.getElementsByTagName(\"tr\");\n for (i = 1; i < trr.length; i++) {\n a = trr[i].getElementsByTagName(\"td\")[1];\n txtValue = a.textContent || a.innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n trr[i].style.display = \"\";\n } else {\n trr[i].style.display = \"none\";\n }\n }\n}", "function find() {\n\t\tvar query = $(\"#search-query\").val();\n\n\t\t// check to see if the query contains special commands/characters\n\t\tconvert(query);\n\t\t\n\n\t\tfindSimilar(query);\n\t}", "function search() {\n let input, filter, elements, a, txtValue;\n input = document.getElementById('search-bar');\n filter = input.value.toUpperCase();\n elements = document.getElementsByClassName('pokebox');\n \n for (let i = 0; i < elements.length; i++) {\n a = elements[i].getElementsByClassName('name')[0];\n txtValue = a.textContent || a.innerText;\n\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n elements[i].style.display = \"\";\n } else {\n elements[i].style.display = \"none\";\n }\n }\n}", "function basicsearch() {\n searchString = document.basicForm.basicText.value;\n searchTerms = searchString.split(/\\s/);\n\n putHeader();\n\n findResults();\n putResults();\n\n putFooter();\n\n writeResultsPage();\n}", "function doneTyping() {\r\n search();\r\n}", "function filterBySearchTerm(){\n let inputName = document.querySelector('#input-pokemon-name').value;\n let pokemonNames = arrayOfPokemon.filter(pokemon => pokemon.name.startsWith(inputName));\n\n let inputType = document.querySelector('#input-pokemon-type').value;\n let pokemonTypes = arrayOfPokemon.filter(pokemon => pokemon.primary_type.startsWith(inputType));\n\n if (inputName !== \"\"){\n document.querySelector('#pokemon-list').innerText = '';\n displayList(pokemonNames);\n } else if (inputType !== \"\"){\n document.querySelector('#pokemon-list').innerText = '';\n displayList(pokemonTypes);\n } else if (inputName == \"\" && inputType == \"\"){\n let pokemonList = document.querySelector('#pokemon-list');\n pokemonList.innerHTML = \"\";\n displayList(arrayOfPokemon);\n };\n}", "function displayMatches() {\n const matchArray = createOrderedListOfTesters(filterBugs(filterDeviceIds(findDeviceIds(searchInputOne.value, devices), filterTesterIds(findTesterIds(searchInputTwo.value, testers), testerDevice)), bugs));\n const html = matchArray.map(tester => {\n return `\n <li>\n <span class=\"name\">${tester}</span>\n </li>\n `;\n }).join('');\n suggestions.innerHTML = html;\n}", "function countrySearch() {\n // Get the input element\n const ctryInput = document.getElementById(\"ctry\");\n\n //Add Event listener\n ctryInput.addEventListener(\"keyup\", e => {\n const ctryClone = ctryInput.value.toLowerCase();\n const names = document.querySelectorAll(\"main h1\");\n const content = document.querySelector(\".display-wrapper\");\n\n // Loop through each country name to see if it contains user search\n names.forEach(name => {\n const nameConverted = name.textContent.toLowerCase();\n if(nameConverted.indexOf(ctryClone) !== -1) {\n name.parentElement.parentElement.style.display = \"block\";\n } else {\n name.parentElement.parentElement.style.display = \"none\";\n }\n }); \n });\n}", "function searchResult() {\n\tlet inputValue = addInput.value;\n\tfor (let i = 0; i < deck.length; i++)\n\t\tif (inputValue == deck[i].name) {\n\t\t\tnameOfPlace.innerText = deck[i].name;\n\t\t\tplaceAbout.innerText = deck[i].about;\n\t\t\tnameOfPlace.appendChild(placeAbout);\n\t\t\tbigImage.setAttribute('src', deck[i].image);\n\t\t}\n}", "function search(){\n // creating a dropdown list for Episodes\n let option = document.createElement(\"option\");\n option.value = 0;\n option.text = \"Episodes\";\n episodesSelect.appendChild(option); \n allEpisodes.map((episodes) => {\n let option = document.createElement(\"option\");\n option.value = episodes.name;\n option.text = episodes.name;\n episodesSelect.appendChild(option);\n });\n\n // Live Search\n searchBar.addEventListener(\"keyup\", function (el) {\n let searchTerm = el.target.value.toLowerCase();\n let filteredEpisodes = allEpisodes.filter((episode) => {\n return (\n episode.name.toLowerCase().includes(searchTerm) ||\n episode.summary.toLowerCase().includes(searchTerm)\n );\n });\n\n displayEpisodes(filteredEpisodes);\n });\n }", "function displayMatches() {\n hide(infoElement);\n hide(matchesList);\n matchesList.textContent = '';\n hide(queryInfoElement);\n hide(textDiv);\n const filteredMatches = getFilteredMatches();\n if (filteredMatches.length > 0) {\n const query = queryInput.value;\n history.pushState({type: 'results', query}, null,\n `${window.location.origin}#${query}`);\n document.title = `Shakespeare: ${query}`;\n show(infoElement);\n show(matchesList);\n show(queryInfoElement);\n // const exactPhrase = new RegExp(`\\b${query}\\b`, 'i');\n // keep exact matches only\n // matches = matches.filter(function(match) {\n // return exactPhrase.test(match.doc.t);\n // });\n //\n for (const match of filteredMatches) {\n addMatch(match.doc);\n }\n } else {\n displayInfo('No matches :^\\\\');\n queryInfoElement.textContent = '';\n }\n}", "function searchAuthName() {\n let input, filter, table, tr, td, i;\n input = document.getElementById(\"searchAName\");\n filter = input.value.toUpperCase();\n table = document.getElementById('authorsTable');\n tr = table.getElementsByTagName(\"tr\");\n\n // Loop through all list items, and hide those who don't match the search query\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName('td')[1];\n if (td) {\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n };\n };\n };\n }", "function searchCharactersAndUpdateList() {\n\n // read text entries from the text input form\n var characterInput = inputByText.value.split(\" \");\n\n // remove any empty entry\n characterInput = characterInput.filter(function(value, index, arr) { return value != \"\"; })\n\n // search characters with the text input\n var searchedCharacters = searchRediveCharactersByKeywords(characterInput, characterPositionsTable, characterTitlesMap, searchLimitedByBasicName.checked, searchExactMatch.checked);\n\n // combine it with the character list from the checkboxes\n searchedCharacters = searchedCharacters.concat(searchRediveCharactersFromCheckboxes(characterTitlesArray));\n\n // update character positions list with the searched characters\n updateList(searchedCharacters);\n\n}", "function searchCoffees() {\n var searchRoast = searchBox.value.toUpperCase(); //can be upper or lower case so it can detect all words inserted\n var filteredCoffees = []; //has to create an empty array so it can push whatever the search value is\n coffees.forEach(function(coffee) {\n if (coffee.name.toUpperCase().includes(searchRoast)) {\n filteredCoffees.push(coffee);\n console.log(filteredCoffees);\n }\n });\n tbody.innerHTML = renderCoffees(filteredCoffees);\n}", "function createSearchBar() {\n let accessInput = document.querySelector(\".input\");\n accessInput.addEventListener(\"keyup\", function (event) {\n accessTheCardDiv = document.querySelectorAll(\"#root .card \");\n let searchItems = event.target.value.toLowerCase();\n accessTheCardDiv.forEach(function (cardDiv) {\n // accessTheCount.innerHTML = `Displaying ${numberOfEpisodes}/${allEpisodes.length} episodes`;\n if (cardDiv.textContent.toLowerCase().indexOf(searchItems) != -1) {\n cardDiv.style.display = \"block\";\n } else {\n cardDiv.style.display = \"none\";\n }\n });\n });\n}", "function searchTerm(){\n \n }", "function ticketsFilter() {\n var ticketsSearch = document.getElementById('tickets-search');\n\n if (ticketsSearch) {\n ticketsSearch.addEventListener(\"keyup\", function (e) {\n const q = e.target.value.toLowerCase();\n var rows = document.querySelectorAll('#tickets .row');\n rows.forEach((row) => {\n row.querySelectorAll('td')[0].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[1].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[2].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[3].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[4].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[5].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[6].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[7].textContent.toLowerCase().startsWith(q)\n || row.querySelectorAll('td')[8].textContent.toLowerCase().startsWith(q)\n ? row.style.display = \"table-row\"\n : row.style.display = 'none';\n });\n })\n }\n}", "function doneTyping(){\n var cityInput = document.getElementById(\"city\");\n var results = [];\n for(var i = 0; i < dataObj.ponudjene.length; i++)\n {\n if(dataObj.ponudjene[i].toLowerCase().indexOf(cityInput.value.toLowerCase()) !== -1){\n results.push(dataObj.ponudjene[i]);\n }\n }\n showAutoComplete(results);\n}", "function suggestFilter(msg, arg){\r\n\t\tstate = 3;\r\n\t\thasTheWord = arg;\r\n\t\topenPanel(msg);\r\n\t}", "function searchThis(e) {\n $('#searchbox').val($(e).text());\n FJS.filter();\n}", "function searchNames() {\r\n\r\n Word.run(function (context) {\r\n\r\n // Mettez en file d'attente une commande pour obtenir la selection actuelle, puis\r\n // creez un objet de plage proxy avec les resultats.\r\n var body = context.document.body;\r\n context.load(body, 'text');\r\n\r\n // Empties the politicians already found since we \"relaunch\" the search.\r\n alreadyFoundPoliticians = {};\r\n\r\n $('#politicians').empty(); // Empties all the content of the panel.\r\n\r\n return context.sync().then(function () {\r\n\r\n var wholeText = body.text; // Get the whole text of the body as a String\r\n\r\n // Launch the search\r\n inspectText(wholeText, context);\r\n\r\n }).then(context.sync);\r\n })\r\n .catch(errorHandler);\r\n\r\n }", "function displayMatches() {\n hide(textDiv);\n show(matchesList);\n matchesList.textContent = '';\n const filteredMatches = getFilteredMatches();\n if (filteredMatches.length > 0) {\n //\n // const exactPhrase = new RegExp(`\\b${query}\\b`, 'i');\n // keep exact matches only\n // matches = matches.filter(function(match) {\n // return exactPhrase.test(match.doc.t);\n // });\n // // prefer exact matches — already done if SEARCH_OPTIONS expand is false\n // matches = matches.sort((a, b) => {\n // return exactPhrase.test(a.doc.t) ? -1 :\n // exactPhrase.test(b.doc.t) ? 1 : 0;\n // });\n //\n for (const match of filteredMatches) {\n addMatch(match.doc);\n }\n } else {\n displayInfo('No matches :^\\\\');\n queryInfoElement.textContent = '';\n }\n}", "function onSearchTerm(evt) {\n var text = evt.target.value;\n doSearch(text, $('#types .btn-primary').text());\n }", "function search(text) {\n text = text.toLowerCase();\n var container = $(\"#catalog\");\n // clear everything\n $(container).html('');\n\n // paint only items that fullfil the filter\n for (var i = 0; i < DB.length; i++) {\n var item = DB[i];\n\n // decide if the items fullfils the filter\n // if so, display it\n if (\n item.title.toLowerCase().indexOf(text) >= 0 // if title contains the text\n || // or\n item.code.toLowerCase().indexOf(text) >= 0 // if the code contains the text\n ) {\n displayItem(item);\n }\n\n }\n}", "function enterSearch() {\n search.keypress(function(e) {\n if (search.val() && e.which === 13) {\n displayWikiEntries();\n // console.log('Length: ' + $('.wikiEntry').length);\n }\n });\n}", "function searchForText() {\n // get the keywords to search\n var query = $('form#search input#mapsearch').val();\n\n // extract the fields to search, from the selected 'search category' options\n let category = $('select#search-category').val();\n\n // filter the object for the term in the included fields\n DATA.filtered = searchObject(DATA.tracker_data, query, CONFIG.search_categories[category]);\n\n // suggestions: if the search category is \"company\", include a list of suggestions below \n var suggestions = $('div#suggestions').empty();\n if (category == 'parent') {\n suggestions.show();\n var companies = searchArray(DATA.companies, query).sort();\n companies.forEach(function(company) {\n var entry = $('<div>', {'class': 'suggestion', text: company}).appendTo(suggestions);\n entry.mark(query);\n });\n }\n\n // add the results to map, table, legend\n drawMap(DATA.filtered); // update the map (and legend)\n updateResultsPanel(DATA.filtered, query) // update the results-panel\n drawTable(DATA.filtered, query); // populate the table\n $('form#nav-table-search input').val(query); // sync the table search input with the query\n CONFIG.selected_country.layer.clearLayers(); // clear any selected country\n CONFIG.selected_country.name = ''; // ... and reset the name\n $('div#country-results').show(); // show the results panel, in case hidden\n $('a.clear-search').show(); // show the clear search links\n\n return false;\n}", "function executeSearch() {\n\tlet user_input = $('#class-lookup').val().toUpperCase();\n\t\t\n\t// clears search results\n\t$('#search-return').empty();\n\n\t// display search hint when input box is empty\n\tif (user_input == \"\"){\n\t\t$('#search-return').append(emptySearchFieldInfo());\n\t}\n\t\n\tfor (course in catalog) {\n\t\t\n\t\t// user input describes a course code\n\t\tif (user_input == course) {\n\t\t\t$('#search-return').append(createCourseContainer(course));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// user input describes a department code\n\t\tif (user_input == catalog[course]['department']) {\n\t\t\t$('#search-return').append(createCourseContainer(course));\n\t\t}\n\t\t\n\t}\n\t\n\t// display a message if no results is returned\n\tif ($('#search-return').children().length == 0) {\n\t\t$('#search-return').append(`<li style='border: 3px solid black;'>\n\t\t\t\t\t\t\t\t\t\t<h3>Sorry, we couldn't find what you were looking for.</h3>\n\t\t\t\t\t\t\t\t\t</li>`)\n\t}\n}", "function searchEntries() {\n var search = document.getElementById(\"search\").value;\n // iterate through all entries\n for (var i = 0; i < contacts.length; i++) {\n // entry i is in div id=\"contact_{i}\"\n var entryDiv = document.getElementById(\"contact_\" + i); \n if (search.length > 0 && !contacts[i].contains(search)) {\n entryDiv.style.display = \"none\";\n }\n else {\n entryDiv.style.display = \"\"; \n } \n }\n}", "function setQuery(event){ // If enter is press store value in getResults()\n if(event.keyCode == 13){\n getResults(searchBox.value);\n }\n}", "function searchEmployee(input){\n\n cardsArray.map(card => {\n if (card.children[1].children[0].textContent.toLowerCase().search(input.toLowerCase()) !== -1) {\n card.style.display = \"\";\n } else {\n card.style.display = 'none';\n }\n });\n }", "function searchFunction(type) {\n var input, filter, table, tr, td, i;\n if (type==\"a\") {\n table = document.getElementById(\"showResult\");\n input = document.getElementById(\"myInput\");\n } else {\n table = document.getElementById(\"showBlurays\");\n input = document.getElementById(\"myInput1\");\n }\n filter = input.value.toUpperCase();\n tr = table.getElementsByTagName(\"tr\");\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName(\"td\")[1];\n if (td) {\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n }\n }\n }\n}", "function finder() {\n filter = keyword.value.toUpperCase();\n var li = box_search.getElementsByTagName(\"li\");\n // Recorriendo elementos a filtrar mediante los li\n for (i = 0; i < li.length; i++) {\n var a = li[i].getElementsByTagName(\"a\")[0];\n textValue = a.textContent || a.innerText;\n\n // QUIERO QUE ME APAREZCAN LAS OPCIONES SI TEXTVALUE.STARTSWITH = FILTER \n\n if (textValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"flex\";\n box_search.style.display = \"flex\";\n if (keyword.value === \"\") {\n box_search.style.display = \"none\";\n }\n }\n else {\n li[i].style.display = \"none\";\n }\n\n }\n\n}", "function filter() {\n\t\t//trim and lowercase the value of the input\n\t\tvar query = this.value.trim().toLowerCase();\n\t\t//run throug all the events in the cache\n\t\tcache.forEach(function(thing) {\n\t\t//make the index variable here for scope\n\t\tvar index = 0;\n\t\t//get the index of the query in the name of the event, returns -1 if not found\n\t\tindex = thing.text.indexOf(query);\n\t\t//set the style of the element according to whether or not a match was found\n\t\tthing.element.style.display = index === -1 ? 'none' : '';\n\t});\n\t}", "function search(request, response) {\n const phrase = JSON.parse(request.body).phrase;\n const entries = global.dbConnection.query(`select title, body, cat, visibility from\n entries where title || body like '%${phrase}%`);\n\n for (const i in entries) {\n const e = entries[i];\n if (entries[i].visibility === \"NONE\" && e.cat !== session.cat.name) {\n entries.splice(i, 1);\n }\n }\n const moveToFront = [];\n const rest = []\n for (const i in entries) {\n const e = entries[i];\n if (entries[i].visibility === \"FRIENDS\" || getFriends(e.cat)) {\n if (getFriends(e.cat)) {\n moveToFront.push(e);\n }\n // entries.splice(i, 1);\n } else {\n rest.push(e);\n }\n }\n\n response.body = JSON.stringify(moveToFront.concat(rest.filter(a => a)));\n}", "function singleSearchBar(){\n const searchText = document.getElementById(\"anySearch\").value.toLowerCase();\n console.log(searchText);\n const result = [];\n const nameResult = findByName(searchText, searchText);\n console.log('nameResult:');\n console.log(nameResult);\n result.concat(nameResult);\n renderedTable(result);\n}", "function onclickForSearchButton(event)\n{\n //console.log(event);\n \n var q = document.getElementById('search-query').value; //escape here?\n \n //some kanji searches are going to be legitimately only one char.\n //we need a trim() function instead...\n if(q.length < 1)\n {\n return;\n }\n \n buttonSpinnerVisible(true);\n \n var matches = doEdictQueryOn(q);\n}", "showMatchedLetter(letter) {\n const phraseLis = document.getElementById('phrase').children[0].children;\n\n for(let i = 0; i < phraseLis.length; i++) {\n if(phraseLis[i].textContent.includes(letter)) {\n phraseLis[i].className = 'show';\n }\n }\n }", "function searchCoffeeNames(e) {\n e.preventDefault();\n var userCoffeeName = document.getElementById(\"user-search\").value;\n var filteredNames = [];\n coffees.forEach(function(coffee) {\n\n if(coffee.name.toLowerCase().includes(userCoffeeName.toLowerCase())){\n filteredNames.push(coffee);\n\n }\n });\n divBody.innerHTML = renderCoffees(filteredNames);\n}", "showMatchedLetter(letter) {\n const letterCollection = document.getElementById('phrase').firstElementChild.children;\n for (let i = 0; i < letterCollection.length; i++) {\n if (letterCollection[i].textContent.toLowerCase() === letter) {\n letterCollection[i].className = 'show letter ' + letter;\n }\n }\n }", "function getMatches(query,type){\r\n\t \tconst len=query.length;\r\n\t \tvar matches_out=[];\r\n\t \tif(len <= 0) {\r\n\t \t\tcurrentLetters=[];\r\n\t \t\treturn matches_out;\r\n\t \t}\t \t\r\n\t \tif(query===\"all\" && type===\"all\") matches_out=dictionary;\r\n\t \telse if(type===\"letter\"){\r\n \t\t\tconst matches=search_letter(query)\r\n \t\t\tmatches_out=matches[0];\r\n \t\t\tif(len==1){\r\n \t\t\t\tcurrentLetters=matches[1];\r\n \t\t\t}\r\n\t \t}\r\n\t else { matches_out=search_query(query); }\r\n\t return matches_out;\r\n}", "function search(){\n\tvar inputHandle = document.getElementById(\"searchBar\");\n\tvar typedValue = inputHandle.value;\n for(post in store){\n if(store[post].tag.indexOf(typedValue) > -1){\n displayElement(store, post);\n console.log(store[post].url + \" is the url\");\n }\n else{\n console.log(\"not found\");\n }\n }\n}", "function showOrpNames() {\n\t// console.log(names);\n\tvar textEntered = getValue(\"orpName\");\n\tvar setContent = \"<div class='results'>\";\n\tvar len = 0;\n\tfor (var i = 0; i < names.length; i++) {\n\t\t// console.log(names[i]);\n\t\tif (names[i].toLowerCase().startsWith(textEntered.toLowerCase())) {\n\t\t\tsetContent += \"<a class='col5' onclick='setOrp(this)' value='\"\n\t\t\t\t\t+ names[i] + \"'><p>\" + names[i].split('-')[0] + \", \"\n\t\t\t\t\t+ names[i].split('-')[2] + \"</p></a>\";\n\t\t\tlen++;\n\t\t\t// console.log(names[i].split('-')[0]);\n\t\t}\n\t\tif (len > 5) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tsetContent += \"</div>\";\n\t// console.log(setContent);\n\tdocument.getElementById(\"suggest\").innerHTML = setContent;\n}", "function setQuery(e) {\n if (e.keyCode == 13) {\n getResults(searchBox.value);\n }\n}", "function onSearchKeyPress(e) {\n switch (e.keyCode) {\n case 38:\n // up arrow\n updateSuggestion(currentSuggestion - 1)\n break\n case 40:\n // down arrow\n updateSuggestion(currentSuggestion + 1)\n break\n case 13:\n // enter. it'll submit the form, but let's unfocus the text box first.\n inputElmt.focus()\n break\n default:\n nextSearch = searchBox.value\n var searchResults = viewer.runSearch(nextSearch, true)\n searchSuggestions.innerHTML = \"\"\n currentSuggestion = -1\n suggestionsCount = 0\n addWordWheelResults(searchResults.front)\n addWordWheelResults(searchResults.rest)\n }\n }", "function SearchFunctionality(input, list) {\n const names = document.querySelectorAll(\"h3\");\n const emails = document.querySelectorAll(\"span.email\");\n let searchNamesArray = [];\n for (i = 0; i < list.length; i++) {\n // Check if search bar input contains letters in names or emails arrays ...\n if (names[i].innerHTML.indexOf(input.value) > -1 || emails[i].innerHTML.indexOf(input.value) > -1) {\n searchNamesArray.push(list[i]);\n }\n // ... If not, set the list item to not display\n else {\n list[i].style.display = \"none\";\n }\n }\n ShowPage(searchNamesArray, 1);\n AppendPageLinks(searchNamesArray);\n\n // If there are no results that match the input, show the \"No results found\" message\n if (searchNamesArray.length == 0) {\n noResultsDiv.style.display = \"block\";\n }\n else {\n noResultsDiv.style.display = \"none\";\n }\n}", "function search() {\n\t\n}", "function displayData(data) {\n let searchTextBox = document.getElementById(\"keyword\");\n let queryItem = searchTextBox.value;\n queryItem = queryItem.trim().toLowerCase();\n let mainContainer = document.getElementById(\"search-list\");\n\n // Clear any previous search result\n while (mainContainer.firstChild) {\n mainContainer.removeChild(mainContainer.firstChild);\n }\n\n // Create ul list and append to container\n let ul = document.createElement('ul');\n ul.setAttribute('id', 'ul-results');\n mainContainer.appendChild(ul);\n\n // Display everything if no input\n if (queryItem == '') {\n for (let i = 0; i < data.Sheet1.length; i++) {\n if (!itemsChosen.includes(data.Sheet1[i].Exercise_name)) {\n let liItem = document.createElement(\"li\");\n let aElem = document.createElement(\"a\");\n let link = document.createTextNode(data.Sheet1[i].Exercise_name); \n \n aElem.setAttribute('onClick', `addAFormItem(${data.Sheet1[i].undefined}, \"${data.Sheet1[i].Exercise_name}\"); removeListItem(${data.Sheet1[i].undefined});`);\n aElem.appendChild(link);\n \n liItem.setAttribute('id', data.Sheet1[i].undefined);\n liItem.appendChild(aElem);\n \n ul.appendChild(liItem);\n }\n }\n }\n\n // Filter items and display the filtered result\n else {\n let foundAName = false;\n\n // Display all the exercise names that contain the query name\n for (let i = 0; i < data.Sheet1.length; i++) {\n\n // If a exercise name has part of the query, display it\n if (data.Sheet1[i].Exercise_name.toLowerCase().indexOf(queryItem) > -1 && !itemsChosen.includes(data.Sheet1[i].Exercise_name)) {\n let liItem = document.createElement(\"li\");\n let aElem = document.createElement(\"a\");\n let link = document.createTextNode(data.Sheet1[i].Exercise_name); \n\n aElem.setAttribute('onClick', `addAFormItem(${data.Sheet1[i].undefined}, \"${data.Sheet1[i].Exercise_name}\"); removeListItem(${data.Sheet1[i].undefined})`);\n aElem.appendChild(link);\n\n liItem.setAttribute('id', data.Sheet1[i].undefined);\n liItem.appendChild(aElem);\n\n ul.appendChild(liItem);\n foundAName = true;\n }\n }\n\n // If no results show, display message\n if (foundAName == false) {\n let msg = document.createTextNode(\"Sorry, we can't find what you're looking for. Instead, add your own item.\");\n let liItem = document.createElement(\"li\");\n let aElem = document.createElement(\"a\");\n\n liItem.setAttribute('style', 'color:white');\n\n aElem.appendChild(msg);\n liItem.appendChild(aElem);\n\n ul.appendChild(liItem);\n }\n }\n}", "function suggest(keywords,key,object)\n{\n //alert(\"line 19=\"+object.id);\nvar results = document.getElementById(\"results\");\n \n if(keywords != \"\")\n {\n var terms = get_data(); // sort? -- data should be alphabetical for best results\n\n var ul = document.createElement(\"ul\");\n var li;\n var a;\n \n if ((key.keyCode == '40' || key.keyCode == '38' || key.keyCode == '13'))\n {\n navigate(key.keyCode,object);\n }\n else\n {\n var kIndex = -1;\n \n for(var i = 0; i < terms.length; i++)\n { \n kIndex = terms[i].activity.toLowerCase().indexOf(keywords.toLowerCase());\n \n if(kIndex >= 0) \n {\n li = document.createElement(\"li\");\n \n // setup the link to populate the search box\n a = document.createElement(\"a\");\n a.href = \"javascript://\"; \n \n a.setAttribute(\"rel\",terms[i].val);\n a.setAttribute(\"rev\", getRank(terms[i].activity.toLowerCase(), keywords.toLowerCase()));\n a.setAttribute(\"ref\",terms[i].val2);\n \n if(!document.all) a.setAttribute(\"onclick\",\"populate(this,object);\");\n else a.onclick = function() { populate(this,object); }\n \n \n \n a.appendChild(document.createTextNode(\"\"));\n \n if(keywords.length == 1) \n {\n var kws = terms[i].activity.toLowerCase().split(\" \");\n //alert(\"line 68=\"+kws+terms[i].val2);\n\n var firstWord = 0;\n \n for(var j = 0; j < kws.length; j++)\n {\n // if(kws[j].toLowerCase().charAt(0) == keywords.toLowerCase()) {\n \n ul.appendChild(li);\n \n if(j != 0) {\n kIndex = terms[i].activity.toLowerCase().indexOf(\" \" + keywords.toLowerCase());\n kIndex++;\n }\n \n break;\n // }\n }\n }\n else if(keywords.length > 1) {\n ul.appendChild(li);\n }\n else continue;\n\n \n var before = terms[i].activity.substring(0,kIndex);\n var after = terms[i].activity.substring(keywords.length + kIndex, terms[i].activity.length);\n \n a.innerHTML = before + \"<strong>\" + keywords.toLowerCase() + \"</strong>\" + after;\n \n li.appendChild(a);\n\n }\n } \n \n if(results.hasChildNodes()) results.removeChild(results.firstChild);\n \n // position the list of suggestions\n var s = document.getElementById(object.id);\n var xy = findPos(s);\n \n results.style.left = xy[0] + \"px\";\n results.style.top = xy[1] + s.offsetHeight + \"px\";\n results.style.width = s.offsetWidth + \"px\";\n \n // if there are some results, show them\n if(ul.hasChildNodes()) {\n results.appendChild(filterResults(ul));\n \n if(results.firstChild.childNodes.length == 1) results.firstChild.firstChild.getElementsByTagName(\"a\")[0].className = \"hover\";\n \n }\n\n }\n }\n else\n {\n if(results.hasChildNodes()) results.removeChild(results.firstChild);\n }\n}", "function displaySearchResults(response, search) {\n var user_finder = new RegExp(search, 'i'),\n results_string = \"\",\n i,\n j;\n\n if(globe.getID(0)) {\n removeLink();\n }\n\n if (globe.search_type_name.checked) {\n for (i = 0; i < response.length; i += 1) {\n if (user_finder.test(response[i].toMake)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].toMake + \"</p>\";\n globe.addID(i.toString());\n }\n }\n } else {\n for (i = 0; i < response.length; i += 1) {\n for (j = 0; j < response[i].ingredients.length; j += 1) {\n if (user_finder.test(response[i].ingredients[j].ingredient)) {\n\n results_string += \"<p id=\\\"\" + i.toString() + \"\\\">\" + response[i].ingredients[j].ingredient + \"</p>\";\n globe.addID(i.toString());\n break;\n }\n }\n }\n }\n\n globe.hint_span.innerHTML = \"\";\n if (results_string === \"\") {\n results_string = \"<span>No results.</span>\";\n }\n globe.results_div.innerHTML = results_string;\n \n if (globe.getID(0)) {\n createLink();\n }\n}", "function inputChange(event) {\n const searchedKey = event.target.value.toLowerCase();\n filterNotes(searchedKey);\n}", "function searchResults(event) {\n\tconst search = event.target.value;\n\t// empty search term - everything matches ''\n\tconst re = new RegExp(search, 'i');\n\tconst usernameElems = Array.from(document.getElementsByClassName('results-username'));\n\tlet even = false;\n\tfor (const e of usernameElems) {\n\t\tconst row = e.parentNode;\n\t\t// visibility: collapse seems to remove innerText (display: none didn't)\n\t\t// So I'm using textContent here instead.\n\t\tif (e.textContent.match(re)) {\n\t\t\trow.classList.remove('hidden');\n\t\t\tif (even) {\n\t\t\t\trow.classList.add('even');\n\t\t\t} else {\n\t\t\t\trow.classList.remove('even');\n\t\t\t}\n\t\t\teven = !even;\n\t\t} else {\n\t\t\trow.classList.add('hidden');\n\t\t}\n\t}\n}", "function searchUser(){\n const searchEntry = [];\n const autoCompleteOptions =[];\n let searchBox = document.getElementById('recipient');\n let autocomplete = document.getElementById('dropdown');\n \n \n // iterate through user name data text to check for user input text match\n searchBox.addEventListener('keydown', function(e) { \n let inputKey = e.key.toLowerCase();\n \n const permittedKeys = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','backspace',' '];\n\n if (permittedKeys.includes(inputKey)){\n \n if (inputKey === 'backspace' && searchEntry.length === 0){\n searchUser();\n } else if (inputKey === 'backspace'){//get proper behaviour of backspace (delete last letter input)\n searchEntry.pop();\n autoCompleteOptions.pop();\n autocomplete.innerHTML = ``;\n } else {\n autocomplete.style.display = 'block';\n searchEntry.push(inputKey);\n let searchValue = searchEntry.join(''); \n autoCompleteOptions.length = 0;\n for (let i=0; i<allMembers.length; i++){\n for (let j=0; j<allMembers[i].name.length;j++){ \n let namePartial = allMembers[i].name.slice(j,j+searchValue.length).toLowerCase();//main part of search; iterate through all name arrays as partials\n if ((searchValue === namePartial) && !autoCompleteOptions.includes(allMembers[i].name)){// check match and not already included \n autocomplete.innerHTML =``;\n autoCompleteOptions.push(allMembers[i].name); \n for (let k=0; k<autoCompleteOptions.length; k++){ \n autocomplete.innerHTML += `<div>${autoCompleteOptions[k]}</div>`;//show the autocomplete suggestions \n } \n }\n } \n } \n }\n }\n });\n\n //Output the selected autocomplete suggestion as User Name address and move focus to message field\n /* --------------------------------------*/ \n\n autocomplete.addEventListener('click', e=>{\n autocomplete.style.display=\"none\";\n searchBox.value = e.target.textContent;\n message.focus(); \n });\n}", "function searchExams() {\n var input, filter, ul, li, a, i, txtValue;\n\n input = document.getElementById(\"exam-search\");\n filter = input.value.toUpperCase();\n\n ul = document.getElementById(\"exam-wrapper\");\n li = ul.getElementsByClassName(\"examBox\");\n\n for (i = 0; i < li.length; i++) {\n a = li[i].getElementsByTagName(\"span\")[0];\n txtValue = a.textContent || a.innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"\";\n } else {\n li[i].style.display = \"none\";\n }\n }\n}", "function search(){\n var searchInputValue = searchInput.value;\n var uppercaseValue = searchInputValue.toUpperCase();\n if (uppercaseValue == 'QUEENSTOWN' ||\n uppercaseValue == 'WANAKA' ||\n uppercaseValue == 'CADRONA' ||\n uppercaseValue == 'REMARKABLES' ||\n uppercaseValue == 'THE REMARKABLES' ||\n uppercaseValue == 'THE REMARKS' ||\n uppercaseValue == 'CORONET PEAK' ){\n loadThumbnails(locations.queenstown);\n initMap(168.697751, 45.026377);\n } else if (uppercaseValue == 'CHRISTCHURCH'||\n uppercaseValue == 'CANTERBURY'||\n uppercaseValue == 'MT HUTT' ||\n uppercaseValue == 'MOUNT HUTT' ||\n uppercaseValue == 'TEMPLE BASIN' ||\n uppercaseValue == 'ARTHUR\\'S PASS' ||\n uppercaseValue == 'CHEESEMAN' ||\n uppercaseValue == 'PORTERS' ||\n uppercaseValue == 'MT OLYMPUS' ||\n uppercaseValue == 'MOUNT OLYMPUS' ||\n uppercaseValue == 'BROKEN RIVER'){\n loadThumbnails(locations.christchurch);\n initMap(172.493273, 43.538478);\n } else if (uppercaseValue == 'WHAKAPAPA' ||\n uppercaseValue == 'RUAPEHU' ||\n uppercaseValue == 'MOUNT RUAPEHU' ||\n uppercaseValue == 'MT RUAPEHU' ||\n uppercaseValue == 'TONGARIRO' ||\n uppercaseValue == 'OHAKUNE' ||\n uppercaseValue == 'NATIONAL PARK' ||\n uppercaseValue == 'TUROA'){\n loadThumbnails(locations.whakapapa);\n initMap(175.549994, 39.231289);\n } else {\n thumbnailsBox.innerHTML = '<span class=\"no-results\">No location matched your search, please check your spelling and try again. Hint: Try searching by field name or nearest town, Eg. Queenstown.</span>';\n }\n }", "function search(e) {\n e.preventDefault();\n\n // documentation: https://dictionaryapi.dev/\n const apiUrl = `https://api.dictionaryapi.dev/api/v2/entries/en_US/${keyword}`;\n axios.get(apiUrl).then(handleDictionaryResponse);\n\n // pexels API call\n const pexelsApiKey = process.env.REACT_APP_PEXELS_API_KEY;\n const pexelsApiUrl = `https://api.pexels.com/v1/search?query=${keyword}&per_page=12`;\n const headers = { Authorization: `Bearer ${pexelsApiKey}` };\n axios.get(pexelsApiUrl, { headers: headers }).then(handlePexelsResponse);\n }", "function searchCraft(e) {\r\n\te.preventDefault();\r\n\tconst searchItem = document.querySelector('#searchbar').value;\r\n\tconsole.log('Searching: '+searchItem)\r\n\trelatedCrafts=[]\r\n\tallCrafts.forEach(function (value, index, array){\r\n\t\tif( value.title.includes(searchItem) | value.authorname.includes(searchItem)) {\r\n\t\t\trelatedCrafts.push(value)\r\n\t\t\r\n\t\t}\r\n\t})\r\n\t// empty the board, load craft tags that contains the search key\r\n\t$('#board').empty();\r\n\t// const cg = new CraftGenerator()\r\n\trelatedCrafts.forEach(function (value, index, array) {\r\n\t\tmakeTag(value)\r\n\t});\r\n}", "function search () {\n let searchInput = document.querySelector('#search-bar');\n\n searchInput.addEventListener('input', function () {\n // Adds a Bootstrap class.\n let pokemonList = document.querySelectorAll('.group-list-item');\n let searchText = searchInput.value.toLowerCase();\n\n pokemonList.forEach(function (pokemon) {\n if (pokemon.innerText.toLowerCase().indexOf(searchText) > -1) {\n pokemon.style.display = '';\n } else {\n pokemon.style.display = 'none';\n }\n });\n });\n }", "function EnterText(){\n //throw new Error(\"User Exception.\");\n dataProvider = DataProvider.getDataProvider()\n query = \"select * from Smoke where CaseName like 'EnterText%'\"\n recSet = dataProvider.execute(query) \n \n if(recSet == null || recSet.EOF){\n Log.Warning(\"Result of the query is empty.\", query);\n return false\n }\n \n recSet.MoveFirst() \n while (!recSet.EOF) {\n InputText(recSet.Fields.Item(\"Param1\").Value) \n recSet.MoveNext();\n }\n \n dataProvider.closeConnection()\n}", "function handleSearchInput(event, allPokemonData, pokemonContainer) {\n const filteredPokes = allPokemonData.filter(pokeObj => {\n return pokeObj.name.includes(event.target.value.toLowerCase())\n })\n\n const filteredPokeHTML = renderAllPokemon(filteredPokes)\n pokemonContainer.innerHTML = filteredPokeHTML ? filteredPokeHTML : `<p><center>There are no Pokémon here</center></p>`\n}", "function myNames() {\n var input, table, tr, td, i, txtValue;\n input = document.getElementById(\"myInput\").value.toUpperCase();\n table = document.getElementById(\"myTable\");\n tr = table.getElementsByTagName(\"tr\");\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName(\"td\")[1];\n if (td) {\n txtValue = td.textContent || td.innerText;\n if (txtValue.toUpperCase().indexOf(input) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n }\n } \n }\n }", "function search() {\n let search, filter, container, card, h2, txtValue;\n search = document.getElementById('searchBar')\n filter = search.value.toUpperCase();\n container = document.getElementById('container');\n card = document.getElementsByClassName('card');\n h2 = container.getElementsByClassName('animeName');\n for (let i = 0; i < h2.length; i++) {\n txtValue = h2[i].textContent || h2[i].innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n card[i].style.display = \"\";\n } else {\n card[i].style.display = \"none\";\n }\n }\n}", "function displayMatches() {\n suggestions.classList.remove(\"hidden\");\n const matchArray = findMatches(this.value, countriesName);\n if (this.value.length > 1) {\n const html = matchArray\n .map((place) => {\n const regex = new RegExp(this.value, \"gi\");\n const countryName = place.Nazione.replace(\n regex,\n `<span class=\"hl\">${this.value}</span>`\n );\n return `\n <li>\n <span class=\"name\">${countryName}</span>\n </li>\n `;\n })\n .join(\"\");\n suggestions.innerHTML = html;\n }\n }", "function searchuser() {\n var input, filter, table, tr, td, i, txtValue;\n input = document.getElementById(\"myInput\");\n filter = input.value.toUpperCase();\n table = document.getElementById(\"myTable\");\n tr = table.getElementsByTagName(\"tr\");\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName(\"td\")[1];\n td = tr[i].getElementsByTagName(\"td\")[1];\n if (td) {\n txtValue = td.textContent || td.innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n }\n } \n }\n }", "function displayResults() {\n // result is filtered array of cities\n const result = findMatches(this.value, cities);\n // map the array to html formatted string for display. Map function returns another array, so we run the \"join\" function at the end to join it into a string.\n const html = result.map(obj => {\n const city = new RegExp(this.value, 'gi');\n const highlight = obj.name.replace(city, `<span style=\"color: red\">${this.value}</span>`);\n return `<li>${highlight}</li>`\n }).join(\"\");\n suggestions.innerHTML = html;\n console.log(html);\n}", "function displayCats() {\r\n if (\r\n searchValue.toLowerCase() === 'cat' ||\r\n searchValue.toLowerCase() === 'cats'\r\n ) {\r\n alert('I must say, you have amazing taste 🌟😻🌟');\r\n }\r\n}", "function handleEnterKeyDownInSearchBox() {\n var value = $(idSearchBoxJQ).val();\n\n var item = isValueAMatchInLookupItems(value);\n\n //If it is match we select the item\n if (item !== null) {\n selectItem(item);\n\n } else {\n if (useAutoCompleteOnKeyPress == false) {\n populateResults();\n }\n\n }\n\n\n }", "function filterForSearch(data) {\n let userInput = $('#textfield').val();\n userInput = userInput.toLowerCase();\n let tempString = userInput.slice(1);\n userInput = userInput.charAt(0).toUpperCase();\n userInput += tempString;\n if(userInput === 'Saudi arabia' || userInput === 'Korea republic' || userInput === 'Costa rica') {\n backString = userInput.slice(0,6);\n frontString = userInput.slice(7);\n userInput = userInput.charAt(6).toUpperCase();\n userInput = backString + userInput + frontString;\n };\n $('#textfield').val('');\n $('.game-chooser').append(`\n <h2 class=\"centered-text\">Which game would you like to view?</h2>\n <form class= \"chooser-form centered-text col-6 centered-element\" aria-live=\"assertive\">\n <button type=\"submit\" class=\"centered-text\">Submit</button>\n </form> `);\n const arrayOfMatches = data.filter(item => item.home_team_country === userInput || item.away_team_country === userInput);\n\n if(arrayOfMatches.length >= 1){\n const renderedMatches = arrayOfMatches.map(renderSearchMatches);\n $('.chooser-form').prepend(renderedMatches);\n }\n else{\n $('.game-chooser').empty();\n $('.game-chooser').append(`<h2 class=\"centered-text\">Sorry, this entry was invalid. Please view the list of World Cup Teams tab above to see a list of valid entries.</h2>`);\n }\n}", "arrayLikeSearch() {\r\n this.setEventListener();\r\n if (!this.display || this.display == this.selectedDisplay) {\r\n this.setEmptyTextResults();\r\n \r\n return true;\r\n }\r\n this.resultslength = this.results.length;\r\n this.$emit(\"results\", { results: this.results });\r\n this.load = false;\r\n\r\n if (this.display != this.selectedDisplay) {\r\n this.results = this.source.filter((item) => {\r\n return this.formatDisplay(item)\r\n .toLowerCase()\r\n .includes(this.display.toLowerCase())&& !item.invisible;\r\n });\r\n \r\n \r\n }\r\n }", "function search(e){\n\t\t\tvar inputText = e.target.value,\n\t\t\t\toptionHTML = '',\n\t\t\t\tliHTML = ''; \n\t\t\tfor(var i=0;i<that.textContent.length;i++){\n\t\t\t\tif( that.textContent[i].indexOf(inputText) != -1){\n\t\t\t\t\tliHTML += \t'<li value=\"' + that.value[i] + '\">' +\n\t\t\t\t\t\t\t\t\tthat.textContent[i] + '</li>';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toptionUl.innerHTML = liHTML;\n\t\t\toption.style.border = 'solid 1px gray';\n\n\t\t\tfor(var i=0;i<optionLi.length;i++){\n\t\t\t\toptionLi[i].addEventListener('click', pick, false); \n\t\t\t\toptionLi[i].addEventListener('mouseenter', keep, false); optionLi[i].addEventListener('touchstart', keep, false); //cellphone ontouchstart event\n\t\t\t\toptionLi[i].addEventListener('mouseout', release, false);\n\n\t\t\t}\n\t\t}", "function search(search, id){\n const table = document.getElementById(id);\n const words = search.value.toLowerCase().split(\" \");\n for (let i = 1; i < table.rows.length; i++){\n const ele = table.rows[i].innerHTML.replace(/<[^>]+>/g,\"\");\n let displayStyle = 'none';\n for (let j = 0; j < words.length; j++) {\n if (ele.toLowerCase().indexOf(words[j])>=0){\n displayStyle = '';\n }\n else {\n displayStyle = 'none';\n break;\n }\n }\n table.rows[i].style.display = displayStyle;\n }\n}", "render() {\n const { gotcaste, searchfield } = this.state;\n //filtering and showing only those characters whose name matches the input value\n const filteredChars = gotcaste.filter(char => {\n return char.name.toLowerCase().includes(searchfield.toLowerCase());\n });\n return (\n <div className=\"tc\">\n <h1 className=\"f1\">GOT FLASH CARDS</h1>\n {/*Passing props*/}\n <Searchbox\n searchChange={this.onSearchChange}\n placeholder={\"search characters...\"}\n />\n <CardList arr={filteredChars} />\n </div>\n );\n }", "function search(e)\n{\n const text = e.target.value.toLowerCase()\n let Lis = document.querySelectorAll('.list-item')\n Lis.forEach(function(li)\n {\n if(li.textContent.toLowerCase().indexOf(text) != -1)\n {\n li.style.display='flex'\n }\n else\n {\n li.style.display='none'\n }\n })\n\n}", "function manualSearch(e) {\n let term = document.querySelector(\"#searchTerm\").value;\n term = term.trim();\n if (term.length < 1) return;\n manualSearchData(term.toLowerCase());\n}", "function fileSearch_kp(e){\n e = e || window.event;\n\n // If there are any modifiers or if we're already entering text into\n // another input field elsewhere, then do nothing\n if(e.ctrlKey || e.altKey || e.metaKey || e.target.tagName === 'INPUT') return true;\n\n // Grab the typed character, test it, and show the box if appropriate\n var theChar = String.fromCharCode(e.which);\n if(/[a-zA-Z0-9\\.\\/\\_\\-]/.test(theChar)) showSearchBox(theChar);\n }", "function setQuery(evt) {\n if (evt.keyCode == 13) {\n getResults(searchBox.value);\n }\n}", "function displayMatches() {\n const matchArray = findMatches(this.value, cities);\n suggestions.innerHTML = matchArray.map(function (place) {\n return `\n <li>\n <span>${place.city} ${place.state}</span>\n </li>\n `\n }).join('');\n\n}", "function handleKeyPress(e, form) {\n\t\tvar key = e.keyCode || e.which;\n\t\tif (key == 13) {\n\t\t\taddSearchResults(document.getElementById('searchText1').value.toLowerCase(),true);\n\t\t}\n\t}", "function search_input() {\n\tlet list = scraper.data[schedule.AYTerm];\n\n\t// It's completely empty. Nothing to filter. No need to continue.\n\tif (!list)\n\t\treturn;\n\n\t// Separate the input from the spaces.\n\tlet txt = div.search_input.value.toUpperCase().match(/\\S+/g) || [\"\"];\n\n\t// Check if the user is trying to check via slot ID.\n\tif (!isNaN(Number(txt[0]))) for (let name in list)\n\t\tif (typeof(list[name]) === \"object\" && list[name].slots[txt[0]]) {\n\t\t\t// Redirect to the course's name with the ID.\n\t\t\ttxt = [name, txt[0]];\n\n\t\t\t// Hide any tables if the slot is from another course.\n\t\t\tif (course_scope && course_scope[0] != name)\n\t\t\t\tlist[course_scope[0]].table.style.display = \"none\";\n\n\t\t\tbreak;\n\t\t}\n\n\t// See if there's a match on the user's input.\n\tif (list[txt[0]]) {\n\t\t// Found a match in the searched courses.\n\t\tlet slots = list[txt[0]].slots;\n\n\t\tif (!course_scope || course_scope[0] != txt[0])\n\t\t\t// Make the table visible when the names match.\n\t\t\tlist[txt[0]].table.style.display = \"\";\n\n\t\t/* See if the user is trying to filter out the slots. Also\n\t\t only update if there is a difference from before.\n\t\t*/\n\t\tif (!course_scope ||\n\t\t\tcourse_scope.toString() != txt.toString()) {\n\t\t\t// This will help reduce lag by minimizing the effort.\n\t\t\tif (txt.length > 1) {\n\t\t\t\tlet id;\n\n\t\t\t\t// Iterate through each slot.\n\t\t\t\tfor (let n in slots) {\n\t\t\t\t\tslots[n].tr.style.display = \"\"; // Set it visible first.\n\n\t\t\t\t\t// See if an existing ID is found in the filters.\n\t\t\t\t\tif (id == null) {\n\t\t\t\t\t\t// Iterate through each filter except the 1st one.\n\t\t\t\t\t\tfor (let i = 1; i < txt.length; i++) {\n\t\t\t\t\t\t\t// See if the selected filter is an ID.\n\t\t\t\t\t\t\tif (slots[txt[i]]) {\n\t\t\t\t\t\t\t\t/* Set the ID so we don't have to iterate\n\t\t\t\t\t\t\t\t again.\n\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\tid = txt[i];\n\n\t\t\t\t\t\t\t\t// Hide it if it doesnt match with the ID.\n\t\t\t\t\t\t\t\tif (id != n)\n\t\t\t\t\t\t\t\t\tslots[n].tr.style.display = \"none\";\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else if (slots[n].literal\n\t\t\t\t\t\t\t.search(txt[i]) == -1) {\n\t\t\t\t\t\t\t\t/* Hide anything that doesn't match with\n\t\t\t\t\t\t\t\t all of the filters.\n\t\t\t\t\t\t\t\t*/ \n\t\t\t\t\t\t\t\tslots[n].tr.style.display = \"none\";\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (id != n)\n\t\t\t\t\t\t/* Since an ID was found, we no longer need to\n\t\t\t\t\t\t iterate through the filters, and only need\n\t\t\t\t\t\t to see if it has a matching ID.\n\t\t\t\t\t\t*/\n\t\t\t\t\t\tslots[n].tr.style.display = \"none\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// User wants to see the entire output.\n\t\t\t\tfor (let i in slots)\n\t\t\t\t\tslots[i].tr.style.display = \"\";\n\t\t\t}\n\t\t}\n\n\t\tdiv.dump.style.display = \"none\";\n\t\tcourse_scope = txt;\n\n\t\treturn;\n\t}\n\t/* No match found. Try to find a similar name in the\n\t 'recently-searched' view.\n\t*/\n\n\tif (course_scope) {\n\t\t// Hide the course view if visible.\n\t\tlist[course_scope[0]].table.style.display = \"none\";\n\n\t\tcourse_scope = null;\n\t}\n\n\t// Make 'recently-searched' view visible.\n\tdiv.dump.style.display = \"block\";\n\n\t/* Find matches in the scraper's 'dumped' entry, which is just a long\n\t string containing all the searched course names.\n\t*/\n\tlet res = list.dump.match(\n\t\tnew RegExp(course_dump_pre + txt[0] + course_dump_suf, \"g\")\n\t);\n\n\tfor (let name in list) if (typeof(list[name]) === \"object\") {\n\t\tif (res !== null &&\n\t\t\tres.indexOf(course_dump_sep + name) > -1) {\n\t\t\t// Found a match. Make it visible.\n\n\t\t\tif (list[name].word.style.display)\n\t\t\t\tlist[name].word.style.display = \"\";\n\t\t} else if (!list[name].word.style.display)\n\t\t\t// Text in the search input doesn't match. Hide it.\n\t\t\tlist[name].word.style.display = \"none\";\n\t}\n}", "showMatchedLetter(letter) {\n\n const lis = document.getElementById('phrase').firstElementChild.children;\n for (let i = 0; i < lis.length; i++) {\n if (lis[i].textContent.toLowerCase() === letter) {\n lis[i].classList.add('show');\n lis[i].classList.remove('hide');\n }\n }\n }", "function displayNewSearchResults(event) {\n let searchTerm = event.target.value;\n let currentSearch = giphy[\"query\"][\"q\"];\n if (searchTerm !== currentSearch && searchTerm !== \"\") {\n giphy[\"query\"][\"q\"] = searchTerm;\n updateOffset(true);\n update();\n }\n}" ]
[ "0.67494947", "0.66835386", "0.66159165", "0.65978134", "0.65576327", "0.65293485", "0.64791554", "0.6406434", "0.63759327", "0.6361633", "0.6329947", "0.6320887", "0.6282645", "0.62643826", "0.6247176", "0.6240933", "0.6205758", "0.62028134", "0.61956656", "0.6189085", "0.6175642", "0.6171843", "0.61516976", "0.61417204", "0.61297864", "0.6127958", "0.6123148", "0.61204755", "0.6113922", "0.6106746", "0.6097971", "0.6096934", "0.60951", "0.6085214", "0.60817236", "0.6077981", "0.6065542", "0.6041528", "0.6032262", "0.6018553", "0.60157496", "0.6009448", "0.6008553", "0.60051066", "0.6004573", "0.5999871", "0.59973884", "0.59960324", "0.59921753", "0.5990314", "0.5989846", "0.5988237", "0.5983759", "0.59830755", "0.598121", "0.597452", "0.59720886", "0.59666425", "0.5954898", "0.59504634", "0.59499806", "0.59465724", "0.5936682", "0.59358025", "0.5934596", "0.59332496", "0.5930761", "0.59167427", "0.5914974", "0.5912073", "0.59104335", "0.59075534", "0.5905641", "0.59055644", "0.59028596", "0.58963835", "0.5896215", "0.58942175", "0.58936095", "0.58932483", "0.58913696", "0.58912605", "0.58897597", "0.5885457", "0.5882818", "0.5881598", "0.5873215", "0.58726895", "0.5862014", "0.58597434", "0.5859126", "0.5855494", "0.58517957", "0.5845682", "0.5845521", "0.5845185", "0.5841286", "0.5838922", "0.5833584", "0.5833322", "0.583273" ]
0.0
-1
store mpw for autodecryption for autofilling option
function tmpStoreMPW(){ // browser.storage.sync.get("mpw").then(function(res){ // if(res['mpw'] == CryptoJS.SHA512($('#modalInputMPW').val()).toString()){ // SM.setMPW($('#modalInputMPW').val()); // $('#modalMPW').modal('hide'); // // activate checkbox // $('#pref_autofill_password').prop('checked', true); // SM.updatePreferences('pref_autofill_password', true); // }else{ // alert("Entered password was not correct."); // } // }); doChallenge($('#modalInputMPW').val(), function(){ SM.setMPW($('#modalInputMPW').val()); $('#modalMPW').modal('hide'); // activate checkbox $('#pref_autofill_password').prop('checked', true); SM.updatePreferences('pref_autofill_password', true); }, function(){ alert("Entered password was not correct."); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveForPW(getPw) {\n const encryptPw = encrypt(getPw);\n localStorage.setItem(PW_LS, encryptPw);\n}", "function withMPDpref(str) { return 'mpd/'+MPD.password+'/'+str; }", "function encryptorInit() {\n var lock = document.getElementById(\"js-lock\");\n lock.addEventListener(\"click\", promptForKey);\n var key = localStorage.getItem(KEY_PHRASE);\n if (!key) {\n promptForKey();\n }\n}", "function u(t) {\n const n = t.getResponseHeader('IG-Set-Password-Encryption-Web-Key-Id')\n , s = t.getResponseHeader('IG-Set-Password-Encryption-Web-Key-Version')\n , o = t.getResponseHeader('IG-Set-Password-Encryption-Web-Pub-Key');\n n && o && s && r(d[8]).setEncryptionKeys(n, o, s)\n}", "autocryptSetupPasswd(window, dlgMode, passwdType = \"numeric9x4\", password) {\n if (!window) {\n window = this.getBestParentWin();\n }\n\n let inputObj = {\n password: null,\n passwdType,\n dlgMode,\n };\n\n if (password) {\n inputObj.initialPasswd = password;\n }\n\n window.openDialog(\n \"chrome://openpgp/content/ui/autocryptSetupPasswd.xhtml\",\n \"\",\n \"dialog,modal,centerscreen\",\n inputObj\n );\n\n return inputObj.password;\n }", "function createCryptogram(){\n vm.cipher = {};\n if(vm.quote){\n killGuess().then(function(){\n $meteor.call('createCryptogram', vm.quote).then(function(result){\n if(result){\n var answer = vm.quote.toLowerCase().slice(0);\n vm.result = result;\n\n vm.cipher = {};\n _.each(answer, function(val, index){\n if(cryptogramService.isLetter(val))\n vm.cipher[result[index]] = val;\n });\n\n changeQuoteHeader();\n vm.currentQuote = vm.buildingQuote;\n }\n }, function(err){\n console.log('err', err);\n });\n }, function(err){\n console.log(err);\n });\n }else{\n vm.currentQuote = vm.needQuote;\n }\n }", "function savePassword(pw) {\n\tIPCRenderer.sendToHost('config', {\n\t\tkey: 'walletPassword',\n\t\tvalue: pw,\n\t});\n}", "function getPassword() {\n if (hasTextEncoder) {\n document.getElementById('create_button').style.display = 'none';\n document.getElementById('passphrase').style.display = 'block';\n }\n else {\n setupKeys();\n }\n}", "function writePassword() {\n var passwordLen = getpasswordLength();\n var options = getPasswordOptionSet();\n\n\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = makePassword(passwordLen, options);\n\n\n}", "function generatePass(plength) {\n $('.genPassConf').css('display', 'block');\n $('#pass-generate').html('').css('display', 'none');\n var keylistalpha = \"abcdefghijklmnopqrstuvwxyz\";\n var keylistint = \"0123456789\";\n var keylistspec = \"!@#_{}[]&*^%\";\n var temp = '';\n var len = plength / 2;\n var len = len - 1;\n var lenspec = plength - len;\n for (i = 0; i < len; i++)\n temp += keylistalpha.charAt(Math.floor(Math.random() * keylistalpha.length));\n for (i = 0; i < lenspec; i++)\n temp += keylistspec.charAt(Math.floor(Math.random() * keylistspec.length));\n for (i = 0; i < len; i++)\n temp += keylistint.charAt(Math.floor(Math.random() * keylistint.length));\n temp = temp.split('').sort(function () {\n return 0.5 - Math.random()\n }).join('');\n $('.pass').val(temp);\n return temp;\n}", "function writePassword() {\n document.getElementById(\"password\").value = \"\";\n\n generator(customChar);\n}", "function encryptGameWord() {\r\n if (level < stages.length - 1) {\r\n encryptedGameWord = encryption.iterateString(gameWord, gameShift, true);\r\n }\r\n else {\r\n gameKey = encryption.convertKeyToNumbers(finalStageKeys[0]);\r\n encryptedGameWord = encryption.iterateVigenereString(gameWord, gameKey, false);\r\n\r\n }\r\n }", "function writePassword() {\n let newOptions = { ...options };\n setOptions(newOptions);\n var password = generatePassword(newOptions);\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function generatePassPhrase() {\n\n var s = new Uint16Array(WORDCOUNT);\n var phrase_words = [];\n\n var bytes = forge.random.getBytesSync(2*WORDCOUNT);\n for(var n=0; n < WORDCOUNT; n++)\n {\n var idx = (bytes.charCodeAt(n*2) & 0x7) << 8;\n idx = idx | bytes.charCodeAt(n*2+1) & 0xFF;\n\n phrase_words.push(words[idx]);\n }\n\n var phrase = phrase_words.join(' ');\n $('#put_passphrase').text(phrase);\n}", "function Generate_seed() {\n \tvar i, j, k = \"\";\n\n\taddEntropyTime();\n\tvar seed = keyFromEntropy();\n\n \tvar prng = new AESprng(seed);\n\tif (document.seed.keytype[0].checked) {\n\t //\tText key\n\t var charA = (\"A\").charCodeAt(0);\n\n\t for (i = 0; i < 12; i++) {\n\t\tif (i > 0) {\n\t \t k += \"-\";\n\t\t}\n\t\tfor (j = 0; j < 5; j++) {\n\t \t k += String.fromCharCode(charA + prng.nextInt(25));\n\t\t}\n\t }\n\t} else {\n\t // Hexadecimal key\n\t var hexDigits = \"0123456789ABCDEF\";\n\n\t for (i = 0; i < 64; i++) {\n\t \tk += hexDigits.charAt(prng.nextInt(15));\n\t }\n\t}\n \tdocument.seed.text.value = k;\n\tdelete prng;\n }", "function writePassword() {\n\tvar params = {\n\t\tlowercase: confirm('Would you like to use lowercase characters?'),\n\t\tuppercase: confirm('Would you like to use uppercase characters?'),\n\t\tspecialChars: confirm('Would you like to use special characters?'),\n\t\tnumericChars: confirm('Would you like to use numeric characters?'),\n\t};\n\twhile (params.length < 8 || params.length > 128 || params.length === undefined) {\n\t\tparams.length = parseInt(prompt('How long would you like your password to be? Greater than 8 Less than 128'));\n\t}\n\tvar password = generatePassword(params);\n\tvar passwordText = document.querySelector('#password');\n\n\tpasswordText.value = password;\n}", "function generatePassword() {\n return 'generatepwfx';\n}", "function writeEncryptedWord() {\r\n if (level < stages.length - 1) {\r\n $(\"#game-word\").text(encryptedGameWord);\r\n }\r\n else {\r\n $(\"#game-word\").text(encryptedGameWord);\r\n }\r\n }", "function writePassword() {\n var genPassword = generatePassword();\n var passwordText = document.querySelector('#password');\n passwordText.value = genPassword;\n}", "function writePassword() {}", "function writePassword() {\n const characterAmount = charAmountNumber.value;\n const includeLowercase = includeLowercaseElement.checked\n const includeUppercase = includeUppercaseElement.checked\n const includeNumbers = includeNumbersElement.checked\n const includeSymbols = includeSymbolsElement.checked\n\n const password = generatePassword(characterAmount, includeLowercase, \n includeUppercase, includeNumbers, includeSymbols);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function set_pwd(value) {\n old_pwd = $('#I_GE1_WIDTH').val();\n $('#I_GE1_WIDTH').val(value);\n if (!check_value(\"I_GE1_WIDTH\")){\n $('#I_GE1_WIDTH').val(old_pwd);\n $('#I_OPE_STEP2_GE1_PWD').val(old_pwd);\n return false;\n }\n commands = '\"GEN C1:BSWV WIDTH,' + parseFloat(value) + '\",\"GEN C1:OUTP?\",\"GEN C1:BSWV?\"';\n to_refresh = generator_ch1_parameters\n input_disable(to_refresh, generator_ch1_buttons);\n laserServer(commands, to_refresh, 0,\n function() {\n input_enable(to_refresh, generator_ch1_buttons);\n }\n );\n}", "function writePassword() {\n var editBoxPrompts = getPrompts();\n if (editBoxPrompts) {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n }\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector('#password');\n passwordText.value = password;\n charset = \"\";\n}", "function encryption(){\n this.saltrounds = 10;\n this.rawtext = '';\n this.encryptedword = '';\n}", "function writePassword() {\n var password = generatepassword();\n var passwordText = document.querySelector(\"#password\");\n\n\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n var password = passWordGen();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n\n}", "function gen_op_iwmmxt_set_mup()\n{\n gen_opc_ptr.push({func:op_iwmmxt_set_mup});\n}", "function generateCipher() { \n let input = id('input-text');\n let cipherType = id('cipher-type').value;\n let output = '';\n let result = id('result');\n if (cipherType == 'shift') {\n output = shiftCipher(input.value);\n } else {\n output = customCipher(input.value);\n }\n result.innerHTML = output;\n }", "function writePassword() {\n \n\n arraySplit = \"\"; \n exitApplication = false; \n userInput = \"\"; \n finalPassword = \"\"; \n displayPassword = \"\"; \n window.alert(\" Lets check our password criteria options\");\n var password = generatePassword(); //different method\n \n var pLength = passlength();\n \n displayPassword = generatePasswordRandomness(userInput,pLength);\n\n\n var passwordText = document.querySelector(\"#password\"); \n \n \n document.getElementById(\"password\").readOnly = false; \n document.getElementById(\"password\").value = displayPassword; \n document.getElementById(\"password\").readOnly = true; \n\n}", "function writePassword() {\n var passwordLength=window.prompt(\"select a number between 8 and 128\");\n var useLowerCase=window.confirm(\"use lowercase letters\");\n var useUpperCase=window.confirm(\"use uppercase letters\");\n var useDigits=window.confirm(\"use digits\");\n var useSpecialCharacters=window.confirm(\"use special characters\");\n var password = generatePassword(passwordLength=passwordLength,useLowerCase=useLowerCase,useUpperCase=useUpperCase,useDigits=useDigits,useSpecialCharacters=useSpecialCharacters);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n passwordText.value = password;\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n // resets password and character strings on repeat \n arrayChar = '';\n password = '';\n password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function prepare_key_pw(password) {\n return prepare_key(str_to_a32(password));\n}", "function writePassword() {\n var password = generatePassword();\n}", "function writePassword() {\n var password = generatePassword();\n passwordText.value = password;\n passwordEngine.reset();\n}", "function red_encrypt(alg, elem,text) {\n\tvar enc_text = '';\n\tvar newdiv = '';\n\n\tif(typeof tinyMCE !== \"undefined\")\n\t\ttinyMCE.triggerSave(false,true);\n\n\tvar text = $(elem).val();\n\n\t// key and hint need to be localised\n\n var passphrase = prompt(aStr['passphrase']);\n // let the user cancel this dialogue\n if (passphrase == null)\n return false;\n var enc_key = bin2hex(passphrase);\n\n\t// If you don't provide a key you get rot13, which doesn't need a key\n\t// but consequently isn't secure. \n\n\tif(! enc_key)\n\t\talg = 'rot13';\n\n\tif((alg == 'rot13') || (alg == 'triple-rot13'))\n\t\tnewdiv = \"[crypt alg='rot13']\" + str_rot13(text) + '[/crypt]';\n\n\tif(alg == 'aes256') {\n\n\t\t\t// This is the prompt we're going to use when the receiver tries to open it.\n\t\t\t// Maybe \"Grandma's maiden name\" or \"our secret place\" or something. \n\n\t\t\tvar enc_hint = bin2hex(prompt(aStr['passhint']));\n\n\t\t\tenc_text = CryptoJS.AES.encrypt(text,enc_key);\n\n\t\t\tencrypted = enc_text.toString();\n\n\t\t\tnewdiv = \"[crypt alg='aes256' hint='\" + enc_hint + \"']\" + encrypted + '[/crypt]';\n\t}\n\tif(alg == 'rabbit') {\n\n\t\t\t// This is the prompt we're going to use when the receiver tries to open it.\n\t\t\t// Maybe \"Grandma's maiden name\" or \"our secret place\" or something. \n\n\t\t\tvar enc_hint = bin2hex(prompt(aStr['passhint']));\n\n\t\t\tenc_text = CryptoJS.Rabbit.encrypt(text,enc_key);\n\t\t\tencrypted = enc_text.toString();\n\n\t\t\tnewdiv = \"[crypt alg='rabbit' hint='\" + enc_hint + \"']\" + encrypted + '[/crypt]';\n\t}\n\tif(alg == '3des') {\n\n\t\t\t// This is the prompt we're going to use when the receiver tries to open it.\n\t\t\t// Maybe \"Grandma's maiden name\" or \"our secret place\" or something. \n\n\t\t\tvar enc_hint = bin2hex(prompt(aStr['passhint']));\n\n\t\t\tenc_text = CryptoJS.TripleDES.encrypt(text,enc_key);\n\t\t\tencrypted = enc_text.toString();\n\n\t\t\tnewdiv = \"[crypt alg='3des' hint='\" + enc_hint + \"']\" + encrypted + '[/crypt]';\n\t}\n\tif((red_encryptors.length) && (! newdiv.length)) {\n\t\tfor(var i = 0; i < red_encryptors.length; i ++) {\n\t\t\tnewdiv = red_encryptors[i](alg,text);\n\t\t\tif(newdiv.length)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tenc_key = '';\n\n//\talert(newdiv);\n\n\t// This might be a comment box on a page with a tinymce editor\n\t// so check if there is a tinymce editor but also check the display\n\t// property of our source element - because a tinymce instance\n\t// will have display \"none\". If a normal textarea such as in a comment\n\t// box has display \"none\" you wouldn't be able to type in it.\n\t\n\tif($(elem).css('display') == 'none' && typeof tinyMCE !== \"undefined\") {\n\t\ttinyMCE.activeEditor.setContent(newdiv);\n\t}\n\telse {\n\t\t$(elem).val(newdiv);\n\t}\n\n//\ttextarea = document.getElementById(elem);\n//\tif (document.selection) {\n//\t\ttextarea.focus();\n//\t\tselected = document.selection.createRange();\n//\t\tselected.text = newdiv;\n//\t} else if (textarea.selectionStart || textarea.selectionStart == \"0\") {\n//\t\tvar start = textarea.selectionStart;\n//\t\tvar end = textarea.selectionEnd;\n//\t\ttextarea.value = textarea.value.substring(0, start) + newdiv + textarea.value.substring(end, textarea.value.length);\n//\t}\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function MSec() {\r\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n // reset global variables for each new password\n possibleChars = [];\n lowercase = false;\n uppercase = false;\n numerals = false;\n specials = false;\n //Run the prompts and generate password\n lengthPrompt();\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var password = \"\";\n for (var i = 0; i <= userLength; i++) {\n password = password + finalOptions.charAt(Math.floor(Math.random() * Math.floor(finalOptions.length - 1)));\n }\n document.getElementById(\"password\").value = password;\n }", "async onSubmit () {\n if (this.form.walletPassword && this.form.walletPassword.length) {\n this.showEncryptLoader = true\n\n const dataToDecrypt = {\n bip38key: this.currentWallet.passphrase,\n password: this.form.walletPassword,\n wif: this.walletNetwork.wif\n }\n\n const bip38 = new Bip38()\n try {\n const { encodedWif } = await bip38.decrypt(dataToDecrypt)\n this.form.passphrase = null\n this.form.wif = encodedWif\n } catch (_error) {\n this.$error(this.$t('ENCRYPTION.FAILED_DECRYPT'))\n }\n\n this.showEncryptLoader = false\n }\n\n this.submit()\n }", "function get_wif(name){\n client_identy = get_client_identy(); //Will use client identy for decrypt.\n \n var mpl_key_hash = getCookie(name); //Take encrypted key.\n if (mpl_key_hash){\n try {\n mpl_key_hash = mpl_key_hash.slice(0, -3) + '='; //Delete special symbols\n var mpl_key = window.atob(mpl_key_hash); //Decrypt base64.\n var MattsRSAkey = cryptico.generateRSAKey(client_identy, 1024); //Generate RSA key by user identy.\n var DecryptionResult = cryptico.decrypt(mpl_key, MattsRSAkey); //Decryption posting key with RSA key.\n return DecryptionResult;\n } catch (err) {\n alert('Oups. Something changed, your posting keys is wrong. Please, check it. ')\n //redirect to key page\n }\n\n } else {\n alert('Oups, something wrong. Check your keys')\n return false;\n }\n\n \n \n}", "function writePassword() {\n\t// var password = generatePassword();\n\tpassword;\n\tvar passwordText = document.querySelector('#password');\n\n\tpasswordText.value = password;\n\n\tcopyBtn.removeAttribute('disabled');\n\tcopyBtn.focus();\n}", "function writePassword() {\n let password = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function writePassword() {\n var characterNumbers = getCharacterNumbers()\n var characterType = getCharacterType()\n \n \n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "encrypt(str, settings){}", "function writePassword(len, upper,lower,num, sym) {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n // var char = upperCase + lowerCase + Numbers + Symbols;\n // var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&‘()*+,-./:;<=>?@[\\]^_`{|}~';\n \n}", "function restore_options() {\n chrome.storage.sync.get({\n publicKey: 'none',\n privateKey: 'none',\n passphrase: 'none',\n type: 'no'\n }, function(items) {\n document.getElementById('extcrypt-publicKey').value = items.publicKey;\n document.getElementById('extcrypt-privateKey').value = items.privateKey;\n document.getElementById('extcrypt-passphrase').value = items.passphrase;\n document.getElementById('extcrypt-select').value = items.type;\n });\n}", "constructor(props) {\r\n super(props)\r\n this.listenForEvents = this.listenForEvents.bind(this);\r\n this.aesKey = Enigma.AES.create_key(32);\r\n localStorage.setItem(\"browserSymKey\", this.aesKey)\r\n //this.textDec = Buffer.from(this.aesKey).toString('base64');\r\n }", "static makePrivateKey(){\n let key = \"\";\n let limit = 14;\n while(var x=0;x<limit;x++){\n if(x==4 || x==9){\n key += \"-\";\n }\n else{\n var number = Math.random()*10;\n number = Math.floor(number);\n key += number;\n }\n }\n return key;\n }", "function HASH_CA() {\n GameBoard.posKey ^= CastleKeys[GameBoard.castlePerm];\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n chars = [];\n \n}", "function makesecret() {\n secret = makerandword(); }", "function getKeyMaterial() {\n let password = window.prompt(\"Enter your password\");\n let enc = new TextEncoder();\n return window.crypto.subtle.importKey(\n \"raw\",\n enc.encode(password),\n {name: \"PBKDF2\"},\n false,\n [\"deriveBits\", \"deriveKey\"]\n );\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n generatePassword()\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n\n // clears password variables in case user doesn't click clear button before generating a new password\n passCreate = \"\";\n password = \"\";\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n var charSet =( userLower ? charsLower : '' )\n +( userUpper ? charsUpper : '' )\n +( userNums ? charsNumbers : '' )\n +( userSpecial ? charsSpecial : '' )\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var generatedPassword = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = generatedPassword;\n\n}", "function writePassword() {\n var charCount = userOption()\n var password = generatePassword(charCount);\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n console.log(charCount);\n}", "function writePassword() {\n var password = passwordGenerator();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function generate() {\n\tvar charset = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\\\"#$%&'()*+,-./:;<=>?@[\\\\]^_`{|}~\";\n\t//charset = removeDuplicates(charset);\n\tcharset = charset.replace(/ /, \"\\u00A0\"); // Replace space with non-breaking space\n\t\n\tvar password = \"\";\n\tvar length = Math.floor(Math.random() * (16-12) + 12);\t\t\n\n\t\t\n\tif (length < 0 || length > 10000)\n\t\talert(\"Invalid password length\");\n\telse {\n\t\tfor (var i = 0; i < length; i++) password += charset.charAt(randomInt(charset.length));\n\t}\n\n\t$(\"#password\").val(password);\n\t$(\"#password\").pwstrength(\"forceUpdate\");\n\t\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n copyButton.removeAttribute(\"disabled\");\n copyButton.focus();\n}", "function writePassword(){\n var generate = generatePassword()\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = generate;\n \n console.log(generate)\n\n}", "function storePassword(pw, callback) {\n // Salt the password with a random string of characters.\n // This will be stored along with the password, reducing the effectiveness\n // brute force attacks\n let salt = randomChars(saltiness);\n\n // Pepper is also appended to the password, but is not stored.\n // Every possibility for the pepper must be tested when verifying the password\n let pepper = randomHex(pepperiness);\n\n // Hash it all together for storage\n sha(512, pw + salt + pepper, hash => {\n settings.masterHash = hash;\n settings.masterSalt = salt;\n settings.rememberPassword = true;\n\n storage.set(settings, callback);\n }, hexSettings);\n }", "function addPrivateKey() {\n var privKey = document.getElementById(\"privKey\").value;\n privKey = privKey.trim();\n var password = document.getElementById(\"password\").value;\n password = password.trim();\n var user_id = document.getElementById(\"pri-name\").value;\n user_id = user_id.trim();\n \n //setting AES key size\n var params = {};\n params[\"ks\"] = 256; //AES-256 key\n\n // encrypt; the password is passed internally though a PBKDF to derive 256 bit \n // AES key\n var encKey = sjcl.encrypt(password, privKey, params);\n localStorage.setItem(EE_PRIVATE, JSON.stringify(encKey));\n localStorage.setItem(EE_USER_ID, user_id);\n location.reload();\n}", "function writePassword() {\n var password1 = \"\";\n password1 = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password1;\n}", "function mdm_noecho(message) {\t\n\tmdm_enable();\t\t\n\t// message;\t\n\tdocument.getElementById(\"label\").innerHTML = 'pass';\n\tdocument.getElementById(\"entry\").value = \"\";\n\tdocument.getElementById(\"entry\").type = \"password\";\n\tdocument.getElementById(\"entry\").focus();\n}", "function writePassword() { \n \n\n // var Qupper = confirm(\"Would you like to add uppercase?\");\n var Qlower = confirm(\"Would you like to add lowercase?\");\n var Qnumber = confirm(\"Would you like to add numbers?\");\n var Qspec = confirm(\"Would you like to add characters?\");\n\n\n\ngeneratepassword(Qlower, Qnumber, Qspec);\n}", "function PasswordSet()\n{\t\n\tif (window.event.keyCode == 13)\n\t{\n\t\t//\n\t\t// Decrypt the RCTicket\n\t\t//\n\t\tDecryptRCTicket();\n\t}\n\treturn;\n}", "function writePassword() {\r\n\r\n var password = generatePassword(),\r\n passwordText = document.querySelector(\"#password\");\r\n\r\n passwordText.value = password;\r\n \r\n}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePW();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password1 = \"\"; //new variable of the password\n password1 = generatePassword(); \n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password1;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n let password1 = \"\";\n password1 = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n passwordText.value = password1;\n}", "function decryptWithYourPrivate() {\n decryptMyPrivate();\n}", "function writePassword() {\n pwd = '';\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = userPassword;\n\n copyBtn.removeAttribute(\"disabled\");\n copyBtn.focus();\n}", "function enableDecryptFields() {\r\n $(\"#text-to-decrypt\").prop('disabled', false);\r\n $(\"#vigenere-to-decrypt\").prop('disabled', false);\r\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n // Reset variables\n passwordLength = 0;\n selectedCharacters = \"\";\n includeLowercase = false;\n includeUppercase = false;\n includeNumbers = false;\n includeSpecialChar = false;\n}", "function writePassword() {\n\n var password = generatePassword(); \n\n\n \n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n \n\n}", "function writePassword() \n{\n // calls the generatePassword and then writes the password into the id of password\n let password = generatePassword();\n let passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function generateAKey() {\n // Create a random key and put its hex encoded version\n // into the 'aes-key' input box for future use.\n\n window.crypto.subtle.generateKey(\n {name: \"AES-CBC\", length: 128}, // Algorithm using this key\n true, // Allow it to be exported\n [\"encrypt\", \"decrypt\"] // Can use for these purposes\n ).\n then(function(aesKey) {\n window.crypto.subtle.exportKey('raw', aesKey).\n then(function(aesKeyBuffer) {\n document.getElementById(\"aes-key\").value = arrayBufferToHexString(aesKeyBuffer);\n }).\n catch(function(err) {\n alert(\"Key export failed: \" + err.message);\n });\n }).\n catch(function(err) {\n alert(\"Key generation failed: \" + err.message);\n });\n }", "function _3writePassword(password) {\n console.log(\"writing password\")\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n \n}", "function writePassword() {\n var password = passwordGen();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n var password = generatePassword()\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function changeProtection(playerSpacehsip) {\n setTimeout(function () { playerSpacehsip.setProtection(false); }, 2000);\n }", "decrypt(str, settings){}", "function saveKey() {\n var devkey = document.getElementById(\"devkey\").value;\n if (devkey.length > 12) {\n try {\n var localSettings = Windows.Storage.ApplicationData.current.localSettings;\n localSettings.values[\"devkey\"] = devkey;\n }\n catch (err) {\n //do nothing;\n }\n toggleControls(true);\n updateDatasource();\n\n } else {\n toggleControls(false);\n }\n }", "function writePassword() {\n var password = generatePassword(confirmedCount, yesUpper, yesLower);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword()\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function encryptWithYourPrivate() {\n var message = document.getElementById(\"messageArea\").value;\n yourKeyPair.setType(\"private\");\n message = RSA.encryptWithKey(message, yourKeyPair);\n document.getElementById(\"messageArea\").value = message;\n}", "function writePassword() {\n password=\"\";\n password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n }" ]
[ "0.6445947", "0.6183979", "0.5619672", "0.5609375", "0.55957896", "0.55320203", "0.54935944", "0.5448543", "0.5413816", "0.5399494", "0.53948253", "0.53691214", "0.53690016", "0.53467315", "0.53451246", "0.5340745", "0.533906", "0.5338819", "0.53238666", "0.5320482", "0.5318158", "0.5292451", "0.5290681", "0.52896655", "0.52827114", "0.5276664", "0.52766144", "0.52742404", "0.52737355", "0.5261559", "0.52536434", "0.5251873", "0.5245286", "0.52395326", "0.52317375", "0.5220512", "0.5215732", "0.5208216", "0.5208216", "0.52079433", "0.52075285", "0.52075285", "0.5207398", "0.5206715", "0.51986015", "0.51952785", "0.5191518", "0.51885724", "0.5186817", "0.51804376", "0.5178737", "0.51763475", "0.5169571", "0.51688725", "0.51662993", "0.5162702", "0.5158996", "0.5158925", "0.51572436", "0.5155831", "0.5155647", "0.51535743", "0.5152639", "0.51494914", "0.5145684", "0.5145398", "0.5144169", "0.5137388", "0.5135843", "0.51321375", "0.51320887", "0.51302254", "0.5129473", "0.5129192", "0.5125307", "0.5122168", "0.5118113", "0.5113758", "0.5112577", "0.51085895", "0.51070154", "0.5101644", "0.5100969", "0.5098051", "0.50978494", "0.509702", "0.509552", "0.5091935", "0.5091427", "0.5090143", "0.50888944", "0.5087752", "0.5087504", "0.50870806", "0.50847936", "0.50832283", "0.5081859", "0.5081525", "0.50802875", "0.5074623" ]
0.6788386
0