@vnejs/sources-set 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export { SourcesSet } from "./sources-set.js";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { SourcesSet } from "./sources-set.js";
@@ -0,0 +1,10 @@
1
+ export declare class SourcesSet {
2
+ private entries;
3
+ add: (source: string) => false | Set<string>;
4
+ rm: (source: string) => boolean;
5
+ set: (source: string, value: boolean) => boolean | Set<string>;
6
+ has: (source: string) => boolean;
7
+ clear: () => void;
8
+ isEmpty: () => boolean;
9
+ isNotEmpty: () => boolean;
10
+ }
@@ -0,0 +1,10 @@
1
+ export class SourcesSet {
2
+ entries = new Set();
3
+ add = (source) => !this.entries.has(source) && this.entries.add(source);
4
+ rm = (source) => this.entries.has(source) && this.entries.delete(source);
5
+ set = (source, value) => (value ? this.add(source) : this.rm(source));
6
+ has = (source) => this.entries.has(source);
7
+ clear = () => this.entries.clear();
8
+ isEmpty = () => this.entries.size === 0;
9
+ isNotEmpty = () => this.entries.size !== 0;
10
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@vnejs/sources-set",
3
+ "version": "0.1.2",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "src",
10
+ "tsconfig.json"
11
+ ],
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\" && exit 1",
14
+ "build": "npx @vnejs/monorepo package",
15
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
16
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
17
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
18
+ },
19
+ "author": "",
20
+ "license": "ISC",
21
+ "devDependencies": {
22
+ "@vnejs/configs.ts-common": "~0.1.0"
23
+ }
24
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { SourcesSet } from "./sources-set.js";
@@ -0,0 +1,12 @@
1
+ export class SourcesSet {
2
+ private entries = new Set<string>();
3
+
4
+ add = (source: string) => !this.entries.has(source) && this.entries.add(source);
5
+ rm = (source: string) => this.entries.has(source) && this.entries.delete(source);
6
+ set = (source: string, value: boolean) => (value ? this.add(source) : this.rm(source));
7
+ has = (source: string): boolean => this.entries.has(source);
8
+ clear = (): void => this.entries.clear();
9
+
10
+ isEmpty = (): boolean => this.entries.size === 0;
11
+ isNotEmpty = (): boolean => this.entries.size !== 0;
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": [
8
+ "src/**/*.ts"
9
+ ],
10
+ "exclude": [
11
+ "dist",
12
+ "node_modules"
13
+ ]
14
+ }