From 68d7cdeee98d2499c416cbcd237e780bd51adae3 Mon Sep 17 00:00:00 2001 From: bryn austin bellomy Date: Sat, 25 Apr 2015 19:59:58 -0500 Subject: [PATCH 1/2] adding eyes module --- eyes/eyes.d.ts | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 eyes/eyes.d.ts diff --git a/eyes/eyes.d.ts b/eyes/eyes.d.ts new file mode 100644 index 000000000..091916821 --- /dev/null +++ b/eyes/eyes.d.ts @@ -0,0 +1,54 @@ +// Type definitions for eyes 0.1.8 +// Project: https://github.com/cloudhead/eyes.js +// Definitions by: bryn austin bellomy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "eyes" +{ + import stream = require('stream'); + + export function inspector(options?:EyesOptions): InspectorFunction; + export function inspect(thing:any, label?:string): void; + + export interface InspectorFunction { + (thing:any, label?:string): void; + } + + export interface EyesOptions + { + /** Styles applied to stdout */ + styles?: { + /** Overall base style applied to everything */ + all?: string; + /** Style when printing inspection labels, like 'array' in `array: [1, 2, 3]` */ + label?: string; + /** Style when printing objects which don't have a literal representation, such as functions */ + other?: string; + /** Style when printing the keys in object literals, like 'a' in `{a: 1}` */ + key?: string; + /** Style when printing `null`, `undefined`, etc. */ + special?: string; + /** Style when printing strings */ + string?: string; + /** Style when printing numbers */ + number?: string; + /** Style when printing booleans */ + bool?: string; + /** Style when printing RegExps */ + regexp?: string; + }; + + /** Indent object literals */ + pretty?: boolean; + /** Don't output functions at all */ + hideFunctions?: boolean; + /** Stream to write to, or null */ + stream?: stream.Writable; + /** Truncate output if longer */ + maxLength?: number; + } +} + + From ce01d2119a599e1877ec91b0d2358a68ce3289c3 Mon Sep 17 00:00:00 2001 From: bryn austin bellomy Date: Mon, 27 Apr 2015 15:14:10 -0500 Subject: [PATCH 2/2] adding tests --- eyes/eyes-tests.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 eyes/eyes-tests.ts diff --git a/eyes/eyes-tests.ts b/eyes/eyes-tests.ts new file mode 100644 index 000000000..3182195dd --- /dev/null +++ b/eyes/eyes-tests.ts @@ -0,0 +1,29 @@ +/// + +import eyes = require('eyes'); + +var testObj = { + color: 'red', + num: 227 +} + +eyes.inspect(testObj) + +var options = { + styles: { + all: 'green', + label: 'red', + other: 'red', + key: 'red', + special: 'red', + 'string': 'red', + 'number': 'red', + bool: 'red', + regexp: 'red' + }, + + pretty: false, + hideFunctions: true, + stream: process.stdout, + maxLength: 120 +} \ No newline at end of file