clean up types, add missing jsdoc parameters, add some descriptions
This commit is contained in:
parent
1cbbe00b7a
commit
f5ccb9c0ba
@ -13,10 +13,6 @@ var isString = require("lodash/lang/isString");
|
||||
|
||||
var t = exports;
|
||||
|
||||
t.NATIVE_TYPE_NAMES = ["Array", "Object", "Number", "Boolean", "Date", "Array", "String"];
|
||||
|
||||
//
|
||||
|
||||
/**
|
||||
* Registers `is[Type]` and `assert[Type]` generated functions for a given `type`.
|
||||
* Pass `skipAliasCheck` to force it to directly compare `node.type` with `type`.
|
||||
@ -39,8 +35,7 @@ function registerType(type, skipAliasCheck) {
|
||||
}
|
||||
|
||||
t.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body"];
|
||||
|
||||
//
|
||||
t.NATIVE_TYPE_NAMES = ["Array", "Object", "Number", "Boolean", "Date", "Array", "String"];
|
||||
|
||||
t.VISITOR_KEYS = require("./visitor-keys");
|
||||
|
||||
@ -66,6 +61,7 @@ each(t.FLIPPED_ALIAS_KEYS, function (types, type) {
|
||||
|
||||
/**
|
||||
* Returns whether `node` is of given `type`.
|
||||
*
|
||||
* For better performance, use this instead of `is[Type]` when `type` is unknown.
|
||||
* Optionally, pass `skipAliasCheck` to directly compare `node.type` with `type`.
|
||||
*
|
||||
@ -156,6 +152,9 @@ t.isFalsyExpression = function (node) {
|
||||
* declarations hoisted to the top of the current scope.
|
||||
*
|
||||
* Expression statements are just resolved to their standard expression.
|
||||
*
|
||||
* @param {Array} nodes
|
||||
* @param {Scope} scope
|
||||
*/
|
||||
|
||||
t.toSequenceExpression = function (nodes, scope) {
|
||||
@ -185,17 +184,23 @@ t.toSequenceExpression = function (nodes, scope) {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
/*
|
||||
* Description
|
||||
*
|
||||
* @param {Object} actual
|
||||
* @param {Object} expected
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
t.shallowEqual = function (actual, expected) {
|
||||
var keys = Object.keys(expected);
|
||||
var key;
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
key = keys[i];
|
||||
var key = keys[i];
|
||||
|
||||
if (actual[key] !== expected[key])
|
||||
if (actual[key] !== expected[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -330,7 +335,7 @@ t.isReferenced = function (node, parent) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Description
|
||||
* Check if the input `node` is an `Identifier` and `isReferenced`.
|
||||
*
|
||||
* @param {Object} node
|
||||
* @param {Object} parent
|
||||
@ -342,7 +347,8 @@ t.isReferencedIdentifier = function (node, parent) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Description
|
||||
* Check if the input `name` is a valid identifier name
|
||||
* and isn't a reserved word.
|
||||
*
|
||||
* @param {String} name
|
||||
* @returns {Boolean}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user