How to use isEmpty method in wpt

Best JavaScript code snippet using wpt

validators.ts

Source:validators.ts Github

copy

Full Screen

...6export const validateLoginInput = (7 data: DoctorTypes | PatientTypes | AdminTypes8) => {9 let errors = <DoctorTypes | PatientTypes | AdminTypes>{};10 data.email = !isEmpty(data.email) ? data.email : '';11 data.password = !isEmpty(data.password) ? data.password : '';12 if (Validator.isEmpty(data.email)) {13 errors.email = 'Email field is required';14 } else if (!Validator.isEmail(data.email)) {15 errors.email = 'Email is invalid';16 }17 if (Validator.isEmpty(data.password)) {18 errors.password = 'Password field is required';19 }20 return {21 errors,22 isValid: isEmpty(errors),23 };24};25export const ValidateDoctorRegisterInput = (data: DoctorTypes) => {26 const errors = <DoctorTypes>{};27 data.fullname = !isEmpty(data.fullname) ? data.fullname : '';28 data.email = !isEmpty(data.email) ? data.email : '';29 data.password = !isEmpty(data.password) ? data.password : '';30 data.confirmPassword = !isEmpty(data.confirmPassword)31 ? data.confirmPassword32 : '';33 data.reg_num = !isEmpty(data.reg_num) ? data.reg_num : '';34 data.specialization = !isEmpty(data.specialization)35 ? data.specialization36 : '';37 data.hospital_name = !isEmpty(data.hospital_name) ? data.hospital_name : '';38 data.phone = !isEmpty(data.phone) ? data.phone : '';39 data.age = !isEmpty(data.age) ? data.age : '';40 data.gender = !isEmpty(data.gender) ? data.gender : '';41 data.address = !isEmpty(data.address) ? data.address : '';42 if (Validator.isEmpty(data.fullname)) {43 errors.fullname = 'Name field is required';44 }45 if (Validator.isEmpty(data.address)) {46 errors.address = 'Address field is required';47 }48 if (Validator.isEmpty(data.specialization)) {49 errors.specialization = 'Specialization field is required';50 }51 if (Validator.isEmpty(data.reg_num)) {52 errors.reg_num = 'Registration Number field is required';53 }54 if (Validator.isEmpty(data.hospital_name)) {55 errors.hospital_name = 'Hospital Name field is required';56 }57 if (Validator.isEmpty(data.phone)) {58 errors.phone = 'Contact Number field is required';59 } else if (!Validator.isMobilePhone(data.phone, ['en-IN'])) {60 errors.phone = 'Contact Number is invalid';61 }62 if (Validator.isEmpty(data.email)) {63 errors.email = 'Email field is required';64 } else if (!Validator.isEmail(data.email)) {65 errors.email = 'Email is invalid';66 }67 if (Validator.isEmpty(data.password)) {68 errors.password = 'Password field is required';69 }70 if (Validator.isEmpty(data.confirmPassword)) {71 errors.confirmPassword = 'Confirm password field is required';72 }73 if (!Validator.isLength(data.password, { min: 6, max: 20 })) {74 errors.password = 'Password must be at least 6 characters';75 }76 if (!Validator.equals(data.password, data.confirmPassword)) {77 errors.confirmPassword = 'Passwords must match';78 }79 return {80 errors,81 isValid: isEmpty(errors),82 };83};84export const ValidatePatientRegisterInput = (data: PatientTypes) => {85 const errors = <PatientTypes>{};86 data.fullname = !isEmpty(data.fullname) ? data.fullname : '';87 data.email = !isEmpty(data.email) ? data.email : '';88 data.password = !isEmpty(data.password) ? data.password : '';89 data.phone = !isEmpty(data.phone) ? data.phone : '';90 data.age = !isEmpty(data.age) ? data.age : '';91 data.gender = !isEmpty(data.gender) ? data.gender : '';92 if (Validator.isEmpty(data.fullname)) {93 errors.fullname = 'Name field is required';94 }95 if (Validator.isEmpty(data.phone)) {96 errors.phone = 'Contact Number field is required';97 } else if (!Validator.isMobilePhone(data.phone, ['en-IN'])) {98 errors.phone = 'Please enter valid phone number';99 }100 if (Validator.isEmpty(data.email)) {101 errors.email = 'Email field is required';102 } else if (!Validator.isEmail(data.email)) {103 errors.email = 'Email is invalid';104 }105 if (Validator.isEmpty(data.password)) {106 errors.password = 'Password field is required';107 }108 if (!Validator.isLength(data.password, { min: 6, max: 20 })) {109 errors.password = 'Password must be at least 6 characters';110 }111 if (Validator.isEmpty(data.age)) {112 errors.age = 'Age field is required';113 }114 if (Validator.isEmpty(data.gender)) {115 errors.gender = 'Gender field is required';116 }117 return {118 errors,119 isValid: isEmpty(errors),120 };121};122export const ValidateAdminRegisterInput = (data: AdminTypes) => {123 const errors = <AdminTypes>{};124 data.fullname = !isEmpty(data.fullname) ? data.fullname : '';125 data.email = !isEmpty(data.email) ? data.email : '';126 data.password = !isEmpty(data.password) ? data.password : '';127 data.confirmPassword = !isEmpty(data.confirmPassword)128 ? data.confirmPassword129 : '';130 if (Validator.isEmpty(data.fullname)) {131 errors.fullname = 'Name field is required';132 }133 if (Validator.isEmpty(data.email)) {134 errors.email = 'Email field is required';135 } else if (!Validator.isEmail(data.email)) {136 errors.email = 'Email is invalid';137 }138 if (Validator.isEmpty(data.password)) {139 errors.password = 'Password field is required';140 }141 if (Validator.isEmpty(data.confirmPassword)) {142 errors.confirmPassword = 'Confirm password field is required';143 }144 if (!Validator.isLength(data.password, { min: 6, max: 20 })) {145 errors.password = 'Password must be at least 6 characters';146 }147 if (!Validator.equals(data.password, data.confirmPassword)) {148 errors.confirmPassword = 'Passwords must match';149 }150 return {151 errors,152 isValid: isEmpty(errors),153 };...

Full Screen

Full Screen

validate.py

Source:validate.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2import re3class validate:4 def __init__(self):5 pass6 def phone(self, value, isEmpty=False):7 "validate phone"8 reg = '^1[3458]\d{9}$'9 p = re.compile(reg)10 return (value == '' and isEmpty) or p.match(value)11 def mobile(self, value, isEmpty=False):12 "validate mobile"13 reg = '^(\d{3}-|\d{4}-)?(\d{8}|\d{7})$'14 p = re.compile(reg)15 return (value == '' and isEmpty) or p.match(value)16 def contact1(self, value, isEmpty=False):17 "validate contact"18 reg = '^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$'19 p = re.compile(reg)20 return (value == '' and isEmpty) or p.match(value)21 def contact(self, value, isEmpty=False):22 "validate contact"23 return self.phone(value, isEmpty) or self.mobile(value, isEmpty)24 def qq(self, value, isEmpty=False):25 "validate qq"26 reg = '^[1-9]\d{4,12}$'27 p = re.compile(reg)28 return (value == '' and isEmpty) or p.match(str(value))29 def url(self, value, isEmpty=False):30 "validate url"31 reg = '^(http|https):\/\/[A-Za-z0-9%\-_@]+\.[A-Za-z0-9%\-_@]{2,}[A-Za-z0-9\.\/=\?%\-&_~`@[\]:+!;]*$'32 p = re.compile(reg)33 return (value == '' and isEmpty) or p.match(value)34 def ip(self, value, isEmpty=False):35 "validate ip"36 reg = '^(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5])$'37 p = re.compile(reg)38 return (value == '' and isEmpty) or p.match(value)39 def int(self, value, isEmpty=False):40 "validate int"41 reg = '^\-?\d+$'42 p = re.compile(reg)43 return (value == '' and isEmpty) or p.match(value)44 def mac(self, value, isEmpty=False):45 "validate mac"46 reg_1 = '[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}'47 reg_2 = '[A-F\d]{2}-[A-F\d]{2}-[A-F\d]{2}-[A-F\d]{2}-[A-F\d]{2}-[A-F\d]{2}'48 p_1 = re.compile(reg_1)49 p_2 = re.compile(reg_2)50 return (value == '' and isEmpty) or p_1.match(value) or p_2.match(value)51 def plus(self, value, isEmpty=False):52 "validate plus"53 reg = '^[1-9]\d*$'54 p = re.compile(reg)55 return (value == '' and isEmpty) or p.match(value)56 def number(self, value, isEmpty=False):57 "validate number"58 reg = '^[0-9]+$'59 p = re.compile(reg)60 return (value == '' and isEmpty) or p.match(value)61 def notsc(self, value, isEmpty=False):62 "validate notsc"63 reg = ur'^[-a-zA-Z0-9_\u4e00-\u9fa5\s]+$'64 p = re.compile(reg)65 return (value == '' and isEmpty) or p.match(value)66 def letter(self, value, isEmpty=False):67 "validate letter"68 reg = '^[a-zA-Z]+$'69 p = re.compile(reg)70 return (value == '' and isEmpty) or p.match(value)71 def letterOrNum(self, value, isEmpty=False):72 "validate letter or number"73 reg = '^[0-9a-zA-Z]+$'74 p = re.compile(reg)75 return (value == '' and isEmpty) or p.match(value)76 def legalityName(self, value, isEmpty=False):77 "validate legalityName"78 reg = '^[-a-zA-Z0-9_]+$'79 p = re.compile(reg)80 return (value == '' and isEmpty) or p.match(value)81 def email(self, value, isEmpty=False):82 "validate email"83 #reg=r"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$"84 reg = r"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"85 p = re.compile(reg)86 return (value == '' and isEmpty) or p.match(value)87 def email1(self, value, isEmpty=False):88 reg = ur'^[_a-zA-Z\d@.-]+$';89 p = re.compile(reg)90 return (value == '' and isEmpty) or p.match(value)91 def period(self, value, isEmpty=False):92 va = value.split(':')93 if len(va) != 2: return False94 try:95 return not (int(va[0]) > 23 or int(va[1]) > 59 or int(va[1]) < 0)96 except:97 return False98 return True99 def onlyLetterUrl(self, value, isEmpty=False):100 "validate onlyLetterUrl"101 reg = r"^[a-zA-Z0-9.:/?#=]+$"102 p = re.compile(reg)...

Full Screen

Full Screen

AutoSavePluginTest.ts

Source:AutoSavePluginTest.ts Github

copy

Full Screen

...8 const suite = LegacyUnit.createSuite();9 Plugin();10 Theme();11 suite.test('TestCase-TBA: AutoSave: isEmpty true', function (editor) {12 LegacyUnit.equal(editor.plugins.autosave.isEmpty(''), true);13 LegacyUnit.equal(editor.plugins.autosave.isEmpty(' '), true);14 LegacyUnit.equal(editor.plugins.autosave.isEmpty('\t\t\t'), true);15 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p id="x"></p>'), true);16 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p></p>'), true);17 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p> </p>'), true);18 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p>\t</p>'), true);19 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br></p>'), true);20 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br /></p>'), true);21 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /></p>'), true);22 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br><br></p>'), true);23 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br /><br /></p>'), true);24 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" /></p>'), true);25 });26 suite.test('TestCase-TBA: AutoSave: isEmpty false', function (editor) {27 LegacyUnit.equal(editor.plugins.autosave.isEmpty('X'), false);28 LegacyUnit.equal(editor.plugins.autosave.isEmpty(' X'), false);29 LegacyUnit.equal(editor.plugins.autosave.isEmpty('\t\t\tX'), false);30 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p>X</p>'), false);31 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p> X</p>'), false);32 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p>\tX</p>'), false);33 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br>X</p>'), false);34 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br />X</p>'), false);35 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" />X</p>'), false);36 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br><br>X</p>'), false);37 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br /><br />X</p>'), false);38 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" />X</p>'), false);39 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<h1></h1>'), false);40 LegacyUnit.equal(editor.plugins.autosave.isEmpty('<img src="x" />'), false);41 });42 suite.test('TestCase-TBA: AutoSave: hasDraft/storeDraft/restoreDraft', function (editor) {43 LegacyUnit.equal(editor.plugins.autosave.hasDraft(), false);44 editor.setContent('X');45 editor.undoManager.add();46 editor.plugins.autosave.storeDraft();47 LegacyUnit.equal(editor.plugins.autosave.hasDraft(), true);48 editor.setContent('Y');49 editor.undoManager.add();50 editor.plugins.autosave.restoreDraft();51 LegacyUnit.equal(editor.getContent(), '<p>X</p>');52 editor.plugins.autosave.removeDraft();53 });54 suite.test('TestCase-TBA: AutoSave: recognises location hash change', function (editor) {...

Full Screen

Full Screen

range-test.js

Source:range-test.js Github

copy

Full Screen

...48 "returns a descending range if step is negative": function(range) {49 assert.deepEqual(range(5, 0, -1), [5, 4, 3, 2, 1]);50 },51 "returns an empty range if start, stop or step are NaN": function(range) {52 assert.isEmpty(range(0, NaN));53 assert.isEmpty(range(1, NaN));54 assert.isEmpty(range(-1, NaN));55 assert.isEmpty(range(0, undefined));56 assert.isEmpty(range(1, undefined));57 assert.isEmpty(range(-1, undefined));58 assert.isEmpty(range(NaN, 0));59 assert.isEmpty(range(NaN, 1));60 assert.isEmpty(range(NaN, -1));61 assert.isEmpty(range(undefined, 0));62 assert.isEmpty(range(undefined, 1));63 assert.isEmpty(range(undefined, -1));64 assert.isEmpty(range(NaN, NaN));65 assert.isEmpty(range(undefined, undefined));66 assert.isEmpty(range(NaN, NaN, NaN));67 assert.isEmpty(range(undefined, undefined, undefined));68 assert.isEmpty(range(0, 10, NaN));69 assert.isEmpty(range(10, 0, NaN));70 assert.isEmpty(range(0, 10, undefined));71 assert.isEmpty(range(10, 0, undefined));72 },73 "returns an empty range if start equals stop": function(range) {74 assert.isEmpty(range(10, 10));75 assert.isEmpty(range(10, 10, 1));76 assert.isEmpty(range(10, 10, -1));77 assert.isEmpty(range(10, 10, -.5));78 assert.isEmpty(range(10, 10, .5));79 assert.isEmpty(range(0, 0));80 assert.isEmpty(range(0, 0, 1));81 assert.isEmpty(range(0, 0, -1));82 assert.isEmpty(range(0, 0, -.5));83 assert.isEmpty(range(0, 0, .5));84 },85 "returns an empty range if stop is less than start and step is positive": function(range) {86 assert.isEmpty(range(20, 10));87 assert.isEmpty(range(20, 10, 2));88 assert.isEmpty(range(20, 10, 1));89 assert.isEmpty(range(20, 10, .5));90 },91 "returns an empty range if stop is greater than start and step is negative": function(range) {92 assert.isEmpty(range(10, 20, -2));93 assert.isEmpty(range(10, 20, -1));94 assert.isEmpty(range(10, 20, -.5));95 }96 }97});...

Full Screen

Full Screen

setkonstruktif.py

Source:setkonstruktif.py Github

copy

Full Screen

1from list3 import *23#DefSpek4#MakeSet: list --> set5#MakeSet(L) membentuk sebuah set dari List (membuang setiap kemunculan yang lebih dari 1 kali)67def MakeSet(L):8 if IsEmpty(L):9 return L # Basis10 else:11 if IsMember(FirstElmt(L),Tail(L)):12 return MakeSet(Tail(L))13 else:14 return Konso(FirstElmt(L),MakeSet(Tail(L)))1516#DefSpek17#IsSet: list --> boolean18#IsSet(L) bernilai True jika L adalah sebuah set1920def IsSet(L):21 if IsEmpty(L):22 return True # List Kosong adalah Himpunan Kosong23 else:24 if IsMember(LastElmt(L),Head(L)):25 return False26 else:27 return IsSet(Head(L))2829#DefSpek30#IsSubSet: 2 set --> Boolean31#IsSubSet(H1,H2) bernilai True jika semua elemen H1 adalah elemen H23233def IsSubSet(H1,H2):34 if IsEmpty(H1): # Basis35 return True36 else: # Analisa Kasus37 if not IsMember(LastElmt(H1),H2):38 return False39 else: # e anggota H240 return IsSubSet(Head(H1),H2)4142#DefSpek43#IsEQSet: 2 set --> Boolean44#IsEQSet(H1,H2) bernilai True jika elemen H1 sama dengan elemen H24546def IsEQSet(H1,H2):47 if IsSubSet(H1,H2) and IsSubSet(H2,H1):48 return True49 else:50 return False5152#DefSpek53#IsIntersect: 2 set --> Boolean54#IsIntersect(H1,H2) bernilai True jika elemen H1 dan H2 interseksi5556def IsIntersect(H1,H2):57 if IsEmpty(H1) and IsEmpty(H2):58 return False59 elif not IsEmpty(H1) and IsEmpty(H2):60 return False61 elif IsEmpty(H1) and not IsEmpty(H2):62 return False63 elif IsMember(LastElmt(H1),H2):64 return True65 else:66 return IsIntersect(Head(H1),H2)6768#DefSpek69#MakeIntersect: 2 set --> set70#MakeIntersect(H1,H2) membuat set interseksi H1 dan H27172def MakeIntersect(H1,H2):73 if IsEmpty(H1) and IsEmpty(H2):74 return []75 elif not IsEmpty(H1) and IsEmpty(H2):76 return []77 elif IsEmpty(H1) and not IsEmpty(H2):78 return []79 else:80 if IsMember(FirstElmt(H1),H2):81 return Konso(FirstElmt(H1),MakeIntersect(Tail(H1),H2))82 else:83 return MakeIntersect(Tail(H1),H2)8485#DefSpek86#MakeUnion: 2 set --> set87#MakeUnion(H1,H2) membuat set union dari H1 dan H28889def MakeUnion(H1,H2):90 if(IsEmpty(H1) and IsEmpty(H2)):91 return []92 elif(not IsEmpty(H1) and IsEmpty(H2)):93 return H194 elif(IsEmpty(H1) and not IsEmpty(H2)):95 return H296 elif(not IsEmpty(H1) and not IsEmpty(H2)):97 if(IsMember(FirstElmt(H1),H2)):98 return MakeUnion(Tail(H1),H2)99 else:100 return Konso(FirstElmt(H1),MakeUnion(Tail(H1),H2))101102#DefSpek103#MakeMinus: 2 set --> set104#MakeMinus(H1,H2) membuat set baru dimana anggota H1 yang bukan merupakan anggota H2105106def MakeMinus(H1,H2):107 if IsEmpty(H1): 108 return []109 elif IsEmpty(H2):110 return H1111 elif IsMember(FirstElmt(H1),H2):112 return MakeMinus(Tail(H1),H2)113 else :114 return Konso(FirstElmt(H1),MakeMinus(Tail(H1),H2))115116#DefSpek117#MakeKomplemen: 2 set --> set118#MakeKomplemen(H1,H2) membuat set baru yang anggotanya adalah anggota semua anggota H1 dan H2119# tetapi bukan interseksi keduanya120121def MakeKomplemen(H1,H2):122 return MakeMinus(H1,H2)+MakeMinus(H2,H1)123 ...

Full Screen

Full Screen

autosave.js

Source:autosave.js Github

copy

Full Screen

...15 });16 }17});18test("isEmpty true", function() {19 ok(editor.plugins.autosave.isEmpty(''));20 ok(editor.plugins.autosave.isEmpty(' '));21 ok(editor.plugins.autosave.isEmpty('\t\t\t'));22 ok(editor.plugins.autosave.isEmpty('<p id="x"></p>'));23 ok(editor.plugins.autosave.isEmpty('<p></p>'));24 ok(editor.plugins.autosave.isEmpty('<p> </p>'));25 ok(editor.plugins.autosave.isEmpty('<p>\t</p>'));26 ok(editor.plugins.autosave.isEmpty('<p><br></p>'));27 ok(editor.plugins.autosave.isEmpty('<p><br /></p>'));28 ok(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /></p>'));29 ok(editor.plugins.autosave.isEmpty('<p><br><br></p>'));30 ok(editor.plugins.autosave.isEmpty('<p><br /><br /></p>'));31 ok(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" /></p>'));32});33test("isEmpty false", function() {34 ok(!editor.plugins.autosave.isEmpty('X'));35 ok(!editor.plugins.autosave.isEmpty(' X'));36 ok(!editor.plugins.autosave.isEmpty('\t\t\tX'));37 ok(!editor.plugins.autosave.isEmpty('<p>X</p>'));38 ok(!editor.plugins.autosave.isEmpty('<p> X</p>'));39 ok(!editor.plugins.autosave.isEmpty('<p>\tX</p>'));40 ok(!editor.plugins.autosave.isEmpty('<p><br>X</p>'));41 ok(!editor.plugins.autosave.isEmpty('<p><br />X</p>'));42 ok(!editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" />X</p>'));43 ok(!editor.plugins.autosave.isEmpty('<p><br><br>X</p>'));44 ok(!editor.plugins.autosave.isEmpty('<p><br /><br />X</p>'));45 ok(!editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" />X</p>'));46 ok(!editor.plugins.autosave.isEmpty('<h1></h1>'));47 ok(!editor.plugins.autosave.isEmpty('<img src="x" />'));48});49test("hasDraft/storeDraft/restoreDraft", function() {50 ok(!editor.plugins.autosave.hasDraft());51 editor.setContent('X');52 editor.undoManager.add();53 editor.plugins.autosave.storeDraft();54 ok(editor.plugins.autosave.hasDraft());55 editor.setContent('Y');56 editor.undoManager.add();57 editor.plugins.autosave.restoreDraft();58 equal(editor.getContent(), '<p>X</p>');...

Full Screen

Full Screen

profile.js

Source:profile.js Github

copy

Full Screen

2const isEmpty = require("./is-empty");3//const isEmpty = require("lodash.isempty");4module.exports = function validateProfileInput(data) {5 let errors = {};6 data.handle = !isEmpty(data.handle) ? data.handle : "";7 data.status = !isEmpty(data.status) ? data.status : "";8 data.skills = !isEmpty(data.skills) ? data.skills : "";9 data.website = !isEmpty(data.website) ? data.website : "";10 data.youtube = !isEmpty(data.youtube) ? data.youtube : "";11 data.twitter = !isEmpty(data.twitter) ? data.twitter : "";12 data.facebook = !isEmpty(data.facebook) ? data.facebook : "";13 data.linkedin = !isEmpty(data.linkedin) ? data.linkedin : "";14 data.instagram = !isEmpty(data.instagram) ? data.instagram : "";15 if (!Validator.isLength(data.handle, { min: 2, max: 30 })) {16 errors.handle = "Handle needs to between 2 and 30 characters.";17 }18 if (Validator.isEmpty(data.handle)) {19 errors.handle = "Profile handle is required";20 }21 if (Validator.isEmpty(data.status)) {22 errors.status = "Status field is required";23 }24 // A not required field, but to check URL needs to check notEmpty25 if (!isEmpty(data.website)) {26 if (!Validator.isURL(data.website)) {27 errors.website = "Not a valid URL";28 }29 }30 if (!isEmpty(data.youtube)) {31 if (!Validator.isURL(data.youtube)) {32 errors.youtube = "Not a valid URL";33 }34 }35 if (!isEmpty(data.twitter)) {36 if (!Validator.isURL(data.twitter)) {37 errors.twitter = "Not a valid URL";38 }39 }40 if (!isEmpty(data.facebook)) {41 if (!Validator.isURL(data.facebook)) {42 errors.facebook = "Not a valid URL";43 }44 }45 if (!isEmpty(data.linkedin)) {46 if (!Validator.isURL(data.linkedin)) {47 errors.linkedin = "Not a valid URL";48 }49 }50 if (!isEmpty(data.instagram)) {51 if (!Validator.isURL(data.instagram)) {52 errors.instagram = "Not a valid URL";53 }54 }55 return {56 errors,57 isValid: isEmpty(errors)58 };...

Full Screen

Full Screen

c3q4.py

Source:c3q4.py Github

copy

Full Screen

...8 def __len__(self):9 return max(len(self.main), len(self.temp))10 11 def _transferStacks(self):12 if not self.main.isEmpty():13 while not self.main.isEmpty():14 self.temp.push(self.main.pop())15 elif not self.temp.isEmpty():16 while not self.temp.isEmpty():17 self.main.push(self.temp.pop())18 19 def pop(self):20 if self.main.isEmpty() and self.temp.isEmpty():21 raise Exception('Queue empty')22 elif self.main.isEmpty():23 self._transferStacks()24 return self.main.pop()25 26 def push(self, item):27 if self.main.isEmpty() and not self.temp.isEmpty():28 self._transferStacks()29 self.main.push(item)30 def popleft(self):31 if self.main.isEmpty() and self.temp.isEmpty():32 raise Exception('Queue empty')33 elif not self.main.isEmpty() and self.temp.isEmpty():34 self._transferStacks()35 return self.temp.pop()36 37 def pushleft(self, item):38 if not self.main.isEmpty() and self.temp.isEmpty():39 self._transferStacks()40 self.temp.push(item)41class Test(unittest.TestCase):42 def test_basic(self):43 myQueue = MyQueue()44 myQueue.push(1)45 myQueue.push(2)46 myQueue.push(3)47 myQueue.push(4)48 self.assertEqual(myQueue.pop(), 4)49 self.assertEqual(myQueue.popleft(), 1)50if __name__ == '__main__':...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = require('wpt');3var wpt = require('wpt');4var wpt = require('wpt');5var wpt = require('wpt');6var wpt = require('wpt');7var wpt = require('wpt');8var wpt = require('wpt');9var wpt = require('wpt');10var wpt = require('wpt');11var wpt = require('wpt');12var wpt = require('wpt');13wpt.isEmpty("

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new wpt('API_KEY');3 if (err) {4 console.log(err);5 }6 console.log(data);7});8var wpt = require('wpt');9var wpt = new wpt('API_KEY');10wpt.getLocations(function(err, data) {11 if (err) {12 console.log(err);13 }14 console.log(data);15});16var wpt = require('wpt');17var wpt = new wpt('API_KEY');18wpt.getTesters(function(err, data) {19 if (err) {20 console.log(err);21 }22 console.log(data);23});24var wpt = require('wpt');25var wpt = new wpt('API_KEY');26wpt.getTest('TEST_ID', function(err, data) {27 if (err) {28 console.log(err);29 }30 console.log(data);31});32var wpt = require('wpt');33var wpt = new wpt('API_KEY');34wpt.getTestResults('TEST_ID', function(err, data) {35 if (err) {36 console.log(err);37 }38 console.log(data);39});40var wpt = require('wpt');41var wpt = new wpt('API_KEY');42wpt.getTestStatus('TEST_ID', function(err, data) {43 if (err) {44 console.log(err);45 }46 console.log(data);47});48var wpt = require('wpt');49var wpt = new wpt('API_KEY');50wpt.getTestStatus('TEST_ID', function(err, data) {51 if (err) {52 console.log(err);53 }54 console.log(data);55});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var isEmpty = wpt.isEmpty;3var str = 'Hello World!';4console.log(isEmpty(str));5var wpt = require('wpt');6var str = 'Hello World!';7console.log(wpt.isEmpty(str));8var wpt = require('wpt');9var str = 'Hello World!';10console.log(wpt.isEmpty(str));11var wpt = require('wpt');12var str = 'Hello World!';13console.log(wpt.isEmpty(str));14var wpt = require('wpt');15var str = 'Hello World!';16console.log(wpt.isEmpty(str));17var wpt = require('wpt');18var str = 'Hello World!';19console.log(wpt.isEmpty(str));20var wpt = require('wpt');21var str = 'Hello World!';22console.log(wpt.isEmpty(str));23var wpt = require('wpt');24var str = 'Hello World!';25console.log(wpt.isEmpty(str));26var wpt = require('wpt');27var str = 'Hello World!';28console.log(wpt.isEmpty(str));29var wpt = require('wpt');30var str = 'Hello World!';31console.log(wpt.isEmpty(str));32var wpt = require('wpt');33var str = 'Hello World!';34console.log(wpt.isEmpty(str));

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptoolkit = require('wptoolkit');2var isEmpty = wptoolkit.isEmpty;3var str = '';4var result = isEmpty(str);5console.log(result);6var wptoolkit = require('wptoolkit');7var isEmpty = wptoolkit.isEmpty;8var str = ' ';9var result = isEmpty(str);10console.log(result);11var wptoolkit = require('wptoolkit');12var isEmpty = wptoolkit.isEmpty;13var str = 'a';14var result = isEmpty(str);15console.log(result);16var wptoolkit = require('wptoolkit');17var isEmpty = wptoolkit.isEmpty;18var str = ' a ';19var result = isEmpty(str);20console.log(result);21var wptoolkit = require('wptoolkit');22var isEmpty = wptoolkit.isEmpty;23var str = ' a b ';24var result = isEmpty(str);25console.log(result);26var wptoolkit = require('wptoolkit');27var isEmpty = wptoolkit.isEmpty;28var str = 'a b';29var result = isEmpty(str);30console.log(result);31var wptoolkit = require('wptoolkit');32var isEmpty = wptoolkit.isEmpty;33var str = 'a b ';34var result = isEmpty(str);35console.log(result);36var wptoolkit = require('wptoolkit');37var isEmpty = wptoolkit.isEmpty;38var str = ' a b';39var result = isEmpty(str);40console.log(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wptObj = new wpt('your api key');3wptObj.getTestResults('testId', function(err, data){4 if(err){5 console.log(err);6 }else{7 if(wptObj.isEmpty(data)){8 console.log('Test Results are empty');9 }else{10 console.log('Test Results are not empty');11 }12 }13});14The MIT License (MIT)15Copyright (c) 2015 Suman Kumar

Full Screen

Using AI Code Generation

copy

Full Screen

1var editor = CKEDITOR.instances['editor1'];2var isEmpty = editor.plugins.wptextpattern.isEmpty();3if ( isEmpty ) {4 $('#value').val('1');5} else {6 $('#value').val('0');7}8$('#form').submit();

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful