repository-provider
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -339,2 +339,5 @@ 'use strict'; | ||
constructor(path, content = undefined, type = Content.TYPE_BLOB, mode = "100644") { | ||
if (path[0] === "/" || path.indexOf("\\") >= 0) { | ||
throw new TypeError(`Paths should not contain leading '/' or any '\\': ${path}`); | ||
} | ||
Object.defineProperties(this, { | ||
@@ -359,2 +362,5 @@ path: { | ||
} | ||
get isBlob() { | ||
return this.type === Content.TYPE_BLOB; | ||
} | ||
equals(other) { | ||
@@ -361,0 +367,0 @@ if (other === undefined || this.path !== other.path || this.type !== other.type || this.mode !== other.mode) { |
{ | ||
"name": "repository-provider", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -102,2 +102,4 @@ [![npm](https://img.shields.io/npm/v/repository-provider.svg)](https://www.npmjs.com/package/repository-provider) | ||
- [Properties](#properties-6) | ||
- [isDirectory](#isdirectory) | ||
- [isBlob](#isblob) | ||
- [equals](#equals) | ||
@@ -411,2 +413,3 @@ - [Parameters](#parameters-12) | ||
Representation of one file or directory entry | ||
All paths are asolute (no leading '/') and build with '/' | ||
@@ -427,2 +430,10 @@ ### Parameters | ||
### isDirectory | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true is content represents a directory | ||
### isBlob | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true is content represents a blog (plain old file) | ||
### equals | ||
@@ -429,0 +440,0 @@ |
/** | ||
* Representation of one file or directory entry | ||
* All paths are asolute (no leading '/') and build with '/' | ||
* @property {string} path file name inside of the repository | ||
@@ -27,2 +28,8 @@ * @property {string|Buffer|Stream} content | ||
) { | ||
if (path[0] === "/" || path.indexOf("\\") >= 0) { | ||
throw new TypeError( | ||
`Paths should not contain leading '/' or any '\\': ${path}` | ||
); | ||
} | ||
Object.defineProperties(this, { | ||
@@ -36,2 +43,5 @@ path: { value: path }, | ||
/** | ||
* @return {boolean} true is content represents a directory | ||
*/ | ||
get isDirectory() { | ||
@@ -42,2 +52,9 @@ return this.type === Content.TYPE_TREE; | ||
/** | ||
* @return {boolean} true is content represents a blog (plain old file) | ||
*/ | ||
get isBlob() { | ||
return this.type === Content.TYPE_BLOB; | ||
} | ||
/** | ||
* compare against other content | ||
@@ -61,3 +78,2 @@ * @param {Content} other | ||
} | ||
} else { | ||
@@ -69,3 +85,5 @@ if (this.content === undefined && other.content === undefined) { | ||
console.log(`not implemented: ${typeof this.content} <> ${typeof other.content}`); | ||
console.log( | ||
`not implemented: ${typeof this.content} <> ${typeof other.content}` | ||
); | ||
return false; | ||
@@ -72,0 +90,0 @@ } |
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
61083
1545
478