1.0.0 • Published 4 years ago

@jswork/next-it v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

next-it

Iterator generator for next.

version license size download

installation

npm install -S @jswork/next-it

usage

import '@jswork/next-it';

const arr = [0, 1, true, false, null, '', undefined];
const filter1 = arr.filter(nx.it('@'));
const filter2 = arr.filter(nx.it('!@'));
// filter1: [ 1, true ];
// filter2: [0, false, null, '', undefined];

const data = [
  {
    "url": "https://demo.com/api/static/images/f7128c5454ef48d431315169ac1c8faf.png",
    "file": {
      "path": "https://demo.com/api/static/images/f7128c5454ef48d431315169ac1c8faf.png",
      "size": 0
    }
  },
  {
    "url": "https://demo.com/api/static/images/8ea7935faede52aa3891436fa5f0dd68.png",
    "file": {
      "path": "https://demo.com/api/static/images/8ea7935faede52aa3891436fa5f0dd68.png",
      "size": 0
    }
  },
  {
    "url": "http://tmp/rYOV8lwCrW6885969266efbb54c322548e83ddd399e0.png",
    "file": {
      "path": "http://tmp/rYOV8lwCrW6885969266efbb54c322548e83ddd399e0.png",
      "size": 792
    }
  }
]

const filter1 = data.filter(nx.it('file.size'));
const filter2 = data.filter(nx.it('!file.size'));
// get size:0 or size!=0 values.

license

Code released under the MIT license.