Last change
on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
491 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var utils = require('../utils');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Return type of `node`.
|
---|
| 5 | *
|
---|
| 6 | * Examples:
|
---|
| 7 | *
|
---|
| 8 | * type(12)
|
---|
| 9 | * // => 'unit'
|
---|
| 10 | *
|
---|
| 11 | * type(#fff)
|
---|
| 12 | * // => 'color'
|
---|
| 13 | *
|
---|
| 14 | * type(type)
|
---|
| 15 | * // => 'function'
|
---|
| 16 | *
|
---|
| 17 | * type(unbound)
|
---|
| 18 | * typeof(unbound)
|
---|
| 19 | * type-of(unbound)
|
---|
| 20 | * // => 'ident'
|
---|
| 21 | *
|
---|
| 22 | * @param {Node} node
|
---|
| 23 | * @return {String}
|
---|
| 24 | * @api public
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | function type(node){
|
---|
| 28 | utils.assertPresent(node, 'expression');
|
---|
| 29 | return node.nodeName;
|
---|
| 30 | }
|
---|
| 31 | type.params = ['node'];
|
---|
| 32 | module.exports = type;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.