├── pipes ├── index.d.ts └── package.json ├── favicon.ico ├── .travis.yml ├── .codedoc ├── package.json ├── content │ ├── theme.ts │ ├── footer.tsx │ ├── header.tsx │ └── index.tsx ├── build.ts ├── serve.ts ├── tsconfig.json ├── watch.ts ├── config.ts └── theme.ts ├── src ├── pipes │ ├── index.ts │ ├── test │ │ ├── index.ts │ │ ├── string.test.ts │ │ ├── boolean.test.ts │ │ └── number.test.ts │ ├── string.ts │ ├── boolean.ts │ └── number.ts ├── index.ts ├── test │ ├── index.ts │ ├── e.test.ts │ ├── string.test.ts │ ├── boolean.test.ts │ └── number.test.ts ├── string.ts ├── e.ts ├── boolean.ts └── number.ts ├── conf ├── typescript │ ├── test.json │ ├── es5.json │ ├── es6.json │ ├── build.json │ └── base.json └── rollup │ ├── base.js │ ├── es6.js │ └── es5.js ├── tsconfig.json ├── samples └── index.ts ├── docs └── md │ ├── _toc.md │ ├── docs │ ├── string.md │ ├── generic.md │ ├── boolean.md │ └── numbers.md │ └── index.md ├── test.ts ├── .github └── workflows │ └── build_docs.yml ├── LICENSE ├── README.md ├── .gitignore ├── package.json ├── logo.svg └── banner.svg /pipes/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from '../dist/es6/pipes'; -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loreanvictor/rxmetics/HEAD/favicon.ico -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "12" 4 | after_success: npm run cov:travis 5 | -------------------------------------------------------------------------------- /.codedoc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@codedoc/core": "^0.1.45" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/pipes/index.ts: -------------------------------------------------------------------------------- 1 | export * from './boolean'; 2 | export * from './number'; 3 | export * from './string'; -------------------------------------------------------------------------------- /conf/typescript/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./build", 3 | "compilerOptions": { 4 | "target": "es5" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./conf/typescript/base", 3 | "compilerOptions": { 4 | "target": "es5" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/pipes/test/index.ts: -------------------------------------------------------------------------------- 1 | describe('pipes', () => { 2 | require('./boolean.test'); 3 | require('./number.test'); 4 | require('./string.test'); 5 | }); -------------------------------------------------------------------------------- /pipes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "../dist/es5/pipes/index.js", 3 | "module": "../dist/es6/pipes/index.js", 4 | "types": "dist/es6/pipes/index.d.ts" 5 | } -------------------------------------------------------------------------------- /conf/typescript/es5.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./build", 3 | "compilerOptions": { 4 | "target": "es5", 5 | "outDir": "../../dist/es5/" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/index.ts: -------------------------------------------------------------------------------- 1 | import { interval } from 'rxjs'; 2 | import { rxl, mul } from '../src'; 3 | 4 | 5 | rxl`hellow ${mul(interval(500), 2)} world ...`.subscribe(console.log); -------------------------------------------------------------------------------- /docs/md/_toc.md: -------------------------------------------------------------------------------- 1 | [Home](/) 2 | [Numeric Operations](/docs/numbers) 3 | [String Operations](/docs/string) 4 | [Boolean Operations](/docs/boolean) 5 | [Generic Functions](/docs/generic) -------------------------------------------------------------------------------- /conf/typescript/es6.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./build", 3 | "compilerOptions": { 4 | "inlineSources": true, 5 | "target": "es6", 6 | "outDir": "../../dist/es6/" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /conf/typescript/build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./base", 3 | "exclude": [ 4 | "../../test.ts", 5 | "../../src/test/**/*", 6 | "../../src/**/test/*", 7 | "../../src/**/*.test.ts" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /src/pipes/string.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from 'rxjs'; 2 | 3 | import { $ } from '../e'; 4 | import { concat as _concat } from '../string'; 5 | 6 | 7 | export function concat(a: $, ...bits: $[]) { 8 | return (o: Observable) => _concat(o, a, ...bits); 9 | } 10 | -------------------------------------------------------------------------------- /conf/rollup/base.js: -------------------------------------------------------------------------------- 1 | export default { 2 | input: 'dist/es6/index.js', 3 | output: { 4 | name: 'rxmetics', 5 | format: 'iife', 6 | globals: { 7 | 'rxjs': 'rxjs', 8 | 'rxjs/operators': 'rxjs.operators', 9 | } 10 | }, 11 | external: ['rxjs', 'rxjs/operators'], 12 | } 13 | -------------------------------------------------------------------------------- /test.ts: -------------------------------------------------------------------------------- 1 | const Mocha = require('mocha'); 2 | import * as path from 'path'; 3 | 4 | const mocha = new Mocha(); 5 | const root = path.join(__dirname, 'src/'); 6 | 7 | const test = (file: string) => mocha.addFile(path.join(root, file)); 8 | 9 | test('test/index.ts'); 10 | 11 | mocha.run(console.log); 12 | -------------------------------------------------------------------------------- /conf/rollup/es6.js: -------------------------------------------------------------------------------- 1 | import { terser } from "rollup-plugin-terser"; 2 | import base from './base'; 3 | 4 | 5 | export default Object.assign(base, { 6 | plugins: [ 7 | terser(), 8 | ], 9 | output: Object.assign(base.output, { 10 | file: 'dist/bundles/rxmetics.es6.min.js', 11 | }), 12 | }); 13 | -------------------------------------------------------------------------------- /.codedoc/content/theme.ts: -------------------------------------------------------------------------------- 1 | import { funcTransport } from '@connectv/sdh/transport'; 2 | import { useTheme } from '@codedoc/core/transport'; 3 | 4 | import { theme } from '../theme'; 5 | 6 | 7 | export function installTheme() { useTheme(theme); } 8 | export const installTheme$ = /*#__PURE__*/funcTransport(installTheme); 9 | -------------------------------------------------------------------------------- /.codedoc/build.ts: -------------------------------------------------------------------------------- 1 | import { build } from '@codedoc/core'; 2 | 3 | import { config } from './config'; 4 | import { installTheme$ } from './content/theme'; 5 | import { content } from './content'; 6 | 7 | 8 | build(config, content, installTheme$, { 9 | resolve: { 10 | modules: ['.codedoc/node_modules'] 11 | }, 12 | resolveLoader: { 13 | modules: ['.codedoc/node_modules'] 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './e'; 2 | export * from './boolean'; 3 | export * from './number'; 4 | export * from './string'; 5 | 6 | import { 7 | neg, inv, add, sub, mul, div, mod, 8 | not, truthy, and, or, eq, neq, 9 | concat, 10 | } from './pipes/index'; 11 | 12 | 13 | export const pipes = /*#__PURE__*/{ 14 | neg, inv, add, sub, mul, div, mod, 15 | not, truthy, and, or, eq, neq, 16 | concat, 17 | }; 18 | -------------------------------------------------------------------------------- /conf/rollup/es5.js: -------------------------------------------------------------------------------- 1 | import babel from 'rollup-plugin-babel'; 2 | import { uglify } from "rollup-plugin-uglify"; 3 | import base from './base'; 4 | 5 | 6 | export default Object.assign(base, { 7 | plugins: [ 8 | babel({ exclude: 'node_modules/**', presets: ["@babel/preset-env"],}), 9 | uglify(), 10 | ], 11 | output: Object.assign(base.output, { 12 | file: 'dist/bundles/rxmetics.es5.min.js', 13 | }), 14 | }); 15 | -------------------------------------------------------------------------------- /.codedoc/serve.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { serve } from '@codedoc/core'; 3 | 4 | import { config } from './config'; 5 | import { content } from './content'; 6 | import { installTheme$ } from './content/theme'; 7 | 8 | 9 | const root = join(__dirname, '../'); 10 | 11 | serve(root, config, content, installTheme$, { 12 | resolve: { 13 | modules: ['.codedoc/node_modules'] 14 | }, 15 | resolveLoader: { 16 | modules: ['.codedoc/node_modules'] 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /.codedoc/content/footer.tsx: -------------------------------------------------------------------------------- 1 | import { CodedocConfig } from '@codedoc/core'; 2 | import { Footer as _Footer } from '@codedoc/core/components'; 3 | 4 | 5 | export function Footer(config: CodedocConfig, renderer: any) { 6 | const github$ = GitHub; 8 | const npm$ = NPM 9 | 10 | return <_Footer>{github$}
{npm$} 11 | } 12 | -------------------------------------------------------------------------------- /conf/typescript/base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": true, 4 | "strictNullChecks": true, 5 | "strictFunctionTypes": true, 6 | "noImplicitThis": true, 7 | "alwaysStrict": true, 8 | "declaration": true, 9 | "sourceMap": true, 10 | "moduleResolution": "node", 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "experimentalDecorators": true, 14 | "emitDecoratorMetadata": true, 15 | "typeRoots": [ 16 | "../../node_modules/@types" 17 | ], 18 | "lib": [ 19 | "es2017" 20 | ] 21 | }, 22 | "include": [ 23 | "../../src/**/*" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/pipes/test/string.test.ts: -------------------------------------------------------------------------------- 1 | import { should, expect } from 'chai'; should(); 2 | 3 | import { Subject } from 'rxjs'; 4 | 5 | import { concat } from '../string'; 6 | 7 | 8 | describe('concat()', () => { 9 | it('should make `concat()` pipeable.', () => { 10 | const src = new Subject(); 11 | const off = new Subject(); 12 | const res: string[] = []; 13 | src.pipe(concat(off, '!')).subscribe(v => res.push(v)); 14 | 15 | res.should.eql([]); 16 | src.next('hellow '); res.should.eql([]); 17 | off.next(42); res.should.eql(['hellow 42!']); 18 | off.next(false); res.should.eql(['hellow 42!', 'hellow false!']); 19 | }); 20 | }); -------------------------------------------------------------------------------- /.codedoc/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "noImplicitAny": true, 5 | "declaration": false, 6 | "strictNullChecks": true, 7 | "strictFunctionTypes": true, 8 | "noImplicitThis": true, 9 | "alwaysStrict": true, 10 | "sourceMap": true, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "allowSyntheticDefaultImports": true, 14 | "experimentalDecorators": true, 15 | "emitDecoratorMetadata": true, 16 | "jsx": "react", 17 | "jsxFactory": "renderer.create", 18 | "lib": [ 19 | "es2017", 20 | "dom" 21 | ] 22 | }, 23 | "include": [ 24 | "./**/*" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /src/test/index.ts: -------------------------------------------------------------------------------- 1 | import { pipes } from '../index'; 2 | import * as packed from '../pipes'; 3 | 4 | 5 | describe('rxmetics', () => { 6 | require('./e.test'); 7 | require('./boolean.test'); 8 | require('./number.test'); 9 | require('./string.test'); 10 | 11 | require('../pipes/test'); 12 | 13 | describe('.pipes', () => { 14 | it('should include all functions from pipes submodule.', () => { 15 | Object.keys(pipes).forEach(key => { 16 | (packed as any)[key].should.equal((pipes as any)[key]); 17 | }); 18 | 19 | Object.keys(packed).forEach(key => { 20 | (packed as any)[key].should.equal((pipes as any)[key]); 21 | }); 22 | }); 23 | }); 24 | }) -------------------------------------------------------------------------------- /.codedoc/watch.ts: -------------------------------------------------------------------------------- 1 | import { exec, spawn } from 'child_process'; 2 | import { config } from './config'; 3 | 4 | 5 | const cmd = 'ts-node-dev'; 6 | const params = `--project .codedoc/tsconfig.json` 7 | + ` -T --watch ${config.src.base},.codedoc` 8 | + ` --ignore-watch .codedoc/node_modules` 9 | + ` .codedoc/serve`; 10 | 11 | 12 | if (process.platform === 'win32') { 13 | const child = exec(cmd + ' ' + params); 14 | 15 | child.stdout?.pipe(process.stdout); 16 | child.stderr?.pipe(process.stderr); 17 | child.on('close', () => {}); 18 | } 19 | else { 20 | const child = spawn(cmd, [params], { stdio: 'inherit', shell: 'bash' }); 21 | child.on('close', () => {}); 22 | } -------------------------------------------------------------------------------- /src/pipes/boolean.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from 'rxjs'; 2 | 3 | import { $ } from '../e'; 4 | import {and as _and, or as _or, eq as _eq, neq as _neq } from '../boolean'; 5 | 6 | export { not, truthy } from '../boolean'; 7 | 8 | 9 | export function and(a: $, ...bools: $[]) { 10 | return (o: Observable) => _and(o, a, ...bools); 11 | } 12 | 13 | 14 | export function or(a: $, ...bools: $[]) { 15 | return (o: Observable) => _or(o, a, ...bools); 16 | } 17 | 18 | 19 | export function eq(a: $, ...rest: $[]) { 20 | return (o: Observable) => _eq(o, a, ...rest); 21 | } 22 | 23 | 24 | export function neq(a: $, ...rest: $[]) { 25 | return (o: Observable) => _neq(o, a, ...rest); 26 | } 27 | -------------------------------------------------------------------------------- /.codedoc/content/header.tsx: -------------------------------------------------------------------------------- 1 | import { CodedocConfig } from '@codedoc/core'; 2 | import { Header as _Header, GithubButton, Watermark } from '@codedoc/core/components'; 3 | 4 | 5 | export function Header(config: CodedocConfig, renderer: any) { 6 | return ( 7 | <_Header>{config.misc?.github ? 8 | 9 | 15 |

16 |
17 | : ''} 18 | 19 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /src/string.ts: -------------------------------------------------------------------------------- 1 | import { E, Func$, $ } from './e'; 2 | 3 | 4 | export function concat(a: $, b: $, ...bits: $[]) { 5 | if (bits.length == 0) return E((a: string, b: any) => a + b)(a, b); 6 | if (bits.length == 1) return E((a: string, b: any, c: any) => a + b + c)(a, b, bits[0]); 7 | else return ( 8 | E((a: string, b: any, ...l: any[]) => 9 | l.reduce((t, x) => t + x, a + b) 10 | ) as Func$ 11 | )(a, b, ...bits); 12 | } 13 | 14 | 15 | export function rxl(strings: TemplateStringsArray, ...values: $[]) { 16 | return ( 17 | E((...l: any[]) => 18 | strings.reduce((t, p, i) => t + p + (i > values.length - 1 ? '' : 19 | ((l[i] === undefined || l[i] === null) ? '' : l[i])) 20 | .toString(), '') 21 | ) as Func$ 22 | )(...values); 23 | } 24 | -------------------------------------------------------------------------------- /.codedoc/config.ts: -------------------------------------------------------------------------------- 1 | 2 | import { configuration } from '@codedoc/core'; 3 | 4 | import { theme } from './theme'; 5 | 6 | 7 | export const config = /*#__PURE__*/configuration({ 8 | theme, 9 | dest: { 10 | namespace: '/rxmetics', 11 | html: 'dist/docs', 12 | assets: 'dist/docs', 13 | }, 14 | page: { 15 | title: { 16 | base: 'RxMetics' 17 | }, 18 | fonts: { 19 | text: { 20 | url: 'https://fonts.googleapis.com/css2?family=Titillium+Web:wght@400;700&display=swap', 21 | name: 'Titillium Web', 22 | }, 23 | code: { 24 | url: 'https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&display=swap', 25 | name: 'DM Mono' 26 | } 27 | } 28 | }, 29 | misc: { 30 | github: { 31 | user: 'loreanvictor', 32 | repo: 'rxmetics', 33 | } 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /.github/workflows/build_docs.yml: -------------------------------------------------------------------------------- 1 | name: Build Docs 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | build-and-deploy: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | 13 | - name: Build 14 | run: | 15 | # install .codedoc dependencies 16 | (cd .codedoc && npm install) 17 | # install codedoc 18 | npm install @codedoc/cli 19 | # build repo 20 | (PATH=$(npm bin):$PATH && codedoc build) 21 | # copy assets 22 | cp banner.svg dist/docs/ 23 | cp favicon.ico dist/docs/ 24 | - name: Deploy 25 | uses: JamesIves/github-pages-deploy-action@releases/v3 26 | with: 27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 28 | BRANCH: gh-pages 29 | FOLDER: dist/docs -------------------------------------------------------------------------------- /src/pipes/number.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from 'rxjs'; 2 | 3 | import { $ } from '../e'; 4 | import { add as _add, sub as _sub, div as _div, mul as _mul, mod as _mod } from '../number'; 5 | 6 | 7 | export { neg, inv } from '../number'; 8 | 9 | 10 | export function add(a: $, ...nums: $[]) { 11 | return (o: Observable) => _add(o, a, ...nums); 12 | } 13 | 14 | 15 | export function sub(a: $, ...nums: $[]) { 16 | return (o: Observable) => _sub(o, a, ...nums); 17 | } 18 | 19 | 20 | export function mul(a: $, ...nums: $[]) { 21 | return (o: Observable) => _mul(o, a, ...nums); 22 | } 23 | 24 | 25 | export function div(a: $, ...nums: $[]) { 26 | return (o: Observable) => _div(o, a, ...nums); 27 | } 28 | 29 | 30 | export function mod(a: $, ...nums: $[]) { 31 | return (o: Observable) => _mod(o, a, ...nums); 32 | } 33 | -------------------------------------------------------------------------------- /.codedoc/theme.ts: -------------------------------------------------------------------------------- 1 | import { createTheme } from '@codedoc/core/transport'; 2 | 3 | 4 | export const theme = /*#__PURE__*/createTheme({ 5 | light: { 6 | primary: '#018383', 7 | background: '#f9fcfb', 8 | }, 9 | dark: { 10 | primary: '#42e6a4', 11 | background: '#1b1919', 12 | }, 13 | quote: { 14 | light: { 15 | background: '#eafbea', 16 | border: '#c5ecbe', 17 | }, 18 | }, 19 | toc: { 20 | light: { 21 | background: '#eafbea' 22 | }, 23 | }, 24 | code: { 25 | wmbar: false, 26 | light: { 27 | shadow: '', 28 | background: '#004445', 29 | lineCounterHighlight: '#c0ffb3', 30 | comment: '#889e81', 31 | lineHightlight: '#105465', 32 | lineHover: '#105465', 33 | }, 34 | dark: { 35 | shadow: '', 36 | background: '#004445', 37 | lineCounterHighlight: '#c0ffb3', 38 | comment: '#889e81', 39 | lineHightlight: '#105465', 40 | lineHover: '#105465', 41 | } 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Eugene Ghanizadeh 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. 22 | -------------------------------------------------------------------------------- /.codedoc/content/index.tsx: -------------------------------------------------------------------------------- 1 | import { RendererLike } from '@connectv/html'; 2 | import { File } from 'rxline/fs'; 3 | import { Page, Meta, ContentNav, Fonts, ToC, GithubSearch$ } from '@codedoc/core/components'; 4 | 5 | import { config } from '../config'; 6 | import { Header } from './header'; 7 | import { Footer } from './footer'; 8 | 9 | 10 | export function content(_content: HTMLElement, toc: HTMLElement, renderer: RendererLike, file: File) { 11 | return ( 12 | } 15 | fonts={} 16 | 17 | scripts={config.page.scripts} 18 | stylesheets={config.page.stylesheets} 19 | 20 | header={
} 21 | footer={