tinyexpect 0.2.2 → 0.3.1
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.
- package/.gitattributes +0 -0
- package/LICENSE +0 -0
- package/README.md +1 -1
- package/index.js +8 -0
- package/index.ts +9 -0
- package/package.json +1 -1
- package/tsconfig.json +0 -0
package/.gitattributes
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -53,6 +53,14 @@ function expect(v) {
|
|
|
53
53
|
if (typeof v === "undefined") {
|
|
54
54
|
throw new Error(`${v} is not defined`);
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
toContainString(str) {
|
|
58
|
+
if (typeof v !== "string") {
|
|
59
|
+
throw new Error(`${v} is not a string`);
|
|
60
|
+
}
|
|
61
|
+
if (!v.includes(str)) {
|
|
62
|
+
throw new Error(`${v} doesn't contain ${str}`);
|
|
63
|
+
}
|
|
56
64
|
}
|
|
57
65
|
};
|
|
58
66
|
}
|
package/index.ts
CHANGED
|
@@ -51,6 +51,15 @@ export function expect(v: any) {
|
|
|
51
51
|
if (typeof v === "undefined"){
|
|
52
52
|
throw new Error(`${v} is not defined`)
|
|
53
53
|
}
|
|
54
|
+
},
|
|
55
|
+
toContainString(str:string){
|
|
56
|
+
if (typeof v !== "string"){
|
|
57
|
+
throw new Error(`${v} is not a string`)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!(v as string).includes(str)){
|
|
61
|
+
throw new Error(`${v} doesn't contain ${str}`)
|
|
62
|
+
}
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
65
|
}
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
File without changes
|