UNPKG

@gravityforms/utils

Version:
57 lines (41 loc) 1.15 kB
# Gravity Forms Utils Custom JavaScript utilities for Gravity Forms development and beyond. ## Installation Install the module as a dependency. ```bash npm install @gravityforms/utils --save ``` **Note**: This package requires `node` 20.10.0 or later, and `npm` 10.2.3 or later. ## Overview A collection of JavaScript utilities that we use in our day to day JavaScript. This package is delivered as es6 modules, you probably want your webpack or other bundling system to run it through babel. In the case of webpack and babel, this means adding it to your exclude property of the rules array in the module object, like so: ```javascript const config = { // other config module: { rules: [ { test : /\.js$/, exclude: [ /node_modules\/(?!(@gravityforms)\/).*/ ], use : [ { loader: 'babel-loader', }, ], } ], }, } ``` ## Usage Example: ```js import { isJson } from '@gravityforms/utils'; const doSomethingWithJson = ( data ) => { if ( ! isJson( data ) ) { return; } } ``` ## Documentation The documentation for this package is available at http://docs.js.gravity.com/