Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
206 additions
and
79 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
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,11 @@ | ||
import pkg from './package.json'; | ||
import fs from 'fs'; | ||
|
||
const newPkg = { | ||
...pkg, | ||
scripts: {}, | ||
ava: undefined, | ||
devDependencies: undefined | ||
}; | ||
|
||
fs.writeFileSync('./build/package.json', JSON.stringify(newPkg, null, 2)); |
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,8 @@ | ||
import shell from 'shelljs'; | ||
|
||
const cwd = process.cwd(); | ||
|
||
shell.cd('build'); | ||
shell.exec('npm publish', () => { | ||
shell.cd(cwd); | ||
}); |
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
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,87 @@ | ||
import test from 'ava'; | ||
|
||
import 'babel-core/register'; | ||
|
||
import { | ||
getIn, | ||
$eachValue, | ||
$eachKey, | ||
$eachPair | ||
} from 'qim/src'; | ||
|
||
const isEven = value => value % 2 === 0; | ||
|
||
test('getIn from primitive', t => { | ||
t.is( | ||
getIn([], 1), | ||
1 | ||
); | ||
t.is( | ||
getIn([], null), | ||
null | ||
); | ||
t.is( | ||
getIn(['x'], 1), | ||
undefined | ||
); | ||
t.is( | ||
getIn(['x'], null), | ||
undefined | ||
); | ||
}); | ||
|
||
test('getIn from object', t => { | ||
t.deepEqual( | ||
getIn([], {x: 1}), | ||
{x: 1} | ||
); | ||
t.deepEqual( | ||
getIn(['x'], {x: 1}), | ||
1 | ||
); | ||
}); | ||
|
||
test('getIn predicate', t => { | ||
t.deepEqual( | ||
getIn([isEven], 1), | ||
undefined | ||
); | ||
t.deepEqual( | ||
getIn([isEven], 2), | ||
2 | ||
); | ||
}); | ||
|
||
test('getIn values', t => { | ||
t.deepEqual( | ||
getIn([$eachValue], [1, 2, 3]), | ||
1 | ||
); | ||
t.deepEqual( | ||
getIn([$eachValue, isEven], [1, 2, 3, 4]), | ||
2 | ||
); | ||
t.deepEqual( | ||
getIn([$eachValue, 'x'], [{x: 1}, {x: 2}]), | ||
1 | ||
); | ||
}); | ||
|
||
test('getIn keys', t => { | ||
t.deepEqual( | ||
getIn([$eachKey], {x: 1, y: 2}), | ||
'x' | ||
); | ||
}); | ||
|
||
test('getIn pairs', t => { | ||
t.deepEqual( | ||
getIn([$eachPair], {x: 1, y: 2}), | ||
['x', 1] | ||
); | ||
|
||
t.deepEqual( | ||
getIn([$eachPair, 1], {x: 1, y: 2}), | ||
1 | ||
); | ||
}); |
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,48 @@ | ||
import test from 'ava'; | ||
|
||
import 'babel-core/register'; | ||
|
||
import { | ||
hasIn, | ||
$eachValue, | ||
$eachKey, | ||
$eachPair | ||
} from 'qim/src'; | ||
|
||
const isEven = value => value % 2 === 0; | ||
|
||
test('hasIn from primitive', t => { | ||
t.true(hasIn([], 1)); | ||
t.true(hasIn([], null)); | ||
t.false(hasIn(['x'], 1)); | ||
t.false(hasIn(['x'], null)); | ||
}); | ||
|
||
test('hasIn from object', t => { | ||
t.true(hasIn([], {x: 1})); | ||
t.true(hasIn(['x'], {x: 1})); | ||
t.false(hasIn(['y'], {x: 1})); | ||
}); | ||
|
||
test('hasIn predicate', t => { | ||
t.false(hasIn([isEven], 1)); | ||
t.true(hasIn([isEven], 2)); | ||
}); | ||
|
||
test('hasIn values', t => { | ||
t.true(hasIn([$eachValue], [1, 2, 3])); | ||
t.true(hasIn([$eachValue, isEven], [1, 2, 3, 4])); | ||
t.false(hasIn([$eachValue, isEven], [1, 3])); | ||
t.true(hasIn([$eachValue, 'x'], [{x: 1}, {x: 2}])); | ||
t.false(hasIn([$eachValue, 'y'], [{x: 1}, {x: 2}])); | ||
}); | ||
|
||
test('hasIn keys', t => { | ||
t.true(hasIn([$eachKey], {x: 1, y: 2})); | ||
t.false(hasIn([$eachKey], {})); | ||
}); | ||
|
||
test('hasIn pairs', t => { | ||
t.true(hasIn([$eachPair], {x: 1, y: 2})); | ||
t.false(hasIn([$eachPair], {})); | ||
}); |
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