Skip to content

Commit 6d0647e

Browse files
Merge pull request #2781 from johnnyreilly/master
2 parents c8e7deb + de7bd7d commit 6d0647e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/common/strings.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ export function kebobString(camelCase: string) {
4141
.replace(/([A-Z])/g, $1 => "-" + $1.toLowerCase()); // replace rest
4242
}
4343

44-
function _toJson(obj) {
44+
function _toJson(obj: Object) {
4545
return JSON.stringify(obj);
4646
}
4747

48-
function _fromJson(json) {
48+
function _fromJson(json: string) {
4949
return isString(json) ? JSON.parse(json) : json;
5050
}
5151

5252

53-
function promiseToString(p) {
53+
function promiseToString(p: Promise<any>) {
5454
return `Promise(${JSON.stringify(p)})`;
5555
}
5656

57-
export function functionToString(fn) {
57+
export function functionToString(fn: Function) {
5858
let fnStr = fnToString(fn);
5959
let namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/);
6060
return namedFunctionMatch ? namedFunctionMatch[1] : fnStr;
@@ -71,18 +71,18 @@ let stringifyPattern = pattern([
7171
[not(isDefined), val("undefined")],
7272
[isNull, val("null")],
7373
[isPromise, promiseToString],
74-
[isTransitionRejectionPromise, x => x._transitionRejection.toString()],
74+
[isTransitionRejectionPromise, (x: any) => x._transitionRejection.toString()],
7575
[is(Rejection), invoke("toString")],
7676
[is(Transition), invoke("toString")],
7777
[is(Resolvable), invoke("toString")],
7878
[isInjectable, functionToString],
7979
[val(true), identity]
8080
]);
8181

82-
export function stringify(o) {
83-
var seen = [];
82+
export function stringify(o: Object) {
83+
var seen: any[] = [];
8484

85-
function format(val) {
85+
function format(val: any) {
8686
if (isObject(val)) {
8787
if (seen.indexOf(val) !== -1) return '[circular ref]';
8888
seen.push(val);
@@ -94,7 +94,7 @@ export function stringify(o) {
9494
}
9595

9696
/** Returns a function that splits a string on a character or substring */
97-
export const beforeAfterSubstr = char => str => {
97+
export const beforeAfterSubstr = (char: string) => (str: string) => {
9898
if (!str) return ["", ""];
9999
let idx = str.indexOf(char);
100100
if (idx === -1) return [str, ""];

0 commit comments

Comments
 (0)