-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added configure method for configuring flags and tokens
- Loading branch information
Showing
8 changed files
with
100 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { flags, tokens } from './tokens.js' | ||
|
||
const { assign } = Object | ||
|
||
/** | ||
* Configures the flags/tokens used by the parser and serialiser. | ||
* | ||
* @param {object} [options] - Flag/token config. | ||
* | ||
* @returns {object} - Configured options. | ||
*/ | ||
export function configure (options = {}) { | ||
assign(flags, options.flags ?? {}) | ||
assign(tokens, options.tokens ?? {}) | ||
|
||
return { | ||
flags, | ||
tokens | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,6 @@ export default class Node { | |
return this | ||
} | ||
|
||
self = () => this | ||
|
||
children = [] | ||
|
||
options = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { jest } from '@jest/globals' | ||
import Filter from '../src/filter.js' | ||
import Property from '../src/property.js' | ||
import Node from '../src/node.js' | ||
|
||
describe('src/node', () => { | ||
describe('constructor', () => { | ||
it('should set token, shift, name, args, key, and filters', () => { | ||
const node = new Node() | ||
|
||
}) | ||
}) | ||
}) |