| language: node_js | ||
| node_js: | ||
| - '0.10' |
+35
| # {%= name %} {%= badge("fury") %} | ||
| > {%= description %} | ||
| ## Install | ||
| {%= include("install-npm", {save: true}) %} | ||
| ## Run tests | ||
| ```bash | ||
| npm test | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| var utils = require('{%= name %}'); | ||
| ``` | ||
| ## API | ||
| {%= comments("index.js") %} | ||
| ## Contributing | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}) | ||
| ## Author | ||
| {%= include("author") %} | ||
| ## License | ||
| {%= copyright() %} | ||
| {%= license() %} | ||
| *** | ||
| {%= include("footer") %} |
| 'use strict'; | ||
| var extract = require('extract-gfm'); | ||
| /** | ||
| * Adjust markdown heading levels. | ||
| * | ||
| * Adds one heading level next to all markdown headings to make | ||
| * them correct within the scope of the inheriting document. | ||
| * _Headings in fenced code blocks are skipped_. | ||
| * | ||
| * ```js | ||
| * utils.heading(str); | ||
| * ``` | ||
| * | ||
| * @param {String} `str` | ||
| * @return {String} | ||
| * @api public | ||
| */ | ||
| module.exports = function(str, lvl) { | ||
| var o = extract.parseBlocks(str); | ||
| lvl = lvl ? new Array(lvl + 2).join('#') : '##'; | ||
| o.text = o.text.replace(/^#/gm, lvl); | ||
| return extract.injectBlocks(o.text, o.blocks); | ||
| }; |
+13
| 'use strict'; | ||
| var fs = require('fs'); | ||
| var path = require('path'); | ||
| fs.readdirSync(__dirname).forEach(function (name) { | ||
| var base = path.basename(name, path.extname(name)); | ||
| var fp = path.resolve(__dirname, name); | ||
| if (!/index/.test(fp) && fs.statSync(fp).isFile()) { | ||
| exports[base] = require(fp); | ||
| } | ||
| }); |
+34
| /*! | ||
| * verb-util <https://github.com/jonschlinkert/verb-util> | ||
| * | ||
| * Copyright (c) 2014 Jon Schlinkert, contributors. | ||
| * Licensed under the MIT License | ||
| */ | ||
| 'use strict'; | ||
| var assert = require('assert'); | ||
| var should = require('should'); | ||
| var utils = require('./'); | ||
| describe('utils', function () { | ||
| describe('.headings()', function () { | ||
| it('should skip fenced code blocks:', function () { | ||
| utils.headings('```js\n# Foo\n```\n# Bar').should.eql('```js\n# Foo\n```\n\n## Bar'); | ||
| }); | ||
| it('should add one heading level:', function () { | ||
| utils.headings('# Bar').should.eql('## Bar'); | ||
| utils.headings('## Bar').should.eql('### Bar'); | ||
| utils.headings('### Bar').should.eql('#### Bar'); | ||
| }); | ||
| it('should add the specified number of heading levels:', function () { | ||
| utils.headings('# Bar', 1).should.eql('## Bar'); | ||
| utils.headings('# Bar', 2).should.eql('### Bar'); | ||
| utils.headings('# Bar', 3).should.eql('#### Bar'); | ||
| utils.headings('# Bar', 4).should.eql('##### Bar'); | ||
| }); | ||
| }); | ||
| }); | ||
+3
-1
| { | ||
| "esnext": true, | ||
| "asi": false, | ||
| "boss": true, | ||
@@ -7,4 +7,6 @@ "curly": true, | ||
| "eqnull": true, | ||
| "esnext": true, | ||
| "immed": true, | ||
| "latedef": true, | ||
| "laxcomma": false, | ||
| "newcap": true, | ||
@@ -11,0 +13,0 @@ "noarg": true, |
+3
-4
@@ -8,5 +8,4 @@ /*! | ||
| module.exports = { | ||
| glob: require('./lib/glob'), | ||
| read: require('./lib/read'), | ||
| }; | ||
| 'use strict'; | ||
| module.exports = require('./lib'); |
+15
-17
| { | ||
| "name": "verb-util", | ||
| "description": "Utilities for Verb, for plugins and tags.", | ||
| "version": "0.1.0", | ||
| "description": "Utilities for verb, and verb helpers, plugins, or other extensions.", | ||
| "version": "0.1.1", | ||
| "homepage": "https://github.com/jonschlinkert/verb-util", | ||
@@ -23,11 +23,2 @@ "author": { | ||
| ], | ||
| "keywords": [ | ||
| "docs", | ||
| "documentation", | ||
| "generate", | ||
| "generator", | ||
| "markdown", | ||
| "templates", | ||
| "verb" | ||
| ], | ||
| "main": "index.js", | ||
@@ -41,12 +32,19 @@ "engines": { | ||
| "devDependencies": { | ||
| "chai": "~1.9.1", | ||
| "mocha": "*", | ||
| "verb": "~0.2.6", | ||
| "verb-readme-includes": "^0.1.18" | ||
| "should": "^4.3.0" | ||
| }, | ||
| "keywords": [ | ||
| "util", | ||
| "utils", | ||
| "utility", | ||
| "utilities", | ||
| "helper", | ||
| "extension", | ||
| "verb", | ||
| "plugin", | ||
| "verbutil" | ||
| ], | ||
| "dependencies": { | ||
| "cwd": "^0.3.3", | ||
| "fs-utils": "^0.4.3", | ||
| "lodash": "^2.4.1" | ||
| "extract-gfm": "^0.1.0" | ||
| } | ||
| } |
+24
-6
@@ -1,12 +0,30 @@ | ||
| # verb-util [](http://badge.fury.io/js/verb-util) | ||
| # verb-util [](http://badge.fury.io/js/verb-util) | ||
| > Utilities for Verb, for plugins and tags. | ||
| > Utilities for verb, and verb helpers, plugins, or other extensions. | ||
| ## Install | ||
| Install with [npm](npmjs.org): | ||
| ### Install with [npm](npmjs.org) | ||
| ```bash | ||
| npm i verb-util --save-dev | ||
| npm i verb-util --save | ||
| ``` | ||
| ## Run tests | ||
| ```bash | ||
| npm test | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| var utils = require('verb-util'); | ||
| ``` | ||
| ## API | ||
| ## Contributing | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/verb-util/issues) | ||
| ## Author | ||
@@ -20,3 +38,3 @@ | ||
| ## License | ||
| Copyright (c) 2014 Jon Schlinkert, contributors. | ||
| Copyright (c) 2014 Jon Schlinkert | ||
| Released under the MIT license | ||
@@ -26,2 +44,2 @@ | ||
| _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 04, 2014._ | ||
| _This file was generated by [verb](https://github.com/jonschlinkert/verb) on November 11, 2014._ |
-17
| # {%= name %} {%= badge('fury') %} | ||
| > {%= description %} | ||
| ## Install | ||
| {%= include("install") %} | ||
| ## Author | ||
| {%= include("author") %} | ||
| ## License | ||
| {%= copyright() %} | ||
| {%= license() %} | ||
| *** | ||
| {%= include("footer") %} |
-46
| /*! | ||
| * verb-util <https://github.com/jonschlinkert/verb-util> | ||
| * | ||
| * Copyright (c) 2014 Jon Schlinkert, contributors. | ||
| * Licensed under the MIT license. | ||
| */ | ||
| 'use strict'; | ||
| var path = require('path'); | ||
| var file = require('fs-utils'); | ||
| var root = require('cwd')(); | ||
| var _ = require('lodash'); | ||
| /** | ||
| * ## glob() | ||
| * | ||
| * Returns a function to glob files. | ||
| * | ||
| * **Example** | ||
| * | ||
| * ```js | ||
| * var glob = require('verb-util').glob(); | ||
| * console.log(glob('LICENSE-MIT')); | ||
| * | ||
| * // Set the cwd, so that any time the `glob` function is used | ||
| * // the file path will be relative to that directory | ||
| * var glob = require('verb-util').glob('test/fixtures'); | ||
| * console.log(glob('foo.md')); // e.g. test/fixtures/foo.md | ||
| * ``` | ||
| * | ||
| * @param {String} `cwd` Optionally pass a cwd. | ||
| * @return {String} the contents of the file. | ||
| */ | ||
| module.exports = function (cwd) { | ||
| cwd = cwd || root; | ||
| return function (patterns, options) { | ||
| var options = _.extend({cwd: cwd}, options); | ||
| return file.find(patterns, options).map(function(filepath) { | ||
| return file.normalizeSlash(path.join(cwd, filepath)); | ||
| }); | ||
| }; | ||
| }; |
-40
| /*! | ||
| * verb-util <https://github.com/jonschlinkert/verb-util> | ||
| * | ||
| * Copyright (c) 2014 Jon Schlinkert, contributors. | ||
| * Licensed under the MIT license. | ||
| */ | ||
| 'use strict'; | ||
| var path = require('path'); | ||
| var file = require('fs-utils'); | ||
| var root = require('cwd'); | ||
| /** | ||
| * ## read() | ||
| * | ||
| * Returns a function to read a file, which in turn returns the contents of the specified file. | ||
| * | ||
| * **Example** | ||
| * | ||
| * ```js | ||
| * var read = require('verb-util').read(); | ||
| * console.log(read('LICENSE-MIT')); | ||
| * | ||
| * // Set the cwd, so that any time the `read` function is used | ||
| * // the file path will be relative to that directory | ||
| * var read = require('verb-util').read('test/fixtures'); | ||
| * console.log(read('foo.md')); // e.g. test/fixtures/foo.md | ||
| * ``` | ||
| * | ||
| * @param {String} `cwd` Optionally pass a cwd. | ||
| * @return {String} the contents of the file. | ||
| */ | ||
| module.exports = function (cwd) { | ||
| return function (filepath, options) { | ||
| var fullpath = path.join(cwd || root(), filepath); | ||
| return file.readFileSync(fullpath, options); | ||
| }; | ||
| }; |
| # Test readme |
| contents of test.txt |
Sorry, the diff of this file is not supported yet
-39
| /*! | ||
| * ut <https://github.com/jonschlinkert/ut> | ||
| * | ||
| * Copyright (c) 2014 Jon Schlinkert, contributors. | ||
| * Licensed under the MIT license. | ||
| */ | ||
| var expect = require('chai').expect; | ||
| var vutil = require('../'); | ||
| describe('read():', function () { | ||
| var fixtures = vutil.read('test/fixtures'); | ||
| it('should convert foo to bar.', function () { | ||
| var fixture = fixtures('test.txt'); | ||
| expect(/^contents/.test(fixture)).to.eql(true); | ||
| }); | ||
| }); | ||
| describe('glob():', function () { | ||
| it('should return an array of files.', function () { | ||
| var files = vutil.glob()('lib/*.js'); | ||
| expect(files).to.be.an('array'); | ||
| expect(files.length).to.be.above(1); | ||
| }); | ||
| it('should use the cwd.', function () { | ||
| var files = vutil.glob('lib')('*.js'); | ||
| expect(files).to.be.an('array'); | ||
| expect(files.length).to.be.above(1); | ||
| }); | ||
| it('should use the cwd.', function () { | ||
| var files = vutil.glob(require('verb-readme-includes'))('*.md'); | ||
| expect(files).to.be.an('array'); | ||
| expect(files.length).to.be.above(0); | ||
| }); | ||
| }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1
-66.67%2
-50%43
72%2
-33.33%6740
-9.58%12
-14.29%68
-41.38%1
Infinity%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed