Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ R.isEmpty(Obj()) # False
R.isEmpty(None) # False
```

- [ ] isNil
- [x] isNil

We keep the same method name as ramda,
this is for checking if the given value is None or not.

- [x] 0.1.2 join
- [x] 0.1.4 juxt
- [x] 0.1.2 keys
Expand Down
1 change: 1 addition & 0 deletions ramda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from .invoker import invoker
from .Is import Is
from .isEmpty import isEmpty
from .isNil import isNil
from .join import join
from .juxt import juxt
from .keys import keys
Expand Down
3 changes: 3 additions & 0 deletions ramda/isNil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .private._curry1 import _curry1

isNil = _curry1(lambda x: x is None)
21 changes: 21 additions & 0 deletions test/test_isNil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import unittest

import ramda as R

"""
https://github.com/ramda/ramda/blob/master/test/isNil.js
"""


class TestIsNil(unittest.TestCase):
def test_a_value_for_None(self):
self.assertEqual(True, R.isNil(None))
self.assertEqual(False, R.isNil([]))
self.assertEqual(False, R.isNil({}))
self.assertEqual(False, R.isNil(0))
self.assertEqual(False, R.isNil(''))


if __name__ == '__main__':
unittest.main()