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

mout

Package Overview
Dependencies
Maintainers
4
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mout - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

array/reverse.js

1

array.js

@@ -40,2 +40,3 @@

'removeAll' : require('./array/removeAll'),
'reverse' : require('./array/reverse'),
'shuffle' : require('./array/shuffle'),

@@ -42,0 +43,0 @@ 'slice' : require('./array/slice'),

12

array/flatten.js

@@ -9,5 +9,3 @@ var isArray = require('../lang/isArray');

function flattenTo(arr, result, level) {
if (arr == null) {
return result;
} else if (level === 0) {
if (level === 0) {
append(result, arr);

@@ -34,6 +32,10 @@ return result;

* A new array containing all the elements is returned.
* If `shallow` is true, it will only flatten one level.
* If level is specified, it will only flatten up to that level.
*/
function flatten(arr, level) {
level = level == null? -1 : level;
if (arr == null) {
return [];
}
level = level == null ? -1 : level;
return flattenTo(arr, [], level);

@@ -40,0 +42,0 @@ }

@@ -328,2 +328,3 @@ # array #

returned. If `level` is specified, it will only flatten up to that level.
Note that arrays within objects will not be flattened.

@@ -339,2 +340,3 @@ ### Example

See: [`object/flatten()`](./object.html#flatten)

@@ -701,4 +703,19 @@

## reverse(arr):void
Returns a copy of the array with all elements in reversed order.
### Example
```js
var foo = [1, 2, 3, 4, 5];
var bar = reverse(foo);
console.log(bar); // [5, 4, 3, 2, 1];
console.log(foo); // [1, 2, 3, 4, 5];
```
## shuffle(arr):Array

@@ -705,0 +722,0 @@

@@ -22,3 +22,3 @@ # function #

```js
var callback = after(onLoaded, 1000);
var callback = awaitDelay(onLoaded, 1000);
loadImages(callback);

@@ -25,0 +25,0 @@ function onLoaded(){

@@ -28,5 +28,5 @@ # number #

var _ptbrDict = {
thousands : ' mil',
millions : ' Mi',
billions : ' Bi'
thousand: ' mil',
million: ' Mi',
billion: ' Bi'
};

@@ -33,0 +33,0 @@ function customAbbr(val) {

@@ -211,3 +211,3 @@ # object #

// returns { bar: 'bar value' }
filter(obj, function(v) { return value.length > 5; });
filter(obj, function(v) { return v.length > 5; });

@@ -238,2 +238,20 @@ // returns { foo: 'value' }

## flatten(object, [level]):Object
Recursively flattens an object. A new object containing all the values is
returned. If `level` is specified, it will only flatten up to that level.
Note that objects within arrays will not be flattened.
### Example
```js
flatten({ a: 1, b: { c: 2, d: { e: 3 } } });
// > { a: 1, 'b.c': 2, 'b.d.e': 3 }
flatten({ a: 1, b: { c: 2, d: { e: 3 } } }, 1);
// > { a: 1, 'b.c': 2, 'b.d': { e: 3 } }
```
See: [`array/flatten()`](./array.html#flatten)
## forIn(obj, callback[, thisObj])

@@ -240,0 +258,0 @@

/**@license
* mout v0.11.0 | http://moutjs.com | MIT license
* mout v0.11.1 | http://moutjs.com | MIT license
*/

@@ -9,3 +9,3 @@

module.exports = {
'VERSION' : '0.11.0',
'VERSION' : '0.11.1',
'array' : require('./array'),

@@ -12,0 +12,0 @@ 'collection' : require('./collection'),

@@ -16,2 +16,3 @@

'find' : require('./object/find'),
'flatten' : require('./object/flatten'),
'forIn' : require('./object/forIn'),

@@ -18,0 +19,0 @@ 'forOwn' : require('./object/forOwn'),

{
"name": "mout",
"description": "Modular Utilities",
"version": "0.11.0",
"version": "0.11.1",
"homepage": "http://moutjs.com/",

@@ -27,8 +27,3 @@ "contributors": [

},
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
],
"license": "MIT",
"bugs": {

@@ -47,3 +42,3 @@ "url": "https://github.com/mout/mout/issues/"

"istanbul": "~0.1.27",
"jasmine-node": "~1.2.2",
"jasmine-node": "~1.14.5",
"requirejs": "2.x",

@@ -101,2 +96,2 @@ "nodefy": "*",

}
}
}
var typecast = require('../string/typecast');
var isString = require('../lang/isString');
var isArray = require('../lang/isArray');

@@ -11,23 +10,22 @@ var hasOwn = require('../object/hasOwn');

var queryArr = (queryStr || '').replace('?', '').split('&'),
count = -1,
length = queryArr.length,
reg = /([^=]+)=(.+)/,
i = -1,
obj = {},
item, pValue, pName, toSet;
equalIndex, cur, pValue, pName;
while (++count < length) {
item = queryArr[count].split('=');
pName = item[0];
if (!pName || !pName.length){
continue;
while ((cur = queryArr[++i])) {
equalIndex = cur.indexOf('=');
pName = cur.substring(0, equalIndex);
pValue = decodeURIComponent(cur.substring(equalIndex + 1));
if (shouldTypecast !== false) {
pValue = typecast(pValue);
}
pValue = shouldTypecast === false ? item[1] : typecast(item[1]);
toSet = isString(pValue) ? decodeURIComponent(pValue) : pValue;
if (hasOwn(obj,pName)){
if (hasOwn(obj, pName)){
if(isArray(obj[pName])){
obj[pName].push(toSet);
obj[pName].push(pValue);
} else {
obj[pName] = [obj[pName],toSet];
obj[pName] = [obj[pName], pValue];
}
} else {
obj[pName] = toSet;
obj[pName] = pValue;
}

@@ -34,0 +32,0 @@ }

@@ -9,3 +9,3 @@

var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt
return (queryString)? decodeURIComponent(queryString[0]) : '';
return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';
}

@@ -12,0 +12,0 @@

@@ -40,2 +40,3 @@ define(function(require){

'removeAll' : require('./array/removeAll'),
'reverse' : require('./array/reverse'),
'shuffle' : require('./array/shuffle'),

@@ -42,0 +43,0 @@ 'slice' : require('./array/slice'),

@@ -8,5 +8,3 @@ define(['../lang/isArray', './append'], function (isArray, append) {

function flattenTo(arr, result, level) {
if (arr == null) {
return result;
} else if (level === 0) {
if (level === 0) {
append(result, arr);

@@ -33,6 +31,10 @@ return result;

* A new array containing all the elements is returned.
* If `shallow` is true, it will only flatten one level.
* If level is specified, it will only flatten up to that level.
*/
function flatten(arr, level) {
level = level == null? -1 : level;
if (arr == null) {
return [];
}
level = level == null ? -1 : level;
return flattenTo(arr, [], level);

@@ -39,0 +41,0 @@ }

/**@license
* mout v0.11.0 | http://moutjs.com | MIT license
* mout v0.11.1 | http://moutjs.com | MIT license
*/

@@ -9,3 +9,3 @@ define(function(require){

return {
'VERSION' : '0.11.0',
'VERSION' : '0.11.1',
'array' : require('./array'),

@@ -12,0 +12,0 @@ 'collection' : require('./collection'),

@@ -16,2 +16,3 @@ define(function(require){

'find' : require('./object/find'),
'flatten' : require('./object/flatten'),
'forIn' : require('./object/forIn'),

@@ -18,0 +19,0 @@ 'forOwn' : require('./object/forOwn'),

@@ -1,2 +0,2 @@

define(['../string/typecast', '../lang/isString', '../lang/isArray', '../object/hasOwn'], function (typecast, isString, isArray, hasOwn) {
define(['../string/typecast', '../lang/isArray', '../object/hasOwn'], function (typecast, isArray, hasOwn) {

@@ -8,23 +8,22 @@ /**

var queryArr = (queryStr || '').replace('?', '').split('&'),
count = -1,
length = queryArr.length,
reg = /([^=]+)=(.+)/,
i = -1,
obj = {},
item, pValue, pName, toSet;
equalIndex, cur, pValue, pName;
while (++count < length) {
item = queryArr[count].split('=');
pName = item[0];
if (!pName || !pName.length){
continue;
while ((cur = queryArr[++i])) {
equalIndex = cur.indexOf('=');
pName = cur.substring(0, equalIndex);
pValue = decodeURIComponent(cur.substring(equalIndex + 1));
if (shouldTypecast !== false) {
pValue = typecast(pValue);
}
pValue = shouldTypecast === false ? item[1] : typecast(item[1]);
toSet = isString(pValue) ? decodeURIComponent(pValue) : pValue;
if (hasOwn(obj,pName)){
if (hasOwn(obj, pName)){
if(isArray(obj[pName])){
obj[pName].push(toSet);
obj[pName].push(pValue);
} else {
obj[pName] = [obj[pName],toSet];
obj[pName] = [obj[pName], pValue];
}
} else {
obj[pName] = toSet;
obj[pName] = pValue;
}

@@ -31,0 +30,0 @@ }

@@ -9,3 +9,3 @@ define(function () {

var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt
return (queryString)? decodeURIComponent(queryString[0]) : '';
return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';
}

@@ -12,0 +12,0 @@

Sorry, the diff of this file is not supported yet

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