https://github.com/sagittaracc/lang
https://github.com/sagittaracc/lang
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sagittaracc/lang
- Owner: sagittaracc
- Created: 2023-08-15T21:20:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-15T21:22:03.000Z (almost 2 years ago)
- Last Synced: 2025-02-05T08:51:32.721Z (4 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lang
```js
const { lang, object, subject } = require('./src/lang')// This is how a language works
// We've got an object, a subject and an action
// Here is a regular sentence structure: An object is doing an action towards a subject// Object
const me = (name, age) => {
let props = {
name,
age
}return object(props)
}// Subject
const friend = (name, age) => {
let props = {
name,
age
}return subject(props)
}// Action
const say = text => {
return (me, friend) => {
if (text === 'fuck' && friend.age < 18) {
console.log(`Watch your mouth, ${me.name}! ${friend.name} is underage!`)
return
}
console.log(`${me.name} says ${text} to ${friend.name}`)
}
}const Yuriy = me('Yuriy', 34)
const Nikita = friend('Nikita', 24)// Object "Yuriy" says something to a subject "Nikita"
// You cannot use curse words if your friend is underage
lang(Yuriy, say('fuck'), Nikita)
```