-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add YAML module #528
Add YAML module #528
Conversation
419000f
to
0e52744
Compare
Could you move it to encoding/yaml? Like toml and csv? |
Yes will do |
Also please add references to https://github.com/nodeca/js-yaml in headers of ported files like here : https://github.com/denoland/deno_std/blob/master/encoding/csv.ts#L1 |
@zekth this PR is now RFR, tell me if squash is needed. |
tsconfig.json
Outdated
@@ -1,5 +1,5 @@ | |||
{ | |||
"extends": "tsconfig.test.json", | |||
"extends": "./tsconfig.test.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was a need when I setup my dev environment with yarn / node and executing eslint
without npx.
Rollbacked.
@@ -0,0 +1,22 @@ | |||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those tests files are not covering all the features of the lib.
Could you port those from here: https://github.com/nodeca/js-yaml/tree/master/test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS files copied. Will do the conversion in ts/deno asap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also be included issues specific tests from js-yaml repository.
Some comments added. Also summoning @bartlomieju for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
export abstract class State { | ||
constructor(public schema: SchemaDefinition = DEFAULT_FULL_SCHEMA) {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that these objects are so well organized but... splitting them into 4 files means there are 4 more deps to download. I'd consider putting them into single file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean all 4 kinds of schema to be grouped as one file ?
styleAliases?: ArrayObject; | ||
} | ||
|
||
function checkTagFormat(tag: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems superfluous
Thank you for your reviews. I'm on it ASAP. 👌 |
export type DumpOptions = DumperStateOptions; | ||
|
||
export function stringify(obj: object, options?: DumpOptions): string { | ||
return dump(obj, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export { dump as stringify };
?
result.push((bits >> 4) & 0xff); | ||
} | ||
|
||
return new Buffer(new Uint8Array(result)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does Deno have Buffer ?
why not just return new Uint8Array(result) ?
This a a port from nodeca/js-yaml.
Typing internally is quite messy but the endpoints themselves (
parse
andstringify
) are ready to use.