Socket
Socket
Sign inDemoInstall

pedash

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.18 to 0.1.19

26

index.js

@@ -91,1 +91,27 @@ export function getCharCountsByKey(arr) {

}
export function getParamsToObject(url) {
if (!url) throw new Error("Don't forget to pass the URL")
const regex = /([^?=&]+)(=([^&]*))/g
return (url.match(regex) || []).reduce((accu, current) => {
const index = current.indexOf("=")
return (accu[current.slice(0, index)] = current.slice(index + 1)), accu
}, {})
}
export function renameKeys(keysMap, obj = {}) {
if (Object.keys(obj).length === 0) throw new Error("Don't forget to pass the object data")
return Object.keys(obj).reduce(
(acc, key) => ({
...acc,
...{ [keysMap[key] || key]: obj[key] }
}),
{}
)
}
export function getRandomInRange(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}

36

package.json
{
"name": "pedash",
"version": "0.1.18",
"description": "A lodash-like javascript helper -- for dummies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"pedash",
"lodash",
"helper",
"utils",
"utilities",
"javascript"
],
"author": "Bejo Karmila",
"license": "ISC"
"name": "pedash",
"version": "0.1.19",
"description": "A lodash-like javascript helper -- for dummies",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"pedash",
"lodash",
"utility",
"helper",
"string manipulation",
"array helper",
"utilities",
"javascript"
],
"author": "Bejo Karmila",
"license": "ISC"
}

@@ -178,1 +178,35 @@ ## Pedash 🌶

```
#### getParamsToObject(url: string)
```
import { getParamsToObject } from pedash;
const completeUrl = "http://website.com?page=77&size=120&is_completed=true"
console.log(getParamsToObject(completeUrl));
// { page: 77, size: 120, is_completed: true }
```
#### renameKeys(keysMap: any, obj: any)
```
import { renameKeys } from pedash;
const obj = { name: "Samsul", location: "Toa Payoh, Singapore", isRetired: true }
console.log(renameKeys({ name: "firstName", location: "address" }, obj));
// { firstName: "Samsul", location: "Toa Payoh, Singapore", isRetired: true }
```
#### getRandomInRange(min: number, max: number)
```
import { getRandomInRange } from pedash;
console.log(getRandomInRange(2, 55);
// 34
console.log(getRandomInRange(1, 10);
// 10
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc