is-reference
Advanced tools
Comparing version 1.2.1 to 2.0.0
# is-reference changelog | ||
## 2.0.0 | ||
* Convert to JavaScript | ||
## 1.2.1 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "is-reference", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Determine whether an AST node is a reference", | ||
"main": "dist/is-reference.js", | ||
"module": "dist/is-reference.es.js", | ||
"types": "dist/types/index.d.ts", | ||
"type": "module", | ||
"module": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"exports": { | ||
"import": "./src/index.js" | ||
}, | ||
"files": [ | ||
"dist/*.js", | ||
"dist/types/**/*.d.ts" | ||
"src", | ||
"types" | ||
], | ||
"scripts": { | ||
"test": "mocha", | ||
"build": "rollup -c && tsc --emitDeclarationOnly", | ||
"pretest": "npm run build", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test" | ||
"test": "uvu", | ||
"prepublishOnly": "npm test && tsc" | ||
}, | ||
@@ -42,9 +42,6 @@ "repository": { | ||
"acorn-static-class-features": "^0.2.1", | ||
"estree-walker": "^2.0.1", | ||
"mocha": "^7.1.2", | ||
"rollup": "^2.10.3", | ||
"rollup-plugin-typescript": "^1.0.1", | ||
"tslib": "^2.0.0", | ||
"typescript": "^3.9.2" | ||
"estree-walker": "^3.0.0", | ||
"typescript": "^3.9.2", | ||
"uvu": "^0.5.1" | ||
} | ||
} |
@@ -8,6 +8,6 @@ # is-reference | ||
```js | ||
console.log( foo ); | ||
console.log(foo); | ||
var foo; | ||
function foo () {} | ||
function bar ( foo ) {} | ||
function foo() {} | ||
function bar(foo) {} | ||
export { foo as x }; | ||
@@ -20,3 +20,3 @@ ``` | ||
var obj = { foo: 1 }; | ||
console.log( obj.foo ); | ||
console.log(obj.foo); | ||
export { x as foo }; | ||
@@ -40,5 +40,5 @@ ``` | ||
```js | ||
const { parse } = require( 'acorn' ); | ||
const { walk } = require( 'estree-walker' ); | ||
const isReference = require( 'is-reference' ); | ||
import { parse } from 'acorn'; | ||
import { walk } from 'estree-walker'; | ||
import is_reference from 'is-reference'; | ||
@@ -48,13 +48,13 @@ const identifiers = []; | ||
const ast = parse( `var a = b.c;` ); | ||
const ast = parse(`var a = b.c;`); | ||
walk( ast, { | ||
enter ( node, parent ) { | ||
if ( node.type === 'Identifier' ) identifiers.push( node ); | ||
if ( isReference( node, parent ) ) references.push( node ); | ||
walk(ast, { | ||
enter(node, parent) { | ||
if (node.type === 'Identifier') identifiers.push(node); | ||
if (is_reference(node, parent)) references.push(node); | ||
} | ||
}); | ||
identifiers.forEach( node => console.log( node.name ) ); // a, b, c | ||
references.forEach( node => console.log( node.name ) ); // a, b | ||
identifiers.forEach(node => console.log(node.name)); // a, b, c | ||
references.forEach(node => console.log(node.name)); // a, b | ||
``` | ||
@@ -61,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9865
6
78
Yes
5