From 2ee0d57fae6bb5a7a298a563da13233bb59f5fdf Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Fri, 31 Jul 2015 14:46:55 -0600 Subject: [PATCH 1/3] Update definitions and tests --- yamljs/yamljs-tests.ts | 12 +++--------- yamljs/yamljs.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/yamljs/yamljs-tests.ts b/yamljs/yamljs-tests.ts index 9780c504d..d4e6376d6 100644 --- a/yamljs/yamljs-tests.ts +++ b/yamljs/yamljs-tests.ts @@ -1,13 +1,7 @@ /// -import yamljs = require('yamljs'); +var yamlObj = YAML.parse("test: some yaml"); -yamljs.load('yaml-testfile.yml'); +YAML.stringify(yamlObj); -yamljs.parse('this_is_no_ymlstring'); - -yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}); - -yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1); - -yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1, 2); \ No newline at end of file +YAML.load("path/to/file.yaml"); \ No newline at end of file diff --git a/yamljs/yamljs.d.ts b/yamljs/yamljs.d.ts index 65d2fd923..96c9d33c7 100644 --- a/yamljs/yamljs.d.ts +++ b/yamljs/yamljs.d.ts @@ -1,9 +1,9 @@ -// Type definitions for yamljs 0.2.1 +// Type definitions for yamljs 0.2.3 // Project: https://github.com/jeremyfa/yaml.js // Definitions by: Tim Jonischkat // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "yamljs" { +declare module YAML { export function load(path : string) : any; From 84dc21b73b9a04f6d90806aee64c3fa9d541ff8f Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Wed, 5 Aug 2015 15:04:49 -0600 Subject: [PATCH 2/3] Update definitions according to the pattern provided by Masahiro Wakame in order to work with nodejs as well --- yamljs/yamljs.d.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/yamljs/yamljs.d.ts b/yamljs/yamljs.d.ts index 96c9d33c7..a0f948fe6 100644 --- a/yamljs/yamljs.d.ts +++ b/yamljs/yamljs.d.ts @@ -3,12 +3,14 @@ // Definitions by: Tim Jonischkat // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module YAML { +declare var YAML: { + load(path : string) : any; - export function load(path : string) : any; + stringify(nativeObject : any, inline? : number, spaces? : number) : string; - export function stringify(nativeObject : any, inline? : number, spaces? : number) : string; + parse(yamlString : string) : any; +}; - export function parse(yamlString : string) : any; - -} \ No newline at end of file +declare module "yamljs" { + export = YAML; +} From 348f3e62bd158ab75aeae74ac5e31496503549f5 Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Mon, 10 Aug 2015 09:17:57 -0600 Subject: [PATCH 3/3] Revert to previous tests --- yamljs/yamljs-tests.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/yamljs/yamljs-tests.ts b/yamljs/yamljs-tests.ts index d4e6376d6..9780c504d 100644 --- a/yamljs/yamljs-tests.ts +++ b/yamljs/yamljs-tests.ts @@ -1,7 +1,13 @@ /// -var yamlObj = YAML.parse("test: some yaml"); +import yamljs = require('yamljs'); -YAML.stringify(yamlObj); +yamljs.load('yaml-testfile.yml'); -YAML.load("path/to/file.yaml"); \ No newline at end of file +yamljs.parse('this_is_no_ymlstring'); + +yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}); + +yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1); + +yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1, 2); \ No newline at end of file