Socket
Socket
Sign inDemoInstall

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.1 to 0.12.0

array/indicesOf.js

1

array.js

@@ -23,2 +23,3 @@

'indexOf' : require('./array/indexOf'),
'indicesOf' : require('./array/indicesOf'),
'insert' : require('./array/insert'),

@@ -25,0 +26,0 @@ 'intersection' : require('./array/intersection'),

2

array/shuffle.js

@@ -13,3 +13,3 @@ var randInt = require('../random/randInt');

var i = -1, len = arr.length, value;
var i = -1, len = arr.length;
while (++i < len) {

@@ -16,0 +16,0 @@ if (!i) {

mout changelog
==============
v0.12.0 (2016/03/03)
--------------------
- add `array/indicesOf`
- add `function/memoize`
- add `array/reverse`
- add `math/overflow`
- fix `query/getQuery`
- fix `object/deepMatches`
- optimize `function/partial`
- updates license
v0.11.0 (2014/11/17)

@@ -5,0 +17,0 @@ --------------------

@@ -393,2 +393,23 @@ # array #

## indicesOf(arr, item, [fromIndex]):Number
Returns an array of indices where `item` is found in the array.
Like `array/indexOf` it does loop over sparse items in the array. The optional
`fromIndex` parameter can limit the scope, the same way as it does in indexOf.
```js
var items = ['lorem', 'ipsum', 'foo', 'ipsum', 'ipsum'];
indicesOf(items, 'ipsum');
// > [1, 3, 4]
indicesOf(items, 'ipsum', 1);
// > [3, 4]
```
## insert(arr, ...items):Number

@@ -395,0 +416,0 @@

@@ -271,3 +271,17 @@ # math #

## overflow(val[, min], max):Number
Wraps number within [min, max). When no `min` is given, the value `0` is assumed.
A number larger or equal `max` loops around and starts over at `min`. For positive numbers larger
or equal max this method behaves identical to the modulo operator.
Numbers smaller than min loop around and start over at `max`.
overflow(13, 5, 10); // 8
overflow(3, 5, 10); // 8
overflow(23, 5); // 3
overflow(-10, -7, -1); // -4
See: [`loop()`](#loop)
## round(val[, step]):Number

@@ -300,3 +314,2 @@

-------------------------------------------------------------------------------

@@ -303,0 +316,0 @@

@@ -14,2 +14,3 @@

'makeIterator_' : require('./function/makeIterator_'),
'memoize' : require('./function/memoize'),
'partial' : require('./function/partial'),

@@ -16,0 +17,0 @@ 'prop' : require('./function/prop'),

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

var indexOf = require('../array/indexOf');
var slice = require('../array/slice');
var take = require('../array/take');
var _ = {};
/**

@@ -8,14 +12,18 @@ * Creates a partially applied function.

var as = slice(arguments, 1);
var has_ = indexOf(as, _) !== -1;
return function() {
var args = as.concat(slice(arguments));
for (var i = args.length; i--;) {
if (args[i] === partial._) {
args[i] = args.splice(-1)[0];
}
}
return f.apply(this, args);
var rest = slice(arguments);
// Don't waste time checking for placeholders if there aren't any.
var args = has_ ? take(as.length, function(i) {
var a = as[i];
return a === _ ? rest.shift() : a;
}) : as;
return f.apply(this, rest.length ? args.concat(rest) : args);
};
}
partial._ = {};
partial._ = _;

@@ -22,0 +30,0 @@ module.exports = partial;

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

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

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

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

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

'norm' : require('./math/norm'),
'overflow' : require('./math/overflow'),
'round' : require('./math/round')

@@ -18,0 +19,0 @@ };

@@ -42,3 +42,4 @@ var forOwn = require('./forOwn');

function deepMatches(target, pattern){
if (target && typeof target === 'object') {
if (target && typeof target === 'object' &&
pattern && typeof pattern === 'object') {
if (isArray(target) && isArray(pattern)) {

@@ -45,0 +46,0 @@ return matchArray(target, pattern);

{
"name": "mout",
"description": "Modular Utilities",
"version": "0.11.1",
"version": "0.12.0",
"homepage": "http://moutjs.com/",
"author": "Miller Medeiros <contact@millermedeiros.com> (http://blog.millermedeiros.com)",
"contributors": [

@@ -13,3 +14,2 @@ "Adam Nowotny",

"Jarrod Overson (http://jarrodoverson.com)",
"Miller Medeiros <contact@millermedeiros.com> (http://blog.millermedeiros.com)",
"Mathias Paumgarten <mail@mathias-paumgarten.com>",

@@ -95,2 +95,2 @@ "Zach Shipley"

}
}
}

@@ -7,3 +7,3 @@

function getQuery(url) {
url = url.replace(/#.*/, ''); //removes hash (to avoid getting hash query)
// url = url.replace(/#.*\?/, '?'); //removes hash (to avoid getting hash query)
var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt

@@ -10,0 +10,0 @@ return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';

@@ -6,2 +6,4 @@ ![mout](http://moutjs.com/logo.png "Modular JavaScript Utilties")

[![Build Status](https://travis-ci.org/mout/mout.svg?branch=master)](https://travis-ci.org/mout/mout)
[![Downloads](https://img.shields.io/npm/dm/mout.svg)](https://www.npmjs.com/package/mout)
[![Version](https://img.shields.io/npm/v/mout.svg)](https://www.npmjs.com/package/mout)

@@ -8,0 +10,0 @@ All code is library agnostic and consist mostly of helper methods that aren't

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

'indexOf' : require('./array/indexOf'),
'indicesOf' : require('./array/indicesOf'),
'insert' : require('./array/insert'),

@@ -25,0 +26,0 @@ 'intersection' : require('./array/intersection'),

@@ -13,3 +13,3 @@ define(['../random/randInt'], function (randInt) {

var i = -1, len = arr.length, value;
var i = -1, len = arr.length;
while (++i < len) {

@@ -16,0 +16,0 @@ if (!i) {

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

'makeIterator_' : require('./function/makeIterator_'),
'memoize' : require('./function/memoize'),
'partial' : require('./function/partial'),

@@ -16,0 +17,0 @@ 'prop' : require('./function/prop'),

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

define(['../array/slice'], function (slice) {
define(['../array/indexOf', '../array/slice', '../array/take'], function (indexOf, slice, take) {
var _ = {};
/**

@@ -8,14 +10,18 @@ * Creates a partially applied function.

var as = slice(arguments, 1);
var has_ = indexOf(as, _) !== -1;
return function() {
var args = as.concat(slice(arguments));
for (var i = args.length; i--;) {
if (args[i] === partial._) {
args[i] = args.splice(-1)[0];
}
}
return f.apply(this, args);
var rest = slice(arguments);
// Don't waste time checking for placeholders if there aren't any.
var args = has_ ? take(as.length, function(i) {
var a = as[i];
return a === _ ? rest.shift() : a;
}) : as;
return f.apply(this, rest.length ? args.concat(rest) : args);
};
}
partial._ = {};
partial._ = _;

@@ -22,0 +28,0 @@ return partial;

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

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

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

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

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

'norm' : require('./math/norm'),
'overflow' : require('./math/overflow'),
'round' : require('./math/round')

@@ -18,0 +19,0 @@ };

@@ -41,3 +41,4 @@ define(['./forOwn', '../lang/isArray'], function(forOwn, isArray) {

function deepMatches(target, pattern){
if (target && typeof target === 'object') {
if (target && typeof target === 'object' &&
pattern && typeof pattern === 'object') {
if (isArray(target) && isArray(pattern)) {

@@ -44,0 +45,0 @@ return matchArray(target, pattern);

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

function getQuery(url) {
url = url.replace(/#.*/, ''); //removes hash (to avoid getting hash query)
// url = url.replace(/#.*\?/, '?'); //removes hash (to avoid getting hash query)
var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt

@@ -10,0 +10,0 @@ return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';

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