@microsoft/node-core-library
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "3.1.0", | ||
"tag": "@microsoft/node-core-library_v3.1.0", | ||
"date": "Fri, 28 Sep 2018 16:05:35 GMT", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"comment": "Add `Path.isUnderOrEquals()`" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "3.0.1", | ||
@@ -7,0 +19,0 @@ "tag": "@microsoft/node-core-library_v3.0.1", |
# Change Log - @microsoft/node-core-library | ||
This log was last generated on Thu, 06 Sep 2018 01:25:26 GMT and should not be manually modified. | ||
This log was last generated on Fri, 28 Sep 2018 16:05:35 GMT and should not be manually modified. | ||
## 3.1.0 | ||
Fri, 28 Sep 2018 16:05:35 GMT | ||
### Minor changes | ||
- Add `Path.isUnderOrEquals()` | ||
## 3.0.1 | ||
@@ -6,0 +13,0 @@ Thu, 06 Sep 2018 01:25:26 GMT |
@@ -1195,2 +1195,3 @@ /** | ||
* This attempts to parse a package name that may include a scope component. | ||
* The packageName must not be an empty string. | ||
* @remarks | ||
@@ -1205,3 +1206,5 @@ * This function will not throw an exception. | ||
* Same as {@link PackageName.tryParse}, except this throws an exception if the input | ||
* cannot be parsed | ||
* cannot be parsed. | ||
* @remarks | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -1225,2 +1228,3 @@ static parse(packageName: string): IParsedPackageName; | ||
* Throws an exception if the specified name is not a valid package name. | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -1244,2 +1248,3 @@ static validate(packageName: string): void; | ||
export declare class Path { | ||
private static _relativePathRegex; | ||
/** | ||
@@ -1252,2 +1257,3 @@ * Returns true if childPath refers to a location under parentFolderPath. | ||
static isUnder(childPath: string, parentFolderPath: string): boolean; | ||
static isUnderOrEqual(childPath: string, parentFolderPath: string): boolean; | ||
} | ||
@@ -1254,0 +1260,0 @@ |
@@ -42,2 +42,3 @@ /** | ||
* This attempts to parse a package name that may include a scope component. | ||
* The packageName must not be an empty string. | ||
* @remarks | ||
@@ -52,3 +53,5 @@ * This function will not throw an exception. | ||
* Same as {@link PackageName.tryParse}, except this throws an exception if the input | ||
* cannot be parsed | ||
* cannot be parsed. | ||
* @remarks | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -72,2 +75,3 @@ static parse(packageName: string): IParsedPackageName; | ||
* Throws an exception if the specified name is not a valid package name. | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -74,0 +78,0 @@ static validate(packageName: string): void; |
@@ -13,2 +13,3 @@ "use strict"; | ||
* This attempts to parse a package name that may include a scope component. | ||
* The packageName must not be an empty string. | ||
* @remarks | ||
@@ -86,3 +87,5 @@ * This function will not throw an exception. | ||
* Same as {@link PackageName.tryParse}, except this throws an exception if the input | ||
* cannot be parsed | ||
* cannot be parsed. | ||
* @remarks | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -119,2 +122,3 @@ static parse(packageName) { | ||
* Throws an exception if the specified name is not a valid package name. | ||
* The packageName must not be an empty string. | ||
*/ | ||
@@ -121,0 +125,0 @@ static validate(packageName) { |
@@ -8,2 +8,3 @@ /** | ||
export declare class Path { | ||
private static _relativePathRegex; | ||
/** | ||
@@ -16,2 +17,3 @@ * Returns true if childPath refers to a location under parentFolderPath. | ||
static isUnder(childPath: string, parentFolderPath: string): boolean; | ||
static isUnderOrEqual(childPath: string, parentFolderPath: string): boolean; | ||
} |
@@ -24,6 +24,11 @@ "use strict"; | ||
const relativePath = path.relative(childPath, parentFolderPath); | ||
return /^[.\/\\]+$/.test(relativePath); | ||
return Path._relativePathRegex.test(relativePath); | ||
} | ||
static isUnderOrEqual(childPath, parentFolderPath) { | ||
const relativePath = path.relative(childPath, parentFolderPath); | ||
return relativePath === '' || Path._relativePathRegex.test(relativePath); | ||
} | ||
} | ||
Path._relativePathRegex = /^[.\/\\]+$/; | ||
exports.Path = Path; | ||
//# sourceMappingURL=Path.js.map |
{ | ||
"name": "@microsoft/node-core-library", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Core libraries that every NodeJS toolchain project should use", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
520352
6534