first commit
This commit is contained in:
20
build/node_modules/glob2base/LICENSE
generated
vendored
Executable file
20
build/node_modules/glob2base/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
Copyright (c) 2014 Fractal <contact@wearefractal.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
51
build/node_modules/glob2base/README.md
generated
vendored
Normal file
51
build/node_modules/glob2base/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# glob2base [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Support us][gittip-image]][gittip-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]
|
||||
|
||||
|
||||
## Information
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Package</td><td>glob2base</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Extracts a base path from a node-glob instance</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Node Version</td>
|
||||
<td>>= 0.10</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
|
||||
The module is a function that takes in a node-glob instance and returns a string. Basically it just gives you everything before any globbing/matching happens.
|
||||
|
||||
```javascript
|
||||
var glob2base = require('glob2base');
|
||||
var glob = require('glob');
|
||||
|
||||
// js/
|
||||
glob2base(new glob.Glob('js/**/*.js'));
|
||||
|
||||
// css/test/
|
||||
glob2base(new glob.Glob('css/test/{a,b}/*.css'));
|
||||
|
||||
// pages/whatever/
|
||||
glob2base(new glob.Glob('pages/whatever/index.html'));
|
||||
```
|
||||
|
||||
## Like what we do?
|
||||
|
||||
[gittip-url]: https://www.gittip.com/WeAreFractal/
|
||||
[gittip-image]: http://img.shields.io/gittip/WeAreFractal.svg
|
||||
|
||||
[downloads-image]: http://img.shields.io/npm/dm/glob2base.svg
|
||||
[npm-url]: https://npmjs.org/package/glob2base
|
||||
[npm-image]: http://img.shields.io/npm/v/glob2base.svg
|
||||
|
||||
[travis-url]: https://travis-ci.org/wearefractal/glob2base
|
||||
[travis-image]: http://img.shields.io/travis/wearefractal/glob2base.svg
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/wearefractal/glob2base
|
||||
[coveralls-image]: http://img.shields.io/coveralls/wearefractal/glob2base/master.svg
|
||||
59
build/node_modules/glob2base/index.js
generated
vendored
Normal file
59
build/node_modules/glob2base/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var findIndex = require('find-index');
|
||||
|
||||
var flattenGlob = function(arr){
|
||||
var out = [];
|
||||
var flat = true;
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
if (typeof arr[i] !== 'string') {
|
||||
flat = false;
|
||||
break;
|
||||
}
|
||||
out.push(arr[i]);
|
||||
}
|
||||
|
||||
// last one is a file or specific dir
|
||||
// so we pop it off
|
||||
if (flat) {
|
||||
out.pop();
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
var flattenExpansion = function(set) {
|
||||
var first = set[0];
|
||||
var toCompare = set.slice(1);
|
||||
|
||||
// find index where the diff is
|
||||
var idx = findIndex(first, function(v, idx){
|
||||
if (typeof v !== 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var matched = toCompare.every(function(arr){
|
||||
return v === arr[idx];
|
||||
});
|
||||
|
||||
return !matched;
|
||||
});
|
||||
|
||||
return first.slice(0, idx);
|
||||
};
|
||||
|
||||
var setToBase = function(set) {
|
||||
// normal something/*.js
|
||||
if (set.length <= 1) {
|
||||
return flattenGlob(set[0]);
|
||||
}
|
||||
// has expansion
|
||||
return flattenExpansion(set);
|
||||
};
|
||||
|
||||
module.exports = function(glob) {
|
||||
var set = glob.minimatch.set;
|
||||
var baseParts = setToBase(set);
|
||||
var basePath = path.normalize(baseParts.join(path.sep))+path.sep;
|
||||
return basePath;
|
||||
};
|
||||
75
build/node_modules/glob2base/package.json
generated
vendored
Normal file
75
build/node_modules/glob2base/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "glob2base@^0.0.12",
|
||||
"_id": "glob2base@0.0.12",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=",
|
||||
"_location": "/glob2base",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "glob2base@^0.0.12",
|
||||
"name": "glob2base",
|
||||
"escapedName": "glob2base",
|
||||
"rawSpec": "^0.0.12",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.0.12"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pngout-bin/glob-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz",
|
||||
"_shasum": "9d419b3e28f12e83a362164a277055922c9c0d56",
|
||||
"_spec": "glob2base@^0.0.12",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/pngout-bin/node_modules/glob-stream",
|
||||
"author": {
|
||||
"name": "Fractal",
|
||||
"email": "contact@wearefractal.com",
|
||||
"url": "http://wearefractal.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/wearefractal/glob2base/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"find-index": "^0.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Extracts a base path from a node-glob instance",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.6.1",
|
||||
"glob": "^4.0.0",
|
||||
"istanbul": "^0.3.2",
|
||||
"jshint": "^2.4.1",
|
||||
"jshint-stylish": "^1.0.0",
|
||||
"mocha": "^2.0.0",
|
||||
"mocha-lcov-reporter": "^0.0.1",
|
||||
"should": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "http://github.com/wearefractal/glob2base",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/wearefractal/glob2base/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"main": "./index.js",
|
||||
"name": "glob2base",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/wearefractal/glob2base.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
|
||||
"lint": "jshint index.js --reporter node_modules/jshint-stylish/stylish.js --exclude node_modules",
|
||||
"test": "npm run-script lint && mocha --reporter spec"
|
||||
},
|
||||
"version": "0.0.12"
|
||||
}
|
||||
Reference in New Issue
Block a user