Compare commits

...

13 Commits

Author SHA1 Message Date
93d5fc3070 2.0.3 2016-05-25 09:05:13 +02:00
08cd48b7bc Add authors note 2016-05-25 09:05:04 +02:00
bb17908ef5 2.0.2 2016-05-25 09:02:45 +02:00
3b8e31c8b0 improve README and add app veyor 2016-05-25 09:02:24 +02:00
a990c5ca32 2.0.1 2016-05-25 06:55:02 +02:00
2d4c480c1b now computes zoneName and finds protocol 2016-05-25 06:54:55 +02:00
05cd515824 2.0.0 2016-05-25 05:06:24 +02:00
bd4de36143 now correctly parsing a Domain 2016-05-25 05:06:19 +02:00
6a1fb1ec50 update structure 2016-05-17 00:02:29 +02:00
930f351626 1.0.3 2016-05-01 21:29:05 +02:00
9f6ab54a05 fixing issue with typings 2016-05-01 21:28:59 +02:00
dcd7423921 1.0.2 2016-05-01 14:03:39 +02:00
5de7c2517d fix declaration issue 2016-05-01 14:02:48 +02:00
24 changed files with 283 additions and 72 deletions

View File

@ -1,2 +1,39 @@
# smartstring
handle strings in smart ways.
handle strings in smart ways. TypeScript ready.
## Status
[![Build Status](https://travis-ci.org/pushrocks/smartstring.svg?branch=master)](https://travis-ci.org/pushrocks/smartstring)
[![Build status](https://ci.appveyor.com/api/projects/status/x4oe2xxwwcbxmk1h/branch/master?svg=true)](https://ci.appveyor.com/project/philkunz/smartstring/branch/master)
[![Dependency Status](https://david-dm.org/pushrocks/smartstring.svg)](https://david-dm.org/pushrocks/smartstring)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartstring/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartstring/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/smartstring/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartstring)
## Usage
Use TypeScript for intellisense.
```typescript
import * as smartstring from "smartstring";
// smartstring.GitRepo class
let myGitRepo = new smartstring.GitRepo("git@github.com:someorg/somerepo.git"); // takes https and git and npm repo URL versions
myGitRepo.host // "github.com"
myGitRepo.user // "someorg"
myGitRepo.repo // "somerepo"
myGitRepo.accessToken // accessToken if specified with https
myGitRepo.sshUrl // ssh URL (computed also from https)
myGitRepo.httpsUrl // https URL (computed also from ssh)
// smartstring.Domain class
let myDomain = new smartstring.Domain("https://sub.main.tld");
myDomain.level1 // "tld"
myDomain.level2 // "main"
// level3 , level 4 and so on...
myDomain.zoneName // "main.tld"
myDOmain.protocol // "https"
```
## About the authors:
[![Project Phase](https://mediaserve.lossless.digital/lossless.com/img/createdby_github.svg)](https://lossless.com/)
[![PayPal](https://img.shields.io/badge/Support%20us-PayPal-blue.svg)](https://paypal.me/lossless)

10
appveyor.yml Normal file
View File

@ -0,0 +1,10 @@
environment:
nodejs_version: "4"
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm test
build: off

7
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import "typings-global";
import SmartstringDocker = require("./smartstring.docker");
import SmartstringTypescript = require("./smartstring.typescript");
export { Domain } from "./smartstring.domain";
export { GitRepo } from "./smartstring.git";
export declare let docker: typeof SmartstringDocker;
export declare let typescript: typeof SmartstringTypescript;

17
dist/index.js vendored
View File

@ -1,13 +1,12 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var SmartstringGit = require("./smartstring.git");
require("typings-global");
var SmartstringDocker = require("./smartstring.docker");
var SmartstringTypescript = require("./smartstring.typescript");
var smartstring = {
git: SmartstringGit,
docker: SmartstringDocker,
typescript: SmartstringTypescript
};
module.exports = smartstring;
var smartstring_domain_1 = require("./smartstring.domain");
exports.Domain = smartstring_domain_1.Domain;
var smartstring_git_1 = require("./smartstring.git");
exports.GitRepo = smartstring_git_1.GitRepo;
exports.docker = SmartstringDocker;
exports.typescript = SmartstringTypescript;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxjQUFj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VyxzQkFBc0IsQ0FBQyxDQUFDO0FBQzNELElBQU8scUJBQXFCLFdBQVcsMEJBQTBCLENBQUMsQ0FBQztBQUVuRSxtQ0FBcUIsc0JBQXNCLENBQUM7QUFBcEMsNkNBQW9DO0FBQzVDLGdDQUFzQixtQkFBbUIsQ0FBQztBQUFsQyw0Q0FBa0M7QUFDL0IsY0FBTSxHQUFHLGlCQUFpQixDQUFDO0FBQzNCLGtCQUFVLEdBQUcscUJBQXFCLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXHJcbmltcG9ydCBTbWFydHN0cmluZ0RvY2tlciA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLmRvY2tlclwiKTtcclxuaW1wb3J0IFNtYXJ0c3RyaW5nVHlwZXNjcmlwdCA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHRcIik7XHJcblxyXG5leHBvcnQge0RvbWFpbn0gZnJvbSBcIi4vc21hcnRzdHJpbmcuZG9tYWluXCI7XHJcbmV4cG9ydCB7R2l0UmVwb30gZnJvbSBcIi4vc21hcnRzdHJpbmcuZ2l0XCI7XHJcbmV4cG9ydCBsZXQgZG9ja2VyID0gU21hcnRzdHJpbmdEb2NrZXI7XHJcbmV4cG9ydCBsZXQgdHlwZXNjcmlwdCA9IFNtYXJ0c3RyaW5nVHlwZXNjcmlwdDsiXX0=

7
dist/smartstring.docker.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
import "typings-global";
/**
* converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg
* @returns {}
*/
export declare let makeEnvObject: (envArrayArg: string[]) => {};

View File

@ -1,4 +1,5 @@
"use strict";
require("typings-global");
/**
* converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg
@ -15,4 +16,4 @@ exports.makeEnvObject = function (envArrayArg) {
return returnObject;
};
//# sourceMappingURL=data:application/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b250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcclxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydHN0cmluZy5wbHVnaW5zXCIpO1xyXG5cclxuLyoqXHJcbiAqIGNvbnZlcnRzIGFuIGVycmF5IG9mIGVudiBzdHJpbmdzIGZyb20gZG9ja2VyIHJlbW90ZSBhcGkgdG8gYW4gdXNhYmxlIG9iamVjdC5cclxuICogQHBhcmFtIGVudkFycmF5QXJnXHJcbiAqIEByZXR1cm5zIHt9XHJcbiAqL1xyXG5leHBvcnQgbGV0IG1ha2VFbnZPYmplY3QgPSBmdW5jdGlvbihlbnZBcnJheUFyZzpzdHJpbmdbXSl7XHJcbiAgICBsZXQgcmV0dXJuT2JqZWN0ID0ge307XHJcbiAgICBsZXQgcmVnZXhTdHJpbmcgPSAvKC4qKT0oLiopLztcclxuICAgIGZvcihsZXQgZW52S2V5IGluIGVudkFycmF5QXJnKXtcclxuICAgICAgICBsZXQgcmVnZXhNYXRjaGVzID0gcmVnZXhTdHJpbmcuZXhlYyhlbnZBcnJheUFyZ1tlbnZLZXldKTtcclxuICAgICAgICByZXR1cm5PYmplY3RbcmVnZXhNYXRjaGVzWzFdXSA9IHJlZ2V4TWF0Y2hlc1syXTtcclxuICAgIH07XHJcbiAgICByZXR1cm4gcmV0dXJuT2JqZWN0O1xyXG59OyJdfQ==

15
dist/smartstring.domain.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
import "typings-global";
export declare class Domain {
fullName: string;
level1: string;
level2: string;
level3: string;
level4: string;
level5: string;
protocol: string;
zoneName: string;
topLevel: string;
domainName: any;
subDomain: any;
constructor(domainStringArg: string);
}

38
dist/smartstring.domain.js vendored Normal file
View File

@ -0,0 +1,38 @@
"use strict";
require("typings-global");
var Domain = (function () {
function Domain(domainStringArg) {
this.fullName = domainStringArg;
var regexMatches = domainRegex(domainStringArg);
this.level1 = regexMatches[0];
this.level2 = regexMatches[1];
this.level3 = regexMatches[2];
this.level4 = regexMatches[3];
this.level5 = regexMatches[4];
this.protocol = protocolRegex(domainStringArg)[1];
this.zoneName = this.level2 + "." + this.level1;
// aliases
this.topLevel = this.level1;
this.domainName = this.level2;
this.subDomain = this.level3;
}
return Domain;
}());
exports.Domain = Domain;
var domainRegex = function (stringArg) {
var regexString = /([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}$/;
var regexMatches = regexString.exec(stringArg);
regexMatches.reverse();
var regexMatchesFiltered = regexMatches.filter(function (stringArg) {
return (stringArg != "");
});
return regexMatchesFiltered;
};
var protocolRegex = function (stringArg) {
var regexString = /^([a-zA-Z0-9]*):\/\//;
var regexMatches = regexString.exec(stringArg);
console.log(regexMatches);
return regexMatches;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLmRvbWFpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBR3ZCO0lBYUksZ0JBQVksZUFBc0I7UUFDOUIsSUFBSSxDQUFDLFFBQVEsR0FBRyxlQUFlLENBQUM7UUFDaEMsSUFBSSxZQUFZLEdBQUcsV0FBVyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FB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RjaGVzRmlsdGVyZWQ7XHJcbn07XHJcblxyXG5sZXQgcHJvdG9jb2xSZWdleCA9IGZ1bmN0aW9uKHN0cmluZ0FyZzpzdHJpbmcpe1xyXG4gICAgbGV0IHJlZ2V4U3RyaW5nID0gL14oW2EtekEtWjAtOV0qKTpcXC9cXC8vO1xyXG4gICAgbGV0IHJlZ2V4TWF0Y2hlcyA9IHJlZ2V4U3RyaW5nLmV4ZWMoc3RyaW5nQXJnKTtcclxuICAgIGNvbnNvbGUubG9nKHJlZ2V4TWF0Y2hlcyk7XHJcbiAgICByZXR1cm4gcmVnZXhNYXRjaGVzO1xyXG59Il19

10
dist/smartstring.git.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import "typings-global";
export declare class GitRepo {
host: string;
user: string;
repo: string;
accessToken: string;
sshUrl: string;
httpsUrl: string;
constructor(stringArg: string, tokenArg?: string);
}

File diff suppressed because one or more lines are too long

2
dist/smartstring.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import "typings-global";
export import beautylog = require("beautylog");

View File

@ -1,8 +1,5 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = {
beautylog: require("beautylog")
};
module.exports = plugins;
require("typings-global");
exports.beautylog = require("beautylog");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFJLE9BQU8sR0FBRztJQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO0NBQ2xDLENBQUM7QUFFRixpQkFBUyxPQUFPLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmxldCBwbHVnaW5zID0ge1xuICAgIGJlYXV0eWxvZzogcmVxdWlyZShcImJlYXV0eWxvZ1wiKVxufTtcblxuZXhwb3J0ID0gcGx1Z2luczsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBRVAsQ0FBQyxDQUZzQjtBQUVULGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcclxuXHJcbmV4cG9ydCBpbXBvcnQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTsiXX0=

2
dist/smartstring.typescript.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import "typings-global";
export declare let regexReferencePath: RegExp;

View File

@ -1,4 +1,5 @@
"use strict";
require("typings-global");
exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIiwiZmlsZSI6InNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLnBsdWdpbnNcIik7XG5cbmV4cG9ydCBsZXQgcmVnZXhSZWZlcmVuY2VQYXRoID0gL1xcL1xcL1xcL1xccyo8cmVmZXJlbmNlXFxzK3BhdGhcXHMqPVxccypbXCJ8J10uKltcInwnXVxccypcXC8+XFxzKltcXFxcbl0/LyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUdaLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIiwiZmlsZSI6InNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXHJcbmltcG9ydCBwbHVnaW5zID0gcmVxdWlyZShcIi4vc21hcnRzdHJpbmcucGx1Z2luc1wiKTtcclxuXHJcbmV4cG9ydCBsZXQgcmVnZXhSZWZlcmVuY2VQYXRoID0gL1xcL1xcL1xcL1xccyo8cmVmZXJlbmNlXFxzK3BhdGhcXHMqPVxccypbXCJ8J10uKltcInwnXVxccypcXC8+XFxzKltcXFxcbl0/LyJdfQ==

View File

@ -1,8 +1,9 @@
{
"name": "smartstring",
"version": "1.0.1",
"version": "2.0.3",
"description": "bundles a bunch of (regex) matching and altering methods.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
},
@ -21,10 +22,12 @@
},
"homepage": "https://github.com/pushrocks/smartstring#readme",
"devDependencies": {
"npmts": "^5.0.4",
"should": "^8.3.1"
"npmts": "^5.1.13",
"should": "^8.4.0",
"typings-test": "^1.0.1"
},
"dependencies": {
"beautylog": "^4.1.2"
"beautylog": "^5.0.6",
"typings-global": "^1.0.3"
}
}

1
test/test.d.ts vendored Normal file
View File

@ -0,0 +1 @@
import "typings-test";

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,36 @@
/// <reference path="../ts/typings/main.d.ts" />
let smartstring = require("../dist/index.js");
import "typings-test"
import * as smartstring from "../dist/index";
let should = require("should");
describe("smartstring",function(){
describe(".git()",function(){
let testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git");
describe(".Domain class",function(){
let testDomain:smartstring.Domain;
it("should create a new Domain object",function(){
testDomain = new smartstring.Domain("https://level3D.level2D.level1D");
testDomain.should.be.instanceof(smartstring.Domain);
});
it("should have a .topLevel",function(){
testDomain.topLevel.should.equal("level1D");
});
it("should have a .level2",function(){
testDomain.level2.should.equal("level2D");
});
it("should have a .level3",function(){
testDomain.level3.should.equal("level3D");
});
it("should have the correct dns zone name",function(){
testDomain.zoneName.should.equal("level2D.level1D");
})
it ("should have the correct protocol",function(){
testDomain.protocol.should.equal("https");
})
})
describe(".Git class",function(){
let testGit:smartstring.GitRepo;
it("should create a new Git class GitRepo",function(){
testGit = new smartstring.GitRepo("git+https://github.com/pushrocks/smartstring.git");
testGit.should.be.instanceof(smartstring.GitRepo);
})
it("should return a .host",function(){
testGit.host
.should.equal("github.com");

View File

@ -1,12 +1,8 @@
/// <reference path="./typings/main.d.ts" />
import SmartstringGit = require("./smartstring.git");
import "typings-global"
import SmartstringDocker = require("./smartstring.docker");
import SmartstringTypescript = require("./smartstring.typescript");
let smartstring = {
git : SmartstringGit,
docker: SmartstringDocker,
typescript: SmartstringTypescript
};
export = smartstring;
export {Domain} from "./smartstring.domain";
export {GitRepo} from "./smartstring.git";
export let docker = SmartstringDocker;
export let typescript = SmartstringTypescript;

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" />
import "typings-global"
import plugins = require("./smartstring.plugins");
/**

51
ts/smartstring.domain.ts Normal file
View File

@ -0,0 +1,51 @@
import "typings-global"
import plugins = require("./smartstring.plugins");
export class Domain {
fullName:string;
level1:string;
level2:string;
level3:string;
level4:string;
level5:string;
protocol:string;
zoneName:string;
//aliases
topLevel:string;
domainName;
subDomain;
constructor(domainStringArg:string){
this.fullName = domainStringArg;
let regexMatches = domainRegex(domainStringArg);
this.level1 = regexMatches[0];
this.level2 = regexMatches[1];
this.level3 = regexMatches[2];
this.level4 = regexMatches[3];
this.level5 = regexMatches[4];
this.protocol = protocolRegex(domainStringArg)[1];
this.zoneName = this.level2 + "." + this.level1;
// aliases
this.topLevel = this.level1;
this.domainName = this.level2;
this.subDomain = this.level3;
}
}
let domainRegex = function(stringArg:string){
let regexString = /([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}$/;
let regexMatches = regexString.exec(stringArg);
regexMatches.reverse();
let regexMatchesFiltered = regexMatches.filter(function(stringArg:string){
return(stringArg != "");
});
return regexMatchesFiltered;
};
let protocolRegex = function(stringArg:string){
let regexString = /^([a-zA-Z0-9]*):\/\//;
let regexMatches = regexString.exec(stringArg);
console.log(regexMatches);
return regexMatches;
}

View File

@ -1,10 +1,10 @@
/// <reference path="./typings/main.d.ts" />
import "typings-global"
import plugins = require("./smartstring.plugins");
/* ---------------------------------------------- *
* ------------------ classes ------------------- *
* ---------------------------------------------- */
class gitRepo {
export class GitRepo {
host:string;
user:string;
repo:string;
@ -50,14 +50,4 @@ let gitLink = function(hostArg:string, userArg:string, repoArg:string, tokenArg:
break;
}
return returnString;
};
/* ---------------------------------------------- *
* ------------------ exports ------------------- *
* ---------------------------------------------- */
let git = function(stringArg:string,tokenArg?:string){
let localGitRepo = new gitRepo(stringArg,tokenArg);
return localGitRepo;
};
export = git;
};

View File

@ -1,6 +1,3 @@
/// <reference path="./typings/main.d.ts" />
let plugins = {
beautylog: require("beautylog")
};
import "typings-global"
export = plugins;
export import beautylog = require("beautylog");

View File

@ -1,3 +1,4 @@
import "typings-global"
import plugins = require("./smartstring.plugins");
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/