Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if base64

// How to check if a string is base64 encoded
// Originally from willnode https://stackoverflow.com/users/3908409/willnode

/* 
Checks if:
 - Length is divisible by 4
 - It uses A-Z, a-z, 0-9, +/=
 - Uses = at the end (within 0-3 characters)
*/

function isBase64(str) {
    return str.length % 4 == 0 && /^[A-Za-z0-9+/]+[=]{0,3}$/.test(str);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: float js precision 
Javascript :: input javascript console 
Javascript :: set default terminal vscode windows 
Javascript :: load js after ajax 
Javascript :: onclick focus out jquery 
Javascript :: move an element into another jquery 
Javascript :: aws beanstalk nodejs redirect http to https 
Javascript :: react slick slider duplicate items when infinite true #1623 
Javascript :: object notation and array notation dynamic class binding vuejs 
Javascript :: drm react native 
Javascript :: puppeteer inner text 
Javascript :: remove event listener react hooks 
Javascript :: remove file from input type file jquery 
Javascript :: change value krajee star rating using jquery 
Javascript :: onclick change text color javascript 
Javascript :: keyup addeventlistener 
Javascript :: set timer jquery 
Javascript :: javascript create variable containing an object that will contain three properties that store the length of each side of the box 
Javascript :: javascript go to page 
Javascript :: get base url vuejs 
Javascript :: npm react redux logger 
Javascript :: check if object is empty javascript 
Javascript :: sum an array in javascript 
Javascript :: negative number error handling in javascript 
Javascript :: scroll to bottom of a div react 
Javascript :: how to filter an array of objects in javascript 
Javascript :: select option trigger in js 
Javascript :: change styles when element enters viewport 
Javascript :: check if date is valid 
Javascript :: delete elment javascript after fade out 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =