From c8110fc090d158b0b51db6b2f72b34a01ee1ba3d Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Wed, 13 Sep 2017 20:48:52 -0700 Subject: [PATCH] fix(trace): Fall back to console.log if .table is unavailable (IE) Closes https://github.com/ui-router/angular/issues/154 --- package.json | 2 +- src/common/trace.ts | 6 ++++-- yarn.lock | 10 +--------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 0e3b2399..f6526a29 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "devDependencies": { "@types/jasmine": "^2.5.47", "@types/jquery": "^1.10.31", - "@uirouter/publish-scripts": "^1.0.5", + "@uirouter/publish-scripts": "^1.0.7", "awesome-typescript-loader": "3.0.0-beta.10", "conventional-changelog": "^1.1.0", "conventional-changelog-cli": "^1.1.1", diff --git a/src/common/trace.ts b/src/common/trace.ts index d8a0ecf1..a6d34f34 100644 --- a/src/common/trace.ts +++ b/src/common/trace.ts @@ -34,7 +34,7 @@ * @module trace */ /** for typedoc */ import {parse} from "../common/hof"; -import {isNumber} from "../common/predicates"; +import {isFunction, isNumber} from "../common/predicates"; import {Transition} from "../transition/transition"; import {ActiveUIView, ViewConfig, ViewContext} from "../view/interface"; import {stringify, functionToString, maxLength, padString} from "./strings"; @@ -64,6 +64,8 @@ function normalizedCat(input: Category|string): string { return isNumber(input) ? Category[input] : Category[Category[input]]; } +/** @hidden */ +const consoletable = isFunction(console.table) ? console.table.bind(console) : console.log.bind(console); /** * Trace categories Enum @@ -229,7 +231,7 @@ export class Trace { return { 'ui-view fqn': uiView, 'state: view name': view }; }).sort((a, b) => a['ui-view fqn'].localeCompare(b['ui-view fqn'])); - console.table(mapping); + consoletable(mapping); } /** @internalapi called by ui-router code */ diff --git a/yarn.lock b/yarn.lock index b820a85f..bbeb8db6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,7 +10,7 @@ version "1.10.33" resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.33.tgz#6c4c279f8d06839b184950432e880e0a469a64a1" -"@uirouter/publish-scripts@^1.0.5": +"@uirouter/publish-scripts@^1.0.7": version "1.0.7" resolved "https://registry.yarnpkg.com/@uirouter/publish-scripts/-/publish-scripts-1.0.7.tgz#99ffd6aeced41e96b92ccb007342eee5d14b0a9a" dependencies: @@ -652,14 +652,6 @@ conventional-changelog-jshint@^0.1.0: compare-func "^1.3.1" q "^1.4.1" -conventional-changelog-ui-router-core@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/conventional-changelog-ui-router-core/-/conventional-changelog-ui-router-core-1.4.1.tgz#8ef76e7960458d9be2539fe673a4b6c853b9dbf3" - dependencies: - compare-func "^1.3.1" - github-url-from-git "^1.4.0" - q "^1.4.1" - conventional-changelog-ui-router-core@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/conventional-changelog-ui-router-core/-/conventional-changelog-ui-router-core-1.4.2.tgz#56d5787163f883e25d3e1f573aef563f85411df7"