项目作者: afeiship

项目描述 :
Iterator generator for next.
高级语言: JavaScript
项目地址: git://github.com/afeiship/next-it.git
创建时间: 2021-06-12T14:28:46Z
项目社区:https://github.com/afeiship/next-it

开源协议:MIT License

下载


next-it

Iterator generator for next.

@jswork/next-it"">version
license
size
@jswork/next-it"">download

installation

  1. npm install -S @jswork/next-it

usage

  1. import '@jswork/next-it';
  2. const arr = [0, 1, true, false, null, '', undefined];
  3. const filter1 = arr.filter(nx.it('@'));
  4. const filter2 = arr.filter(nx.it('!@'));
  5. // filter1: [ 1, true ];
  6. // filter2: [0, false, null, '', undefined];
  7. const data = [
  8. {
  9. "url": "https://demo.com/api/static/images/f7128c5454ef48d431315169ac1c8faf.png",
  10. "file": {
  11. "path": "https://demo.com/api/static/images/f7128c5454ef48d431315169ac1c8faf.png",
  12. "size": 0
  13. }
  14. },
  15. {
  16. "url": "https://demo.com/api/static/images/8ea7935faede52aa3891436fa5f0dd68.png",
  17. "file": {
  18. "path": "https://demo.com/api/static/images/8ea7935faede52aa3891436fa5f0dd68.png",
  19. "size": 0
  20. }
  21. },
  22. {
  23. "url": "http://tmp/rYOV8lwCrW6885969266efbb54c322548e83ddd399e0.png",
  24. "file": {
  25. "path": "http://tmp/rYOV8lwCrW6885969266efbb54c322548e83ddd399e0.png",
  26. "size": 792
  27. }
  28. }
  29. ]
  30. const filter1 = data.filter(nx.it('file.size'));
  31. const filter2 = data.filter(nx.it('!file.size'));
  32. // get size:0 or size!=0 values.

license

Code released under the MIT license.