-
-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <[email protected]>
- Loading branch information
1 parent
667c9e9
commit 6ed5cb3
Showing
7 changed files
with
199 additions
and
1 deletion.
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
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
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,17 @@ | ||
import test from 'ava'; | ||
import queryString from '..'; | ||
|
||
test('excludes elements in a URL with a filter array', t => { | ||
t.is(queryString.exclude('http://example.com/?a=1&b=2&c=3#a', ['c']), 'http://example.com/?a=1&b=2#a'); | ||
}); | ||
|
||
test('excludes elements in a URL with a filter predicate', t => { | ||
t.is(queryString.exclude('http://example.com/?a=1&b=2&c=3#a', (name, value) => { | ||
t.is(typeof name, 'string'); | ||
t.is(typeof value, 'number'); | ||
|
||
return name === 'a'; | ||
}, { | ||
parseNumbers: true | ||
}), 'http://example.com/?b=2&c=3#a'); | ||
}); |
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,17 @@ | ||
import test from 'ava'; | ||
import queryString from '..'; | ||
|
||
test('picks elements in a URL with a filter array', t => { | ||
t.is(queryString.pick('http://example.com/?a=1&b=2&c=3#a', ['a', 'b']), 'http://example.com/?a=1&b=2#a'); | ||
}); | ||
|
||
test('picks elements in a URL with a filter predicate', t => { | ||
t.is(queryString.pick('http://example.com/?a=1&b=2&c=3#a', (name, value) => { | ||
t.is(typeof name, 'string'); | ||
t.is(typeof value, 'number'); | ||
|
||
return name === 'a'; | ||
}, { | ||
parseNumbers: true | ||
}), 'http://example.com/?a=1#a'); | ||
}); |