New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

n8iv

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n8iv - npm Package Compare versions

Comparing version 0.2.9 to 0.3.0

docs/n8iv.md

38

docs/Array.md

@@ -222,17 +222,4 @@ # Array

### invoke( method:String[, arg1:Mixed, arg2:Mixed, ..., argN:Mixed] ):Array
Executes the passed `method` – **NOTE:** `method` is a String, and should be the name of `method` that exists on each item in the Array – on each item in the Array, passing any extra arguments to each method call.
#### Example:
```javascript
['lorem', 'ipsum', 'dolor', 'sit', 'amet'].invoke( 'toUpperCase' ); // returns => ["LOREM", "IPSUM", "DOLOR", "SIT", "AMET"]
[1, 2, 3, 4, 5, 6, 7, 8].invoke( 'pad', 4, 2 ); // returns => ["0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000"]
```
### invokec( method_name:String[, arg1:Mixed, arg2:Mixed, ..., argN:Mixed] ):Array
Works similar to `invoke` above, only any `null` and `undefined` values are omitted from the returned Array.
Works similar to `invoke`, only any `NaN`, `null` and `undefined` values are omitted from the returned Array.

@@ -302,25 +289,2 @@ Think of it as an optimised version of running: `[].invoke().compact()`.

### pluck( key:String[, compact:Boolean] ):Array
Returns a new Array where all the items are the values of the passed property `key`.
If `compact` is set to `true` then all `null` and `undefined` values will be omitted from the returned Array.
**NOTE:** Unlike other `pluck` implementations, this implementation has a "smarter" way to get property values, allows you to `pluck` nested Object values, as well as HTML attributes.
#### Example:
```javascript
var data = [{ data : { value : 'foo' } }, { data : { value : 'bar' } }, {}, { value : 'blim' }, { data : { value : 'blam' } }];
// slower, has to iterate twice
data.pluck( 'data' ).pluck( 'value' ); // returns => ["foo", "bar", undefined, undefined, "blam"]
// optimised version of the above
data.pluck( 'data.value' ); // returns => ["foo", "bar", undefined, undefined, "blam"]
data.pluck( 'data.value', true ); // returns => ["foo", "bar", "blam"]
```
### remove( arg1:Mixed[, arg2:Mixed, ..., argN:Mixed] ):Array

@@ -327,0 +291,0 @@ Alters the Array by removing the passed items from the Array instance. Returns an Array with all the removed items.

;!function( util, Name, PACKAGE ) {
"use strict";
/*~ src/Object.js ~*/
/*~ n8iv/src/Object.js ~*/
util.x.cache( 'Object', function( Type ) {

@@ -37,3 +37,3 @@ function arraysEqual( a1, a2 ) {

/*~ src/Function.js ~*/
/*~ n8iv/src/Function.js ~*/
util.x.cache( 'Function', function( Type ) {

@@ -100,3 +100,3 @@ var re_args = /^[\s\(]*function[^\(]*\(([^\)]*)\)/,

/*~ src/Array.js ~*/
/*~ n8iv/src/Array.js ~*/
util.x.cache( 'Array', function( Type ) {

@@ -182,6 +182,2 @@ function groupByFn( field, v ) { return field( v ) ? '0' : '1'; }

include : function( o ) { return PROTO.contains.call( this, o ) ? !1 : !this.push( o ) || true; },
invoke : function( fn ) {
var args = Type.coerce( arguments, 1 );
return PROTO.map.call( this, function( o, i ) { return o[fn].apply( o, args ); } );
},
invokec : function( fn ) {

@@ -202,7 +198,2 @@ var args = Type.coerce( arguments, 1 );

},
pluck : function( k, c ) {
return PROTO[c === true ? 'mapc' : 'map'].call( this, function( o ) {
return Object.value( o, k );
} );
},
remove : function() {

@@ -240,3 +231,3 @@ var args = Type.coerce( arguments ), i, res = [], v;

/*~ src/Number.js ~*/
/*~ n8iv/src/Number.js ~*/
util.x.cache( 'Number', function( Type ) {

@@ -270,3 +261,3 @@ var abs = Math.abs, big_int = 9007199254740992, floor = Math.floor;

/*~ src/String.js ~*/
/*~ n8iv/src/String.js ~*/
util.x.cache( 'String', function( Type ) {

@@ -362,3 +353,3 @@ var cache_chars = util.obj(), cache_slices = util.obj(),

/*~ src/expose.js ~*/
/*~ n8iv/src/expose.js ~*/
function __lib__() {

@@ -365,0 +356,0 @@ util.x.apply( util, arguments );

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

!function(e,t,n){"use strict";function r(){return e.x.apply(e,arguments),r}function i(t,n){return e.x.cache(t.__name__,n).x(t),r}e.x.cache("Object",function(t){function n(e,n){return e.length==n.length&&Array.coerce(e).every(function(e,r){return t.equalTo(n[r],e)})}function r(n,r){if(e.len(n)!==e.len(r)||t.ownLen(n)!==t.ownLen(r))return!1;for(var i in r)if(e.has(n,i)!==e.has(r,i)||!t.equalTo(n[i],r[i]))return!1;return!0}e.defs(t,{aggregate:function(e,n,r,i){return i||(i=e),t.keys(e).reduce(function(t,n,s){return r.call(i,t,e[n],n,e,s)},n)},clear:function(e){return t.keys(e).forEach(function(t){delete e[t]},e),e},equalTo:function(t,i){switch(e.ntype(t)){case"array":return Array.isArray(i)?n(t,i):!1;case"object":return e.ntype(i)=="object"?r(t,i):!1;case"date":return+t==+i}return t==i},ownKeys:function(e){return t.getOwnPropertyNames(e)},ownLen:function(e){return t.ownKeys(e).length}},"w")}),e.x.cache("Function",function(t){var n=/^[\s\(]*function[^\(]*\(([^\)]*)\)/,r=/\s*,\s*/;e.def(t,"coerce",e.describe(function(n){return e.ntype(n)=="function"?n:function(){return n}},"w")),e.defs(t.prototype,{params:{get:function(){var e=String(this).match(n)[1].trim().split(r);return e.length==1&&!e[0]?[]:e}},attempt:function(e){var t=Array.coerce(arguments,1),n=this;return function(){try{return n.apply(e||this,t)}catch(i){return i}}()},bake:function(){var t="baked",n=this;return n[t]||!e.def(n,t,e.describe(function(){return n.apply(this,[this].concat(Array.coerce(arguments)))}.mimic(n),"w"))||n[t]},defer:e.ENV=="commonjs"?function(e){return process.nextTick(this.bind.apply(this,[e].concat(Array.coerce(arguments,1))))}:function(){return this.delay.apply(this,[1].concat(Array.coerce(arguments)))},delay:function(t,n){function s(){return s.stop(),i.apply(n||this,r)}var r=Array.coerce(arguments,2),i=this;return e.copy(s,{stop:function(){return clearTimeout(this.timeoutId),delete this.timeoutId,i},timeoutId:setTimeout(s,t)})},memoize:function(t,n){function i(){var e=Array.coerce(arguments),i=e.toString();return i in n?n[i]:n[i]=r.apply(t,e)}var r=this;return e.ntype(n)=="object"||(n=e.obj()),i.unmemoize=function(){return r},i},stop:function(){return this},unmemoize:function(){return this},wrap:function(e){var t=Array.coerce(arguments,1),n=this;return function(){return e.apply(this,[n.bind(this)].concat(t).concat(Array.coerce(arguments)))}.mimic(e)}},"w")}),e.x.cache("Array",function(t){function n(e,t){return e(t)?"0":"1"}function r(e,t){return e.test(t)?"0":"1"}function i(e,t){return Object.value(t,e)||"1"}function s(e){return e?e:null}function o(e){return e[0]}function u(e){return[e,typeof this=="function"?this(e):Object.value(e,this)]}var a=t.prototype,f={desc:function(e,t){return e[1]==t[1]?0:e[1]<t[1]?1:-1},asc:function(e,t){return e[1]==t[1]?0:e[1]>t[1]?1:-1}};f[String(!0)]=f[1]=f.asc,f[String(!1)]=f[0]=f.desc,e.def(t,"sortFns",e.describe({value:f},"w")),e.defs(t.prototype,{aggregate:function(e,t,n){return a.reduce.call(this,function(e,r,i,s){return t.call(n||r,e,r,i,s)},e)},associate:function(t,n,r){return n||(n=e),r||(r=this),a.reduce.call(this,function(e,i,s){return e[t[s]]=n.call(r,i,s,this),e},e.obj())},clear:function(){return this.length=0,this},clone:function(){return a.slice.call(this)},compact:function(t){return a.mapc.call(this,t===!0?s:e)},contains:function(e){return!!~a.indexOf.call(this,e)},each:function(e,t){return a.forEach.call(this,e,t||this),this},flatten:function(n){if(e.type(n)=="number"){if(!(n>0))return this;--n}return a.aggregate.call(this,[],function(e,r,i){return t.isArray(r)?e.splice.apply(e,[e.length,0].concat(r.flatten(n))):e.push(r),e},this)},grep:function(t,n,r){var i=this;return n||(n=e),r||(r=i),e.ntype(t)!="string"||(t=new RegExp(t.escapeRE(),"g")),a.aggregate.call(i,[],function(e,s,o){return!t.test(s)||e.push(n.call(r,s,o,i)),e})},groupBy:function(t,s,o){s||(s=e);var u=this,f,l,c={};switch(e.type(t)){case"function":l=n;break;case"regexp":l=r;break;case"number":case"string":l=i,f=a.pluck.call(u,t,!0);break;default:throw new TypeError("Array.prototype.groupBy can only match based on a Function, RegExp or String.")}return f?f.forEach(function(e){c[e]=[]}):(c[0]=[],c[1]=[]),a.aggregate.call(u,c,function(e,n,r){return e[l(t,n)].push(s.call(this,n,r,u)),e},o||u)},include:function(e){return a.contains.call(this,e)?!1:!this.push(e)||!0},invoke:function(e){var n=t.coerce(arguments,1);return a.map.call(this,function(t,r){return t[e].apply(t,n)})},invokec:function(n){var r=t.coerce(arguments,1);return a.mapc.call(this,function(t,i){return e.ntype(t[n])=="function"?t[n].apply(t,r):null})},item:function(e){return this[e<0?this.length+e:e]},last:function(){return this[this.length-1]},mapc:function(t,n){return n||(n=this),a.reduce.call(this,function(r,i,s,o){return!e.exists(i=t.call(n,i,s,o))||r.push(i),r},[])},pluck:function(e,t){return a[t===!0?"mapc":"map"].call(this,function(t){return Object.value(t,e)})},remove:function(){var e=t.coerce(arguments),n,r=[],i;while(i=e.shift())!~(n=a.indexOf.call(this,i))||r.push(a.splice.call(this,n,1)[0]);return r},sortBy:function(t,n){return a.map.call(this,u,t).sort(e.ntype(n)=="function"?n:f[String(n).toLowerCase()]||f.asc).map(o)},tuck:function(e,n){var r=t.isArray(n);return a.each.call(this,function(t,i){t[e]=r?n[i]:n})},uniq:function(){return a.reduce.call(this,function(e,t){return e.contains(t)||e.push(t),e},[])},without:function(){var e=a.clone.call(this);return e.remove.apply(e,arguments),e},zip:function(){var e=t.coerce(arguments);return e.unshift(this),a.map.call(this,function(t,n){return e.pluck(n)})}},"w")}),e.x.cache("Number",function(t){var n=Math.abs,r=9007199254740992,i=Math.floor;e.defs(t,{isInteger:function(t){return e.type(t)=="number"&&isFinite(t)&&t>-r&&t<r&&i(t)===t},toInteger:function(e){return e=+e,isNaN(e)?0:e===0||!isFinite(e)?e:(e<0?-1:1)*n(i(e))}},"w"),e.defs(t.prototype,{pad:function(e,t){var n=this.toString(t||10);return"0".times(e-n.length)+n},times:function(t,n){return e.range(0,this).forEach(t,n||e.global),this},toHex:function(){return this.pad(2,16)}},"w")}),e.x.cache("String",function(t){function c(e,t){return t+t.toLowerCase()}function h(e){e=e.trim();var t=e.charAt(0),n=e.charAt(1),r=t.toLowerCase()==t&&n!=" "&&n.toUpperCase()==n?2:1,i=e.substring(r).replace(o,c).split(f);return i[0]=e.substring(0,r)+i[0],i}var n=e.obj(),r=e.obj(),i=/([-\*\+\?\.\|\^\$\/\\\(\)[\]\{\}])/g,s="\\$1",o=/([A-Z])/g,u=/#?(\w{1,6})/,a=/(\d{1,3})/g,f=/[\sA-Z_-]+/g,l=/(.*?)\s*$/;e.defs(t.prototype,{blank:function(){return!!this.trim().empty()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},clean:function(e){return e||(e=" "),e=n[e]||(n[e]={re:new RegExp("("+e+"){1,}","g"),fill:e}),this.split(e.re).filter(function(t){return!t.blank()&&t!=e.fill}).join(e.fill)},contains:function(e){return!!~this.indexOf(e)},empty:function(){return t(this)===""},endsWith:function(e){return this.length&&this.lastIndexOf(e)==this.length-e.length},format:e.format.bake(),gsub:e.gsub.bake(),hyphenate:function(){return h(this).join("-").toLowerCase()},includes:function(e){return this.toLowerCase().contains(t(e).toLowerCase())},parts:function(e){var t=Array.coerce(this.match(e));switch(t.length){case 1:if(t[0]===null||t[0]===this)return[];default:return t[0]!==this||t.shift(),t}},regexpEsc:function(){return this.replace(i,s)},sliceEvery:function(e){return e=parseInt(e,10),isNaN(e)||this.length<e||e==0?[t(this)]:this.match(r[e]||(r[e]=new RegExp("(.{1,"+e+"})","g")))},startsWith:function(e){return!this.indexOf(e)},times:function(e){return(new Array(Number.toInteger(e)+1)).join(this)},toCamelCase:function(){var e=h(this),t=[e.shift()];return e.reduce(function(e,t){return e.push(t.capitalize()),e},t).join("")},toHex:function(){function e(e){return parseInt(e,10).pad(2,16)}return function(){var t=this.match(a);return"#"+(t.length==1?e(t[0]).times(3):t.map(e).join(""))}}(),toJSON:function(){return JSON.parse(this)},toRGB:function(e){var t=this.match(u)[1],n=t.length,r;switch(n){case 6:break;case 3:t=this.times(2);break;case 2:t=this.times(3);break;default:t=n>6?t.substring(0,6):n==4?t+"00":t+"0"}return r=t.sliceEvery(2).map(function(e){return parseInt(e,16)}),e===!0?r:"rgb("+r.join(", ")+")"},trimRight:function(){return this.replace(l,"$1")},truncate:function(n,r){return n||(n=50),e.ntype(r)=="string"||(r="..."),this.length<n?t(this):this.substring(0,n).trimRight()+r},underscore:function(){return h(this).join("_").toLowerCase()}},"w")}),e.iter(n)||(n=e.ENV=="commonjs"?module:e.global),e.defs(r=e.expose(r,t,n),{util:e,x:i},"r"),e.expose(e,r),e.x(Object,Array,Function,Number,String)}(typeof m8!="undefined"?m8:typeof require!="undefined"?require("m8"):null,"n8iv")
!function(e,t,n){"use strict";function r(){return e.x.apply(e,arguments),r}function i(t,n){return e.x.cache(t.__name__,n).x(t),r}e.x.cache("Object",function(t){function n(e,n){return e.length==n.length&&Array.coerce(e).every(function(e,r){return t.equalTo(n[r],e)})}function r(n,r){if(e.len(n)!==e.len(r)||t.ownLen(n)!==t.ownLen(r))return!1;for(var i in r)if(e.has(n,i)!==e.has(r,i)||!t.equalTo(n[i],r[i]))return!1;return!0}e.defs(t,{aggregate:function(e,n,r,i){return i||(i=e),t.keys(e).reduce(function(t,n,u){return r.call(i,t,e[n],n,e,u)},n)},clear:function(e){return t.keys(e).forEach(function(t){delete e[t]},e),e},equalTo:function(t,i){switch(e.ntype(t)){case"array":return Array.isArray(i)?n(t,i):!1;case"object":return"object"==e.ntype(i)?r(t,i):!1;case"date":return+t==+i}return t==i},ownKeys:function(e){return t.getOwnPropertyNames(e)},ownLen:function(e){return t.ownKeys(e).length}},"w")}),e.x.cache("Function",function(t){var n=/^[\s\(]*function[^\(]*\(([^\)]*)\)/,r=/\s*,\s*/;e.def(t,"coerce",e.describe(function(t){return"function"==e.ntype(t)?t:function(){return t}},"w")),e.defs(t.prototype,{params:{get:function(){var e=(this+"").match(n)[1].trim().split(r);return 1!=e.length||e[0]?e:[]}},attempt:function(e){var t=Array.coerce(arguments,1),n=this;return function(){try{return n.apply(e||this,t)}catch(r){return r}}()},bake:function(){var t="baked",n=this;return n[t]||!e.def(n,t,e.describe(function(){return n.apply(this,[this].concat(Array.coerce(arguments)))}.mimic(n),"w"))||n[t]},defer:"commonjs"==e.ENV?function(e){return process.nextTick(this.bind.apply(this,[e].concat(Array.coerce(arguments,1))))}:function(){return this.delay.apply(this,[1].concat(Array.coerce(arguments)))},delay:function(t,n){function r(){return r.stop(),u.apply(n||this,i)}var i=Array.coerce(arguments,2),u=this;return e.copy(r,{stop:function(){return clearTimeout(this.timeoutId),delete this.timeoutId,u},timeoutId:setTimeout(r,t)})},memoize:function(t,n){function r(){var e=Array.coerce(arguments),r=""+e;return r in n?n[r]:n[r]=i.apply(t,e)}var i=this;return"object"==e.ntype(n)||(n=e.obj()),r.unmemoize=function(){return i},r},stop:function(){return this},unmemoize:function(){return this},wrap:function(e){var t=Array.coerce(arguments,1),n=this;return function(){return e.apply(this,[n.bind(this)].concat(t).concat(Array.coerce(arguments)))}.mimic(e)}},"w")}),e.x.cache("Array",function(t){function n(e,t){return e(t)?"0":"1"}function r(e,t){return e.test(t)?"0":"1"}function i(e,t){return Object.value(t,e)||"1"}function u(e){return e?e:null}function s(e){return e[0]}function o(e){return[e,"function"==typeof this?this(e):Object.value(e,this)]}var c=t.prototype,a={desc:function(e,t){return e[1]==t[1]?0:e[1]<t[1]?1:-1},asc:function(e,t){return e[1]==t[1]?0:e[1]>t[1]?1:-1}};a[!0+""]=a[1]=a.asc,a[!1+""]=a[0]=a.desc,e.def(t,"sortFns",e.describe({value:a},"w")),e.defs(t.prototype,{aggregate:function(e,t,n){return c.reduce.call(this,function(e,r,i,u){return t.call(n||r,e,r,i,u)},e)},associate:function(t,n,r){return n||(n=e),r||(r=this),c.reduce.call(this,function(e,i,u){return e[t[u]]=n.call(r,i,u,this),e},e.obj())},clear:function(){return this.length=0,this},clone:function(){return c.slice.call(this)},compact:function(t){return c.mapc.call(this,t===!0?u:e)},contains:function(e){return!!~c.indexOf.call(this,e)},each:function(e,t){return c.forEach.call(this,e,t||this),this},flatten:function(n){if("number"==e.type(n)){if(!(n>0))return this;--n}return c.aggregate.call(this,[],function(e,r){return t.isArray(r)?e.splice.apply(e,[e.length,0].concat(r.flatten(n))):e.push(r),e},this)},grep:function(t,n,r){var i=this;return n||(n=e),r||(r=i),"string"!=e.ntype(t)||(t=RegExp(t.escapeRE(),"g")),c.aggregate.call(i,[],function(e,u,s){return!t.test(u)||e.push(n.call(r,u,s,i)),e})},groupBy:function(t,u,s){u||(u=e);var o,a,f=this,l={};switch(e.type(t)){case"function":a=n;break;case"regexp":a=r;break;case"number":case"string":a=i,o=c.pluck.call(f,t,!0);break;default:throw new TypeError("Array.prototype.groupBy can only match based on a Function, RegExp or String.")}return o?o.forEach(function(e){l[e]=[]}):(l["0"]=[],l["1"]=[]),c.aggregate.call(f,l,function(e,n,r){return e[a(t,n)].push(u.call(this,n,r,f)),e},s||f)},include:function(e){return c.contains.call(this,e)?!1:!this.push(e)||!0},invokec:function(n){var r=t.coerce(arguments,1);return c.mapc.call(this,function(t){return"function"==e.ntype(t[n])?t[n].apply(t,r):null})},item:function(e){return this[0>e?this.length+e:e]},last:function(){return this[this.length-1]},mapc:function(t,n){return n||(n=this),c.reduce.call(this,function(r,i,u,s){return!e.exists(i=t.call(n,i,u,s))||r.push(i),r},[])},remove:function(){for(var e,n,r=t.coerce(arguments),i=[];n=r.shift();)!~(e=c.indexOf.call(this,n))||i.push(c.splice.call(this,e,1)[0]);return i},sortBy:function(t,n){return c.map.call(this,o,t).sort("function"==e.ntype(n)?n:a[(n+"").toLowerCase()]||a.asc).map(s)},tuck:function(e,n){var r=t.isArray(n);return c.each.call(this,function(t,i){t[e]=r?n[i]:n})},uniq:function(){return c.reduce.call(this,function(e,t){return e.contains(t)||e.push(t),e},[])},without:function(){var e=c.clone.call(this);return e.remove.apply(e,arguments),e},zip:function(){var e=t.coerce(arguments);return e.unshift(this),c.map.call(this,function(t,n){return e.pluck(n)})}},"w")}),e.x.cache("Number",function(t){var n=Math.abs,r=9007199254740992,i=Math.floor;e.defs(t,{isInteger:function(t){return"number"==e.type(t)&&isFinite(t)&&t>-r&&r>t&&i(t)===t},toInteger:function(e){return e=+e,isNaN(e)?0:0!==e&&isFinite(e)?(0>e?-1:1)*n(i(e)):e}},"w"),e.defs(t.prototype,{pad:function(e,t){var n=this.toString(t||10);return"0".times(e-n.length)+n},times:function(t,n){return e.range(0,this).forEach(t,n||e.global),this},toHex:function(){return this.pad(2,16)}},"w")}),e.x.cache("String",function(t){function n(e,t){return t+t.toLowerCase()}function r(e){e=e.trim();var t=e.charAt(0),r=e.charAt(1),i=t.toLowerCase()==t&&" "!=r&&r.toUpperCase()==r?2:1,u=e.substring(i).replace(c,n).split(l);return u[0]=e.substring(0,i)+u[0],u}var i=e.obj(),u=e.obj(),s=/([-\*\+\?\.\|\^\$\/\\\(\)[\]\{\}])/g,o="\\$1",c=/([A-Z])/g,a=/#?(\w{1,6})/,f=/(\d{1,3})/g,l=/[\sA-Z_-]+/g,h=/(.*?)\s*$/;e.defs(t.prototype,{blank:function(){return!!this.trim().empty()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},clean:function(e){return e||(e=" "),e=i[e]||(i[e]={re:RegExp("("+e+"){1,}","g"),fill:e}),this.split(e.re).filter(function(t){return!t.blank()&&t!=e.fill}).join(e.fill)},contains:function(e){return!!~this.indexOf(e)},empty:function(){return""===t(this)},endsWith:function(e){return this.length&&this.lastIndexOf(e)==this.length-e.length},format:e.format.bake(),gsub:e.gsub.bake(),hyphenate:function(){return r(this).join("-").toLowerCase()},includes:function(e){return this.toLowerCase().contains(t(e).toLowerCase())},parts:function(e){var t=Array.coerce(this.match(e));switch(t.length){case 1:if(null===t[0]||t[0]===this)return[];default:return t[0]!==this||t.shift(),t}},regexpEsc:function(){return this.replace(s,o)},sliceEvery:function(e){return e=parseInt(e,10),isNaN(e)||e>this.length||0==e?[t(this)]:this.match(u[e]||(u[e]=RegExp("(.{1,"+e+"})","g")))},startsWith:function(e){return!this.indexOf(e)},times:function(e){return Array(Number.toInteger(e)+1).join(this)},toCamelCase:function(){var e=r(this),t=[e.shift()];return e.reduce(function(e,t){return e.push(t.capitalize()),e},t).join("")},toHex:function(){function e(e){return parseInt(e,10).pad(2,16)}return function(){var t=this.match(f);return"#"+(1==t.length?e(t[0]).times(3):t.map(e).join(""))}}(),toJSON:JSON.parse.bake(),toRGB:function(e){var t,n=this.match(a)[1],r=n.length;switch(r){case 6:break;case 3:n=this.times(2);break;case 2:n=this.times(3);break;default:n=r>6?n.substring(0,6):4==r?n+"00":n+"0"}return t=n.sliceEvery(2).map(function(e){return parseInt(e,16)}),e===!0?t:"rgb("+t.join(", ")+")"},trimRight:function(){return this.replace(h,"$1")},truncate:function(n,r){return n||(n=50),"string"==e.ntype(r)||(r="..."),n>this.length?t(this):this.substring(0,n).trimRight()+r},underscore:function(){return r(this).join("_").toLowerCase()}},"w")}),e.iter(n)||(n="commonjs"==e.ENV?module:e.global),e.defs(r=e.expose(r,t,n),{util:e,x:i},"r"),e.expose(e,r),e.x(Object,Array,Function,Number,String)}("undefined"!=typeof m8?m8:"undefined"!=typeof require?require("m8"):null,"n8iv");

@@ -9,6 +9,6 @@ {

"dependencies" : {
"m8" : ">= 0.3.3"
"m8" : ">= 0.3.4"
},
"devDependencies" : {
"catn8" : ">= 0.0.2",
"catn8" : ">= 0.0.4",
"chai" : ">= 1.2.0",

@@ -34,3 +34,3 @@ "mocha" : ">= 1.4.2"

},
"version" : "0.2.9"
"version" : "0.3.0"
}

@@ -42,4 +42,4 @@ # n8iv.js [![build status](https://secure.travis-ci.org/constantology/n8iv.png)](http://travis-ci.org/constantology/n8iv)

- n8iv.js ≅ 4.6kb (gzipped)
- n8iv.min.js ≅ 3.2kb (minzipped)
- n8iv.js ≅ 4.5kb (gzipped)
- n8iv.min.js ≅ 3.1kb (minzipped)

@@ -46,0 +46,0 @@ ## License

@@ -81,6 +81,2 @@ util.x.cache( 'Array', function( Type ) {

include : function( o ) { return PROTO.contains.call( this, o ) ? !1 : !this.push( o ) || true; },
invoke : function( fn ) {
var args = Type.coerce( arguments, 1 );
return PROTO.map.call( this, function( o, i ) { return o[fn].apply( o, args ); } );
},
invokec : function( fn ) {

@@ -101,7 +97,2 @@ var args = Type.coerce( arguments, 1 );

},
pluck : function( k, c ) {
return PROTO[c === true ? 'mapc' : 'map'].call( this, function( o ) {
return Object.value( o, k );
} );
},
remove : function() {

@@ -108,0 +99,0 @@ var args = Type.coerce( arguments ), i, res = [], v;

@@ -73,9 +73,2 @@ typeof m8 !== 'undefined' || ( m8 = require( 'm8' ) );

test( 'find', function( done ) {
expect( [1, 2, 3, 4, 5].find( function( v ) { return v == 3; } ) ).to.deep.equal( 3 );
expect( [1, 2, 3, 4, 5].find( function( v ) { return v == 6; } ) ).to.equal( null );
done();
} );
test( 'flatten', function( done ) {

@@ -124,8 +117,2 @@ var a = [1, 2, 3, [4, 5, 6, [7, 8, 9, [10, 11, 12]]]];

test( 'invoke', function( done ) {
expect( [1, 2, 3, 4, 5].invoke( 'pad', 3 ) ).to.deep.equal( ['001', '002', '003', '004', '005'] );
done();
} );
test( 'invokec', function( done ) {

@@ -165,25 +152,2 @@ expect( [

test( 'pluck', function( done ) {
expect( [
{ 'one' : 1, 'two' : 2, 'three' : 3 },
{ 'one' : 1, 'two' : 2, 'three' : 3 },
{ 'one' : 1, 'two' : 2, 'three' : 3 }
].pluck( 'one' ) ).to.deep.equal( [1, 1, 1] );
expect( [
{ 'one' : 1, 'two' : 2, 'three' : 3 },
{ 'one' : undefined, 'two' : 2, 'three' : 3 },
{ 'one' : 1, 'two' : 2, 'three' : 3 },
{ 'one' : null, 'two' : 2, 'three' : 3 },
{ 'one' : 1, 'two' : 2, 'three' : 3 }
].pluck( 'one', true ) ).to.deep.equal( [1, 1, 1] );
expect( m8.range( 1, 10 ).map( function( o, i ) {
return { src : { val : i } };
} ).pluck( 'src.val' ) ).to.deep.equal( m8.range( 0, 9 ) );
expect( m8.range( 1, 10 ).map( function( o, i ) {
return { src : { val : i % 2 ? i : null } };
} ).pluck( 'src.val', true ) ).to.deep.equal( [1, 3, 5, 7, 9] );
done();
} );
test( 'remove', function( done ) {

@@ -190,0 +154,0 @@ var a = m8.range( 0, 9 );

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