added awesome modular multi-hdd-case
This commit is contained in:
33
openscad/foreign/modular multi-hdd case/Functions/is.scad
Normal file
33
openscad/foreign/modular multi-hdd case/Functions/is.scad
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Diversas funciones para detectar el tipo de datos de un valor.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @license CC-BY-NC-4.0
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Functions/is.scad
|
||||
*/
|
||||
/**
|
||||
* Verifica si el valor es un array
|
||||
*
|
||||
* @param value Valor a verificar.
|
||||
*
|
||||
* @return `true` si el valor es un array.
|
||||
*/
|
||||
function isArray(x) = len(x) != undef && !isString(x);
|
||||
|
||||
/**
|
||||
* Verifica si el valor es un booleano
|
||||
*
|
||||
* @param value Valor a verificar.
|
||||
*
|
||||
* @return `true` si el valor es un booleano.
|
||||
*/
|
||||
function isBool(x) = !isString(x) && (str(x) == "true" || str(x) == "false");
|
||||
|
||||
/**
|
||||
* Verifica si el valor es un texto
|
||||
*
|
||||
* @param value Valor a verificar.
|
||||
*
|
||||
* @return `true` si el valor es un texto.
|
||||
*/
|
||||
function isString(x) = x != undef && len(x) != undef && len(str(x,x)) == len(x) * 2;
|
Reference in New Issue
Block a user