This library provides various functions designed for Onify Flow that can also be used in Node.js applications.
The functions available are as follows:
Use functions.*
to access the functions present in this library.
const result = functions.slugify('sample onify');
console.log(result); // output: sample-onify
npm install @onify/flow-script-functions
const functions = require('@onify/flow-script-functions');
// import all functions
import * as functions from '@onify/flow-script-functions';
// or
// import specific functions
import { slugify } from '@onify/flow-script-functions';
// example usage of `slugify` function
let output = functions.slugify('Hello World!');
// or
// when using specific imports in TypeScript
output = slugify('Hello World!');
Creates a GUID string using crypto
generateUuid(): string
GUID string with the format ${string}-${string}-${string}-${string}-${string}
import { generateUuid } from '@onify/flow-script-functions';
// ...
const id = generateUuid(); // generates random GUID
console.log(id); // sample output: "55d03475-45fe-4415-81d7-8cd052081fe1"
Transforms string to kebab case
slugify(text: string): string
Name | Type | Description |
---|---|---|
text | string |
the string value to transform |
kebab-case
of the input
import { slugify } from '@onify/flow-script-functions';
// ...
const transformedText = slugify('Hello World!');
console.log(transformedText); // output: "hello-world"
Checks if string is a valid email format
validateEmail(email: string): boolean
Name | Type | Description |
---|---|---|
string |
string to validate |
true
if input is a valid email format, otherwise false
import { validateEmail } from '@onify/flow-script-functions';
// ...
const isValid = slugify('sample@onify.co');
console.log(isValid); // output: true
- Update
version
inpackage.json
- Update
CHANGELOG.md
- Commit and push the changes
- Run
npm run release