new conversions: dec<->hex, dec<->bin
This commit is contained in:
		
							parent
							
								
									e2b78b6e93
								
							
						
					
					
						commit
						cb4fddc56b
					
				
					 2 changed files with 70 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -1 +1,3 @@ | |||
| *~ | ||||
| .idea/ | ||||
| *.iml | ||||
|  |  | |||
							
								
								
									
										68
									
								
								dencode.js
									
										
									
									
									
								
							
							
						
						
									
										68
									
								
								dencode.js
									
										
									
									
									
								
							|  | @ -99,6 +99,40 @@ | |||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		{ | ||||
| 			"id": "hextodec", | ||||
| 			"name": "Decode hex as decimal", | ||||
| 			"convert": function (input) { | ||||
| 				try { | ||||
| 					return { | ||||
| 						"status": "OK", | ||||
| 						"content": parseInt(input, 16).toString(10) | ||||
| 					}; | ||||
| 				} catch (exception) { | ||||
| 					return { | ||||
| 						"status": "ERROR", | ||||
| 						"content": "Invalid number (integer) string." | ||||
| 					}; | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		{ | ||||
| 			"id": "bintodec", | ||||
| 			"name": "Decode binary as decimal", | ||||
| 			"convert": function (input) { | ||||
| 				try { | ||||
| 					return { | ||||
| 						"status": "OK", | ||||
| 						"content": parseInt(input, 2).toString(10) | ||||
| 					}; | ||||
| 				} catch (exception) { | ||||
| 					return { | ||||
| 						"status": "ERROR", | ||||
| 						"content": "Invalid number (integer) string." | ||||
| 					}; | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		{ | ||||
| 			"id": "base64encode", | ||||
| 			"name": "Encode Base64", | ||||
|  | @ -154,6 +188,40 @@ | |||
| 					"content": quotedPrintable.encode(utf8.encode(input)) | ||||
| 				}; | ||||
| 			} | ||||
| 		}, | ||||
| 		{ | ||||
| 			"id": "dectohex", | ||||
| 			"name": "Encode decimal as hex", | ||||
| 			"convert": function (input) { | ||||
| 				try { | ||||
| 					return { | ||||
| 						"status": "OK", | ||||
| 						"content": parseInt(input).toString(16) | ||||
| 					}; | ||||
| 				} catch (exception) { | ||||
| 					return { | ||||
| 						"status": "ERROR", | ||||
| 						"content": "Invalid number (integer) string." | ||||
| 					}; | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		{ | ||||
| 			"id": "dectobin", | ||||
| 			"name": "Encode decimal as binary", | ||||
| 			"convert": function (input) { | ||||
| 				try { | ||||
| 					return { | ||||
| 						"status": "OK", | ||||
| 						"content": parseInt(input).toString(2) | ||||
| 					}; | ||||
| 				} catch (exception) { | ||||
| 					return { | ||||
| 						"status": "ERROR", | ||||
| 						"content": "Invalid number (integer) string." | ||||
| 					}; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	]; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue