@bothrs/util
Advanced tools
Comparing version 3.0.5 to 3.0.7
@@ -36,3 +36,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.create(exports.env, tableName, fields); | ||
return (0, airtable_1.create)(exports.env, tableName, fields); | ||
}); | ||
@@ -43,3 +43,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.find(exports.env, tableName, id); | ||
return (0, airtable_1.find)(exports.env, tableName, id); | ||
}); | ||
@@ -50,3 +50,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.first(exports.env, tableName, filter); | ||
return (0, airtable_1.first)(exports.env, tableName, filter); | ||
}); | ||
@@ -57,3 +57,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.select(exports.env, tableName, filter); | ||
return (0, airtable_1.select)(exports.env, tableName, filter); | ||
}); | ||
@@ -64,3 +64,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.selectAll(exports.env, tableName, filter, prepend); | ||
return (0, airtable_1.selectAll)(exports.env, tableName, filter, prepend); | ||
}); | ||
@@ -71,3 +71,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.update(exports.env, tableName, id, fields); | ||
return (0, airtable_1.update)(exports.env, tableName, id, fields); | ||
}); | ||
@@ -78,5 +78,5 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return airtable_1.remove(exports.env, tableName, id); | ||
return (0, airtable_1.remove)(exports.env, tableName, id); | ||
}); | ||
} | ||
exports.remove = remove; |
@@ -45,3 +45,3 @@ "use strict"; | ||
env.log && env.log('create', tableName, fields); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName, { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName, { | ||
method: 'POST', | ||
@@ -61,3 +61,3 @@ headers: headers(env.key), | ||
env.log && env.log('find', tableName, id); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName + '/' + id, { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName + '/' + id, { | ||
headers: headers(env.key), | ||
@@ -83,3 +83,3 @@ }).then((r) => r.json()); | ||
env.log && env.log('select', tableName, filter); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName + '?' + url_1.serialize(filter), { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName + '?' + (0, url_1.serialize)(filter), { | ||
headers: headers(env.key), | ||
@@ -102,3 +102,3 @@ }).then((r) => r.json()); | ||
env.log && env.log('selectAll', tableName, filter, prepend.length); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName + '?' + url_1.serialize(filter), { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName + '?' + (0, url_1.serialize)(filter), { | ||
headers: headers(env.key), | ||
@@ -124,3 +124,3 @@ }).then((r) => r.json()); | ||
env.log && env.log('update', tableName, fields); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName + '/' + id, { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName + '/' + id, { | ||
method: 'PATCH', | ||
@@ -140,3 +140,3 @@ headers: headers(env.key), | ||
env.log && env.log('remove', tableName, id); | ||
const body = yield node_fetch_1.default(app(env.app) + tableName + '/' + id, { | ||
const body = yield (0, node_fetch_1.default)(app(env.app) + tableName + '/' + id, { | ||
method: 'DELETE', | ||
@@ -143,0 +143,0 @@ headers: headers(env.key), |
10
fs.js
@@ -11,3 +11,4 @@ "use strict"; | ||
return new Promise((resolve, reject) => { | ||
fs_1.readFile(fileName, type, (err, data) => { | ||
//@ts-ignore | ||
(0, fs_1.readFile)(fileName, type, (err, data) => { | ||
err ? reject(err) : resolve(data); | ||
@@ -20,3 +21,4 @@ }); | ||
return new Promise((resolve, reject) => { | ||
fs_1.writeFile(fileName, data, type, err => { | ||
//@ts-ignore | ||
(0, fs_1.writeFile)(fileName, data, type, (err) => { | ||
err ? reject(err) : resolve(data); | ||
@@ -29,3 +31,3 @@ }); | ||
return new Promise((resolve, reject) => { | ||
fs_1.readFile(fileName, 'utf8', (err, data) => { | ||
(0, fs_1.readFile)(fileName, 'utf8', (err, data) => { | ||
err ? reject(err) : resolve(JSON.parse(data)); | ||
@@ -38,3 +40,3 @@ }); | ||
return new Promise((resolve, reject) => { | ||
fs_1.writeFile(fileName, JSON.stringify(data), 'utf8', err => { | ||
(0, fs_1.writeFile)(fileName, JSON.stringify(data), 'utf8', (err) => { | ||
err ? reject(err) : resolve(data); | ||
@@ -41,0 +43,0 @@ }); |
@@ -6,8 +6,8 @@ "use strict"; | ||
function md5(str) { | ||
return crypto_1.createHash('md5').update(str).digest('hex'); | ||
return (0, crypto_1.createHash)('md5').update(str).digest('hex'); | ||
} | ||
exports.md5 = md5; | ||
function sha256(str) { | ||
return crypto_1.createHash('sha256').update(str).digest('hex'); | ||
return (0, crypto_1.createHash)('sha256').update(str).digest('hex'); | ||
} | ||
exports.sha256 = sha256; |
@@ -13,4 +13,4 @@ "use strict"; | ||
const [, data] = token.split('.'); | ||
return JSON.parse(exports.atob(data)); | ||
return JSON.parse((0, exports.atob)(data)); | ||
} | ||
exports.unsafeDecode = unsafeDecode; |
{ | ||
"name": "@bothrs/util", | ||
"version": "3.0.5", | ||
"version": "3.0.7", | ||
"description": "Common helper functions", | ||
@@ -8,12 +8,7 @@ "license": "MIT", | ||
"dev": "npm run clean && tsc -w --noEmit", | ||
"fix": "npm run clean && prettier --write -l src", | ||
"lint": "npm run clean && prettier -l src", | ||
"clean": "find . -maxdepth 1 -type f \\( -name \\*.mjs -or -name \\*.js -or -name \\*.d.ts -or -name \\*.jsx \\) -delete; date", | ||
"build": "npm run clean && tsc -d && cp src/mjs/*.mjs .", | ||
"prepare": "npm run fix", | ||
"prepublishOnly": "npm run build", | ||
"preversion": "npm run fix", | ||
"docs": "typedoc --out docs src --includeVersion" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -32,7 +27,4 @@ "@tsconfig/recommended": "^1.0.1", | ||
"peerDependencies": { | ||
"node-fetch": "^2.6.1" | ||
"node-fetch": "2.x" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"files": [ | ||
@@ -45,17 +37,9 @@ "*.js", | ||
"type": "git", | ||
"url": "git+https://github.com/bothrs/util.git" | ||
"url": "git@github.com:bothrs/open-source.git" | ||
}, | ||
"contributors": [ | ||
"Thomas Ghysels <info@thomasg.be> (https://thomasg.be)" | ||
"Thomas Ghysels <info@thomasg.be> (https://thomasg.be)", | ||
"Jacco Goris <contact@jaccogoris.com> (https://jaccogoris.com)" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/bothrs/util/issues" | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
}, | ||
"homepage": "https://github.com/bothrs/util#readme" | ||
"gitHead": "4e4044094fe871e0c42f9de971060609aad2de3a" | ||
} |
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export declare function serialize(obj: any): string; | ||
export declare function serialize(object: any): string; | ||
export declare function unserialize(str: string): any; | ||
@@ -12,0 +12,0 @@ export declare function httpUrl(url?: string | null): string | undefined; |
18
url.js
@@ -12,10 +12,12 @@ "use strict"; | ||
exports.origin = exports.isUrl = exports.isRelative = exports.isAbsolute = exports.isNamed = exports.resolveUrl = exports.resolveModule = exports.httpUrl = exports.unserialize = exports.serialize = void 0; | ||
function serialize(obj) { | ||
const str = []; | ||
for (const p in obj) { | ||
if (obj.hasOwnProperty(p) && obj[p]) { | ||
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p])); | ||
function serialize(object) { | ||
const string = []; | ||
for (const property in object) { | ||
if (object.hasOwnProperty(property) && object[property]) { | ||
string.push(encodeURIComponent(property) + | ||
'=' + | ||
encodeURIComponent(object[property])); | ||
} | ||
} | ||
return str.join('&'); | ||
return string.join('&'); | ||
} | ||
@@ -26,3 +28,3 @@ exports.serialize = serialize; | ||
const result = {}; | ||
query.split('&').forEach(part => { | ||
query.split('&').forEach((part) => { | ||
const item = part.split('='); | ||
@@ -63,3 +65,3 @@ result[decodeURIComponent(item[0])] = decodeURIComponent(item[1]); | ||
const originLength = isUrl(baseUrl) ? 3 : 1; | ||
path.split('/').forEach(part => { | ||
path.split('/').forEach((part) => { | ||
if (part === '.' || !part) { | ||
@@ -66,0 +68,0 @@ return; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2029
67051
1
1