You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

806 lines
21 KiB

4 years ago
  1. # snapdragon-util [![NPM version](https://img.shields.io/npm/v/snapdragon-util.svg?style=flat)](https://www.npmjs.com/package/snapdragon-util) [![NPM monthly downloads](https://img.shields.io/npm/dm/snapdragon-util.svg?style=flat)](https://npmjs.org/package/snapdragon-util) [![NPM total downloads](https://img.shields.io/npm/dt/snapdragon-util.svg?style=flat)](https://npmjs.org/package/snapdragon-util) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/snapdragon-util.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/snapdragon-util)
  2. > Utilities for the snapdragon parser/compiler.
  3. <details>
  4. <summary><strong>Table of Contents</strong></summary>
  5. - [Install](#install)
  6. - [Usage](#usage)
  7. - [API](#api)
  8. - [Release history](#release-history)
  9. * [[3.0.0] - 2017-05-01](#300---2017-05-01)
  10. * [[0.1.0]](#010)
  11. - [About](#about)
  12. </details>
  13. ## Install
  14. Install with [npm](https://www.npmjs.com/):
  15. ```sh
  16. $ npm install --save snapdragon-util
  17. ```
  18. Install with [yarn](https://yarnpkg.com):
  19. ```sh
  20. $ yarn add snapdragon-util
  21. ```
  22. ## Usage
  23. ```js
  24. var util = require('snapdragon-util');
  25. ```
  26. ## API
  27. ### [.isNode](index.js#L21)
  28. Returns true if the given value is a node.
  29. **Params**
  30. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  31. * `returns` **{Boolean}**
  32. **Example**
  33. ```js
  34. var Node = require('snapdragon-node');
  35. var node = new Node({type: 'foo'});
  36. console.log(utils.isNode(node)); //=> true
  37. console.log(utils.isNode({})); //=> false
  38. ```
  39. ### [.noop](index.js#L37)
  40. Emit an empty string for the given `node`.
  41. **Params**
  42. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  43. * `returns` **{undefined}**
  44. **Example**
  45. ```js
  46. // do nothing for beginning-of-string
  47. snapdragon.compiler.set('bos', utils.noop);
  48. ```
  49. ### [.identity](index.js#L53)
  50. Appdend `node.val` to `compiler.output`, exactly as it was created by the parser.
  51. **Params**
  52. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  53. * `returns` **{undefined}**
  54. **Example**
  55. ```js
  56. snapdragon.compiler.set('text', utils.identity);
  57. ```
  58. ### [.append](index.js#L76)
  59. Previously named `.emit`, this method appends the given `val` to `compiler.output` for the given node. Useful when you know what value should be appended advance, regardless of the actual value of `node.val`.
  60. **Params**
  61. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  62. * `returns` **{Function}**: Returns a compiler middleware function.
  63. **Example**
  64. ```js
  65. snapdragon.compiler
  66. .set('i', function(node) {
  67. this.mapVisit(node);
  68. })
  69. .set('i.open', utils.append('<i>'))
  70. .set('i.close', utils.append('</i>'))
  71. ```
  72. ### [.toNoop](index.js#L99)
  73. Used in compiler middleware, this onverts an AST node into an empty `text` node and deletes `node.nodes` if it exists. The advantage of this method is that, as opposed to completely removing the node, indices will not need to be re-calculated in sibling nodes, and nothing is appended to the output.
  74. **Params**
  75. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  76. * `nodes` **{Array}**: Optionally pass a new `nodes` value, to replace the existing `node.nodes` array.
  77. **Example**
  78. ```js
  79. utils.toNoop(node);
  80. // convert `node.nodes` to the given value instead of deleting it
  81. utils.toNoop(node, []);
  82. ```
  83. ### [.visit](index.js#L128)
  84. Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon automatically calls registered compilers, this allows you to pass a visitor function.
  85. **Params**
  86. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  87. * `fn` **{Function}**
  88. * `returns` **{Object}**: returns the node after recursively visiting all child nodes.
  89. **Example**
  90. ```js
  91. snapdragon.compiler.set('i', function(node) {
  92. utils.visit(node, function(childNode) {
  93. // do stuff with "childNode"
  94. return childNode;
  95. });
  96. });
  97. ```
  98. ### [.mapVisit](index.js#L155)
  99. Map [visit](#visit) the given `fn` over `node.nodes`. This is called by [visit](#visit), use this method if you do not want `fn` to be called on the first node.
  100. **Params**
  101. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  102. * `options` **{Object}**
  103. * `fn` **{Function}**
  104. * `returns` **{Object}**: returns the node
  105. **Example**
  106. ```js
  107. snapdragon.compiler.set('i', function(node) {
  108. utils.mapVisit(node, function(childNode) {
  109. // do stuff with "childNode"
  110. return childNode;
  111. });
  112. });
  113. ```
  114. ### [.addOpen](index.js#L194)
  115. Unshift an `*.open` node onto `node.nodes`.
  116. **Params**
  117. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  118. * `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node).
  119. * `filter` **{Function}**: Optionaly specify a filter function to exclude the node.
  120. * `returns` **{Object}**: Returns the created opening node.
  121. **Example**
  122. ```js
  123. var Node = require('snapdragon-node');
  124. snapdragon.parser.set('brace', function(node) {
  125. var match = this.match(/^{/);
  126. if (match) {
  127. var parent = new Node({type: 'brace'});
  128. utils.addOpen(parent, Node);
  129. console.log(parent.nodes[0]):
  130. // { type: 'brace.open', val: '' };
  131. // push the parent "brace" node onto the stack
  132. this.push(parent);
  133. // return the parent node, so it's also added to the AST
  134. return brace;
  135. }
  136. });
  137. ```
  138. ### [.addClose](index.js#L244)
  139. Push a `*.close` node onto `node.nodes`.
  140. **Params**
  141. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  142. * `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node).
  143. * `filter` **{Function}**: Optionaly specify a filter function to exclude the node.
  144. * `returns` **{Object}**: Returns the created closing node.
  145. **Example**
  146. ```js
  147. var Node = require('snapdragon-node');
  148. snapdragon.parser.set('brace', function(node) {
  149. var match = this.match(/^}/);
  150. if (match) {
  151. var parent = this.parent();
  152. if (parent.type !== 'brace') {
  153. throw new Error('missing opening: ' + '}');
  154. }
  155. utils.addClose(parent, Node);
  156. console.log(parent.nodes[parent.nodes.length - 1]):
  157. // { type: 'brace.close', val: '' };
  158. // no need to return a node, since the parent
  159. // was already added to the AST
  160. return;
  161. }
  162. });
  163. ```
  164. ### [.wrapNodes](index.js#L274)
  165. Wraps the given `node` with `*.open` and `*.close` nodes.
  166. **Params**
  167. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  168. * `Node` **{Function}**: (required) Node constructor function from [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node).
  169. * `filter` **{Function}**: Optionaly specify a filter function to exclude the node.
  170. * `returns` **{Object}**: Returns the node
  171. ### [.pushNode](index.js#L299)
  172. Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent.
  173. **Params**
  174. * `parent` **{Object}**
  175. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  176. * `returns` **{Object}**: Returns the child node
  177. **Example**
  178. ```js
  179. var parent = new Node({type: 'foo'});
  180. var node = new Node({type: 'bar'});
  181. utils.pushNode(parent, node);
  182. console.log(parent.nodes[0].type) // 'bar'
  183. console.log(node.parent.type) // 'foo'
  184. ```
  185. ### [.unshiftNode](index.js#L325)
  186. Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent.
  187. **Params**
  188. * `parent` **{Object}**
  189. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  190. * `returns` **{undefined}**
  191. **Example**
  192. ```js
  193. var parent = new Node({type: 'foo'});
  194. var node = new Node({type: 'bar'});
  195. utils.unshiftNode(parent, node);
  196. console.log(parent.nodes[0].type) // 'bar'
  197. console.log(node.parent.type) // 'foo'
  198. ```
  199. ### [.popNode](index.js#L354)
  200. Pop the last `node` off of `parent.nodes`. The advantage of using this method is that it checks for `node.nodes` and works with any version of `snapdragon-node`.
  201. **Params**
  202. * `parent` **{Object}**
  203. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  204. * `returns` **{Number|Undefined}**: Returns the length of `node.nodes` or undefined.
  205. **Example**
  206. ```js
  207. var parent = new Node({type: 'foo'});
  208. utils.pushNode(parent, new Node({type: 'foo'}));
  209. utils.pushNode(parent, new Node({type: 'bar'}));
  210. utils.pushNode(parent, new Node({type: 'baz'}));
  211. console.log(parent.nodes.length); //=> 3
  212. utils.popNode(parent);
  213. console.log(parent.nodes.length); //=> 2
  214. ```
  215. ### [.shiftNode](index.js#L382)
  216. Shift the first `node` off of `parent.nodes`. The advantage of using this method is that it checks for `node.nodes` and works with any version of `snapdragon-node`.
  217. **Params**
  218. * `parent` **{Object}**
  219. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  220. * `returns` **{Number|Undefined}**: Returns the length of `node.nodes` or undefined.
  221. **Example**
  222. ```js
  223. var parent = new Node({type: 'foo'});
  224. utils.pushNode(parent, new Node({type: 'foo'}));
  225. utils.pushNode(parent, new Node({type: 'bar'}));
  226. utils.pushNode(parent, new Node({type: 'baz'}));
  227. console.log(parent.nodes.length); //=> 3
  228. utils.shiftNode(parent);
  229. console.log(parent.nodes.length); //=> 2
  230. ```
  231. ### [.removeNode](index.js#L409)
  232. Remove the specified `node` from `parent.nodes`.
  233. **Params**
  234. * `parent` **{Object}**
  235. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  236. * `returns` **{Object|undefined}**: Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`.
  237. **Example**
  238. ```js
  239. var parent = new Node({type: 'abc'});
  240. var foo = new Node({type: 'foo'});
  241. utils.pushNode(parent, foo);
  242. utils.pushNode(parent, new Node({type: 'bar'}));
  243. utils.pushNode(parent, new Node({type: 'baz'}));
  244. console.log(parent.nodes.length); //=> 3
  245. utils.removeNode(parent, foo);
  246. console.log(parent.nodes.length); //=> 2
  247. ```
  248. ### [.isType](index.js#L443)
  249. Returns true if `node.type` matches the given `type`. Throws a `TypeError` if `node` is not an instance of `Node`.
  250. **Params**
  251. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  252. * `type` **{String}**
  253. * `returns` **{Boolean}**
  254. **Example**
  255. ```js
  256. var Node = require('snapdragon-node');
  257. var node = new Node({type: 'foo'});
  258. console.log(utils.isType(node, 'foo')); // false
  259. console.log(utils.isType(node, 'bar')); // true
  260. ```
  261. ### [.hasType](index.js#L486)
  262. Returns true if the given `node` has the given `type` in `node.nodes`. Throws a `TypeError` if `node` is not an instance of `Node`.
  263. **Params**
  264. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  265. * `type` **{String}**
  266. * `returns` **{Boolean}**
  267. **Example**
  268. ```js
  269. var Node = require('snapdragon-node');
  270. var node = new Node({
  271. type: 'foo',
  272. nodes: [
  273. new Node({type: 'bar'}),
  274. new Node({type: 'baz'})
  275. ]
  276. });
  277. console.log(utils.hasType(node, 'xyz')); // false
  278. console.log(utils.hasType(node, 'baz')); // true
  279. ```
  280. ### [.firstOfType](index.js#L519)
  281. Returns the first node from `node.nodes` of the given `type`
  282. **Params**
  283. * `nodes` **{Array}**
  284. * `type` **{String}**
  285. * `returns` **{Object|undefined}**: Returns the first matching node or undefined.
  286. **Example**
  287. ```js
  288. var node = new Node({
  289. type: 'foo',
  290. nodes: [
  291. new Node({type: 'text', val: 'abc'}),
  292. new Node({type: 'text', val: 'xyz'})
  293. ]
  294. });
  295. var textNode = utils.firstOfType(node.nodes, 'text');
  296. console.log(textNode.val);
  297. //=> 'abc'
  298. ```
  299. ### [.findNode](index.js#L556)
  300. Returns the node at the specified index, or the first node of the given `type` from `node.nodes`.
  301. **Params**
  302. * `nodes` **{Array}**
  303. * `type` **{String|Number}**: Node type or index.
  304. * `returns` **{Object}**: Returns a node or undefined.
  305. **Example**
  306. ```js
  307. var node = new Node({
  308. type: 'foo',
  309. nodes: [
  310. new Node({type: 'text', val: 'abc'}),
  311. new Node({type: 'text', val: 'xyz'})
  312. ]
  313. });
  314. var nodeOne = utils.findNode(node.nodes, 'text');
  315. console.log(nodeOne.val);
  316. //=> 'abc'
  317. var nodeTwo = utils.findNode(node.nodes, 1);
  318. console.log(nodeTwo.val);
  319. //=> 'xyz'
  320. ```
  321. ### [.isOpen](index.js#L584)
  322. Returns true if the given node is an "*.open" node.
  323. **Params**
  324. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  325. * `returns` **{Boolean}**
  326. **Example**
  327. ```js
  328. var Node = require('snapdragon-node');
  329. var brace = new Node({type: 'brace'});
  330. var open = new Node({type: 'brace.open'});
  331. var close = new Node({type: 'brace.close'});
  332. console.log(utils.isOpen(brace)); // false
  333. console.log(utils.isOpen(open)); // true
  334. console.log(utils.isOpen(close)); // false
  335. ```
  336. ### [.isClose](index.js#L607)
  337. Returns true if the given node is a "*.close" node.
  338. **Params**
  339. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  340. * `returns` **{Boolean}**
  341. **Example**
  342. ```js
  343. var Node = require('snapdragon-node');
  344. var brace = new Node({type: 'brace'});
  345. var open = new Node({type: 'brace.open'});
  346. var close = new Node({type: 'brace.close'});
  347. console.log(utils.isClose(brace)); // false
  348. console.log(utils.isClose(open)); // false
  349. console.log(utils.isClose(close)); // true
  350. ```
  351. ### [.hasOpen](index.js#L633)
  352. Returns true if `node.nodes` **has** an `.open` node
  353. **Params**
  354. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  355. * `returns` **{Boolean}**
  356. **Example**
  357. ```js
  358. var Node = require('snapdragon-node');
  359. var brace = new Node({
  360. type: 'brace',
  361. nodes: []
  362. });
  363. var open = new Node({type: 'brace.open'});
  364. console.log(utils.hasOpen(brace)); // false
  365. brace.pushNode(open);
  366. console.log(utils.hasOpen(brace)); // true
  367. ```
  368. ### [.hasClose](index.js#L663)
  369. Returns true if `node.nodes` **has** a `.close` node
  370. **Params**
  371. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  372. * `returns` **{Boolean}**
  373. **Example**
  374. ```js
  375. var Node = require('snapdragon-node');
  376. var brace = new Node({
  377. type: 'brace',
  378. nodes: []
  379. });
  380. var close = new Node({type: 'brace.close'});
  381. console.log(utils.hasClose(brace)); // false
  382. brace.pushNode(close);
  383. console.log(utils.hasClose(brace)); // true
  384. ```
  385. ### [.hasOpenAndClose](index.js#L697)
  386. Returns true if `node.nodes` has both `.open` and `.close` nodes
  387. **Params**
  388. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  389. * `returns` **{Boolean}**
  390. **Example**
  391. ```js
  392. var Node = require('snapdragon-node');
  393. var brace = new Node({
  394. type: 'brace',
  395. nodes: []
  396. });
  397. var open = new Node({type: 'brace.open'});
  398. var close = new Node({type: 'brace.close'});
  399. console.log(utils.hasOpen(brace)); // false
  400. console.log(utils.hasClose(brace)); // false
  401. brace.pushNode(open);
  402. brace.pushNode(close);
  403. console.log(utils.hasOpen(brace)); // true
  404. console.log(utils.hasClose(brace)); // true
  405. ```
  406. ### [.addType](index.js#L719)
  407. Push the given `node` onto the `state.inside` array for the given type. This array is used as a specialized "stack" for only the given `node.type`.
  408. **Params**
  409. * `state` **{Object}**: The `compiler.state` object or custom state object.
  410. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  411. * `returns` **{Array}**: Returns the `state.inside` stack for the given type.
  412. **Example**
  413. ```js
  414. var state = { inside: {}};
  415. var node = new Node({type: 'brace'});
  416. utils.addType(state, node);
  417. console.log(state.inside);
  418. //=> { brace: [{type: 'brace'}] }
  419. ```
  420. ### [.removeType](index.js#L759)
  421. Remove the given `node` from the `state.inside` array for the given type. This array is used as a specialized "stack" for only the given `node.type`.
  422. **Params**
  423. * `state` **{Object}**: The `compiler.state` object or custom state object.
  424. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  425. * `returns` **{Array}**: Returns the `state.inside` stack for the given type.
  426. **Example**
  427. ```js
  428. var state = { inside: {}};
  429. var node = new Node({type: 'brace'});
  430. utils.addType(state, node);
  431. console.log(state.inside);
  432. //=> { brace: [{type: 'brace'}] }
  433. utils.removeType(state, node);
  434. //=> { brace: [] }
  435. ```
  436. ### [.isEmpty](index.js#L788)
  437. Returns true if `node.val` is an empty string, or `node.nodes` does not contain any non-empty text nodes.
  438. **Params**
  439. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  440. * `fn` **{Function}**
  441. * `returns` **{Boolean}**
  442. **Example**
  443. ```js
  444. var node = new Node({type: 'text'});
  445. utils.isEmpty(node); //=> true
  446. node.val = 'foo';
  447. utils.isEmpty(node); //=> false
  448. ```
  449. ### [.isInsideType](index.js#L833)
  450. Returns true if the `state.inside` stack for the given type exists and has one or more nodes on it.
  451. **Params**
  452. * `state` **{Object}**
  453. * `type` **{String}**
  454. * `returns` **{Boolean}**
  455. **Example**
  456. ```js
  457. var state = { inside: {}};
  458. var node = new Node({type: 'brace'});
  459. console.log(utils.isInsideType(state, 'brace')); //=> false
  460. utils.addType(state, node);
  461. console.log(utils.isInsideType(state, 'brace')); //=> true
  462. utils.removeType(state, node);
  463. console.log(utils.isInsideType(state, 'brace')); //=> false
  464. ```
  465. ### [.isInside](index.js#L867)
  466. Returns true if `node` is either a child or grand-child of the given `type`, or `state.inside[type]` is a non-empty array.
  467. **Params**
  468. * `state` **{Object}**: Either the `compiler.state` object, if it exists, or a user-supplied state object.
  469. * `node` **{Object}**: Instance of [snapdragon-node](https://github.com/jonschlinkert/snapdragon-node)
  470. * `type` **{String}**: The `node.type` to check for.
  471. * `returns` **{Boolean}**
  472. **Example**
  473. ```js
  474. var state = { inside: {}};
  475. var node = new Node({type: 'brace'});
  476. var open = new Node({type: 'brace.open'});
  477. console.log(utils.isInside(state, open, 'brace')); //=> false
  478. utils.pushNode(node, open);
  479. console.log(utils.isInside(state, open, 'brace')); //=> true
  480. ```
  481. ### [.last](index.js#L915)
  482. Get the last `n` element from the given `array`. Used for getting
  483. a node from `node.nodes.`
  484. **Params**
  485. * `array` **{Array}**
  486. * `n` **{Number}**
  487. * `returns` **{undefined}**
  488. ### [.arrayify](index.js#L935)
  489. Cast the given `val` to an array.
  490. **Params**
  491. * `val` **{any}**
  492. * `returns` **{Array}**
  493. **Example**
  494. ```js
  495. console.log(utils.arraify(''));
  496. //=> []
  497. console.log(utils.arraify('foo'));
  498. //=> ['foo']
  499. console.log(utils.arraify(['foo']));
  500. //=> ['foo']
  501. ```
  502. ### [.stringify](index.js#L948)
  503. Convert the given `val` to a string by joining with `,`. Useful
  504. for creating a cheerio/CSS/DOM-style selector from a list of strings.
  505. **Params**
  506. * `val` **{any}**
  507. * `returns` **{Array}**
  508. ### [.trim](index.js#L961)
  509. Ensure that the given value is a string and call `.trim()` on it,
  510. or return an empty string.
  511. **Params**
  512. * `str` **{String}**
  513. * `returns` **{String}**
  514. ## Release history
  515. Changelog entries are classified using the following labels from [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog):
  516. * `added`: for new features
  517. * `changed`: for changes in existing functionality
  518. * `deprecated`: for once-stable features removed in upcoming releases
  519. * `removed`: for deprecated features removed in this release
  520. * `fixed`: for any bug fixes
  521. Custom labels used in this changelog:
  522. * `dependencies`: bumps dependencies
  523. * `housekeeping`: code re-organization, minor edits, or other changes that don't fit in one of the other categories.
  524. ### [3.0.0] - 2017-05-01
  525. **Changed**
  526. * `.emit` was renamed to [.append](#append)
  527. * `.addNode` was renamed to [.pushNode](#pushNode)
  528. * `.getNode` was renamed to [.findNode](#findNode)
  529. * `.isEmptyNodes` was renamed to [.isEmpty](#isEmpty): also now works with `node.nodes` and/or `node.val`
  530. **Added**
  531. * [.identity](#identity)
  532. * [.removeNode](#removeNode)
  533. * [.shiftNode](#shiftNode)
  534. * [.popNode](#popNode)
  535. ### [0.1.0]
  536. First release.
  537. ## About
  538. ### Contributing
  539. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  540. Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
  541. ### Building docs
  542. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  543. To generate the readme, run the following command:
  544. ```sh
  545. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  546. ```
  547. ### Running tests
  548. Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
  549. ```sh
  550. $ npm install && npm test
  551. ```
  552. ### Author
  553. **Jon Schlinkert**
  554. * [github/jonschlinkert](https://github.com/jonschlinkert)
  555. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  556. ### License
  557. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  558. Released under the [MIT License](LICENSE).
  559. ***
  560. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 01, 2017._