Skip to content

Commit

Permalink
✨ add generic string sanetiser
Browse files Browse the repository at this point in the history
  • Loading branch information
actuallymentor committed Nov 7, 2023
1 parent c237970 commit 4b7601b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Example sanetiser usage:

```js
// Import the sanetisers you need
import { sanetise_eth_address, sanetise_ens_address, sanetise_eth_or_ens_address, sanetise_poap_id, sanetise_poap_edit_code, sanetise_email } from '@poap/sane-data'
import { sanetise_eth_address, sanetise_ens_address, sanetise_eth_or_ens_address, sanetise_poap_id, sanetise_poap_edit_code, sanetise_email, sanetise_string } from '@poap/sane-data'

// Use the sanetisers in your code
function send_poap( wallet_or_ens, drop_id, email ){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@poap/sane-data",
"private": false,
"version": "0.0.4",
"version": "0.0.5",
"description": "A collection of data validations and sanetisers",
"main": "./src/index.js",
"browser": "./dist/browser/index.js",
Expand Down
12 changes: 11 additions & 1 deletion src/modules/sanitisers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,14 @@ export const sanetise_email = ( input, throw_on_fail = true ) => sanetize(
'email',
email_regex,
throw_on_fail
)
)

/* ///////////////////////////////
// Generic sanitisations
// /////////////////////////////*/
/**
*
* @param {String} input - Input string
* @returns {String} Lowercased and trimmed version of the input
*/
export const sanetise_string = input => `${ input }`.toLocaleLowerCase().trim()

0 comments on commit 4b7601b

Please sign in to comment.