Best JavaScript code snippet using best
custom_datatypes.js
Source:custom_datatypes.js
...82 isLegal: function (lexicalForm) {83 return lengthRegex.test(lexicalForm);84 },85 recognisesDatatype: function (datatypeUri) {86 return this.getUri() === datatypeUri;87 },88 getRecognisedDatatypes: function () {89 return [this.getUri()];90 },91 isEqual: function (lexicalForm1, lexicalForm2, datatypeUri2) {92 if(datatypeUri2 === undefined) {93 datatypeUri2 = this.getUri();94 }95 if (this.getUri() === datatypeUri2) {96 return this.getVoltage(lexicalForm1) === this.getVoltage(lexicalForm2);97 }98 return false;99 },100 compare: function (lexicalForm1, lexicalForm2, datatypeUri2) {101 if(datatypeUri2 === undefined) {102 datatypeUri2 = this.getUri();103 }104 if (this.getUri() === datatypeUri2) {105 var metres1 = this.getVoltage(lexicalForm1);106 var metres2 = this.getVoltage(lexicalForm2);107 if (metres1 < metres2) {108 return -1;109 } else if (metres1 === metres2) {110 return 0;111 } else if (metres1 > metres2) {112 return 1;113 }114 }115 return false;116 },117 getNormalForm: function (lexicalForm) {118 if (!Length.isLegal(lexicalForm)) {119 throw new Error("Non legal lexical form");120 }121 return this.getVoltage(lexicalForm) + " m";122 },123 importLiteral: function (lexicalForm, datatypeUri) {124 // transforms lexicalForm^^datatypeUri to return^^this.getUri() 125 if (this.getUri() === datatypeUri) {126 return lexicalForm;127 }128 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);129 },130 exportLiteral: function (lexicalForm, datatypeUri) {131 // transforms lexicalForm^^this.getUri() to return^^datatypeUri 132 if (this.getUri() === datatypeUri) {133 return lexicalForm;134 }135 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);136 }137 };138 var volumeRegex = /^([-+]?[0-9]*\.?[0-9]+)([eE]([-+]?[0-9]+))? ?((y|z|a|f|p|n|μ|m|c|d|da|h|k|M|G|T|P|E|Z|Y)?(l|m3))$/;139 var Volume = {140 getCubicMeter: function (lexicalForm) {141 var parse = lexicalForm.match(volumeRegex);142 if (parse === null) {143 throw new Error("illegal lexical form");144 }145 var value = parse[1];146 var sigNum = Math.max(value.length,7);147 var exponent = parse[3];148 if (exponent !== undefined) {149 value *= Math.pow(10, exponent);150 }151 if (parse[6] === "l") {152 value *= Math.pow(10, 3*metricprefixes[prefix]);153 var prefix = parse[5];154 if (prefix !== undefined) {155 value *= Math.pow(10, metricprefixes[prefix]);156 }157 } else {158 var prefix = parse[5];159 if (prefix !== undefined) {160 value *= Math.pow(10, 3*metricprefixes[prefix]);161 }162 }163 return Math.round(value*Math.pow(10, sigNum))/Math.pow(10, sigNum);164 },165 getUri: function () {166 return "https://w3id.org/lindt/custom_datatypes#volume";167 },168 isLegal: function (lexicalForm) {169 return volumeRegex.test(lexicalForm);170 },171 recognisesDatatype: function (datatypeUri) {172 return this.getUri() === datatypeUri;173 },174 getRecognisedDatatypes: function () {175 return [this.getUri()];176 },177 isEqual: function (lexicalForm1, lexicalForm2, datatypeUri2) {178 if(datatypeUri2 === undefined) {179 datatypeUri2 = this.getUri();180 }181 if (this.getUri() === datatypeUri2) {182 return this.getCubicMeter(lexicalForm1) === this.getCubicMeter(lexicalForm2);183 }184 return false;185 },186 compare: function (lexicalForm1, lexicalForm2, datatypeUri2) {187 if(datatypeUri2 === undefined) {188 datatypeUri2 = this.getUri();189 }190 if (this.getUri() === datatypeUri2) {191 var volume1 = this.getCubicMeter(lexicalForm1);192 var volume2 = this.getCubicMeter(lexicalForm2);193 if (volume1 < volume2) {194 return -1;195 } else if (volume1 === volume2) {196 return 0;197 } else if (volume1 > volume2) {198 return 1;199 }200 }201 return false;202 },203 getNormalForm: function (lexicalForm) {204 if (!Volume.isLegal(lexicalForm)) {205 throw new Error("Non legal lexical form");206 }207 return this.getCubicMeter(lexicalForm) + " m3";208 },209 importLiteral: function (lexicalForm, datatypeUri) {210 // transforms lexicalForm^^datatypeUri to return^^this.getUri() 211 if (this.getUri() === datatypeUri) {212 return lexicalForm;213 }214 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);215 },216 exportLiteral: function (lexicalForm, datatypeUri) {217 // transforms lexicalForm^^this.getUri() to return^^datatypeUri 218 if (this.getUri() === datatypeUri) {219 return lexicalForm;220 }221 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);222 }223 };224 var tempRegex = /^([-+]?[0-9]*\.?[0-9]+)([eE]([-+]?[0-9]+))? ?°(F|C|K)$/;225 var Temperature = {226 getCelsius: function (lexicalForm) {227 var parse = lexicalForm.match(tempRegex);228 if (parse === null) {229 throw new Error("illegal lexical form");230 }231 var value = parse[1];232 var sigNum = Math.max(value.length,7);233 var exponent = parse[3];234 if (exponent !== undefined) {235 value *= Math.pow(10, exponent);236 }237 if (parse[4] === "F") {238 value = ( value - 32 ) * 5/9;239 } else if (parse[4] === "K") {240 value = value + 273.15;241 }242 return Math.round(value*Math.pow(10, sigNum))/Math.pow(10, sigNum);243 },244 getUri: function () {245 return "https://w3id.org/lindt/custom_datatypes#temperature";246 },247 isLegal: function (lexicalForm) {248 return tempRegex.test(lexicalForm);249 },250 recognisesDatatype: function (datatypeUri) {251 return this.getUri() === datatypeUri;252 },253 getRecognisedDatatypes: function () {254 return [this.getUri()];255 },256 isEqual: function (lexicalForm1, lexicalForm2, datatypeUri2) {257 if(datatypeUri2 === undefined) {258 datatypeUri2 = this.getUri();259 }260 if (this.getUri() === datatypeUri2) {261 return this.getCelsius(lexicalForm1) === this.getCelsius(lexicalForm2);262 }263 return false;264 },265 compare: function (lexicalForm1, lexicalForm2, datatypeUri2) {266 if(datatypeUri2 === undefined) {267 datatypeUri2 = this.getUri();268 }269 if (this.getUri() === datatypeUri2) {270 var temp1 = this.getCelsius(lexicalForm1);271 var temp2 = this.getCelsius(lexicalForm2);272 if (temp1 < temp2) {273 return -1;274 } else if (temp1 === temp2) {275 return 0;276 } else if (temp1 > temp2) {277 return 1;278 }279 }280 return false;281 },282 getNormalForm: function (lexicalForm) {283 if (!Length.isLegal(lexicalForm)) {284 throw new Error("Non legal lexical form");285 }286 return this.getCelsius(lexicalForm) + " °C";287 },288 importLiteral: function (lexicalForm, datatypeUri) {289 // transforms lexicalForm^^datatypeUri to return^^this.getUri() 290 if (this.getUri() === datatypeUri) {291 return lexicalForm;292 }293 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);294 },295 exportLiteral: function (lexicalForm, datatypeUri) {296 // transforms lexicalForm^^this.getUri() to return^^datatypeUri 297 if (this.getUri() === datatypeUri) {298 return lexicalForm;299 }300 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);301 }302 };303 var voltageRegex = /^([-+]?[0-9]*\.?[0-9]+)([eE]([-+]?[0-9]+))? ?((y|z|a|f|p|n|μ|m|c|d|da|h|k|M|G|T|P|E|Z|Y)?V)$/;304 var Voltage = {305 getVoltage: function (lexicalForm) {306 var parse = lexicalForm.match(voltageRegex);307 if (parse === null) {308 throw new Error("illegal lexical form");309 }310 var value = parse[1];311 var sigNum = Math.max(value.length,7);312 var exponent = parse[3];313 if (exponent !== undefined) {314 value *= Math.pow(10, exponent);315 }316 var prefix = parse[5];317 if (prefix !== undefined) {318 value *= Math.pow(10, metricprefixes[prefix]);319 }320 return Math.round(value*Math.pow(10, sigNum))/Math.pow(10, sigNum);321 },322 getUri: function () {323 return "https://w3id.org/lindt/custom_datatypes#voltage";324 },325 isLegal: function (lexicalForm) {326 return voltageRegex.test(lexicalForm);327 },328 recognisesDatatype: function (datatypeUri) {329 return this.getUri() === datatypeUri;330 },331 getRecognisedDatatypes: function () {332 return [this.getUri()];333 },334 isEqual: function (lexicalForm1, lexicalForm2, datatypeUri2) {335 if(datatypeUri2 === undefined) {336 datatypeUri2 = this.getUri();337 }338 if (this.getUri() === datatypeUri2) {339 return this.getVoltage(lexicalForm1) === this.getVoltage(lexicalForm2);340 }341 return false;342 },343 compare: function (lexicalForm1, lexicalForm2, datatypeUri2) {344 if(datatypeUri2 === undefined) {345 datatypeUri2 = this.getUri();346 }347 if (this.getUri() === datatypeUri2) {348 var voltage1 = this.getVoltage(lexicalForm1);349 var voltage2 = this.getVoltage(lexicalForm2);350 if (voltage1 < voltage2) {351 return -1;352 } else if (voltage1 === voltage2) {353 return 0;354 } else if (voltage1 > voltage2) {355 return 1;356 }357 }358 return false;359 },360 getNormalForm: function (lexicalForm) {361 if (!Length.isLegal(lexicalForm)) {362 throw new Error("Non legal lexical form");363 }364 return this.getVoltage(lexicalForm) + " V";365 },366 importLiteral: function (lexicalForm, datatypeUri) {367 // transforms lexicalForm^^datatypeUri to return^^this.getUri() 368 if (this.getUri() === datatypeUri) {369 return lexicalForm;370 }371 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);372 },373 exportLiteral: function (lexicalForm, datatypeUri) {374 // transforms lexicalForm^^this.getUri() to return^^datatypeUri 375 if (this.getUri() === datatypeUri) {376 return lexicalForm;377 }378 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);379 }380 };381 382 383 var electricIntensityRegex = /^([-+]?[0-9]*\.?[0-9]+)([eE]([-+]?[0-9]+))? ?((y|z|a|f|p|n|μ|m|c|d|da|h|k|M|G|T|P|E|Z|Y)?A)$/;384 var ElectricIntensity = {385 getAmpere: function (lexicalForm) {386 var parse = lexicalForm.match(electricIntensityRegex);387 if (parse === null) {388 throw new Error("illegal lexical form");389 }390 var value = parse[1];391 var sigNum = Math.max(value.length,7);392 var exponent = parse[3];393 if (exponent !== undefined) {394 value *= Math.pow(10, exponent);395 }396 var prefix = parse[5];397 if (prefix !== undefined) {398 value *= Math.pow(10, metricprefixes[prefix]);399 }400 return Math.round(value*Math.pow(10, sigNum))/Math.pow(10, sigNum);401 },402 getUri: function () {403 return "https://w3id.org/lindt/custom_datatypes#electricIntensity";404 },405 isLegal: function (lexicalForm) {406 return electricIntensityRegex.test(lexicalForm);407 },408 recognisesDatatype: function (datatypeUri) {409 return this.getUri() === datatypeUri;410 },411 getRecognisedDatatypes: function () {412 return [this.getUri()];413 },414 isEqual: function (lexicalForm1, lexicalForm2, datatypeUri2) {415 if(datatypeUri2 === undefined) {416 datatypeUri2 = this.getUri();417 }418 if (this.getUri() === datatypeUri2) {419 return this.getAmpere(lexicalForm1) === this.getAmpere(lexicalForm2);420 }421 return false;422 },423 compare: function (lexicalForm1, lexicalForm2, datatypeUri2) {424 if(datatypeUri2 === undefined) {425 datatypeUri2 = this.getUri();426 }427 if (this.getUri() === datatypeUri2) {428 var ampere1 = this.getAmpere(lexicalForm1);429 var ampere2 = this.getAmpere(lexicalForm2);430 if (ampere1 < ampere2) {431 return -1;432 } else if (ampere1 === ampere2) {433 return 0;434 } else if (ampere1 > ampere2) {435 return 1;436 }437 }438 return false;439 },440 getNormalForm: function (lexicalForm) {441 if (!Length.isLegal(lexicalForm)) {442 throw new Error("Non legal lexical form");443 }444 return this.getAmpere(lexicalForm) + " A";445 },446 importLiteral: function (lexicalForm, datatypeUri) {447 // transforms lexicalForm^^datatypeUri to return^^this.getUri() 448 if (this.getUri() === datatypeUri) {449 return lexicalForm;450 }451 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);452 },453 exportLiteral: function (lexicalForm, datatypeUri) {454 // transforms lexicalForm^^this.getUri() to return^^datatypeUri 455 if (this.getUri() === datatypeUri) {456 return lexicalForm;457 }458 throw new Error("datatype " + this.getUri() + " does not recognize datatype " + datatypeUri);459 }460 };461 if (uri === Length.getUri() || uri ==="http://w3id.org/lindt/v1/custom_datatypes#length") {462 return Length;463 } else if (uri === Volume.getUri() || uri === "http://w3id.org/lindt/v1/custom_datatypes#volume") {464 return Volume;465 } else if (uri === Temperature.getUri() || uri === "http://w3id.org/lindt/v1/custom_datatypes#temperature") {466 return Temperature;467 } else if (uri === Voltage.getUri() || uri === "http://w3id.org/lindt/v1/custom_datatypes#voltage") {468 return Voltage;469 } else if (uri === ElectricIntensity.getUri() || uri === "http://w3id.org/lindt/v1/custom_datatypes#electricIntensity") {470 return ElectricIntensity;471 } 472 ...
AppConstants.js
Source:AppConstants.js
...23};24const AppConstants = {25 assetsDomain: ASSETS_DOMAIN,26 backgroundColor: "black",27 // HomeScreenImage: {height: 2880, width: 5120, src: getUri("031_cover_noword.png")},28 HomeScreenImage: {29 height: 2880,30 width: 5120,31 src: {32 uri: `${ASSETS_DOMAIN}/assets/031_cover_kstr2.png`,33 },34 },35 NoWordCoverImage: {36 height: 2880,37 width: 5120,38 src: {39 uri: getUri("031_cover_noword.png"),40 },41 },42 // HomeScreenImage: {height: 2880, width: 5120, src: {uri: require('./assets/031_cover_noword.png')}},43 themeImage: {44 Sad: { height: 2880, width: 5120, src: getUri("028_sad_nosign.png") },45 Pumped: { height: 2880, width: 5120, src: getUri("032_pumped_nosign.png") },46 Cloudy: { height: 2880, width: 5120, src: getUri("034_cloud_nosign.png") },47 Romantic: {48 height: 2880,49 width: 5120,50 src: getUri("036_romantic_nosign.png"),51 },52 Icy: { height: 2880, width: 5120, src: getUri("038_snow_nosign.png") },53 Party: { height: 2880, width: 5120, src: getUri("039_party_nosign.png") },54 Beach: { height: 2880, width: 5120, src: getUri("042_beach_nosign.png") },55 Weird: { height: 2880, width: 5120, src: getUri("043_weird_nosign.png") },56 Home: { height: 2880, width: 5120, src: getUri("044_home_nosign.png") },57 Space: { height: 2880, width: 5120, src: getUri("045_space_nosign.png") },58 Happy: { height: 2880, width: 5120, src: getUri("046_happy_nosign.png") },59 Lazy: { height: 2880, width: 5120, src: getUri("047_lazy_nosign.png") },60 },61 themeColors: {62 Home: createColorTheme("#ffffff", "#b4a7d6", "#8e7cc380"),63 Pumped: createColorTheme("#ead1dc", "#d5a6bd", "#4c11305f"),64 Lazy: createColorTheme("#d9ead3", "#b6d7a8", "#274e135e"),65 Happy: createColorTheme("#fff2cc", "#ffe599", "#7f60005c"),66 Weird: createColorTheme("#ead1dc", "#d5a6bd", "#4c11305f"),67 Sad: createColorTheme("#f3f3f3", "#efefef", "#6666665e"),68 Romantic: createColorTheme("#ead1dc", "#d5a6bd", "#4c11305f"),69 Home: createColorTheme("#fce5cd", "#f9cb9c", "#783f045e"),70 Cloudy: createColorTheme("#c9daf8", "#a4c2f4", "#1c458760"),71 Beach: createColorTheme("#cfe2f3", "#9fc5e8", "#0737635e"),72 Party: createColorTheme("#d9d2e9", "#b4a7d6", "#20124d5f"),73 Icy: createColorTheme("#d9d2e9", "#b4a7d6", "#20124d5f"),74 Space: createColorTheme("#d9d2e9", "#b4a7d6", "#20124d5f"),75 },76 themeTitleNames: {77 Pumped: "Pumped!",78 Lazy: "Lazy...",79 Happy: "Happy!",80 Weird: "~ Weird ~",81 Sad: "A Little Sad...",82 Romantic: "Romantic",83 Home: "Home",84 Cloudy: "Through the Clouds",85 Beach: "The Beach",86 Party: "To A Party!",87 Icy: "Somewhere Icy",88 Space: "Outer Space",89 },90 themeTitleBoxSize: {91 Pumped: "60%",92 Lazy: "60%",93 Happy: "50%",94 Weird: "70%",95 Sad: "100%",96 Romantic: "60%",97 Home: "40%",98 Cloudy: "100%",99 Beach: "70%",100 Party: "80%",101 Icy: "100%",102 Space: "80%",103 },104 moodThemes: {105 Sad: "Sad",106 Pumped: "Pumped",107 Romantic: "Romantic",108 Weird: "Weird",109 Happy: "Happy",110 Lazy: "Lazy",111 },112 placeThemes: {113 Cloudy: "Cloudy",114 Icy: "Icy",115 Party: "Party",116 Beach: "Beach",117 Home: "Home",118 Space: "Space",119 },120 themes: {121 Sad: "Sad",122 Pumped: "Pumped",123 Cloudy: "Cloudy",124 Romantic: "Romantic",125 Icy: "Icy",126 Party: "Party",127 Beach: "Beach",128 Weird: "Weird",129 Home: "Home",130 Space: "Space",131 Happy: "Happy",132 Lazy: "Lazy",133 },134 icons: {135 Back: { uri: getUrl("back.png"), name: "Back" },136 Home: { uri: getUrl("home.png"), name: "Home" },137 Cloudy: { uri: getUrl("clouds.png"), name: "Cloudy" },138 Beach: { uri: getUrl("beach.png"), name: "Beach" },139 Party: { uri: getUrl("party.png"), name: "Party" },140 Icy: { uri: getUrl("cold%20updated.png"), name: "Icy" },141 Space: { uri: getUrl("space.png"), name: "Space" },142 Random: { uri: getUrl("random.png"), name: "Random" },143 Weird: { uri: getUrl("weird.png"), name: "Random" },144 Lazy: { uri: getUrl("lazy.png"), name: "Lazy" },145 Pumped: { uri: getUrl("pumped.png"), name: "Pumped" },146 Happy: { uri: getUrl("happy.png"), name: "Happy" },147 Sad: { uri: getUrl("sad.png"), name: "Sad" },148 Romantic: { uri: getUrl("romance.png"), name: "Romantic" },149 },150 backHomeIcon: { src: getUri("back_home_button.png"), name: "BackHome" },151 themePlaylists: {152 Beach: [153 {154 name: "Limonada Fria",155 artist: "FutureYou",156 track: getUri("FutureYou_Limonada%20Fria.wav"),157 },158 {159 name: "Verano En Playa Azul",160 artist: "Michelle Lugo",161 track: getUri("Michelle_VeranoEnPlayaAzul.wav"),162 },163 { name: "By the Bay", artist: "Raydee99", track: getUri("BytheBay.wav") },164 ],165 Icy: [166 {167 name: "A Vast Emptiness",168 artist: "William Joseph Scire",169 track: getUri("scire_william_AVastEmptiness.wav"),170 },171 {172 name: "Winter's Calling",173 artist: "Raydee99",174 track: getUri("Raydee99_Winter's%20Calling.wav"),175 },176 {177 name: "Wintersong",178 artist: 'Carlos "insaneintherainmusic" Eiene',179 track: getUri("Carlos_Wintersong.wav"),180 },181 ],182 Party: [183 {184 name: "Bring It Around",185 artist: "FutureYou",186 track: getUri("FutureYou_BringitAroundTownBoogie.wav"),187 },188 {189 name: "House of Fun",190 artist: "Michelle Lugo",191 track: getUri("Michelle_HouseofFun.wav"),192 },193 {194 name: "Luminous",195 artist: "Pascal Garoute",196 track: getUri("Pascal_Luminous.wav"),197 },198 ],199 Home: [200 {201 name: "Chamomile Among the Stars",202 artist: "Raydee99",203 track: getUri("Raydee99_ChamomileAmongtheStars.wav"),204 },205 {206 name: "Comfort",207 artist: "Dayna Ambrosio",208 track: getUri("DaynaAmbrosio_Comfort.wav"),209 },210 {211 name: "A Place to Stay",212 artist: "Ben Lipkin",213 track: getUri("Ben_APlaceToStay.wav"),214 },215 ],216 Space: [217 {218 name: "Landing On Mars",219 artist: "Madison Denbrock",220 track: getUri("Madison_LandingOnMars_02.wav"),221 },222 {223 name: "Observatory Deck",224 artist: "Brian Mowat",225 track: getUri("Space_BrianMowat_Audioventure_v02.wav"),226 },227 {228 name: "Drifting",229 artist: "Raydee99",230 track: getUri("Drifting%20-%20Mastered.wav"),231 },232 ],233 Cloudy: [234 {235 name: "Taking Flight",236 artist: "Raydee99",237 track: getUri("Raydee99_TakingFlight.wav"),238 },239 {240 name: "Hero's First Flight",241 artist: "Michelle Lugo",242 track: getUri("Michelle_Hero's_First_Flight.wav"),243 },244 {245 name: "Gliding Above the Cloud Sea",246 artist: "Achilles Jiang (Composerkiwi)",247 track: getUri("Gliding_Above_the%20Cloud_Sea.wav"),248 },249 ],250 Lazy: [251 {252 name: "Afternoon Lounging",253 artist: "Ben Lipkin",254 track: getUri("Ben_AfternoonLounging.wav"),255 },256 {257 name: "Lazy Tunes",258 artist: "Raydee99",259 track: getUri("Raydee99_LazyTunes.wav"),260 },261 {262 name: "Unwind",263 artist: "Dayna Ambrosio",264 track: getUri("DaynaAmbrosio_Unwind.wav"),265 },266 ],267 Pumped: [268 {269 name: "Level Up",270 artist: "Trey Rodman (KERO)",271 track: getUri("Trey_Level Up.wav"),272 },273 {274 name: "Chewy Water",275 artist: "Gregory Osborne",276 track: getUri("Greg_ChewyWater_FirstMix.wav"),277 },278 {279 name: "GALAXYâFACTORY",280 artist: "dante / SoundCirclet",281 track: getUri("dante_GALAXY_FACTORY.wav"),282 },283 ],284 Sad: [285 {286 name: "Melan",287 artist: "Corvus Prudens",288 track: getUri("CorvusPrudens_Melan.wav"),289 },290 {291 name: "Remnants of the Past",292 artist: "Raydee99",293 track: getUri("Raydee99_RemnantsofthePast.wav"),294 },295 {296 name: "Allura",297 artist: "Caio M. Jiacomini",298 track: getUri("Caio_Allura.wav"),299 },300 ],301 Romantic: [302 {303 name: "Echo",304 artist: "Sydney Smith",305 track: getUri("sydney_echo.wav"),306 },307 {308 name: "Against the Wind",309 artist: "Madison Denbrock",310 track: getUri("Madison_Romantic01.wav"),311 },312 {313 name: "Timeless Love",314 artist: "Trey Rodman (KERO)",315 track: getUri("Trey_Timeless_Love.wav"),316 },317 ],318 Weird: [319 {320 name: "Woodpecker Disco",321 artist: "Dylan Ever | mudheart",322 track: getUri("dylan_woodpecker_disco.wav"),323 },324 {325 name: "Rip-Off Roo",326 artist: "Pascal Garoute",327 track: getUri("Pascal_Rip_Off_Roo.wav"),328 },329 {330 name: "Duck Tape Medicine",331 artist: "Gregory Osborne",332 track: getUri("Greg_DuctTapeMedicine_FirstMix.wav"),333 },334 ],335 Happy: [336 {337 name: "Can't Drag Me Down",338 artist: "FutureYou",339 track: getUri("FutureYou_Can't_Drag_Me_Down.wav"),340 },341 {342 name: "Sunbeam",343 artist: 'Remi "Candle" Chandler',344 track: getUri("CandleKing_Sunbeam.wav"),345 },346 {347 name: "A Happy Little Valley",348 artist: "Raydee99",349 track: getUri("Raydee99_AHappyLittleValley.wav"),350 },351 ],352 },353 BACKGROUND_IMAGE_HEIGHT: 867,354 BACKGROUND_IMAGE_WIDTH: 1542,355 BUTTON_BORDER_WIDTH: 7,356 GOOGLE_DOCS_TEXT_CONVERSION_RATIO: GOOGLE_DOCS_TEXT_CONVERSION_RATIO,357 TILE_FONT_SIZE: 24 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,358 SUBTITLE_FONT_SIZE: 24 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,359 CLOUDS_TITLE_FONT_SIZE: 19 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,360 CLICK_FONT_SIZE: 14 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,361 ENTRY_FONT_SIZE: 21 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,362 TIME_STAMP_FONT_SIZE: 7 * GOOGLE_DOCS_TEXT_CONVERSION_RATIO,363 LINE_SPACING: 1.15,...
Datatypes.ts
Source:Datatypes.ts
1import { ARTURIResource, ARTLiteral } from "./ARTResources";2import { XmlSchema, RDF, OWL } from "./Vocabulary";34export interface DatatypeRestrictionsMap extends Map<string, DatatypeRestrictionDescription> { } //map of datatype -> restrictions56export class DatatypeUtils {78 public static xsdBuiltInTypes: ARTURIResource[] = [9 XmlSchema.anyURI,10 XmlSchema.base64Binary,11 XmlSchema.boolean,12 XmlSchema.byte,13 XmlSchema.date,14 XmlSchema.dateTime,15 XmlSchema.decimal,16 XmlSchema.double,17 XmlSchema.duration,18 XmlSchema.ENTITIES,19 XmlSchema.ENTITY,20 XmlSchema.float,21 XmlSchema.gDay,22 XmlSchema.gMonth,23 XmlSchema.gMonthDay,24 XmlSchema.gYear,25 XmlSchema.gYearMonth,26 XmlSchema.hexBinary,27 XmlSchema.ID,28 XmlSchema.IDREF,29 XmlSchema.IDREFS,30 XmlSchema.int,31 XmlSchema.integer,32 XmlSchema.language,33 XmlSchema.long,34 XmlSchema.Name,35 XmlSchema.NCName,36 XmlSchema.negativeInteger,37 XmlSchema.NMTOKEN,38 XmlSchema.NMTOKENS,39 XmlSchema.nonNegativeInteger,40 XmlSchema.nonPositiveInteger,41 XmlSchema.normalizedString,42 XmlSchema.NOTATION,43 XmlSchema.positiveInteger,44 XmlSchema.QName,45 XmlSchema.short,46 XmlSchema.string,47 XmlSchema.time,48 XmlSchema.token,49 XmlSchema.unsignedByte,50 XmlSchema.unsignedInt,51 XmlSchema.unsignedLong,52 XmlSchema.unsignedShort,53 ];5455 /**56 * Datatypes defined as "numeric" in the XSD definition57 */58 public static xsdNumericDatatypes: ARTURIResource[] = [59 XmlSchema.byte,60 XmlSchema.decimal,61 XmlSchema.double,62 XmlSchema.float,63 XmlSchema.int,64 XmlSchema.integer,65 XmlSchema.long,66 XmlSchema.negativeInteger,67 XmlSchema.nonNegativeInteger,68 XmlSchema.nonPositiveInteger,69 XmlSchema.positiveInteger,70 XmlSchema.short,71 XmlSchema.unsignedByte,72 XmlSchema.unsignedInt,73 XmlSchema.unsignedLong,74 XmlSchema.unsignedShort,75 ];7677 /**78 * Datatypes for which exists a UI widget or a programmatic check that validate implicitly the value79 * e.g. xsd:boolean, xsd:date, xsd:string or rdf:langString (which are valid simply if not empty)80 */81 public static programmaticallyValidableType: ARTURIResource[] = [82 RDF.langString,83 XmlSchema.boolean,84 XmlSchema.date,85 XmlSchema.dateTime,86 XmlSchema.time,87 XmlSchema.string,88 ];8990 /**91 * Standard restrictions defined by the xsd scheme92 * Useful references:93 * https://www.w3.org/TR/xmlschema11-294 * http://www.datypic.com/sc/xsd/s-datatypes.xsd.html95 * http://books.xmlschemata.org/relaxng/relax-CHP-19.html96 * 97 * the real pattern of xsd:Name is "\i\c*", see here https://github.com/TIBCOSoftware/genxdm/issues/69#issuecomment-12529060398 */99 public static typeRestrictionsMap: Map<string, ConstrainingFacets> = new Map([100 [XmlSchema.anyURI.getURI(), {}],101 [XmlSchema.base64Binary.getURI(), { pattern: "((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?" }],102 [XmlSchema.boolean.getURI(), {}],103 [XmlSchema.byte.getURI(), { minInclusive: -128, maxInclusive: 128, pattern: "[-+]?[0-9]+" }],104 [XmlSchema.date.getURI(), {}],105 [XmlSchema.dateTime.getURI(), {}],106 [XmlSchema.dateTimeStamp.getURI(), { pattern: ".*(Z|(+|-)[0-9][0-9]:[0-9][0-9])" }],107 [XmlSchema.dayTimeDuration.getURI(), {}], //unknown pattern [^YM]*(T.*)?108 [XmlSchema.decimal.getURI(), {}],109 [XmlSchema.double.getURI(), {}],110 [XmlSchema.duration.getURI(), {}],111 [XmlSchema.ENTITIES.getURI(), {}],112 [XmlSchema.ENTITY.getURI(), {}], //unknown pattern \i\c* â© [\i-[:]][\c-[:]]*113 [XmlSchema.float.getURI(), {}],114 [XmlSchema.gDay.getURI(), {}],115 [XmlSchema.gMonth.getURI(), {}],116 [XmlSchema.gMonthDay.getURI(), {}],117 [XmlSchema.gYear.getURI(), {}],118 [XmlSchema.gYearMonth.getURI(), {}],119 [XmlSchema.hexBinary.getURI(), {}],120 [XmlSchema.ID.getURI(), {}], //unknown pattern \i\c* â© [\i-[:]][\c-[:]]*121 [XmlSchema.IDREF.getURI(), {}], //unknown pattern \i\c* â© [\i-[:]][\c-[:]]*122 [XmlSchema.IDREFS.getURI(), {}],123 [XmlSchema.int.getURI(), { minInclusive: -2147483648, maxInclusive: 2147483647, pattern: "[-+]?[0-9]+" }],124 [XmlSchema.integer.getURI(), { pattern: "[-+]?[0-9]+" }],125 [XmlSchema.language.getURI(), { pattern: "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" }],126 [XmlSchema.long.getURI(), { minInclusive: -9223372036854775808, maxInclusive: 9223372036854775807, pattern: "[-+]?[0-9]+" }],127 [XmlSchema.Name.getURI(), { pattern: "[_:A-Za-z][-._:A-Za-z0-9]*" }],128 [XmlSchema.NCName.getURI(), {}], //unknown pattern \i\c* â© [\i-[:]][\c-[:]]*129 [XmlSchema.negativeInteger.getURI(), { maxInclusive: -1, pattern: "[-+]?[0-9]+" }],130 [XmlSchema.NMTOKEN.getURI(), {}],131 [XmlSchema.NMTOKENS.getURI(), {}],132 [XmlSchema.nonNegativeInteger.getURI(), { minInclusive: 0, pattern: "[-+]?[0-9]+" }],133 [XmlSchema.nonPositiveInteger.getURI(), { maxInclusive: 0, pattern: "[-+]?[0-9]+" }],134 [XmlSchema.normalizedString.getURI(), {}],135 [XmlSchema.NOTATION.getURI(), {}],136 [XmlSchema.positiveInteger.getURI(), { minInclusive: 1, pattern: "^[-+]?[0-9]+$" }],137 [XmlSchema.QName.getURI(), {}],138 [XmlSchema.short.getURI(), { minInclusive: -32768, maxInclusive: 32767, pattern: "[-+]?[0-9]+" }],139 [XmlSchema.string.getURI(), {}],140 [XmlSchema.time.getURI(), {}],141 [XmlSchema.token.getURI(), {}],142 [XmlSchema.unsignedByte.getURI(), { minInclusive: 0, maxInclusive: 255, pattern: "[-+]?[0-9]+" }],143 [XmlSchema.unsignedInt.getURI(), { minInclusive: 0, maxInclusive: 4294967295, pattern: "[-+]?[0-9]+" }],144 [XmlSchema.unsignedLong.getURI(), { minInclusive: 0, maxInclusive: 18446744073709551615, pattern: "[-+]?[0-9]+" }],145 [XmlSchema.unsignedShort.getURI(), { minInclusive: 0, maxInclusive: 65535, pattern: "[-+]?[0-9]+" }],146 [XmlSchema.yearMonthDuration.getURI(), { pattern: "-?P((([0-9]+Y)([0-9]+M)?)|([0-9]+M))" }],147 ]);148149 /**150 * Restrictions not defined explicitly in the standards, but defined accordingly their description151 */152 public static notStandardRestrictionsMap: Map<string, ConstrainingFacets> = new Map([153 [OWL.rational.getURI(), { pattern: "[-+]?[0-9]+(/[1-9][0-9]*)*" }], //https://www.w3.org/TR/owl2-syntax/#Real_Numbers.2C_Decimal_Numbers.2C_and_Integers154 ]);155156}157158export class ConstrainingFacets {159 minExclusive?: number;160 minInclusive?: number;161 maxExclusive?: number;162 maxInclusive?: number;163 pattern?: string;164}165166export class DatatypeRestrictionDescription {167 enumerations?: ARTLiteral[];168 facets?: FacetsRestriction;169}170171export class FacetsRestriction {172 base: ARTURIResource;173 facets: ConstrainingFacets = new ConstrainingFacets();
...
Using AI Code Generation
1var BestBuy = require('bestbuy');2var bestbuy = new BestBuy('mykey');3bestbuy.products('(search=galaxy)', {show: 'sku,name,salePrice', page: 1, pageSize: 2}).then(function(data) {4 console.log(data);5});6var BestBuy = require('bestbuy');7var bestbuy = new BestBuy('mykey');8bestbuy.getProduct('1234', {show: 'sku,name,salePrice'}).then(function(data) {9 console.log(data);10});11var BestBuy = require('bestbuy');12var bestbuy = new BestBuy('mykey');13bestbuy.products('(search=galaxy)', {show: 'sku,name,salePrice', page: 1, pageSize: 2}).then(function(data) {14 console.log(data);15});16var BestBuy = require('bestbuy');17var bestbuy = new BestBuy('mykey');18bestbuy.products('(search=galaxy)', {show: 'sku,name,salePrice', page: 1, pageSize: 2}).then(function(data) {19 console.log(data);20});21var BestBuy = require('bestbuy');22var bestbuy = new BestBuy('mykey');23bestbuy.products('(search=galaxy)', {show: 'sku,name,salePrice', page: 1, pageSize: 2}).then(function(data) {24 console.log(data);25});26var BestBuy = require('bestbuy');27var bestbuy = new BestBuy('mykey');28bestbuy.products('(search=galaxy)', {show: 'sku,name,salePrice', page: 1, pageSize: 2}).then(function(data) {29 console.log(data);30});31var BestBuy = require('bestbuy');32var bestbuy = new BestBuy('mykey');33bestbuy.products('(search=galaxy)', {show: 'sku,name
Using AI Code Generation
1var bestBuy = require('BestBuy');2var data = bestBuy.getUri();3Ti.API.info(data);4exports.getUri = function() {5};6var bestBuy = require('BestBuy');7var data = bestBuy.getUri();8Ti.API.info(data);9exports.getUri = function() {10};
Using AI Code Generation
1var bby = require('bestbuy')('your-api-key-here');2bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})3.then(function(data){4 console.log(data);5})6.catch(function(err){7 console.log(err);8});9var bby = require('bestbuy')('your-api-key-here');10bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})11.then(function(data){12 console.log(data);13})14.catch(function(err){15 console.log(err);16});17var bby = require('bestbuy')('your-api-key-here');18bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})19.then(function(data){20 console.log(data);21})22.catch(function(err){23 console.log(err);24});25var bby = require('bestbuy')('your-api-key-here');26bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})27.then(function(data){28 console.log(data);29})30.catch(function(err){31 console.log(err);32});33var bby = require('bestbuy')('your-api-key-here');34bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})35.then(function(data){36 console.log(data);37})38.catch(function(err){39 console.log(err);40});41var bby = require('bestbuy')('your-api-key-here');42bby.products('(search=ipod&salePrice<200)', {show: 'sku,name,salePrice', page: 2, pageSize: 15})
Using AI Code Generation
1var BestBuy = require('bestbuy');2var bestbuy = new BestBuy('your-api-key');3var uri = bestbuy.getUri('/v1/products', {4});5console.log(uri);6var BestBuy = require('bestbuy');7var bestbuy = new BestBuy('your-api-key');8var uri = bestbuy.getUri('/v1/products', {9});10console.log(uri);11var BestBuy = require('bestbuy');12var bestbuy = new BestBuy('your-api-key');13var uri = bestbuy.getUri('/v1/products', {14});15console.log(uri);16var BestBuy = require('bestbuy');17var bestbuy = new BestBuy('your-api-key');18var uri = bestbuy.getUri('/v1/products', {19});20console.log(uri);21var BestBuy = require('bestbuy');22var bestbuy = new BestBuy('your-api-key');23var uri = bestbuy.getUri('/v1/products', {24});25console.log(uri);26var BestBuy = require('bestbuy');27var bestbuy = new BestBuy('your-api-key');28var uri = bestbuy.getUri('/v1/products', {29});30console.log(uri);
Using AI Code Generation
1var BestTime = require('./BestTime');2var bt = new BestTime();3console.log("The URI is: " + bt.getUri());4var BestTime = function() {5}6BestTime.prototype.getUri = function() {7 return this.uri;8}9module.exports = BestTime;
Using AI Code Generation
1var BestBuyAPI = require('./BestBuyAPI.js');2var bestBuy = new BestBuyAPI();3bestBuy.getUri('products(manufacturer=Apple&name=ipod*)', function(err, uri) {4 console.log(uri);5});6BestBuyAPI.prototype.getUri = function(query, cb) {7 if(!query) {8 cb('Query string is required', null);9 } else {10 cb(null, this.baseUri + query + '&apiKey=' + this.apiKey + '&format=json');11 }12};13BestBuyAPI.prototype.get = function(query, cb) {14 this.getUri(query, function(err, uri) {15 if(err) {16 cb(err, null);17 } else {18 request.get(uri, function(err, res, body) {19 if(err) {20 cb(err, null);21 } else {22 cb(null, JSON.parse(body));23 }24 });25 }26 });27};28var BestBuyAPI = require('./BestBuyAPI.js');29var bestBuy = new BestBuyAPI();30bestBuy.get('products(manufacturer=Apple&name=ipod*)', function(err, res) {31 console.log(res);32});33{ total: 7,
Using AI Code Generation
1var bestBuyAPI = require('bestbuy-api');2var bb = new bestBuyAPI('bestbuyapikey');3bb.getUri('products', { sku: '123456' }, function(err, uri) {4 console.log(uri);5});6var bestBuyAPI = require('bestbuy-api');7var bb = new bestBuyAPI('bestbuyapikey');8bb.getUri('products', { sku: '123456' }, function(err, uri) {9 console.log(uri);10});11var bestBuyAPI = require('bestbuy-api');12var bb = new bestBuyAPI('bestbuyapikey');13bb.getUri('products', { sku: '123456' }, function(err, uri) {14 console.log(uri);15});16var bestBuyAPI = require('bestbuy-api');17var bb = new bestBuyAPI('bestbuyapikey');18bb.getUri('products', { sku: '123456' }, function(err, uri) {19 console.log(uri);20});21var bestBuyAPI = require('bestbuy-api');22var bb = new bestBuyAPI('bestbuyapikey');23bb.getUri('products', { sku: '123456' }, function(err, uri) {24 console.log(uri);25});26var bestBuyAPI = require('bestbuy-api');27var bb = new bestBuyAPI('bestbuyapikey');28bb.getUri('products', { sku: '123456' }, function(err, uri) {29 console.log(uri);30});31var bestBuyAPI = require('bestbuy-api');32var bb = new bestBuyAPI('bestbuyapikey');33bb.getUri('products', { sku: '123456' }, function(err, uri) {34 console.log(uri);35});36var bestBuyAPI = require('bestbuy-api');37var bb = new bestBuyAPI('best
Using AI Code Generation
1var request = require('request');2var fs = require('fs');3var path = require('path');4var jsonfile = require('jsonfile');5var file = 'test4.json';6var myObj = {};7var count = 0;8request(url, function(err, resp, body) {9 if (err) {10 console.log(err);11 } else {12 var data = JSON.parse(body);13 var uri = data.products;14 for (var i = 0; i < uri.length; i++) {15 var url1 = uri[i].links[0].href;16 request(url1, function(err, resp, body) {17 if (err) {18 console.log(err);19 } else {20 var data = JSON.parse(body);21 var name = data.name;22 var price = data.salePrice;23 var image = data.image;24 var description = data.longDescription;25 var url = data.url;26 var sku = data.sku;27 var brand = data.manufacturer;28 var model = data.modelNumber;29 var category = data.categoryPath;30 var color = data.color;31 var customerReview = data.customerReviewAverage;32 var customerReviewCount = data.customerReviewCount;33 var shipping = data.freeShipping;34 var sale = data.onSale;35 var stock = data.stock;36 var storePickup = data.storePickup;37 var upc = data.upc;38 var condition = data.condition;39 var releaseDate = data.releaseDate;40 var shippingCost = data.shippingCost;41 var shippingWeight = data.shippingWeight;42 var shippingWeightUnit = data.shippingWeightUnit;43 var shippingHeight = data.shippingHeight;44 var shippingHeightUnit = data.shippingHeightUnit;45 var shippingWidth = data.shippingWidth;46 var shippingWidthUnit = data.shippingWidthUnit;47 var shippingDepth = data.shippingDepth;
Using AI Code Generation
1var BestBuyAPI = require('bestbuy');2var bb = new BestBuyAPI({3});4bb.getUri(4393300, function(err, uri) {5 if (err) {6 console.log(err);7 } else {8 console.log(uri);9 }10});11var BestBuyAPI = require('bestbuy');12var bb = new BestBuyAPI({13});14bb.getUri(4393300, function(err, uri) {15 if (err) {16 console.log(err);17 } else {18 console.log(uri);19 }20});21var BestBuyAPI = require('bestbuy');22var bb = new BestBuyAPI({23});24bb.getUri(4393300, function(err, uri) {25 if (err) {26 console.log(err);27 } else {28 console.log(uri);29 }30});31var BestBuyAPI = require('bestbuy');32var bb = new BestBuyAPI({33});34bb.getUri(4393300, function(err, uri) {35 if (err) {36 console.log(err);37 } else {38 console.log(uri);39 }40});
Using AI Code Generation
1var BestBuyAPI = require('./bestbuyapi');2var api = new BestBuyAPI('your-api-key');3api.getUri('/v1/products(sku=4810000).json', function (err, data) {4 if (err) {5 console.log('Error: ' + err);6 } else {7 console.log(data);8 }9});10api.getUri('/v1/products(sku=4810000).json', function (err, data) {11 if (err) {12 console.log('Error: ' + err);13 } else {14 console.log(data);15 }16});17api.getUri('/v1/products(sku=4810000).json', function (err, data) {18 if (err) {19 console.log('Error: ' + err);20 } else {21 console.log(data);22 }23});24api.getUri('/v1/products(sku=4810000).json', function (err, data) {25 if (err) {26 console.log('Error: ' + err);27 } else {28 console.log(data);29 }30});31api.getUri('/v1/products(sku=4810000).json', function (err, data) {32 if (err) {33 console.log('Error: ' + err);34 } else {35 console.log(data);36 }37});38api.getUri('/v1/products(sku=4810000).json', function (err, data) {39 if (err) {40 console.log('Error: ' + err);41 } else {42 console.log(data);43 }44});45api.getUri('/v1/products(sku=4810000).json', function (err, data) {46 if (err) {47 console.log('Error: ' + err);48 } else {49 console.log(data);50 }51});52api.getUri('/v1/products(sku=4810000).json', function (err, data) {53 if (err) {54 console.log('Error: ' + err);55 } else {56 console.log(data);57 }58});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!