Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-param

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-param - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

16

can-param.md

@@ -13,3 +13,3 @@ @module {function} can-param can-param

```js
import param from "can-param";
import { param } from "can";

@@ -31,5 +31,13 @@ param( { foo: "bar" } ); //-> "foo=bar"

Use this JS Bin to play around with this package:
Run the following example on CodePen to play around with this package:
<a class="jsbin-embed" href="https://jsbin.com/zezamig/embed?js,console">can-param on jsbin.com</a>
<script src="https://static.jsbin.com/js/embed.min.js?4.0.4"></script>
```html
<script type="module">
import { param } from "can";
var parameters = {canjs: 'awesome'};
var queryString = param(parameters);
console.log(queryString);
</script>
```
@codepen

@@ -1,3 +0,3 @@

/*can-param@1.1.1#can-param*/
define('can-param', [
/*can-param@1.1.2#can-param*/
define([
'require',

@@ -4,0 +4,0 @@ 'exports',

@@ -1,35 +0,28 @@

/*can-param@1.1.1#can-param*/
define('can-param', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
'use strict';
var namespace = require('can-namespace');
function buildParam(prefix, obj, add) {
if (Array.isArray(obj)) {
for (var i = 0, l = obj.length; i < l; ++i) {
var inner = obj[i];
var shouldIncludeIndex = typeof inner === 'object';
var arrayIndex = shouldIncludeIndex ? '[' + i + ']' : '[]';
buildParam(prefix + arrayIndex, inner, add);
}
} else if (obj && typeof obj === 'object') {
for (var name in obj) {
buildParam(prefix + '[' + name + ']', obj[name], add);
}
} else {
add(prefix, obj);
/*can-param@1.1.2#can-param*/
'use strict';
var namespace = require('can-namespace');
function buildParam(prefix, obj, add) {
if (Array.isArray(obj)) {
for (var i = 0, l = obj.length; i < l; ++i) {
var inner = obj[i];
var shouldIncludeIndex = typeof inner === 'object';
var arrayIndex = shouldIncludeIndex ? '[' + i + ']' : '[]';
buildParam(prefix + arrayIndex, inner, add);
}
} else if (obj && typeof obj === 'object') {
for (var name in obj) {
buildParam(prefix + '[' + name + ']', obj[name], add);
}
} else {
add(prefix, obj);
}
module.exports = namespace.param = function param(object) {
var pairs = [], add = function (key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
};
for (var name in object) {
buildParam(name, object[name], add);
}
return pairs.join('&').replace(/%20/g, '+');
};
});
}
module.exports = namespace.param = function param(object) {
var pairs = [], add = function (key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
};
for (var name in object) {
buildParam(name, object[name], add);
}
return pairs.join('&').replace(/%20/g, '+');
};

@@ -168,3 +168,3 @@ /*[process-shim]*/

/*can-param@1.1.1#can-param*/
/*can-param@1.1.2#can-param*/
define('can-param', [

@@ -171,0 +171,0 @@ 'require',

{
"name": "can-param",
"version": "1.1.2",
"version": "1.1.3",
"main": "can-param",

@@ -5,0 +5,0 @@ "description": "Serialize an array or object into a query string.",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc