https://github.com/oelin/subjectify
Make all method calls return their call subject.
https://github.com/oelin/subjectify
function-chaining functional-programming
Last synced: 6 months ago
JSON representation
Make all method calls return their call subject.
- Host: GitHub
- URL: https://github.com/oelin/subjectify
- Owner: oelin
- License: mit
- Created: 2023-02-28T11:06:51.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-22T12:13:31.000Z (about 3 years ago)
- Last Synced: 2025-06-25T21:54:48.129Z (9 months ago)
- Topics: function-chaining, functional-programming
- Language: JavaScript
- Homepage: https://npmjs.com/subjectify
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# subjectify
Make all method calls return their call subject.
## Installation
```sh
npm i subjectify
```
## Usage
Original code:
```js
const element = document.createElement('div')
element.setAttribute('class', 'foo')
element.setAttribute('id', 'bar')
element.append('hello world')
```
Simplified code using `subjectify()`:
```js
import subjectify from 'subjectify'
const element = subjectify(document.createElement('div'))
.setAttribute('class', 'foo')
.setAttribute('id', 'bar')
.append('hello world')
```