flymis/WebRoot/dojojs/src/validate/common.js
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.validate.common");
dojo.require("dojo.regexp");
dojo.validate.isText = function(/*String*/value, /*Object?*/flags){
// summary:
// Checks if a string has non whitespace characters.
// Parameters allow you to constrain the length.
//
// value: A string
// flags: {length: Number, minlength: Number, maxlength: Number}
// flags.length If set, checks if there are exactly flags.length number of characters.
// flags.minlength If set, checks if there are at least flags.minlength number of characters.
// flags.maxlength If set, checks if there are at most flags.maxlength number of characters.
flags = (typeof flags == "object") ? flags : {};
// test for text
if(/^\s*$/.test(value)){ return false; } // Boolean
// length tests
if(typeof flags.length == "number" && flags.length != value.length){ return false; } // Boolean
if(typeof flags.minlength == "number" && flags.minlength > value.length){ return false; } // Boolean
if(typeof flags.maxlength == "number" && flags.maxlength < value.length){ return false; } // Boolean
return true; // Boolean
}
dojo.validate.isInteger = function(/*String*/value, /*Object?*/flags){
// summary:
// Validates whether a string is in an integer format
//
// value A string
// flags {signed: Boolean|[true,false], separator: String}
// flags.signed The leading plus-or-minus sign. Can be true, false, or [true, false].
// Default is [true, false], (i.e. sign is optional).
// flags.separator The character used as the thousands separator. Default is no separator.
// For more than one symbol use an array, e.g. [",", ""], makes ',' optional.
var re = new RegExp("^" + dojo.regexp.integer(flags) + "$");
return re.test(value); // Boolean
}
dojo.validate.isRealNumber = function(/*String*/value, /*Object?*/flags){
// summary:
// Validates whether a string is a real valued number.
// Format is the usual exponential notation.
//
// value: A string
后面还有 188 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。