mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
lint: src/node/hooks/express/isValidJSONPName.js
This commit is contained in:
parent
3571eb7c32
commit
18ebf7b69a
1 changed files with 4 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const RESERVED_WORDS = [
|
const RESERVED_WORDS = [
|
||||||
'abstract',
|
'abstract',
|
||||||
'arguments',
|
'arguments',
|
||||||
|
@ -65,9 +67,9 @@ const RESERVED_WORDS = [
|
||||||
'yield',
|
'yield',
|
||||||
];
|
];
|
||||||
|
|
||||||
const regex = /^[a-zA-Z_$][0-9a-zA-Z_$]*(?:\[(?:".+"|\'.+\'|\d+)\])*?$/;
|
const regex = /^[a-zA-Z_$][0-9a-zA-Z_$]*(?:\[(?:".+"|'.+'|\d+)\])*?$/;
|
||||||
|
|
||||||
module.exports.check = function (inputStr) {
|
module.exports.check = (inputStr) => {
|
||||||
let isValid = true;
|
let isValid = true;
|
||||||
inputStr.split('.').forEach((part) => {
|
inputStr.split('.').forEach((part) => {
|
||||||
if (!regex.test(part)) {
|
if (!regex.test(part)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue