-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add prettify and build docs and more
- Loading branch information
Showing
90 changed files
with
21,764 additions
and
21,768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 L1lith | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
|
||
Copyright (c) 2018 L1lith | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
<img src="https://raw.githubusercontent.com/l1lith/Sandhands/master/logo/no-background.svg?sanitize=true" width="100" height="100"> | ||
|
||
# Sandhands ![License](https://img.shields.io/badge/license-MIT-blue.svg) ![NPM Version](https://img.shields.io/npm/v/sandhands.svg?style=flat) | ||
Sanitize, don't let your computer get sick. Handle your JS data sanitation effectively and accurately with Sandhands. | ||
|
||
Please read our Docs 😊 Sandhands is a big passion project of mine, and I think you could love it too! Feel free to open an issue or make a pull request :) | ||
|
||
## [Documentation](https://l1lith.github.io/Sandhands/home) | ||
|
||
## A note on Boolean Logic | ||
Boolean logic is currently bugged while using the Format constructor. I'm not sure why this is so please be aware and understanding of this. | ||
|
||
## Example Usage | ||
``` | ||
import {sanitize, valid, details} from 'sandhands' | ||
valid(12, String) // returns false | ||
sanitize(12, String) // throws error with message "Invalid Type" | ||
details(12, String) // returns "Invalid Type" | ||
``` | ||
|
||
## Working With Express | ||
Sandhands has built-in support for Express! | ||
```js | ||
... | ||
server.post('/register', sandhandsExpress({ | ||
username: 'username', // the 'username' string is an alias for the special username custom format. See here for a list of existing custom formats https://github.com/L1lith/Sandhands/blob/master/source/customFormats.js | ||
email: 'email', | ||
password: 'password' | ||
}), (req, res) => { | ||
console.log('Got Registration Details', req.body) | ||
res.send('Registered') | ||
}) | ||
``` | ||
To see the full example please [visit this page.](https://l1lith.github.io/Sandhands/methods.html#sandhands-express) | ||
|
||
## Forms | ||
Sandhands has a sister library [SandForms](https://github.com/L1lith/SandForms) for straightforward form management which uses Sandhands internally. | ||
<img src="https://raw.githubusercontent.com/l1lith/Sandhands/master/logo/no-background.svg?sanitize=true" width="100" height="100"> | ||
|
||
# Sandhands ![License](https://img.shields.io/badge/license-MIT-blue.svg) ![NPM Version](https://img.shields.io/npm/v/sandhands.svg?style=flat) | ||
Sanitize, don't let your computer get sick. Handle your JS data sanitation effectively and accurately with Sandhands. | ||
|
||
Please read our Docs 😊 Sandhands is a big passion project of mine, and I think you could love it too! Feel free to open an issue or make a pull request :) | ||
|
||
## [Documentation](https://l1lith.github.io/Sandhands/home) | ||
|
||
## A note on Boolean Logic | ||
Boolean logic is currently bugged while using the Format constructor. I'm not sure why this is so please be aware and understanding of this. | ||
|
||
## Example Usage | ||
``` | ||
import {sanitize, valid, details} from 'sandhands' | ||
valid(12, String) // returns false | ||
sanitize(12, String) // throws error with message "Invalid Type" | ||
details(12, String) // returns "Invalid Type" | ||
``` | ||
|
||
## Working With Express | ||
Sandhands has built-in support for Express! | ||
```js | ||
... | ||
server.post('/register', sandhandsExpress({ | ||
username: 'username', // the 'username' string is an alias for the special username custom format. See here for a list of existing custom formats https://github.com/L1lith/Sandhands/blob/master/source/customFormats.js | ||
email: 'email', | ||
password: 'password' | ||
}), (req, res) => { | ||
console.log('Got Registration Details', req.body) | ||
res.send('Registered') | ||
}) | ||
``` | ||
To see the full example please [visit this page.](https://l1lith.github.io/Sandhands/methods.html#sandhands-express) | ||
|
||
## Forms | ||
Sandhands has a sister library [SandForms](https://github.com/L1lith/SandForms) for straightforward form management which uses Sandhands internally. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,85 @@ | ||
# Updates | ||
|
||
## 1.8.2 | ||
Hammered out more bugs and disabled a small broken feature. Added more tests, we're at 148 now :) Additionally a small change has been made to add the optionalProps and the allOptional props to objects, and to remove the optional flag from properties so that optionals are always at the same level as their format for clarity. | ||
|
||
## 1.8.0 | ||
Stability/Security Update. All of the dependencies have been updated and some minor bugs have been fixed. | ||
|
||
#### 1.7.1 | ||
Created the getFormatErrors to see if there is an issue with your format (note: this is completely unnecessary as your format is checked for validation when sanitation is performed). As of the date of the update there is currently no tests for this function. | ||
|
||
## 1.7.0 | ||
I've just implemented boolean logic inside of Sandhands, and to ensure it works correctly I've included a new set of tests! There's now 138 total tests :D | ||
|
||
### 1.6.5 | ||
Implemented a deepEqual function when comparing with the equalTo option, and added some tests for equalTo | ||
|
||
#### 1.6.4 | ||
Support supplying the Function class to indicate a function is expected | ||
|
||
#### 1.6.1 | ||
Support the standard option for objects :) | ||
|
||
### 1.6.0 | ||
Fixed more breaking bugs in the Array format, should be working now :) | ||
|
||
#### 1.3.8 | ||
Fix major bug breaking array format and slightly change array format so that arrays using explicit or implied firstAsStandard option now have a default minimum length of 1 | ||
|
||
#### 1.3.73 | ||
Improve whitespace flag and create new trimmed flag. | ||
|
||
##### 1.3.64 | ||
Add support for deep format shorthand. | ||
|
||
##### 1.3.63 | ||
Fix bugs with the format shorthand. | ||
|
||
#### 1.3.6 | ||
Create format shorthand. | ||
|
||
##### 1.3.52 | ||
Fix custom formats. | ||
##### 1.3.51 | ||
Improve Array format further | ||
#### 1.3.5 | ||
Implement and document new array formats (minLength, length, maxLength), and modify array behavior (default minLength of 1 usually). | ||
|
||
##### 1.3.43 | ||
Reorganize express middleware export | ||
|
||
##### 1.3.425 | ||
Further improve array strict default by defaulting to true when the array length is not 1 | ||
|
||
##### 1.3.42 | ||
Default strict to true in arrays when the array length is greater than 1. | ||
|
||
##### 1.3.41 | ||
Fix issue/reorganize interpretCustomFormats call | ||
#### 1.3.4 - Details Object/Array output | ||
The details function no longer returns null property placeholder values. | ||
|
||
##### 1.3.32 - Validation Functions | ||
Validation functions can now return either an error string or a success boolean. Standard username custom format has also been updated. | ||
|
||
##### 1.3.31 - Standard Custom Formats | ||
Add the username and password standard custom format. | ||
|
||
#### 1.3.3 - Custom Formats | ||
Sandhands now supports custom formats! | ||
|
||
##### 1.3.21 | ||
Minor Change to middleware behavior, null values from arrays and objects are stripped out. | ||
|
||
#### 1.3.2 - Middleware! | ||
Sandhands now has middleware support, starting with express! | ||
|
||
##### 1.3.12 - Sanitize Method Fixed | ||
There was a reference error in the sanitize method causing it to fail completely. This has been fixed. | ||
|
||
#### 1.3.1 - setDefault | ||
A new method called setDefault has been introduced. It allows you to override the default settings for each data type. | ||
|
||
### 1.3.0 - Readability, Array Support, Details, Validation | ||
The entire codebase has been drastically reorganized for much better readability. More support for Arrays has been introduced. Potentially breaking changes (most users will be unaffected) from the last have also been introduced to the library (the result of the detail function is now different, however the sanitize and validate functions remain the same). More format validation has been introduced. Error messages are now more detailed. | ||
# Updates | ||
|
||
## 1.8.2 | ||
Hammered out more bugs and disabled a small broken feature. Added more tests, we're at 148 now :) Additionally a small change has been made to add the optionalProps and the allOptional props to objects, and to remove the optional flag from properties so that optionals are always at the same level as their format for clarity. | ||
|
||
## 1.8.0 | ||
Stability/Security Update. All of the dependencies have been updated and some minor bugs have been fixed. | ||
|
||
#### 1.7.1 | ||
Created the getFormatErrors to see if there is an issue with your format (note: this is completely unnecessary as your format is checked for validation when sanitation is performed). As of the date of the update there is currently no tests for this function. | ||
|
||
## 1.7.0 | ||
I've just implemented boolean logic inside of Sandhands, and to ensure it works correctly I've included a new set of tests! There's now 138 total tests :D | ||
|
||
### 1.6.5 | ||
Implemented a deepEqual function when comparing with the equalTo option, and added some tests for equalTo | ||
|
||
#### 1.6.4 | ||
Support supplying the Function class to indicate a function is expected | ||
|
||
#### 1.6.1 | ||
Support the standard option for objects :) | ||
|
||
### 1.6.0 | ||
Fixed more breaking bugs in the Array format, should be working now :) | ||
|
||
#### 1.3.8 | ||
Fix major bug breaking array format and slightly change array format so that arrays using explicit or implied firstAsStandard option now have a default minimum length of 1 | ||
|
||
#### 1.3.73 | ||
Improve whitespace flag and create new trimmed flag. | ||
|
||
##### 1.3.64 | ||
Add support for deep format shorthand. | ||
|
||
##### 1.3.63 | ||
Fix bugs with the format shorthand. | ||
|
||
#### 1.3.6 | ||
Create format shorthand. | ||
|
||
##### 1.3.52 | ||
Fix custom formats. | ||
##### 1.3.51 | ||
Improve Array format further | ||
#### 1.3.5 | ||
Implement and document new array formats (minLength, length, maxLength), and modify array behavior (default minLength of 1 usually). | ||
|
||
##### 1.3.43 | ||
Reorganize express middleware export | ||
|
||
##### 1.3.425 | ||
Further improve array strict default by defaulting to true when the array length is not 1 | ||
|
||
##### 1.3.42 | ||
Default strict to true in arrays when the array length is greater than 1. | ||
|
||
##### 1.3.41 | ||
Fix issue/reorganize interpretCustomFormats call | ||
#### 1.3.4 - Details Object/Array output | ||
The details function no longer returns null property placeholder values. | ||
|
||
##### 1.3.32 - Validation Functions | ||
Validation functions can now return either an error string or a success boolean. Standard username custom format has also been updated. | ||
|
||
##### 1.3.31 - Standard Custom Formats | ||
Add the username and password standard custom format. | ||
|
||
#### 1.3.3 - Custom Formats | ||
Sandhands now supports custom formats! | ||
|
||
##### 1.3.21 | ||
Minor Change to middleware behavior, null values from arrays and objects are stripped out. | ||
|
||
#### 1.3.2 - Middleware! | ||
Sandhands now has middleware support, starting with express! | ||
|
||
##### 1.3.12 - Sanitize Method Fixed | ||
There was a reference error in the sanitize method causing it to fail completely. This has been fixed. | ||
|
||
#### 1.3.1 - setDefault | ||
A new method called setDefault has been introduced. It allows you to override the default settings for each data type. | ||
|
||
### 1.3.0 - Readability, Array Support, Details, Validation | ||
The entire codebase has been drastically reorganized for much better readability. More support for Arrays has been introduced. Potentially breaking changes (most users will be unaffected) from the last have also been introduced to the library (the result of the detail function is now different, however the sanitize and validate functions remain the same). More format validation has been introduced. Error messages are now more detailed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules/ | ||
.next | ||
/out/ | ||
node_modules/ | ||
.next | ||
/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
const Editor = props => { | ||
if (typeof window !== 'undefined') { | ||
const Ace = require('react-ace').default | ||
require('brace/mode/javascript') | ||
require('brace/theme/ambiance') | ||
|
||
return <Ace {...props} /> | ||
} | ||
|
||
return null | ||
} | ||
|
||
class IsomorphicEditor extends React.Component { | ||
state = { mounted: false } | ||
|
||
componentDidMount() { | ||
this.setState({ mounted: true }) | ||
} | ||
|
||
render = () => (this.state.mounted ? <Editor {...this.props} /> : null) | ||
} | ||
|
||
export default IsomorphicEditor | ||
const Editor = props => { | ||
if (typeof window !== 'undefined') { | ||
const Ace = require('react-ace').default | ||
require('brace/mode/javascript') | ||
require('brace/theme/ambiance') | ||
|
||
return <Ace {...props} /> | ||
} | ||
|
||
return null | ||
} | ||
|
||
class IsomorphicEditor extends React.Component { | ||
state = { mounted: false } | ||
|
||
componentDidMount() { | ||
this.setState({ mounted: true }) | ||
} | ||
|
||
render = () => (this.state.mounted ? <Editor {...this.props} /> : null) | ||
} | ||
|
||
export default IsomorphicEditor |
Oops, something went wrong.