gatsby-plugin-gravity-forms
Version:
A component to take GraphQl Gravity Forms query data and return a usable form.
24 lines (20 loc) • 607 B
JavaScript
export const createGfKeyFromField = (string) => {
const fieldName = "input_";
const field = string.slice(string.indexOf(fieldName) + fieldName.length);
return field.replace("_", ".");
};
export const doesObjectExist = (obj) => {
if (typeof obj !== "undefined") {
return true;
}
return false;
};
export const filteredKeys = (obj, filter) => {
let key,
keys = [];
for (key in obj)
if ({}.hasOwnProperty.call(obj, key) && filter.test(key)) keys.push(key);
return keys;
};
export const valueToLowerCase = (string) =>
string ? string.toLowerCase() : "";