I hereby claim:
- I am bamblehorse on github.
- I am bamblehorse (https://keybase.io/bamblehorse) on keybase.
- I have a public key ASA2DlmEpQpwxN9c_DQEoVHNMoC0HIPyAACi_QWoMPHANgo
To claim this, I am signing this object:
{"lastUpload":"2022-01-27T16:21:13.616Z","extensionVersion":"v3.4.3"} |
I hereby claim:
To claim this, I am signing this object:
{ | |
"name": "@bamblehorse/tiny", | |
"version": "1.0.0", | |
"description": "Removes all spaces from a string", | |
"license": "MIT", | |
"repository": "bamblehorse/tiny", | |
"main": "index.js", | |
"keywords": [ | |
"tiny", | |
"npm", |
module.exports = function tiny(string) { | |
if (typeof string !== "string") throw new TypeError("Tiny wants a string!"); | |
return string.replace(/\s/g, ""); | |
}; |
const space = require("just-a-space"); | |
console.log(typeof space, space.length, space === " "); // string 1 true |
const chokidar = require("chokidar"); | |
const watcher = chokidar | |
.watch("src/components/**", { ignored: /node_modules/ }) | |
.on("addDir", (path, event) => { | |
const name = path.replace(/.*\/components\//, ""); | |
const goodToGo = /^[^\/_]*$/.test(name); | |
if (goodToGo) createFiles(path, name); | |
}); |
function createFiles(path, name) { | |
const files = { | |
index: "index.jsx", | |
test: `${name}.test.js`, | |
sass: `${name}.sass` | |
}; | |
if (name !== "components") { | |
const writeFile = writeToPath(path); | |
const toFileMissingBool = file => !fileExists(path)(file); |
const fs = require('fs'); | |
const fileExists = path => file => fs.existsSync(`${path}/${file}`); | |
const fileExistsInSrc = fileExists('/src'); // file => fs.existsSync(`${path}/${file}`) | |
fileExistsInSrc('index.js') // true || false |
const fs = require('fs'); | |
const fileExists = path => file => fs.existsSync(`${path}/${file}`); | |
const writeToPath = path => (file, content) => { | |
const filePath = `${path}/${file}`; | |
fs.writeFile(filePath, content, err => { | |
if (err) throw err; | |
console.log("Created file: ", filePath); |