Library utilities - AquilaCMS/aquila-connector GitHub Wiki

/src/lib/utils.js

Functions

Merge 2 objects

deepMergeObjects(target, source)
  • target - string : target object
  • source - string : object to merge with target

Removes the parameter part of a URL (everything after "?")

simplifyPath(path)
  • path - string : URL

String to slug

slugify(string)
  • string - string : String to convert to slug

Set a JSON Web Token with Axios

setTokenAxios(cookies)
  • cookies - string : Request from headers coockie
Example
import { setTokenAxios } from '@aquilacms/aquila-connector/lib/utils';
const Token = setTokenAxios(cookies);

Generate URL image cache

generateURLImageCache(type, size, id, fileName, extension)
  • type - string : Image type
  • size - string : Image size ("256x256" is the default value)
  • id - string : Image ID
  • fileName - string : Image filename
  • extension - string : Image extension (with point)
⚠️ **GitHub.com Fallback** ⚠️