Skip to content

Instantly share code, notes, and snippets.

View krohne's full-sized avatar

Gregory Krohne krohne

  • Atlanta, Georgia, USA
View GitHub Profile
/**
* Parses mixed type values into booleans. This is the same function as filter_var in PHP using boolean validation
* @param {Mixed} value
* @param {Boolean} nullOnFailure = false
* @return {Boolean|Null}
*/
var parseBooleanStyle = function(value, nullOnFailure = false){
if (typeof value !== 'string')
return Boolean(value);
@krohne
krohne / get-form-validation-errors.ts
Last active October 11, 2023 14:13 — forked from JohannesHoppe/get-form-validation-errors.ts
Get all validation errors for Angular FormGroup, FormRecord, or FormArray
import {
FormGroup,
FormRecord,
FormArray,
ValidationErrors
} from '@angular/forms';
export function getFormValidationErrors(form: FormGroup|FormRecord|FormArray, path ?: string = '$') {
const result = [];