├── .babelrc ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── pull_request_template.md ├── .gitignore ├── .npmignore ├── .prettierrc ├── CHANGE_LOG.md ├── CONTRIBUTE.md ├── LICENSE ├── README.md ├── dist └── iterize.umd.js ├── lib ├── commons │ ├── ErrorModels.d.ts │ ├── ErrorModels.js │ ├── Iterators.d.ts │ ├── Iterators.js │ ├── types.d.ts │ ├── types.js │ ├── utility.d.ts │ └── utility.js ├── cycle.d.ts ├── cycle.js ├── index.d.ts ├── index.js ├── range.d.ts ├── range.js ├── repeat.d.ts ├── repeat.js ├── replicate.js ├── take.d.ts └── take.js ├── package.json ├── src ├── commons │ ├── ErrorModels.ts │ ├── Iterators.ts │ ├── types.ts │ └── utility.ts ├── cycle.ts ├── index.ts ├── range.ts ├── repeat.ts └── take.ts ├── test ├── cycle.test.ts ├── range.test.ts ├── repeat.test.ts ├── take.test.ts └── utility.ts ├── tsconfig.json └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/env",{ 4 | "targets": { 5 | "chrome": "58", 6 | "ie": "11" 7 | } 8 | }], 9 | "@babel/preset-typescript" 10 | ], 11 | "plugins": [ 12 | ["@babel/plugin-transform-modules-umd", { 13 | "globals": { 14 | "iterize": "Iterize" 15 | }, 16 | "exactGlobals": true 17 | }], 18 | "@babel/plugin-transform-runtime", 19 | "@babel/plugin-proposal-class-properties" 20 | ], 21 | "env": { 22 | "production": { 23 | "presets": [ 24 | "minify" 25 | ] 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # These owners will be the default owners for everything in the repo. 5 | * @hg-pyun @SungJinYoo 6 | 7 | # Order is important. The last matching pattern has the most precedence. 8 | # So if a pull request only touches javascript files, only these owners 9 | # will be requested to review. 10 | *.ts @hg-pyun @SungJinYoo 11 | 12 | # You can also use email addresses if you prefer. 13 | src/* phg2491@gmail.com -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Environment (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser: [e.g. chrome, safari] 26 | - Iterize Version: [e.g. 22] 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Summary 2 | Fixes #. 3 | 4 | ## Changes List 5 | - 6 | - 7 | - 8 | 9 | ## Reference -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | /package-lock.json 3 | /node_modules/ 4 | .idea 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Config 2 | /.gitignore 3 | /.babelrc 4 | /package-lock.json 5 | /.prettierrc 6 | /tsconfig.json 7 | 8 | # Folders 9 | /.github/ 10 | /node_modules/ 11 | .idea 12 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 4, 4 | "semi": true, 5 | "singleQuote": true 6 | } -------------------------------------------------------------------------------- /CHANGE_LOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## 1.5.0 4 | - Fix `@ts-ignore` to 5 | - Add `takeWhile` API 6 | - Replace `eslint` to `prettier` 7 | 8 | ## 1.4.0 9 | - Add `*.d.ts` Files 10 | - Extract interfaces on `types.ts` file. 11 | 12 | ## 1.3.0 13 | - Add change log and pull request templates 14 | - Add Eslint 15 | - Update babel version to 7.2.x 16 | - Support Universal Module Define 17 | - Reformatting codes 18 | 19 | ## 1.2.0 20 | - Add Higher-API Functions. 21 | - Support string type on cycle. 22 | - Combine repeat and replicate API. 23 | - Support take method for function predicate. 24 | 25 | ## 1.1.0 26 | - Exception handling when using infinite type on cycle, repeat, replicate method. 27 | - Support function type on all method. 28 | - Refactoring. 29 | - Error models. 30 | - Test cases. 31 | - Default parameter on range. 32 | 33 | ## 1.0.1 34 | - Release regular version. -------------------------------------------------------------------------------- /CONTRIBUTE.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Basically, if you send me pull request of the issues, I will review and merge. 4 | 5 | # How to Dev 6 | 7 | #### Build 8 | 9 | ```bash 10 | $ npm run build 11 | ``` 12 | 13 | #### Test 14 | 15 | You can test your source code before merge. 16 | 17 | ```bash 18 | $ npm test 19 | ``` 20 | 21 | For develop TDD, using watch script. 22 | 23 | ```bash 24 | $ npm run test:watch 25 | ``` 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Haegul Pyun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iterize 2 | 3 | [![npm](https://img.shields.io/npm/v/iterize.svg)](https://www.npmjs.com/package/iterize) 4 | [![npm](https://img.shields.io/npm/dt/iterize.svg)](https://www.npmjs.com/package/iterize) 5 | [![GitHub license](https://img.shields.io/github/license/hg-pyun/iterize.svg)](https://github.com/hg-pyun/iterize/blob/master/LICENSE) 6 | ![Build Status](https://codebuild.ap-northeast-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoibC9MTUdiTUlIUkFGZzB3SThHMWc1WlI0N2I2TnhFT0RxcXozUVlrU1V6dk1iZzlyWHJvelRIMDJCMHowRE56cDc0N3NUcFIxQ0owSWlqektFR1JJaGI0PSIsIml2UGFyYW1ldGVyU3BlYyI6IkNnMUdYU01GTVpFbFpUNE0iLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) 7 | 8 | > Use JavaScript Iterator, Easily 9 | 10 | **iterize** is a minimalistic creator for the iterator. A great feature called Iterator was added into JavaScript. However, it's a strange concept for most of the front-end developers. 11 | **iterize** helps you create your code more easily and efficiently using the various attributes of the Iterable Protocol. 12 | 13 | ## Why Powerful? 14 | 15 | #### Lazy Evaluation 16 | 17 | An array does not need to be allocated to memory on compile-time, nor does it need to be declared explicitly. You can let it be calculated on run-time, or any time you want it to be used. 18 | 19 | #### Expressing Infinity 20 | 21 | It was not easy to express the concept of infinity using the conventional syntax of JavaScript. **iterize** can help you express this concept effectively. 22 | 23 | #### Reuse 24 | 25 | Most functions of **iterize** are implemented as Higher-Order Functions. You can improve your productivity by reusing the functions you have already implemented before. 26 | 27 | # Install 28 | 29 | ```bash 30 | $ npm install iterize --save 31 | ``` 32 | 33 | You can import **iterize** using ESModule style. 34 | 35 | ```js 36 | import * as iterize from 'iterize'; 37 | ``` 38 | ```js 39 | import {range} from 'iterize'; 40 | ``` 41 | If you want to use [UMD](https://github.com/umdjs/umd), please import `dist/iterize.umd.js` on your html file. 42 | ```html 43 |