Skip to content

Commit 60235cd

Browse files
committed
Update dependencies, dev-dependencies
1 parent ed96d00 commit 60235cd

File tree

5 files changed

+72
-71
lines changed

5 files changed

+72
-71
lines changed

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"language"
1313
],
1414
"dependencies": {
15-
"wooorm/mdast-range": "^1.0.0",
15+
"wooorm/remark-range": "^2.0.0",
1616
"wooorm/nlcst-to-string": "^1.0.0"
1717
},
1818
"repository": "wooorm/mdast-util-to-nlcst",

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Dependencies.
1616
*/
1717

18-
var range = require('mdast-range');
18+
var range = require('remark-range');
1919
var toString = require('nlcst-to-string');
2020

2121
/*

mdast-util-to-nlcst.js

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Dependencies.
1717
*/
1818

19-
var range = require('mdast-range');
19+
var range = require('remark-range');
2020
var toString = require('nlcst-to-string');
2121

2222
/*
@@ -280,12 +280,71 @@ function toNLCST(file, Parser) {
280280

281281
module.exports = toNLCST;
282282

283-
},{"mdast-range":2,"nlcst-to-string":3}],2:[function(require,module,exports){
283+
},{"nlcst-to-string":2,"remark-range":3}],2:[function(require,module,exports){
284+
/**
285+
* @author Titus Wormer
286+
* @copyright 2014-2015 Titus Wormer
287+
* @license MIT
288+
* @module nlcst:to-string
289+
* @fileoverview Transform an NLCST node into a string.
290+
*/
291+
292+
'use strict';
293+
294+
/* eslint-env commonjs */
295+
296+
/**
297+
* Stringify an NLCST node.
298+
*
299+
* @param {NLCSTNode|Array.<NLCSTNode>} node - Node to to
300+
* stringify.
301+
* @param {string} separator - Value to separate each item
302+
* with.
303+
* @return {string} - Stringified `node`.
304+
*/
305+
function nlcstToString(node, separator) {
306+
var values;
307+
var length;
308+
var children;
309+
310+
separator = separator || '';
311+
312+
if (typeof node.value === 'string') {
313+
return node.value;
314+
}
315+
316+
children = 'length' in node ? node : node.children;
317+
length = children.length;
318+
319+
/*
320+
* Shortcut: This is pretty common, and a small performance win.
321+
*/
322+
323+
if (length === 1 && 'value' in children[0]) {
324+
return children[0].value;
325+
}
326+
327+
values = [];
328+
329+
while (length--) {
330+
values[length] = nlcstToString(children[length], separator);
331+
}
332+
333+
return values.join(separator);
334+
}
335+
336+
/*
337+
* Expose.
338+
*/
339+
340+
module.exports = nlcstToString;
341+
342+
},{}],3:[function(require,module,exports){
284343
/**
285344
* @author Titus Wormer
286345
* @copyright 2015 Titus Wormer
287346
* @license MIT
288-
* @module mdast:range
347+
* @module remark:range
289348
* @fileoverview Patch index-based range on mdast nodes.
290349
*/
291350

@@ -303,7 +362,7 @@ var visit = require('unist-util-visit');
303362
* Calculate offsets for `lines`.
304363
*
305364
* @param {Array.<string>} lines - Lines to compile.
306-
* @return {Array.<number>}
365+
* @return {Array.<number>} - List of offsets per line.
307366
*/
308367
function toOffsets(lines) {
309368
var total = 0;
@@ -322,6 +381,7 @@ function toOffsets(lines) {
322381
* Add an offset based on `offsets` to `position`.
323382
*
324383
* @param {Object} position - Position.
384+
* @param {Function} fn - Calculator.
325385
*/
326386
function addRange(position, fn) {
327387
position.offset = fn(position);
@@ -411,7 +471,7 @@ function transformer(ast, file) {
411471
*/
412472

413473
if (!file || typeof file.contents !== 'string') {
414-
throw new Error('Missing `file` for mdast-range');
474+
throw new Error('Missing `file` for remark-range');
415475
}
416476

417477
/*
@@ -460,66 +520,7 @@ function attacher() {
460520

461521
module.exports = attacher;
462522

463-
},{"unist-util-visit":4}],3:[function(require,module,exports){
464-
/**
465-
* @author Titus Wormer
466-
* @copyright 2014-2015 Titus Wormer
467-
* @license MIT
468-
* @module nlcst:to-string
469-
* @fileoverview Transform an NLCST node into a string.
470-
*/
471-
472-
'use strict';
473-
474-
/* eslint-env commonjs */
475-
476-
/**
477-
* Stringify an NLCST node.
478-
*
479-
* @param {NLCSTNode|Array.<NLCSTNode>} node - Node to to
480-
* stringify.
481-
* @param {string} separator - Value to separate each item
482-
* with.
483-
* @return {string} - Stringified `node`.
484-
*/
485-
function nlcstToString(node, separator) {
486-
var values;
487-
var length;
488-
var children;
489-
490-
separator = separator || '';
491-
492-
if (typeof node.value === 'string') {
493-
return node.value;
494-
}
495-
496-
children = 'length' in node ? node : node.children;
497-
length = children.length;
498-
499-
/*
500-
* Shortcut: This is pretty common, and a small performance win.
501-
*/
502-
503-
if (length === 1 && 'value' in children[0]) {
504-
return children[0].value;
505-
}
506-
507-
values = [];
508-
509-
while (length--) {
510-
values[length] = nlcstToString(children[length], separator);
511-
}
512-
513-
return values.join(separator);
514-
}
515-
516-
/*
517-
* Expose.
518-
*/
519-
520-
module.exports = nlcstToString;
521-
522-
},{}],4:[function(require,module,exports){
523+
},{"unist-util-visit":4}],4:[function(require,module,exports){
523524
/**
524525
* @author Titus Wormer
525526
* @copyright 2015 Titus Wormer. All rights reserved.

mdast-util-to-nlcst.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"language"
1313
],
1414
"dependencies": {
15-
"mdast-range": "^1.0.0",
15+
"remark-range": "^2.0.0",
1616
"nlcst-to-string": "^1.0.0"
1717
},
1818
"repository": {
@@ -28,10 +28,10 @@
2828
"LICENSE"
2929
],
3030
"devDependencies": {
31-
"browserify": "^11.0.0",
31+
"browserify": "^13.0.0",
3232
"eslint": "^1.1.0",
3333
"esmangle": "^1.0.0",
34-
"istanbul": "^0.3.0",
34+
"istanbul": "^0.4.0",
3535
"jscs": "^2.0.0",
3636
"jscs-jsdoc": "^1.0.0",
3737
"mocha": "^2.0.0",

0 commit comments

Comments
 (0)