validates script
@this   JSONScript
@param  {Any} script script can be any allowed value
@return {Boolean} validation result
324218
function validateScript(script) {
  var valid = this._validate(script);
  validateScript.errors = this._validate.errors;
  return valid;
}
718317
def delete_script(delete=None):  # noqa: E501
    
    if connexion.request.is_json:
        delete = Delete.from_dict(connexion.request.get_json())  # noqa: E501
    return 'do some magic!'
783231
function parseAndAutoValidate(json) {
  try {
    const obj = JSON.parse(json);
    return autoValidate(obj);
  } catch (error) {
    return { isValid: false, error: error };
  }
}
1268507
protected function addValidationMethods(&$script)
    {
        $this->addValidationFailuresAttribute($script);
        $this->addGetValidationFailures($script);
        $this->addValidate($script);
        $this->addDoValidate($script);
    }
698168
function validate () {
    var this$1 = this;
    var args = [], len = arguments.length;
    while ( len-- ) args[ len ] = arguments[ len ];

    var validators;
    var value;
    var cb;
    var ret = true;

    if (args.length === 3) {
      validators = [args[0]];
      value = args[1];
      cb = args[2];
    } else if (args.length === 2) {
      if (isPlainObject(args[0])) {
        validators = [args[0].validator];
        value = args[0].value || this.getValue();
        cb = args[1];
      } else {
        validators = this._keysCached(this._uid.toString(), this.results);
        value = args[0];
        cb = args[1];
      }
    } else if (args.length === 1) {
      validators = this._keysCached(this._uid.toString(), this.results);
      value = this.getValue();
      cb = args[0];
    } else {
      validators = this._keysCached(this._uid.toString(), this.results);
      value = this.getValue();
      cb = null;
    }

    if (args.length === 3 || (args.length === 2 && isPlainObject(args[0]))) {
      ret = this._validate(validators[0], value, cb);
    } else {
      validators.forEach(function (validator) {
        ret = this$1._validate(validator, value, cb);
      });
    }

    return ret
  }
477597
public static Object eval(String script, ScriptContext context) throws ScriptRuntimeException {
		try {
			return compile(script).eval(context);
		} catch (ScriptException e) {
			throw new ScriptRuntimeException(e);
		}
	}
692336
function validate(object, validator, callback) {
  if (typeof callback === 'function') {
    return Joi.validate(object, validator, callback);
  } else {
    return Joi.validate(object, validator);
  }
}
867139
def validate_script_sigs
      bad_inputs = []
      valid = true
      @inputs.each_with_index do |input, index|
        # TODO: confirm whether we need to mess with the block_timestamp arg
        unless self.native.verify_input_signature(index, input.output.transaction.native)
          valid = false
          bad_inputs << index
        end

      end
      {:valid => valid, :inputs => bad_inputs}
    end
149908
private static List<ModelError> validateScriptComponent( File applicationFilesDirectory, Component component ) {
		List<ModelError> result = new ArrayList<> ();

		// There must be a "scripts" directory
		File directory = ResourceUtils.findInstanceResourcesDirectory( applicationFilesDirectory, component );
		List<File> subDirs = Utils.listAllFiles( directory );

		if( !subDirs.isEmpty()) {
			File scriptsDir = new File( directory, SCRIPTS_DIR_NAME );
			if( ! scriptsDir.exists())
				result.add( new ModelError( ErrorCode.REC_SCRIPT_NO_SCRIPTS_DIR, component, component( component )));
		}

		return result;
	}
644493
protected Object evaluate(String script, String scriptName) {
        try {
            Context curCtx = Context.getCurrentContext();
            curCtx.setLanguageVersion(Context.VERSION_1_8);
            return curCtx.evaluateString(programScope, script, scriptName, 1, null);
        } catch (EcmaError rerr) {
            throw new BPjsCodeEvaluationException(rerr);

        } catch (WrappedException wrapped) {
            try {
                throw wrapped.getCause();
            } catch (BPjsException be ) {
                throw be;
            } catch ( IllegalStateException ise ) {
                String msg = ise.getMessage();
                if ( msg.contains("Cannot capture continuation") && msg.contains("executeScriptWithContinuations or callFunctionWithContinuations") ){
                    throw new BPjsCodeEvaluationException("bp.sync called outside of a b-thread");
                } else {
                    throw ise;
                }
            } catch ( Throwable generalException ) {
                throw new BPjsRuntimeException("(Wrapped) Exception evaluating BProgram code: " + generalException.getMessage(), generalException);
            }

        } catch (EvaluatorException evalExp) {
            throw new BPjsCodeEvaluationException(evalExp);
            
        } catch ( Exception exp ) {
            throw new BPjsRuntimeException("Error evaluating BProgram code: " + exp.getMessage(), exp);
        }
    }
668507
private function validateScriptParams()
    {
        $this->script_params = array_intersect_key(
            $this->script_params,
            array_fill_keys(self::$valid_script_params, null)
        );
    }
1168620
@Override
    public Object executeScript(String script)
    {
        Object result = mongoDb.eval(script);
        KunderaCoreUtils.printQuery("Execute mongo jscripts:" + script, showQuery);
        return result;
    }
1187647
function javascript_validation() {
    if ($this->gateway_mode == 'offsite') return '';
    $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
          '    var cc_owner = document.checkout_payment.authorizenet_cc_owner.value;' . "\n" .
          '    var cc_number = document.checkout_payment.authorizenet_cc_number.value;' . "\n";
    if (MODULE_PAYMENT_AUTHORIZENET_USE_CVV == 'True')  {
      $js .= '    var cc_cvv = document.checkout_payment.authorizenet_cc_cvv.value;' . "\n";
    }
    $js .= '    if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "\n" .
          '      error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENET_TEXT_JS_CC_OWNER . '";' . "\n" .
          '      error = 1;' . "\n" .
          '    }' . "\n" .
          '    if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "\n" .
          '      error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENET_TEXT_JS_CC_NUMBER . '";' . "\n" .
          '      error = 1;' . "\n" .
          '    }' . "\n";
    if (MODULE_PAYMENT_AUTHORIZENET_USE_CVV == 'True')  {
      $js .= '    if (cc_cvv == "" || cc_cvv.length < "3" || cc_cvv.length > "4") {' . "\n".
      '      error_message = error_message + "' . MODULE_PAYMENT_AUTHORIZENET_TEXT_JS_CC_CVV . '";' . "\n" .
      '      error = 1;' . "\n" .
      '    }' . "\n" ;
    }
    $js .= '  }' . "\n";
    return $js;
  }
932279
@Check
	public void checkTopElementsAreUnique(SarlScript script) {
		final Multimap<String, XtendTypeDeclaration> name2type = HashMultimap.create();
		for (final XtendTypeDeclaration declaration : script.getXtendTypes()) {
			final String name = declaration.getName();
			if (!Strings.isEmpty(name)) {
				name2type.put(name, declaration);
			}
		}
		for (final String name: name2type.keySet()) {
			final Collection<XtendTypeDeclaration> types = name2type.get(name);
			if (types.size() > 1) {
				for (final XtendTypeDeclaration type: types) {
					error(
							MessageFormat.format(Messages.SARLValidator_93, name),
							type,
							XtendPackage.Literals.XTEND_TYPE_DECLARATION__NAME,
							DUPLICATE_TYPE_NAME);
				}
			}
		}
	}
418568
private ScriptValidationContext getScriptValidationContext(Element messageElement, String messageType) {
        ScriptValidationContext context = null;

        boolean done = false;
        List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
        if (validateElements.size() > 0) {
            for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
                Element validateElement = (Element) iter.next();

                Element scriptElement = DomUtils.getChildElementByTagName(validateElement, "script");

                // check for nested validate script child node
                if (scriptElement != null) {
                    if (!done) {
                        done = true;
                    } else {
                        throw new BeanCreationException("Found multiple validation script definitions - " +
                                "only supporting a single validation script for message validation");
                    }

                    context = new ScriptValidationContext(messageType);
                    String type = scriptElement.getAttribute("type");
                    context.setScriptType(type);

                    String filePath = scriptElement.getAttribute("file");
                    if (StringUtils.hasText(filePath)) {
                        context.setValidationScriptResourcePath(filePath);
                        if (scriptElement.hasAttribute("charset")) {
                            context.setValidationScriptResourceCharset(scriptElement.getAttribute("charset"));
                        }
                    } else {
                        context.setValidationScript(DomUtils.getTextValue(scriptElement));
                    }
                }
            }
        }

        return context;
    }
1010207
public static boolean valueIsScript(String propertyName) {
      return (getInstance().properties.containsKey(propertyName) && getInstance().properties.get(propertyName)
                                                                                            .startsWith(
                                                                                               SCRIPT_PROPERTY));
   }
1194624
public String getValidationScript(TestContext context) {
        try {
            if (validationScriptResourcePath != null) {
                return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context),
                        Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset))));
            } else if (validationScript != null) {
                return context.replaceDynamicContentInString(validationScript);
            } else {
                return "";
            }
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed to load validation script resource", e);
        }
    }