Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

reflinks

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflinks - npm Package Compare versions

Comparing version
0.2.6
to
0.2.7
+17
-11
index.js

@@ -10,2 +10,3 @@ /*!

var ora = require('ora');
var utils = require('./utils');

@@ -32,14 +33,18 @@

var log = utils.log;
var name = options.spinnerName || 'reflinks';
var start = options.spinnerStart || 'creating reference links from npm data';
var stop = options.spinnerStop || 'created reference links from npm data';
var color = options.color || 'green';
var start = options.starting || 'creating reference links from npm data';
var stop = options.finished || 'created reference links from npm data';
// start spinner
log.spinner.startTimer(time, name, start, options);
var spinner = ora(start).start();
utils.pkgs(names, options, function(err, arr) {
if (err) return cb(err);
spinner.color = color;
spinner.text = stop;
spinner.stop();
// stop spinner
log.spinner.stopTimer(time, name, stop, options);
if (err) {
// let the implementor decide what to do when a package doesn't exist
cb(err, arr);
return;
}
cb(null, linkify(arr, options));

@@ -54,5 +59,6 @@ });

function linkify(arr, options) {
return arr.reduce(function(acc, pkg) {
return utils.arrayify(arr).reduce(function(acc, pkg) {
if (!pkg.name) return acc;
pkg.homepage = utils.homepage(pkg);
var link = typeof options.template !== 'function'

@@ -59,0 +65,0 @@ ? utils.reference(pkg.name, pkg.homepage)

{
"name": "reflinks",
"description": "Generate (relative) reference links for a glob of markdown files, allowing you to more easily create references from one file to another.",
"version": "0.2.6",
"version": "0.2.7",
"homepage": "https://github.com/jonschlinkert/reflinks",

@@ -24,8 +24,9 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"lazy-cache": "^1.0.3",
"log-utils": "^0.1.2",
"lazy-cache": "^2.0.1",
"log-utils": "^0.1.4",
"markdown-reference": "^0.1.0",
"pkg-cache": "^0.1.3",
"ora": "^0.2.3",
"pkg-cache": "^0.1.4",
"pkg-homepage": "^0.1.1",
"time-diff": "^0.2.1"
"time-diff": "^0.3.1"
},

@@ -32,0 +33,0 @@ "devDependencies": {

@@ -14,2 +14,6 @@ 'use strict';

utils.arrayify = function(val) {
return val ? (Array.isArray(val) ? val : [val]) : [];
};
/**

@@ -16,0 +20,0 @@ * Expose utils

# reflinks [![NPM version](https://img.shields.io/npm/v/reflinks.svg?style=flat)](https://www.npmjs.com/package/reflinks) [![NPM downloads](https://img.shields.io/npm/dm/reflinks.svg?style=flat)](https://npmjs.org/package/reflinks) [![Build Status](https://img.shields.io/travis/jonschlinkert/reflinks.svg?style=flat)](https://travis-ci.org/jonschlinkert/reflinks)
Generate (relative) reference links for a glob of markdown files, allowing you to more easily create references from one file to another.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install reflinks --save
```
**HEADS UP!**
The API was completely changed in v0.2. The main export is now an async function that expects a callback, and instead of globbing local files, reflinks are created from npm package names.
## Usage
```js
var reflinks = require('reflinks');
reflinks(['base', 'verb', 'generate'], function(err, links) {
if (err) throw err;
console.log(links);
// results in:
// [ '[generate]: https://github.com/generate/generate',
// '[verb]: https://github.com/verbose/verb',
// '[base]: https://github.com/node-base/base' ]
});
```
By default results are cached for 7 days. See [pkg-cache](https://github.com/jonschlinkert/pkg-cache) for more details and API documentation related to caching packages.
## Related projects
You might also be interested in these projects:
* [markdown-utils](https://www.npmjs.com/package/markdown-utils): Micro-utils for creating markdown snippets. | [homepage](https://github.com/jonschlinkert/markdown-utils)
* [remarkable](https://www.npmjs.com/package/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://www.npmjs.com/package/remarkable) | [homepage](https://github.com/jonschlinkert/remarkable)
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/reflinks/issues/new).
## Building docs
Generate readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install verb && npm run docs
```
Or, if [verb](https://github.com/verbose/verb) is installed globally:
```sh
$ verb
```
## Running tests
Install dev dependencies:
```sh
$ npm install -d && npm test
```
## Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/reflinks/blob/master/LICENSE).
***
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 02, 2016._