update to support latest deps
This commit is contained in:
parent
930d90345a
commit
f66864d0af
@ -1,4 +0,0 @@
|
||||
docs/
|
||||
coverage/
|
||||
ts/
|
||||
test/
|
14
README.md
14
README.md
@ -2,10 +2,10 @@
|
||||
offers smart ways to handle paths
|
||||
|
||||
## Availabililty
|
||||
[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartpath)
|
||||
[![git](https://push.rocks/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartpath)
|
||||
[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartpath)
|
||||
[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartpath/)
|
||||
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartpath)
|
||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartpath)
|
||||
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartpath)
|
||||
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartpath/)
|
||||
|
||||
## Status for master
|
||||
[![build status](https://GitLab.com/pushrocks/smartpath/badges/master/build.svg)](https://GitLab.com/pushrocks/smartpath/commits/master)
|
||||
@ -21,4 +21,8 @@ offers smart ways to handle paths
|
||||
## Usage
|
||||
Use TypeScript for best in class instellisense.
|
||||
|
||||
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
|
||||
For further information read the linked docs at the top of this README.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
|
||||
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
|
||||
|
6
dist/index.d.ts
vendored
6
dist/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import check = require('./smartpath.check');
|
||||
import get = require('./smartpath.get');
|
||||
import transform = require('./smartpath.transform');
|
||||
import * as check from './smartpath.check';
|
||||
import * as get from './smartpath.get';
|
||||
import * as transform from './smartpath.transform';
|
||||
export { check, get, transform };
|
||||
export * from './smartpath.classes.smartpath';
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -10,4 +10,4 @@ exports.get = get;
|
||||
const transform = require("./smartpath.transform");
|
||||
exports.transform = transform;
|
||||
__export(require("./smartpath.classes.smartpath"));
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUJBQWlCO0FBQ2pCLDJDQUEyQztBQU12QyxzQkFBSztBQUxULHVDQUF1QztBQU1uQyxrQkFBRztBQUxQLG1EQUFtRDtBQU0vQyw4QkFBUztBQUdiLG1EQUE2QyJ9
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUJBQWlCO0FBQ2pCLDJDQUEwQztBQU10QyxzQkFBSztBQUxULHVDQUFzQztBQU1sQyxrQkFBRztBQUxQLG1EQUFrRDtBQU05Qyw4QkFBUztBQUdiLG1EQUE2QyJ9
|
2
dist/smartpath.check.js
vendored
2
dist/smartpath.check.js
vendored
@ -6,4 +6,4 @@ exports.isDir = function (pathArg) {
|
||||
exports.isFile = function (pathArg) {
|
||||
return /\.[a-zA-Z]*$/.test(pathArg); // checks if there is a .anything at the end
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwYXRoLmNoZWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRwYXRoLmNoZWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFHWixRQUFBLEtBQUssR0FBRyxVQUFTLE9BQWU7SUFDdkMsTUFBTSxDQUFDLENBQUMsY0FBTSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0FBQzNCLENBQUMsQ0FBQTtBQUVVLFFBQUEsTUFBTSxHQUFHLFVBQVMsT0FBTztJQUNoQyxNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQSxDQUFDLDRDQUE0QztBQUNwRixDQUFDLENBQUEifQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwYXRoLmNoZWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRwYXRoLmNoZWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBdUI7QUFHWixRQUFBLEtBQUssR0FBRyxVQUFVLE9BQWU7SUFDMUMsTUFBTSxDQUFDLENBQUMsY0FBTSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0FBQ3pCLENBQUMsQ0FBQTtBQUVVLFFBQUEsTUFBTSxHQUFHLFVBQVUsT0FBTztJQUNuQyxNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQSxDQUFDLDRDQUE0QztBQUNsRixDQUFDLENBQUEifQ==
|
2
dist/smartpath.classes.smartpath.js
vendored
2
dist/smartpath.classes.smartpath.js
vendored
@ -9,4 +9,4 @@ class Smartpath {
|
||||
}
|
||||
}
|
||||
exports.Smartpath = Smartpath;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwYXRoLmNsYXNzZXMuc21hcnRwYXRoLmpzIiwic291cmNlUm9vdCI6IiIs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NQUFNLENBQUMsbUJBQW1CLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFBO0lBQzFFLENBQUM7Q0FDRjtBQVhELDhCQVdDIn0=
|
5
dist/smartpath.plugins.d.ts
vendored
5
dist/smartpath.plugins.d.ts
vendored
@ -1,3 +1,4 @@
|
||||
import 'typings-global';
|
||||
export declare var home: any;
|
||||
export import path = require('path');
|
||||
declare let home: any;
|
||||
import * as path from 'path';
|
||||
export { home, path };
|
||||
|
8
dist/smartpath.plugins.js
vendored
8
dist/smartpath.plugins.js
vendored
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
exports.home = require('home');
|
||||
exports.path = require("path");
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwYXRoLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHBhdGgucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ1osUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO0FBQ2pDLCtCQUFvQyJ9
|
||||
let home = require('home');
|
||||
exports.home = home;
|
||||
const path = require("path");
|
||||
exports.path = path;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRwYXRoLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHBhdGgucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQTtBQUl4QixvQkFBSTtBQUhOLDZCQUE0QjtBQUkxQixvQkFBSSJ9
|
@ -27,9 +27,8 @@
|
||||
"typings-global": "^1.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/should": "^8.1.30",
|
||||
"npmts-g": "^5.2.10",
|
||||
"should": "^11.1.1",
|
||||
"npmts-g": "^6.0.0",
|
||||
"smartchai": "^1.0.3",
|
||||
"typings-test": "^1.0.3"
|
||||
}
|
||||
}
|
||||
|
63
test/test.js
63
test/test.js
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
const should = require("should");
|
||||
const smartchai_1 = require("smartchai");
|
||||
const smartpath = require("../dist/index.js");
|
||||
describe('smartpath', function () {
|
||||
describe('class Smartpath', function () {
|
||||
let mySmartpath;
|
||||
it('should create a valid instance', function () {
|
||||
it('expect create a valid instance', function () {
|
||||
mySmartpath = new smartpath.Smartpath('/some/path/to/some.file');
|
||||
should(mySmartpath).be.instanceof(smartpath.Smartpath);
|
||||
should(mySmartpath.pathLevelsBackwards).be.of.length(5);
|
||||
smartchai_1.expect(mySmartpath).to.be.instanceof(smartpath.Smartpath);
|
||||
smartchai_1.expect(mySmartpath.pathLevelsBackwards).to.be.of.length(5);
|
||||
});
|
||||
});
|
||||
describe('.check', function () {
|
||||
@ -16,21 +16,21 @@ describe('smartpath', function () {
|
||||
let dirPathString = './somedir/anotherdir';
|
||||
let dirPathString2 = './somedir/another.dir/';
|
||||
describe('.isFile', function () {
|
||||
it('should be true for a file path', function () {
|
||||
should(smartpath.check.isFile(filePathString)).be.true();
|
||||
it('expect be true for a file path', function () {
|
||||
smartchai_1.expect(smartpath.check.isFile(filePathString)).to.be.true;
|
||||
});
|
||||
it('should be false for a directory path', function () {
|
||||
should(smartpath.check.isFile(dirPathString)).be.false();
|
||||
should(smartpath.check.isFile(dirPathString2)).be.false();
|
||||
it('expect be false for a directory path', function () {
|
||||
smartchai_1.expect(smartpath.check.isFile(dirPathString)).to.be.false;
|
||||
smartchai_1.expect(smartpath.check.isFile(dirPathString2)).to.be.false;
|
||||
});
|
||||
});
|
||||
describe('.isDir', function () {
|
||||
it('should be true for a directory path', function () {
|
||||
should(smartpath.check.isDir(dirPathString)).be.true();
|
||||
should(smartpath.check.isDir(dirPathString2)).be.true();
|
||||
it('expect be true for a directory path', function () {
|
||||
smartchai_1.expect(smartpath.check.isDir(dirPathString)).to.be.true;
|
||||
smartchai_1.expect(smartpath.check.isDir(dirPathString2)).to.be.true;
|
||||
});
|
||||
it('should be false for a file path', function () {
|
||||
should(smartpath.check.isDir(filePathString)).be.false();
|
||||
it('expect be false for a file path', function () {
|
||||
smartchai_1.expect(smartpath.check.isDir(filePathString)).to.be.false;
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -40,40 +40,37 @@ describe('smartpath', function () {
|
||||
let relativeString = 'somedir/somefile.txt';
|
||||
let relativeString2 = 'anotherdir/anotherfile.txt';
|
||||
let relativeArray = [relativeString, relativeString, relativeString2];
|
||||
it('should make a string absolute', function () {
|
||||
should(smartpath.transform.toAbsolute(relativeString)).startWith('/');
|
||||
should(smartpath.transform.toAbsolute(relativeString)).endWith(relativeString);
|
||||
should(smartpath.transform.toAbsolute(relativeString, baseString)).equal('/basedir/somedir/somefile.txt');
|
||||
it('expect make a string absolute', function () {
|
||||
smartchai_1.expect(smartpath.transform.toAbsolute(relativeString)).startWith('/');
|
||||
smartchai_1.expect(smartpath.transform.toAbsolute(relativeString)).endWith(relativeString);
|
||||
smartchai_1.expect(smartpath.transform.toAbsolute(relativeString, baseString)).equal('/basedir/somedir/somefile.txt');
|
||||
});
|
||||
it('should make an array of relative Strings an Array of absolute Strings', function () {
|
||||
it('expect make an array of relative Strings an Array of absolute Strings', function () {
|
||||
let absoluteArray = smartpath.transform.toAbsolute(relativeArray, baseString);
|
||||
should(absoluteArray[2]).startWith('/');
|
||||
should(absoluteArray[2]).endWith(relativeString2);
|
||||
});
|
||||
it('should return false if neither String nor Array', function () {
|
||||
should(smartpath.transform.toAbsolute(3)).be.false();
|
||||
smartchai_1.expect(absoluteArray[2]).to.startWith('/');
|
||||
smartchai_1.expect(absoluteArray[2]).endWith(relativeString2);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('.get', function () {
|
||||
describe('.type()', function () {
|
||||
it("should return 'url' for an URL", function () {
|
||||
should(smartpath.get.type('https://push.rocks/some/url')).equal('url');
|
||||
should(smartpath.get.type('https://push.rocks/some/url')).not.equal('local');
|
||||
it("expect return 'url' for an URL", function () {
|
||||
smartchai_1.expect(smartpath.get.type('https://push.rocks/some/url')).equal('url');
|
||||
smartchai_1.expect(smartpath.get.type('https://push.rocks/some/url')).not.equal('local');
|
||||
});
|
||||
it("should return 'path' for a Path", function () {
|
||||
should(smartpath.get.type('/some/absolute/path/')).equal('local');
|
||||
should(smartpath.get.type('./some/relative/path/')).not.equal('url');
|
||||
it("expect return 'path' for a Path", function () {
|
||||
smartchai_1.expect(smartpath.get.type('/some/absolute/path/')).equal('local');
|
||||
smartchai_1.expect(smartpath.get.type('./some/relative/path/')).not.equal('url');
|
||||
});
|
||||
});
|
||||
describe('.get()', function () {
|
||||
it('should a absolute path for an home relative URL', function () {
|
||||
it('expect a absolute path for an home relative URL', function () {
|
||||
console.log(smartpath.get.home('~/test'));
|
||||
});
|
||||
it('should return the home directory path when no argument is specified', function () {
|
||||
it('expect return the home directory path when no argument is specified', function () {
|
||||
console.log(smartpath.get.home());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsOENBQTZDO0FBRTdDLFFBQVEsQ0FBQyxXQUFXLEVBQUU7SUFDbEIsUUFBUSxDQUFDLGlCQUFpQixFQUFFO1FBQ3hCLElBQUksV0FBZ0MsQ0FBQTtRQUNwQyxFQUFFLENBQUMsZ0NBQWdDLEVBQUU7WUFDakMsV0F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UFDLEdBQUcsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFBO1lBQzNDLENBQUMsQ0FBQyxDQUFBO1lBQ0YsRUFBRSxDQUFDLHFFQUFxRSxFQUFFO2dCQUN4RSxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQTtZQUNuQyxDQUFDLENBQUMsQ0FBQTtRQUNKLENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUMsQ0FBQSJ9
|
161
test/test.ts
161
test/test.ts
@ -1,89 +1,92 @@
|
||||
import 'typings-test'
|
||||
import * as should from 'should'
|
||||
import { expect } from 'smartchai'
|
||||
import * as smartpath from '../dist/index.js'
|
||||
|
||||
describe('smartpath', function () {
|
||||
describe('class Smartpath', function() {
|
||||
let mySmartpath: smartpath.Smartpath
|
||||
it('should create a valid instance', function() {
|
||||
mySmartpath = new smartpath.Smartpath('/some/path/to/some.file')
|
||||
should(mySmartpath).be.instanceof(smartpath.Smartpath)
|
||||
should(mySmartpath.pathLevelsBackwards).be.of.length(5)
|
||||
})
|
||||
describe('class Smartpath', function () {
|
||||
let mySmartpath: smartpath.Smartpath
|
||||
it('expect create a valid instance', function () {
|
||||
mySmartpath = new smartpath.Smartpath('/some/path/to/some.file')
|
||||
expect(mySmartpath).to.be.instanceof(smartpath.Smartpath)
|
||||
expect(mySmartpath.pathLevelsBackwards).to.be.of.length(5)
|
||||
})
|
||||
describe('.check', function () {
|
||||
let filePathString = './somedir/somefile.json'
|
||||
let dirPathString = './somedir/anotherdir'
|
||||
let dirPathString2 = './somedir/another.dir/'
|
||||
describe('.isFile', function () {
|
||||
it('should be true for a file path', function () {
|
||||
should(
|
||||
smartpath.check.isFile(filePathString)
|
||||
).be.true()
|
||||
})
|
||||
it('should be false for a directory path', function () {
|
||||
should(
|
||||
smartpath.check.isFile(dirPathString)
|
||||
).be.false()
|
||||
should(
|
||||
smartpath.check.isFile(dirPathString2)
|
||||
).be.false()
|
||||
})
|
||||
})
|
||||
describe('.isDir', function () {
|
||||
it('should be true for a directory path', function () {
|
||||
should(smartpath.check.isDir(dirPathString)
|
||||
).be.true()
|
||||
should(smartpath.check.isDir(dirPathString2)
|
||||
).be.true()
|
||||
})
|
||||
it('should be false for a file path', function () {
|
||||
should(
|
||||
smartpath.check.isDir(filePathString)
|
||||
).be.false()
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('.check', function () {
|
||||
let filePathString = './somedir/somefile.json'
|
||||
let dirPathString = './somedir/anotherdir'
|
||||
let dirPathString2 = './somedir/another.dir/'
|
||||
describe('.isFile', function () {
|
||||
it('expect be true for a file path', function () {
|
||||
expect(
|
||||
smartpath.check.isFile(filePathString)
|
||||
).to.be.true
|
||||
})
|
||||
it('expect be false for a directory path', function () {
|
||||
expect(
|
||||
smartpath.check.isFile(dirPathString)
|
||||
).to.be.false
|
||||
expect(
|
||||
smartpath.check.isFile(dirPathString2)
|
||||
).to.be.false
|
||||
})
|
||||
})
|
||||
describe('.transform', function () {
|
||||
describe('toAbsolute()', function () {
|
||||
let baseString = '/basedir'
|
||||
let relativeString = 'somedir/somefile.txt'
|
||||
let relativeString2 = 'anotherdir/anotherfile.txt'
|
||||
let relativeArray = [relativeString, relativeString, relativeString2]
|
||||
it('should make a string absolute', function () {
|
||||
should(smartpath.transform.toAbsolute(relativeString)).startWith('/')
|
||||
should(smartpath.transform.toAbsolute(relativeString)).endWith(relativeString)
|
||||
should(smartpath.transform.toAbsolute(relativeString, baseString)).equal('/basedir/somedir/somefile.txt')
|
||||
})
|
||||
it('should make an array of relative Strings an Array of absolute Strings', function () {
|
||||
let absoluteArray = smartpath.transform.toAbsolute(relativeArray, baseString)
|
||||
should(absoluteArray[2]).startWith('/')
|
||||
should(absoluteArray[2]).endWith(relativeString2)
|
||||
describe('.isDir', function () {
|
||||
it('expect be true for a directory path', function () {
|
||||
|
||||
})
|
||||
it('should return false if neither String nor Array', function () {
|
||||
should(smartpath.transform.toAbsolute(3)).be.false()
|
||||
})
|
||||
})
|
||||
expect(
|
||||
smartpath.check.isDir(dirPathString)
|
||||
).to.be.true
|
||||
|
||||
expect(
|
||||
smartpath.check.isDir(dirPathString2)
|
||||
).to.be.true
|
||||
|
||||
})
|
||||
|
||||
it('expect be false for a file path', function () {
|
||||
expect(
|
||||
smartpath.check.isDir(filePathString)
|
||||
).to.be.false
|
||||
})
|
||||
})
|
||||
describe('.get', function () {
|
||||
describe('.type()', function () {
|
||||
it("should return 'url' for an URL", function () {
|
||||
should(smartpath.get.type('https://push.rocks/some/url')).equal('url')
|
||||
should(smartpath.get.type('https://push.rocks/some/url')).not.equal('local')
|
||||
})
|
||||
it("should return 'path' for a Path", function () {
|
||||
should(smartpath.get.type('/some/absolute/path/')).equal('local')
|
||||
should(smartpath.get.type('./some/relative/path/')).not.equal('url')
|
||||
})
|
||||
})
|
||||
describe('.get()', function () {
|
||||
it('should a absolute path for an home relative URL', function () {
|
||||
console.log(smartpath.get.home('~/test'))
|
||||
})
|
||||
it('should return the home directory path when no argument is specified', function () {
|
||||
console.log(smartpath.get.home())
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('.transform', function () {
|
||||
describe('toAbsolute()', function () {
|
||||
let baseString = '/basedir'
|
||||
let relativeString = 'somedir/somefile.txt'
|
||||
let relativeString2 = 'anotherdir/anotherfile.txt'
|
||||
let relativeArray = [ relativeString, relativeString, relativeString2 ]
|
||||
it('expect make a string absolute', function () {
|
||||
expect(smartpath.transform.toAbsolute(relativeString)).startWith('/')
|
||||
expect(smartpath.transform.toAbsolute(relativeString)).endWith(relativeString)
|
||||
expect(smartpath.transform.toAbsolute(relativeString, baseString)).equal('/basedir/somedir/somefile.txt')
|
||||
})
|
||||
it('expect make an array of relative Strings an Array of absolute Strings', function () {
|
||||
let absoluteArray = smartpath.transform.toAbsolute(relativeArray, baseString)
|
||||
expect(absoluteArray[ 2 ]).to.startWith('/')
|
||||
expect(absoluteArray[ 2 ]).endWith(relativeString2)
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('.get', function () {
|
||||
describe('.type()', function () {
|
||||
it("expect return 'url' for an URL", function () {
|
||||
expect(smartpath.get.type('https://push.rocks/some/url')).equal('url')
|
||||
expect(smartpath.get.type('https://push.rocks/some/url')).not.equal('local')
|
||||
})
|
||||
it("expect return 'path' for a Path", function () {
|
||||
expect(smartpath.get.type('/some/absolute/path/')).equal('local')
|
||||
expect(smartpath.get.type('./some/relative/path/')).not.equal('url')
|
||||
})
|
||||
})
|
||||
describe('.get()', function () {
|
||||
it('expect a absolute path for an home relative URL', function () {
|
||||
console.log(smartpath.get.home('~/test'))
|
||||
})
|
||||
it('expect return the home directory path when no argument is specified', function () {
|
||||
console.log(smartpath.get.home())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
// import modules
|
||||
import check = require('./smartpath.check')
|
||||
import get = require('./smartpath.get')
|
||||
import transform = require('./smartpath.transform')
|
||||
import * as check from './smartpath.check'
|
||||
import * as get from './smartpath.get'
|
||||
import * as transform from './smartpath.transform'
|
||||
|
||||
|
||||
export {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'typings-global'
|
||||
import plugins = require('./smartpath.plugins')
|
||||
|
||||
export let isDir = function(pathArg: string){
|
||||
return !isFile(pathArg)
|
||||
export let isDir = function (pathArg: string) {
|
||||
return !isFile(pathArg)
|
||||
}
|
||||
|
||||
export let isFile = function(pathArg){
|
||||
return /\.[a-zA-Z]*$/.test(pathArg) // checks if there is a .anything at the end
|
||||
export let isFile = function (pathArg) {
|
||||
return /\.[a-zA-Z]*$/.test(pathArg) // checks if there is a .anything at the end
|
||||
}
|
||||
|
@ -2,14 +2,14 @@ import * as plugins from './smartpath.plugins'
|
||||
import * as getMod from './smartpath.get'
|
||||
|
||||
export class Smartpath {
|
||||
originalPath: string
|
||||
type: getMod.TPathType
|
||||
pathLevels: string[]
|
||||
pathLevelsBackwards: string[]
|
||||
constructor(pathArg: string) {
|
||||
this.originalPath = pathArg
|
||||
this.type = getMod.type(this.originalPath)
|
||||
this.pathLevels = getMod.pathLevels(this.originalPath)
|
||||
this.pathLevelsBackwards = getMod.pathLevelsBackwards(this.originalPath)
|
||||
}
|
||||
originalPath: string
|
||||
type: getMod.TPathType
|
||||
pathLevels: string[]
|
||||
pathLevelsBackwards: string[]
|
||||
constructor(pathArg: string) {
|
||||
this.originalPath = pathArg
|
||||
this.type = getMod.type(this.originalPath)
|
||||
this.pathLevels = getMod.pathLevels(this.originalPath)
|
||||
this.pathLevelsBackwards = getMod.pathLevelsBackwards(this.originalPath)
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
import 'typings-global'
|
||||
export var home = require('home')
|
||||
export import path = require('path')
|
||||
let home = require('home')
|
||||
import * as path from 'path'
|
||||
|
||||
export {
|
||||
home,
|
||||
path
|
||||
}
|
||||
|
209
yarn.lock
Normal file
209
yarn.lock
Normal file
@ -0,0 +1,209 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/chai-as-promised@0.0.29":
|
||||
version "0.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-0.0.29.tgz#43d52892aa998e185a3de3e2477edb8573be1d77"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
"@types/promises-a-plus" "*"
|
||||
|
||||
"@types/chai-string@^1.1.30":
|
||||
version "1.1.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai-string/-/chai-string-1.1.30.tgz#4d8744b31a5a2295fc01c981ed1e2d4c8a070f0a"
|
||||
dependencies:
|
||||
"@types/chai" "*"
|
||||
|
||||
"@types/chai@*", "@types/chai@^3.4.35":
|
||||
version "3.4.35"
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-3.4.35.tgz#e8d65f83492d2944f816fc620741821c28a8c900"
|
||||
|
||||
"@types/mocha@^2.2.31":
|
||||
version "2.2.39"
|
||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.39.tgz#f68d63db8b69c38e9558b4073525cf96c4f7a829"
|
||||
|
||||
"@types/node@*":
|
||||
version "7.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.5.tgz#96a0f0a618b7b606f1ec547403c00650210bfbb7"
|
||||
|
||||
"@types/promises-a-plus@*":
|
||||
version "0.0.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/promises-a-plus/-/promises-a-plus-0.0.27.tgz#c64651134614c84b8f5d7114ce8901d36a609780"
|
||||
|
||||
"@types/shelljs@^0.3.33":
|
||||
version "0.3.33"
|
||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.3.33.tgz#df613bddb88225ed09ce5c835f620dcaaf155e6b"
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
assertion-error@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c"
|
||||
|
||||
balanced-match@^0.4.1:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
|
||||
|
||||
brace-expansion@^1.0.0:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
|
||||
dependencies:
|
||||
balanced-match "^0.4.1"
|
||||
concat-map "0.0.1"
|
||||
|
||||
chai-as-promised@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-6.0.0.tgz#1a02a433a6f24dafac63b9c96fa1684db1aa8da6"
|
||||
dependencies:
|
||||
check-error "^1.0.2"
|
||||
|
||||
chai-string@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/chai-string/-/chai-string-1.3.0.tgz#df6139f294391b1035be5606f60a843b3a5041e7"
|
||||
|
||||
chai@^3.5.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
|
||||
dependencies:
|
||||
assertion-error "^1.0.1"
|
||||
deep-eql "^0.1.3"
|
||||
type-detect "^1.0.0"
|
||||
|
||||
check-error@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
|
||||
deep-eql@^0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
|
||||
dependencies:
|
||||
type-detect "0.1.1"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
|
||||
glob@^7.0.0:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
|
||||
dependencies:
|
||||
fs.realpath "^1.0.0"
|
||||
inflight "^1.0.4"
|
||||
inherits "2"
|
||||
minimatch "^3.0.2"
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
home@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/home/-/home-1.0.1.tgz#96a423ceb49b98378ff5ef3ceae059a557f9dd35"
|
||||
dependencies:
|
||||
os-homedir "^1.0.1"
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
dependencies:
|
||||
once "^1.3.0"
|
||||
wrappy "1"
|
||||
|
||||
inherits@2:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
|
||||
interpret@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
|
||||
|
||||
minimatch@^3.0.2:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||
dependencies:
|
||||
brace-expansion "^1.0.0"
|
||||
|
||||
npmts-g@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/npmts-g/-/npmts-g-6.0.0.tgz#491fd50f110967f1b68f14237e7ea5157bf4ddb3"
|
||||
dependencies:
|
||||
"@types/shelljs" "^0.3.33"
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.5"
|
||||
typings-global "^1.0.14"
|
||||
|
||||
once@^1.3.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
os-homedir@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
|
||||
|
||||
path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
|
||||
rechoir@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
||||
dependencies:
|
||||
resolve "^1.1.6"
|
||||
|
||||
resolve@^1.1.6:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c"
|
||||
|
||||
semver@^5.3.0:
|
||||
version "5.3.0"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
|
||||
|
||||
shelljs@^0.7.4, shelljs@^0.7.5:
|
||||
version "0.7.6"
|
||||
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad"
|
||||
dependencies:
|
||||
glob "^7.0.0"
|
||||
interpret "^1.0.0"
|
||||
rechoir "^0.6.2"
|
||||
|
||||
smartchai@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/smartchai/-/smartchai-1.0.3.tgz#de6d010bb8b5aef24cb70b31a5f5334e8c41b72f"
|
||||
dependencies:
|
||||
"@types/chai" "^3.4.35"
|
||||
"@types/chai-as-promised" "0.0.29"
|
||||
"@types/chai-string" "^1.1.30"
|
||||
chai "^3.5.0"
|
||||
chai-as-promised "^6.0.0"
|
||||
chai-string "^1.3.0"
|
||||
|
||||
type-detect@0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
|
||||
|
||||
type-detect@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
|
||||
|
||||
typings-global@*, typings-global@^1.0.14:
|
||||
version "1.0.14"
|
||||
resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.14.tgz#ab682720a03d6b9278869fb5c30c30d7dc61d12c"
|
||||
dependencies:
|
||||
semver "^5.3.0"
|
||||
shelljs "^0.7.4"
|
||||
|
||||
typings-test@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/typings-test/-/typings-test-1.0.3.tgz#fbab895eb3f0c44842e73db059f65946b971e369"
|
||||
dependencies:
|
||||
"@types/mocha" "^2.2.31"
|
||||
typings-global "*"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
Loading…
Reference in New Issue
Block a user