hudozka app added edit from 2018.02
This commit is contained in:
1 parent
6805e07434
commit
759f1217b5
57 files changed
+3630
-1247
No files matched your search
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Remove trailing spaces from string
|
||||
*
|
||||
* f(_x_) => x
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
export function trim(str) {
|
||||
return str
|
||||
.replace(/^\s+/, '')
|
||||
.replace(/\s+$/, '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove trailing spaces from string
|
||||
*
|
||||
* f(_x_) => x
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
export function trimNewline(str) {
|
||||
return str
|
||||
.replace(/^\n+/, '')
|
||||
.replace(/\n+$/, '')
|
||||
}
|
||||
|
||||
export function constrain(n, min, max) {
|
||||
if (n < min) return min
|
||||
if (n > max) return max
|
||||
return n
|
||||
}
|
||||
Reference in new issue
Block a user