mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
feat: moved some useful tools to common
This commit is contained in:
committed by
Chi Vinh Le
parent
3c64bb0240
commit
c81d612c70
@@ -1,6 +1,9 @@
|
||||
import { EventEmitter2 } from "eventemitter2";
|
||||
import qs from "query-string";
|
||||
|
||||
import ensureNoEndSlash from "talk-common/utils/ensureNoEndSlash";
|
||||
import urls from "talk-framework/helpers/urls";
|
||||
|
||||
import {
|
||||
Decorator,
|
||||
withAutoHeight,
|
||||
@@ -15,13 +18,6 @@ import PymControl, {
|
||||
defaultPymControlFactory,
|
||||
PymControlFactory,
|
||||
} from "./PymControl";
|
||||
import { ensureNoEndSlash } from "./utils";
|
||||
|
||||
// This is importing the url helper from the framework using a relative path
|
||||
// import because the ts paths are not configured to use the framework for this
|
||||
// target.
|
||||
// TODO: (wyattjoh) replace with import from framework when we include it in the config.
|
||||
import urls from "../framework/helpers/urls";
|
||||
|
||||
export interface StreamEmbedConfig {
|
||||
storyID?: string;
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "es5"],
|
||||
"types": ["jest", "node"],
|
||||
"paths": {}
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"talk-common/*": ["../../common/*"],
|
||||
"talk-framework/*": ["../framework/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"./**/*",
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import ensureEndSlash from "./ensureEndSlash";
|
||||
|
||||
it("should add slash to the end", () => {
|
||||
const path = ensureEndSlash("/test");
|
||||
expect(path).toBe("/test/");
|
||||
});
|
||||
|
||||
it("should not add slash to the end if it's already there", () => {
|
||||
const path = ensureEndSlash("/test/");
|
||||
expect(path).toBe("/test/");
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
export default function ensureEndSlash(p: string) {
|
||||
return p.match(/\/$/) ? p : `${p}/`;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import ensureNoEndSlash from "./ensureNoEndSlash";
|
||||
|
||||
it("should remove the slash from the end", () => {
|
||||
const path = ensureNoEndSlash("/test/");
|
||||
expect(path).toBe("/test");
|
||||
});
|
||||
|
||||
it("should not change a string if there is no ending slash", () => {
|
||||
const path = ensureNoEndSlash("/test");
|
||||
expect(path).toBe("/test");
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
export default function ensureEndSlash(p: string) {
|
||||
return p.replace(/\/$/, "");
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
export { default as buildURL } from "./buildURL";
|
||||
export { default as ensureEndSlash } from "./ensureEndSlash";
|
||||
export { default as ensureNoEndSlash } from "./ensureNoEndSlash";
|
||||
export { default as startsWith } from "./startsWith";
|
||||
export { default as prefixStorage } from "./prefixStorage";
|
||||
export { default as parseHashQuery } from "./parseHashQuery";
|
||||
|
||||
Reference in New Issue
Block a user