mirror of
https://github.com/FullScreenShenanigans/StateHoldr.git
synced 2026-08-12 02:18:37 -07:00
(v0.7.0) Used shenanigans-manager@0.2 instead of Gulp
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "7"
|
||||
- "node"
|
||||
- "5"
|
||||
|
||||
script:
|
||||
node_modules/gulp/bin/gulp.js
|
||||
npm run verify
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"editor.tabSize": 4,
|
||||
"editor.trimAutoWhitespace": true,
|
||||
"tslint.alwaysShowRuleFailuresAsWarnings": true,
|
||||
"tslint.autoFixOnSave": true,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
require("gulp-shenanigans").initialize(require("gulp"));
|
||||
+57
-19
@@ -1,31 +1,69 @@
|
||||
{
|
||||
"name": "stateholdr",
|
||||
"description": "General localStorage saving for collections of state.",
|
||||
"version": "0.6.1",
|
||||
"author": {
|
||||
"name": "Josh Goldberg",
|
||||
"email": "joshuakgoldberg@outlook.com"
|
||||
"email": "joshuakgoldberg@outlook.com",
|
||||
"name": "Josh Goldberg"
|
||||
},
|
||||
"browser": "./src/index.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/StateHoldr/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"itemsholdr": "^0.7.0"
|
||||
},
|
||||
"description": "General localStorage saving for collections of state.",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.0.4",
|
||||
"@types/lolex": "^1.5.32",
|
||||
"@types/mocha": "^2.2.44",
|
||||
"@types/sinon": "^4.0.0",
|
||||
"@types/sinon-chai": "^2.7.29",
|
||||
"chai": "^4.1.2",
|
||||
"glob": "^7.1.2",
|
||||
"lolex": "^2.3.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha-headless-chrome": "^1.7.1",
|
||||
"requirejs": "^2.3.5",
|
||||
"run-for-every-file": "^1.1.0",
|
||||
"shenanigans-manager": "^0.2.0",
|
||||
"sinon": "^4.1.2",
|
||||
"sinon-chai": "^2.14.0",
|
||||
"tslint": "5.8.0",
|
||||
"typedoc": "^0.9.0",
|
||||
"typescript": "^2.6.2",
|
||||
"webpack": "^3.10.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"name": "stateholdr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:FullScreenShenanigans/StateHoldr.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/FullScreenShenanigans/StateHoldr/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"itemsholdr": "0.6.X"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-shenanigans": "^0.6.17"
|
||||
},
|
||||
"scripts": {
|
||||
"gulp": "gulp",
|
||||
"test": "gulp test"
|
||||
"dist": "npm run dist:webpack",
|
||||
"dist:webpack": "webpack --config webpack.config.js",
|
||||
"docs": "npm run docs:typedoc",
|
||||
"docs:typedoc": "typedoc src/ --out docs/generated",
|
||||
"init": "npm install && npm run setup && npm run verify",
|
||||
"setup": "npm run setup:copy && npm run setup:package",
|
||||
"setup:copy": "npm run setup:copy:default",
|
||||
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
|
||||
"setup:package": "shenanigans-manager hydrate-package-json",
|
||||
"src": "npm run src:tsc && npm run src:tslint",
|
||||
"src:tsc": "tsc -p .",
|
||||
"src:tslint": "tslint -c tslint.json --exclude ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
|
||||
"test": "npm run test:setup && npm run test:run",
|
||||
"test:run": "mocha-headless-chrome --file test/index.html",
|
||||
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
|
||||
"test:setup:copy": "npm run test:setup:copy:default",
|
||||
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
|
||||
"test:setup:html": "shenanigans-manager generate-test-html",
|
||||
"test:setup:tsc": "tsc -p test",
|
||||
"verify": "npm run src && npm run test && npm run dist && npm run docs",
|
||||
"watch": "run-p \"tsc -p . -w\" \"echo sup\""
|
||||
},
|
||||
"shenanigans": {
|
||||
"name": "StateHoldr"
|
||||
}
|
||||
},
|
||||
"types": "./src/index.d.ts",
|
||||
"version": "0.7.0"
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { IItemsHoldr } from "itemsholdr/lib/IItemsHoldr";
|
||||
import { IItemsHoldr } from "itemsholdr";
|
||||
|
||||
import { IStateHoldr } from "./IStateHoldr";
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { stubChangedCollection, stubCollection, stubItemsHoldr, stubStateHoldr } from "./fakes.test";
|
||||
import { IChangeGroup, ICollection } from "./IStateHoldr";
|
||||
|
||||
describe("StateHoldr", () => {
|
||||
describe("addChange", () => {
|
||||
it("updates the collection's value", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", stubCollection());
|
||||
stateHolder.addChange("car", "color", "blue");
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getCollection()).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
});
|
||||
|
||||
describe("addCollectionChange", () => {
|
||||
it("updates the current collection", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", stubCollection());
|
||||
stateHolder.addCollectionChange("exampleCollection", "car", "color", "blue");
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getCollection()).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
|
||||
it("updates a non-current collection", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
const collection: ICollection = {
|
||||
car: {
|
||||
color: "black",
|
||||
},
|
||||
};
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", stubCollection());
|
||||
stateHolder.setCollection("anotherCollection", collection);
|
||||
stateHolder.addCollectionChange("exampleCollection", "car", "color", "blue");
|
||||
|
||||
// Assertt
|
||||
expect(stateHolder.getOtherCollection("exampleCollection")).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyChanges", () => {
|
||||
it("copies objects to a recipient", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
const recipient: IChangeGroup = {};
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", stubCollection());
|
||||
stateHolder.applyChanges("car", recipient);
|
||||
|
||||
// Assert
|
||||
expect(recipient).to.deep.equal({ color: "red" });
|
||||
});
|
||||
|
||||
it("only shallow copies objects to a recipient", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
const changedGroup = "car";
|
||||
const changedKey = "manufacturer";
|
||||
const collection: ICollection = {
|
||||
[changedGroup]: {
|
||||
[changedKey]: {
|
||||
color: "red",
|
||||
},
|
||||
},
|
||||
};
|
||||
const recipient: IChangeGroup = {};
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", collection);
|
||||
stateHolder.applyChanges(changedGroup, recipient);
|
||||
|
||||
// Assert
|
||||
expect(recipient[changedKey]).to.equal(collection[changedGroup][changedKey]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("saveCollection", () => {
|
||||
it("saves the collectionKeys list", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("exampleCollection", stubCollection());
|
||||
stateHolder.saveCollection();
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getItemsHolder().getItem("StateHoldercollectionKeys")).to.deep.equal(["StateHolderexampleCollection"]);
|
||||
});
|
||||
|
||||
it("saves collectionKeys as an empty array", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.saveCollection();
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getItemsHolder().getItem("StateHoldercollectionKeys")).to.deep.equal([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("setCollection", () => {
|
||||
it("sets collectionKeyRaw", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getCollectionKeyRaw()).to.equal("newCollection");
|
||||
});
|
||||
|
||||
it("sets collectionKey", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr({
|
||||
prefix: "prefix",
|
||||
itemsHolder: stubItemsHoldr(),
|
||||
});
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getCollectionKey()).to.equal("prefixnewCollection");
|
||||
});
|
||||
|
||||
it("sets the collection", (): void => {
|
||||
// Arrange
|
||||
const stateHolder = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
stateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
expect(stateHolder.getCollection()).to.deep.equal(stubCollection());
|
||||
});
|
||||
});
|
||||
});
|
||||
+7
-8
@@ -1,5 +1,4 @@
|
||||
import { IItemsHoldr } from "itemsholdr/lib/IItemsHoldr";
|
||||
import { ItemsHoldr } from "itemsholdr/lib/ItemsHoldr";
|
||||
import { IItemsHoldr, ItemsHoldr } from "itemsholdr";
|
||||
|
||||
import { ICollection, IStateHoldr, IStateHoldrSettings } from "./IStateHoldr";
|
||||
|
||||
@@ -94,7 +93,7 @@ export class StateHoldr implements IStateHoldr {
|
||||
* @param otherCollectionKeyRaw A key for a collection to retrieve.
|
||||
* @returns The collection stored under the raw key, if it exists.
|
||||
*/
|
||||
public getOtherCollection(otherCollectionKeyRaw: string): void {
|
||||
public getOtherCollection(otherCollectionKeyRaw: string): ICollection {
|
||||
const otherCollectionKey: string = this.prefix + otherCollectionKeyRaw;
|
||||
|
||||
this.ensureCollectionKeyExists(otherCollectionKey);
|
||||
@@ -145,7 +144,7 @@ export class StateHoldr implements IStateHoldr {
|
||||
*/
|
||||
public saveCollection(): void {
|
||||
this.itemsHolder.setItem(this.collectionKey, this.collection);
|
||||
this.itemsHolder.setItem(this.prefix + "collectionKeys", this.collectionKeys);
|
||||
this.itemsHolder.setItem(`${this.prefix}collectionKeys`, this.collectionKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,12 +211,12 @@ export class StateHoldr implements IStateHoldr {
|
||||
private ensureCollectionKeyExists(collectionKey: string): void {
|
||||
if (!this.itemsHolder.hasKey(collectionKey)) {
|
||||
this.itemsHolder.addItem(collectionKey, {
|
||||
"valueDefault": {},
|
||||
"storeLocally": true
|
||||
valueDefault: {},
|
||||
storeLocally: true,
|
||||
});
|
||||
|
||||
this.collectionKeys.push(collectionKey);
|
||||
this.itemsHolder.setItem(this.prefix + "collectionKeys", this.collectionKeys);
|
||||
this.itemsHolder.setItem(`${this.prefix}collectionKeys`, this.collectionKeys);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +228,7 @@ export class StateHoldr implements IStateHoldr {
|
||||
* @returns The item in the collection under the given key.
|
||||
*/
|
||||
private getCollectionItemSafely(itemKey: string): any {
|
||||
if (typeof this.collection[itemKey] === "undefined") {
|
||||
if (!{}.hasOwnProperty.call(this.collection, itemKey)) {
|
||||
return this.collection[itemKey] = {};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IItemsHoldrSettings, ItemsHoldr } from "itemsholdr";
|
||||
|
||||
import { ICollection, IStateHoldrSettings } from "./IStateHoldr";
|
||||
import { StateHoldr } from "./StateHoldr";
|
||||
|
||||
/**
|
||||
* @param [settings] Settings for the StateHoldr.
|
||||
* @returns An StateHoldr instance.
|
||||
*/
|
||||
export const stubStateHoldr = (settings?: IStateHoldrSettings) =>
|
||||
new StateHoldr(settings);
|
||||
|
||||
/**
|
||||
* @param [settings] Settings for the ItemsHoldr.
|
||||
* @returns An ItemsHoldr instance.
|
||||
*/
|
||||
export const stubItemsHoldr = (settings?: IItemsHoldrSettings) =>
|
||||
new ItemsHoldr(settings);
|
||||
|
||||
/**
|
||||
* @returns An example collection object.
|
||||
*/
|
||||
export const stubCollection = (): ICollection => ({
|
||||
car: {
|
||||
color: "red",
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* @returns A changed collection of mockCollection.
|
||||
*/
|
||||
export const stubChangedCollection = (): ICollection => ({
|
||||
car: {
|
||||
color: "blue",
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./IStateHoldr";
|
||||
export * from "./StateHoldr";
|
||||
@@ -1,15 +0,0 @@
|
||||
import { IStateHoldr } from "../../src/IStateHoldr";
|
||||
import { mochaLoader } from "../main";
|
||||
import { stubChangedCollection, stubCollection, stubStateHoldr } from "../utils/fakes";
|
||||
|
||||
mochaLoader.it("updates the collection's value", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", stubCollection());
|
||||
StateHolder.addChange("car", "color", "blue");
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getCollection()).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
@@ -1,33 +0,0 @@
|
||||
import { ICollection, IStateHoldr } from "../../src/IStateHoldr";
|
||||
import { mochaLoader } from "../main";
|
||||
import { stubChangedCollection, stubCollection, stubStateHoldr } from "../utils/fakes";
|
||||
|
||||
mochaLoader.it("updates the current collection", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", stubCollection());
|
||||
StateHolder.addCollectionChange("exampleCollection", "car", "color", "blue");
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getCollection()).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
|
||||
mochaLoader.it("updates a non-current collection", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
const collection: ICollection = {
|
||||
car: {
|
||||
color: "black"
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", stubCollection());
|
||||
StateHolder.setCollection("anotherCollection", collection);
|
||||
StateHolder.addCollectionChange("exampleCollection", "car", "color", "blue");
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getOtherCollection("exampleCollection")).to.deep.equal(stubChangedCollection());
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
import { IChangeGroup, ICollection, IStateHoldr } from "../../src/IStateHoldr";
|
||||
import { mochaLoader } from "../main";
|
||||
import { stubCollection, stubStateHoldr } from "../utils/fakes";
|
||||
|
||||
mochaLoader.it("copies objects to a recipient", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
const recipient: IChangeGroup = {};
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", stubCollection());
|
||||
StateHolder.applyChanges("car", recipient);
|
||||
|
||||
// Assert
|
||||
chai.expect(recipient).to.deep.equal({ color: "red" });
|
||||
});
|
||||
|
||||
mochaLoader.it("only shallow copies objects to a recipient", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
const changedGroup: string = "car";
|
||||
const changedKey: string = "manufacturer";
|
||||
const collection: ICollection = {
|
||||
[changedGroup]: {
|
||||
[changedKey]: {
|
||||
color: "red"
|
||||
}
|
||||
}
|
||||
};
|
||||
const recipient: IChangeGroup = {};
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", collection);
|
||||
StateHolder.applyChanges(changedGroup, recipient);
|
||||
|
||||
// Assert
|
||||
chai.expect(recipient[changedKey]).to.equal(collection[changedGroup][changedKey]);
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
import { IStateHoldr } from "../../src/IStateHoldr";
|
||||
import { mochaLoader } from "../main";
|
||||
import { stubCollection, stubStateHoldr } from "../utils/fakes";
|
||||
|
||||
mochaLoader.it("saves the collectionKeys list", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("exampleCollection", stubCollection());
|
||||
StateHolder.saveCollection();
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getItemsHolder().getItem("StateHoldercollectionKeys")).to.deep.equal(["StateHolderexampleCollection"]);
|
||||
});
|
||||
|
||||
mochaLoader.it("saves collectionKeys as an empty array", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.saveCollection();
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getItemsHolder().getItem("StateHoldercollectionKeys")).to.deep.equal([]);
|
||||
});
|
||||
@@ -1,39 +0,0 @@
|
||||
import { IStateHoldr } from "../../src/IStateHoldr";
|
||||
import { mochaLoader } from "../main";
|
||||
import { stubCollection, stubItemsHoldr, stubStateHoldr } from "../utils/fakes";
|
||||
|
||||
mochaLoader.it("sets collectionKeyRaw", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getCollectionKeyRaw()).to.equal("newCollection");
|
||||
});
|
||||
|
||||
mochaLoader.it("sets collectionKey", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr({
|
||||
prefix: "prefix",
|
||||
itemsHolder: stubItemsHoldr()
|
||||
});
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getCollectionKey()).to.equal("prefixnewCollection");
|
||||
});
|
||||
|
||||
mochaLoader.it("sets the collection", (): void => {
|
||||
// Arrange
|
||||
const StateHolder: IStateHoldr = stubStateHoldr();
|
||||
|
||||
// Act
|
||||
StateHolder.setCollection("newCollection", stubCollection());
|
||||
|
||||
// Assert
|
||||
chai.expect(StateHolder.getCollection()).to.deep.equal(stubCollection());
|
||||
});
|
||||
+2
-17
@@ -1,19 +1,4 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"./**/*.ts"
|
||||
]
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { IItemsHoldr, IItemsHoldrSettings } from "itemsholdr/lib/IItemsHoldr";
|
||||
import { ItemsHoldr } from "itemsholdr/lib/ItemsHoldr";
|
||||
|
||||
import { ICollection, IStateHoldr, IStateHoldrSettings } from "../../src/IStateHoldr";
|
||||
import { StateHoldr } from "../../src/StateHoldr";
|
||||
|
||||
/**
|
||||
* @param [settings] Settings for the StateHoldr.
|
||||
* @returns An StateHoldr instance.
|
||||
*/
|
||||
export function stubStateHoldr(settings?: IStateHoldrSettings): IStateHoldr {
|
||||
return new StateHoldr(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param [settings] Settings for the ItemsHoldr.
|
||||
* @returns An ItemsHoldr instance.
|
||||
*/
|
||||
export function stubItemsHoldr(settings?: IItemsHoldrSettings): IItemsHoldr {
|
||||
return new ItemsHoldr(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns An example collection object.
|
||||
*/
|
||||
export function stubCollection(): ICollection {
|
||||
return {
|
||||
car: {
|
||||
color: "red"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns A changed collection of mockCollection.
|
||||
*/
|
||||
export function stubChangedCollection(): ICollection {
|
||||
return {
|
||||
car: {
|
||||
color: "blue"
|
||||
}
|
||||
};
|
||||
}
|
||||
+9
-3
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react",
|
||||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
@@ -8,12 +10,16 @@
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"pretty": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"./src/**/*.ts"
|
||||
"./src/**/*.ts",
|
||||
"./src/**/*.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
+5
-52
@@ -1,56 +1,9 @@
|
||||
{
|
||||
"extends": "tslint:all",
|
||||
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
|
||||
"rules": {
|
||||
"array-type": [false],
|
||||
"arrow-return-shorthand": [false],
|
||||
"ban-types": [false],
|
||||
"callable-types": [false],
|
||||
"comment-format": [false],
|
||||
"completed-docs": [false],
|
||||
"cyclomatic-complexity": [false],
|
||||
"forin": [false],
|
||||
"linebreak-style": [false],
|
||||
"max-file-line-count": [false],
|
||||
"max-line-length": [true, 140],
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"newline-before-return": [false],
|
||||
"no-any": [false],
|
||||
"no-bitwise": [false],
|
||||
"no-console": [false],
|
||||
"no-default-export": [false],
|
||||
"no-inferrable-types": [false],
|
||||
"no-magic-numbers": [false],
|
||||
"no-redundant-jsdoc": [false],
|
||||
"no-non-null-assertion": [false],
|
||||
"no-object-literal-type-assertion": [false],
|
||||
"no-submodule-imports": [false],
|
||||
"no-require-imports": false,
|
||||
"no-unbound-method": [false],
|
||||
"no-unsafe-any": [false],
|
||||
"no-unused-variable": [false],
|
||||
"no-void-expression": [false],
|
||||
"number-literal-format": [false],
|
||||
"object-literal-key-quotes": [false],
|
||||
"object-literal-shorthand": [false],
|
||||
"object-literal-sort-keys": [false],
|
||||
"only-arrow-functions": [false],
|
||||
"prefer-function-over-method": [false],
|
||||
"prefer-method-signature": [false],
|
||||
"prefer-switch": [false],
|
||||
"prefer-conditional-expression": [false],
|
||||
"prefer-template": [false],
|
||||
"restrict-plus-operands": [false],
|
||||
"space-before-function-paren": [false],
|
||||
"strict-boolean-expressions": [false],
|
||||
"strict-type-predicates": [false],
|
||||
"switch-final-break": [false],
|
||||
"trailing-comma": [false],
|
||||
"typedef": [false],
|
||||
"variable-name": [false]
|
||||
"completed-docs": false,
|
||||
"no-any": false,
|
||||
"no-unsafe-any": false,
|
||||
"strict-boolean-expressions": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user