⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
is-expression
/
Edit File: README.md
# is-expression Validates a string as a JavaScript expression [](https://travis-ci.org/pugjs/is-expression) [](https://david-dm.org/pugjs/is-expression) [](https://www.npmjs.org/package/is-expression) ## Installation npm install is-expression ## Usage ### `isExpression(src[, options])` Validates a string as a JavaScript expression. `src` contains the source. `options` can contain any Acorn options (since we use Acorn under-the-hood), or any of the following: - `throw`: Throw an error if the string is not an expression. The error can be an Acorn error, with location information in `err.loc` and `err.pos`. Defaults to `false`. - `strict`: Use strict mode when trying to parse the string. Defaults to `false`. Even if this option is `false`, if you have provided `options.sourceType === 'module'` which imples strict mode under ES2015, strict mode will be used. - `lineComment`: When `true`, allows line comments in the expression. Defaults to `false` for safety. See the examples below for usage. ## Examples ```js var isExpression = require('is-expression') isExpression('myVar') //=> true isExpression('var') //=> false isExpression('["an", "array", "\'s"].indexOf("index")') //=> true isExpression('var', {throw: true}) // SyntaxError: Unexpected token (1:0) // at Parser.pp.raise (acorn/dist/acorn.js:940:13) // at ... isExpression('public') //=> true isExpression('public', {strict: true}) //=> false isExpression('abc // my comment') //=> false isExpression('abc // my comment', {lineComment: true}) //=> true ``` ## License MIT
Simpan