1.0.3 • Published 5 years ago

scpfn v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

scpfn.js

Scope functions like Kotlin

Start

$ npm install scpfn

index.js:

const scpfn = require('scpfn').default;

scpfn.inject(Object.prototype);
console.log("test".let(it => it.toUpperCase())); // TEST
$ node index.js
TEST

Browser

  • Download dist/scpfn.min.js
  • index.html:
<script type="module">
import scpfn from './scpfn.min.js'
scpfn.inject(Object.prototype)

document.body.appendChild(document.createElement('span').also(it => {
    it.innerText = "Hello"
    let s = it.style
    s['color'] = 'white'
    s['background-color'] = 'darkgray'
}))
document.body.appendChild(document.createElement('span').also(it => {
    it.innerText = ", world!"
    let s = it.style
    s['color'] = 'black'
    s['background-color'] = 'lightgray'
}))
</script>

result base64

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago