Comparing version 0.11.0-beta.5 to 0.11.0-beta.6
@@ -13,2 +13,5 @@ # Changelog | ||
- e.g: `map(negate, factors(-36)) // => [-1, -2, -3, -4, -6, -9, -12, -18, -36]` | ||
- `empty` (and `isEmpty` until its removed) will now throw a type error for unsupported types | ||
- `empty` supports the same types as `count` as well as `null` and `undefined` | ||
- e.g: `empty(1) // => TypeError: Unsupported type: Number` | ||
@@ -35,5 +38,8 @@ ### Deprecated | ||
- Added `reduced` Function which should be used with `reduce` or `reduceRight` as a short circuit for the function (see improved) | ||
- `has` is now generic for `Array`, `String`, `Object`, `Map`, and `Set` data types | ||
- Added `within` Function which acts like `between` but is exclusive of the numbers provided | ||
### Improved | ||
- `empty` now supports `Maps` and `Sets` | ||
- Slight increase in `partition` performance | ||
@@ -52,2 +58,3 @@ - Slight increase in `omit` performance | ||
- Moved `every`, `some`, `reject`, `filter`, and `find` to use this new flow giving them decent performance improvements | ||
- Tweaked `height` function for a tiny performance boost | ||
@@ -54,0 +61,0 @@ ## v0.10.3 |
@@ -81,7 +81,7 @@ (function (global, factory) { | ||
var countBy = function countBy(fn, arr) { | ||
return arr.reduce(function (acc, a) { | ||
return reduce$1(function (a, acc) { | ||
var k = fn(a); | ||
var _an = _assocǃ$1(acc, k); | ||
return acc.hasOwnProperty(k) ? _an(acc[k] + 1) : _an(1); | ||
}, {}); | ||
}, {}, arr); | ||
}; | ||
@@ -95,13 +95,8 @@ var countBy$1 = _curry2(countBy); | ||
var has = function has(prop, obj) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
}; | ||
var has$1 = _curry2(has); | ||
var groupBy = function groupBy(fn, list) { | ||
return list.reduce(function (acc, v) { | ||
return reduce$1(function (v, acc) { | ||
var k = fn(v); | ||
var _an = _assocǃ$1(acc, k); | ||
return has$1(k, acc) ? _an(_appendǃ(acc[k], v)) : _an([v]); | ||
}, {}); | ||
return acc.hasOwnProperty(k) ? _an(_appendǃ(acc[k], v)) : _an([v]); | ||
}, {}, list); | ||
}; | ||
@@ -124,8 +119,15 @@ var groupBy$1 = _curry2(groupBy); | ||
var filter = function filter(fn, arr) { | ||
return reduce$1(function (val, acc) { | ||
return fn(val) ? _appendǃ(acc, val) : acc; | ||
}, [], arr); | ||
}; | ||
var filter$1 = _curry2(filter); | ||
var difference = function difference(arrs) { | ||
var arr = concatMap$1(uniq, arrs); | ||
var grouped = groupBy$1(identity, arr); | ||
return arr.filter(function (x) { | ||
return filter$1(function (x) { | ||
return grouped[x].length === 1; | ||
}); | ||
}, arr); | ||
}; | ||
@@ -174,9 +176,2 @@ | ||
var filter = function filter(fn, arr) { | ||
return reduce$1(function (val, acc) { | ||
return fn(val) ? _appendǃ(acc, val) : acc; | ||
}, [], arr); | ||
}; | ||
var filter$1 = _curry2(filter); | ||
var find = function find(fn, arr) { | ||
@@ -202,2 +197,24 @@ return reduce$1(function (val, acc) { | ||
var type = function type(x) { | ||
return Object.prototype.toString.call(x).slice(8, -1); | ||
}; | ||
var has = function has(key, data) { | ||
var t = type(data); | ||
switch (t) { | ||
case 'Array': | ||
case 'String': | ||
return data.includes(key); | ||
case 'Object': | ||
case 'Arguments': | ||
return data.hasOwnProperty(key); | ||
case 'Map': | ||
case 'Set': | ||
return data.has(key); | ||
default: | ||
throw new TypeError("Unsupported type: ".concat(t)); | ||
} | ||
}; | ||
var has$1 = _curry2(has); | ||
var intersection = function intersection(a, b) { | ||
@@ -522,6 +539,2 @@ var grouped = groupBy$1(identity, b); | ||
var height = function height(obj) { | ||
return Object.values(obj).length; | ||
}; | ||
var length = function length(a) { | ||
@@ -531,24 +544,18 @@ return a.length; | ||
var size = function size(x) { | ||
return x.size; | ||
}; | ||
var height = compose$1(length, Object.values); | ||
var type = function type(x) { | ||
return Object.prototype.toString.call(x).slice(8, -1); | ||
}; | ||
var count = function count(a) { | ||
var match = { | ||
Array: length, | ||
String: length, | ||
Object: height, | ||
Map: size, | ||
Set: size | ||
}; | ||
var key = type(a); | ||
var fn = match[key]; | ||
if (fn) { | ||
return fn(a); | ||
switch (key) { | ||
case 'Array': | ||
case 'String': | ||
return a.length; | ||
case 'Object': | ||
return height(a); | ||
case 'Map': | ||
case 'Set': | ||
return a.size; | ||
default: | ||
throw new TypeError("Unsupported type: ".concat(key)); | ||
} | ||
throw new TypeError("Unexpected type given to count: ".concat(key)); | ||
}; | ||
@@ -707,3 +714,3 @@ | ||
var key = keysA[_i]; | ||
if (!(has$1(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { | ||
if (!(Object.prototype.hasOwnProperty.call(b, key) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { | ||
return false; | ||
@@ -741,3 +748,3 @@ } | ||
var empty = function empty(x) { | ||
return nil(x) || !Object.keys(x).length; | ||
return nil(x) || !count(x); | ||
}; | ||
@@ -819,2 +826,6 @@ | ||
var size = function size(x) { | ||
return x.size; | ||
}; | ||
var unless = function unless(fn, act, x) { | ||
@@ -986,2 +997,7 @@ return fn(x) ? x : act(x); | ||
var within = function within(min, max, n) { | ||
return min < n && max > n; | ||
}; | ||
var within$1 = _curry3(within); | ||
var zero = eq$1(0); | ||
@@ -1161,4 +1177,4 @@ | ||
exports.reduce = reduce$1; | ||
exports.reduced = reduced; | ||
exports.reduceRight = reduceRight$1; | ||
exports.reduced = reduced; | ||
exports.reject = reject$1; | ||
@@ -1203,2 +1219,3 @@ exports.remove = remove$1; | ||
exports.gte = gte$1; | ||
exports.has = has$1; | ||
exports.identity = identity; | ||
@@ -1252,2 +1269,3 @@ exports.isEmpty = isEmpty; | ||
exports.subtract = subtract$1; | ||
exports.within = within$1; | ||
exports.zero = zero; | ||
@@ -1257,3 +1275,2 @@ exports.amend = amend$1; | ||
exports.draft = draft$1; | ||
exports.has = has$1; | ||
exports.height = height; | ||
@@ -1260,0 +1277,0 @@ exports.omit = omit$1; |
@@ -1,1 +0,1 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.kyanite={})}(this,function(n){"use strict";function r(n){return function r(t,e){return arguments.length?1===arguments.length?function(r){return n(t,r)}:n(t,e):r}}var t=r(function(n,r){return r.concat(n)});function e(n){return function t(e,u,c){switch(arguments.length){case 0:return t;case 1:return r(function(r,t){return n(e,r,t)});case 2:return function(r){return n(e,u,r)};default:return n(e,u,c)}}}var u=function(n){return{"@@transducer/result":function(n){return n},"@@transducer/step":n}},c=e(function(n,r,t){for(var e=u(n),c=0,o=t.length;c<o;c++)if((r=e["@@transducer/step"](t[c],r))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}return e["@@transducer/result"](r)}),o=r(function(n,r){return c(function(r,e){return t(n(r),e)},[],r)}),i=e(function(n,r,t){return n[r]=t,n}),f=r(function(n,r){return r.reduce(function(r,t){var e=n(t),u=i(r,e);return r.hasOwnProperty(e)?u(r[e]+1):u(1)},{})}),a=function(n,r){return n.push(r),n},s=r(function(n,r){return Object.prototype.hasOwnProperty.call(r,n)}),l=r(function(n,r){return r.reduce(function(r,t){var e=n(t),u=i(r,e);return s(e,r)?u(a(r[e],t)):u([t])},{})}),d=function(n){return n},p=r(function(n,r){return Object.values(r.reduce(function(r,t){var e=n(t);return r.hasOwnProperty(e)?r:i(r,e,t)},{}))}),y=p(d),h=r(function(n,r){return r.slice(n,1/0)}),v=r(function(n,r){var t=r.findIndex(function(r){return!n(r)});return t<0?[]:r.slice(t)}),g=function(n){return null==n},m=function(n){return n&&n["@@transducer/reduced"]?n:{"@@transducer/value":n,"@@transducer/reduced":!0}},b=r(function(n,r){return c(function(r,t){return n(r)?t:m(!1)},!0,r)}),A=r(function(n,r){return c(function(r,t){return n(r)?a(t,r):t},[],r)}),O=r(function(n,r){return c(function(r,t){return n(r)?m(r):t},null,r)}),w=r(function(n,r){return r.findIndex(n)}),j=e(function(n,r,t){var e=n<t.length&&n>=0?n:t.length,u=t.slice(0);return u.splice(e,0,r),u}),k=r(function(n,r){var t=l(d,r);return y(n.filter(function(n){return s(n,t)}))}),x=r(function(n,r){for(var t=r.length,e=Array(t),u=0;u<t;u++)i(e,u,n(r[u]));return e}),S=r(function(n,r){return r.reduce(function(r,t){return n(r)>=n(t)?r:t})}),N=r(function(n,r){return r.reduce(function(r,t){return n(r)<=n(t)?r:t})});function B(n){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function z(n,r){return P(n)||function(n,r){var t=[],e=!0,u=!1,c=void 0;try{for(var o,i=n[Symbol.iterator]();!(e=(o=i.next()).done)&&(t.push(o.value),!r||t.length!==r);e=!0);}catch(n){u=!0,c=n}finally{try{e||null==i.return||i.return()}finally{if(u)throw c}}return t}(n,r)||I()}function E(n){return function(n){if(Array.isArray(n)){for(var r=0,t=new Array(n.length);r<n.length;r++)t[r]=n[r];return t}}(n)||M(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function P(n){if(Array.isArray(n))return n}function M(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function I(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var C=r(function(n,r){return c(function(r,t){var e=z(t,2),u=e[0],c=e[1];return n(r)?[a(u,r),c]:[u,a(c,r)]},[[],[]],r)}),U=r(function(n,r){return[].concat(n,r)}),q=e(function(n,r,t){for(var e=u(n),c=t.length-1;c>=0;c--)if((r=e["@@transducer/step"](t[c],r))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}return e["@@transducer/result"](r)}),T=function(n){return!n},W=r(function(n,r){return T(n(r))}),R=r(function(n,r){return A(W(n),r)}),D=r(function(n,r){return o(d,[r.slice(0,n),r.slice(n+1)])}),F=r(function(n,r){return c(function(r,t){return n(r)?m(!0):t},!1,r)}),L=r(function(n,r){return r.slice().sort(n)}),_=r(function(n,r){return n<r?-1:n>r?1:0});function G(n){return function t(u,c,o,i){switch(arguments.length){case 0:return t;case 1:return e(function(r,t,e){return n(u,r,t,e)});case 2:return r(function(r,t){return n(u,c,r,t)});case 3:return function(r){return n(u,c,o,r)};default:return n(u,c,o,i)}}}var H=G(function(n,r,t,e){return n(r(t),r(e))}),J=r(function(n,r){return L(H(_,n),r)}),K=r(function(n,r){return E(r).sort(function(r,t){return n.reduce(function(n,e){return 0===n?e(r,t):n},0)})}),Q=r(function(n,r){return r.slice(0,n)}),V=r(function(n,r){var t=r.findIndex(function(r){return!n(r)});return t<0?r:r.slice(0,t)}),X=r(function(n,r){return y(n.concat(r))}),Y=e(function(n,r,t){return o(d,[t.slice(0,n),r,t.slice(n+1)])}),Z=r(function(n,r){return(n.length<r.length?n:r).reduce(function(t,e,u){return i(t,n[u],r[u])},{})}),$=r(function(n,r){return n}),nn=r(function(n,r){return n&&r}),rn=r(function(n,r){return c(function(n,e){return t(x(n,r),e)},[],n)}),tn=r(function(n,r){return n.apply(void 0,E(r))}),en=e(function(n,r,t){return _(n(r),n(t))}),un=e(function(n,r,t){return n(t)&&r(t)}),cn=G(function(n,r,t,e){return n(e)?r(e):t(e)}),on=e(function(n,r,t){return n(r(t))}),fn=e(function(n,r,t){return r(t).then(n)}),an=function(n){return Object.values(n).length},sn=function(n){return n.length},ln=function(n){return n.size},dn=function(n){return Object.prototype.toString.call(n).slice(8,-1)},pn=r(function(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}),yn=function(n,r,t){for(var e=0,u=t.length;e<u;e++)if(n(r,t[e]))return!0;return!1},hn=function(n){for(var r=[],t=null;!(t=n.next()).done;)r.push(t.value);return r};function vn(n,r,t,e){var u=hn(n),c=hn(r);function o(n,r){return gn(n,r,t.slice(),e.slice())}return!yn(function(n,r){return!yn(o,r,n)},c,u)}var gn=function n(r,t,e,u){if(pn(r,t))return!0;var c,o,i=dn(r);if(i!==dn(t)||null==r||null==t)return!1;switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof r.constructor&&"Promise"===(c=r.constructor,null==(o=String(c).match(/^function (\w*)/))?"":o[1]))return r===t;break;case"Boolean":case"Number":case"String":if(B(r)!==B(t)||!pn(r.valueOf(),t.valueOf()))return!1;break;case"Date":if(!pn(r.valueOf(),t.valueOf()))return!1;break;case"Error":return r.name===t.name&&r.message===t.message;case"RegExp":if(r.source!==t.source||r.global!==t.global||r.ignoreCase!==t.ignoreCase||r.multiline!==t.multiline||r.sticky!==t.sticky||r.unicode!==t.unicode)return!1}for(var f=e.length-1;f>=0;f--)if(e[f]===r)return u[f]===t;switch(i){case"Map":return r.size===t.size&&vn(r.entries(),t.entries(),e.concat([r]),u.concat([t]));case"Set":return r.size===t.size&&vn(r.values(),t.values(),e.concat([r]),u.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=Object.keys(r);if(a.length!==Object.values(t).length)return!1;for(var l=e.concat([r]),d=u.concat([t]),p=a.length-1;p>=0;p--){var y=a[p];if(!s(y,t)||!n(t[y],r[y],l,d))return!1}return!0},mn=r(function(n,r){return gn(n,r,[],[])}),bn=r(function(n,r){return g(r)||pn(NaN,r)?n:r}),An=r(function(n,r){return n>r?-1:n<r?1:0}),On=e(function(n,r,t){return An(n(r),n(t))}),wn=e(function(n,r,t){return n(t)||r(t)}),jn=function(n){return g(n)||!Object.keys(n).length},kn=r(function(n,r){try{return n(r)}catch(n){return}}),xn=e(function(n,r,t){return pn(n(r),n(t))}),Sn=e(function(n,r,t){return n(t,r)}),Nn=r(function(n,r){return r>n}),Bn=r(function(n,r){return r>=n}),zn=jn,En=g,Pn=r(function(n,r){return r<n}),Mn=r(function(n,r){return r<=n}),In=r(function(n,r){return n||r}),Cn=r(function(n,r){return n.reduce(function(n,r){return r(n)},r)}),Un=r(function(n,r){return n.reduce(function(n,r){return n.then(r)},Promise.resolve(r))}),qn=e(function(n,r,t){return n(t)?t:r(t)}),Tn=e(function(n,r,t){return n(t)?r(t):t}),Wn=e(function(n,r,t){return t.slice(n,r)}),Rn=r(function(n,r){return on(mn(n),Wn(-n.length,1/0),r)}),Dn=r(function(n,r){return-1!==r.indexOf(n)}),Fn=r(function(n,r){return r[n<0?r.length+n:n]}),Ln=r(function(n,r){return n+r}),_n=e(function(n,r,t){return n<=t&&r>=t}),Gn=e(function(n,r,t){if(n>r)throw new Error("Min cannot be greater than max in clamp");return t>n&&t<r?t:t<=n?n:r}),Hn=r(function(n,r){return r/n}),Jn=function(n){return nn(!pn(n,NaN),pn(n%2,0))},Kn=function(n){return-n},Qn=r(function(n,r){for(var t=[],e=Number(n),u=Number(r);e<u;e++)t.push(e);return t}),Vn=r(function(n,r){return r%n}),Xn=r(function n(r,t){return t?n(t,r%t):r}),Yn=Jn,Zn=function(n){if(!pn(n,NaN)){var r=pn(n%2);return!r(NaN)&&!r(0)}return!1},$n=Zn,nr=function(n){for(var r=Math.sqrt(n),t=2;t<=r;t++)if(!Vn(t,n))return!1;return n&&1!==n},rr=nr,tr=r(function(n,r){return Math.abs(Math.floor(n/Xn(n,r)*r))}),er=r(function(n,r){return n*r}),ur=r(function(n,r){return Math.pow(r,n)}),cr=r(function(n,r){return Number("".concat(Math.round("".concat(r,"e").concat(n)),"e-").concat(n))}),or=r(function(n,r){return r-n}),ir=pn(0),fr=r(function(n,r){return Object.assign({},r,n)}),ar=r(function(n,r){return Object.keys(n).some(function(t){return n[t](r[t])})}),sr=r(function(n,r){return Object.keys(r).reduce(function(t,e){return i(t,e,n(r[e]))},{})}),lr=r(function(n,r){return c(function(t,e){return T(Dn(t,n))?i(e,t,r[t]):e},{},Object.keys(r))}),dr=e(function(n,r,t){return Object.assign({},t,function(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}({},n,r(t[n])))}),pr=r(function n(r,t){var e,u=P(e=r)||M(e)||I(),c=u[0],o=u.slice(1);return o.length?g(t[c])?void 0:n(o,t[c]):t[c]}),yr=e(function(n,r,t){var e=pr(r,t);return g(e)?n:e}),hr=r(function(n,r){return Object.assign({},r,Object.keys(n).reduce(function(t,e){return r.hasOwnProperty(e)?i(t,e,n[e](r[e])):t},{}))}),vr=r(function(n,r){return r[n]}),gr=r(function(n,r){return x(function(n){return r[n]},n)}),mr=r(function(n,r){return Object.keys(r).reduce(function(t,e){return n(r[e])?i(t,e,r[e]):t},{})}),br=r(function(n,r){return Object.keys(n).every(function(t){return n[t](r[t])})}),Ar=r(function(n,r){var t=r.length,e=n.length,u=0;if(e>t)return!1;if(e===t)return n===r;n:for(var c=0;c<e;c++){for(var o=n.charCodeAt(c);u<t;u++)if(r.charCodeAt(u)===o)continue n;return!1}return!0}),Or=r(function(n,r){return r.join(n)}),wr=r(function(n,r){return r.match(n)}),jr=e(function(n,r,t){return t.replace(n,r)}),kr=r(function(n,r){return r.split(n)}),xr=r(function(n,r){return n.test(r)});n.concatMap=o,n.countBy=f,n.difference=function(n){var r=o(y,n),t=l(d,r);return r.filter(function(n){return 1===t[n].length})},n.drop=h,n.dropWhile=v,n.ensureArray=function(n){return Array.isArray(n)?n:g(n)?[]:[n]},n.every=b,n.filter=A,n.find=O,n.findIndex=w,n.groupBy=l,n.insert=j,n.intersection=k,n.map=x,n.max=function(n){return n.reduce(function(n,r){return n>=r?n:r})},n.maxBy=S,n.min=function(n){return n.reduce(function(n,r){return n<=r?n:r})},n.minBy=N,n.partition=C,n.prepend=U,n.reduce=c,n.reduceRight=q,n.reduced=m,n.reject=R,n.remove=D,n.some=F,n.sort=L,n.sortBy=J,n.sortWith=K,n.take=Q,n.takeWhile=V,n.union=X,n.uniq=y,n.uniqBy=p,n.update=Y,n.zip=Z,n.always=$,n.and=nn,n.ap=rn,n.apply=tn,n.ascend=_,n.ascendBy=en,n.both=un,n.branch=cn,n.complement=W,n.compose=on,n.composeP=fn,n.count=function(n){var r={Array:sn,String:sn,Object:an,Map:ln,Set:ln},t=dn(n),e=r[t];if(e)return e(n);throw new TypeError("Unexpected type given to count: ".concat(t))},n.curry=function n(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),u=1;u<t;u++)e[u-1]=arguments[u];return r.length<=e.length?r.apply(void 0,e):function(){for(var t=arguments.length,u=new Array(t),c=0;c<t;c++)u[c]=arguments[c];return n.apply(void 0,[r].concat(e,u))}},n.curryN=function n(r,t){for(var e=arguments.length,u=new Array(e>2?e-2:0),c=2;c<e;c++)u[c-2]=arguments[c];return r<=0?t.apply(void 0,u):function(){for(var e=arguments.length,c=new Array(e),o=0;o<e;o++)c[o]=arguments[o];return n.apply(void 0,[r-c.length,t].concat(u,c))}},n.deepEq=mn,n.defaultTo=bn,n.descend=An,n.descendBy=On,n.either=wn,n.empty=jn,n.encase=kn,n.eq=pn,n.eqBy=xn,n.flip=Sn,n.gt=Nn,n.gte=Bn,n.identity=d,n.isEmpty=zn,n.isNil=En,n.juxt=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return x(function(n){return n.apply(void 0,t)},n)}},n.lt=Pn,n.lte=Mn,n.nil=g,n.not=T,n.on=H,n.or=In,n.pipe=Cn,n.pipeP=Un,n.size=ln,n.type=dn,n.unless=qn,n.when=Tn,n.concat=t,n.endsWith=Rn,n.first=function(n){return n[0]},n.includes=Dn,n.last=function(n){return n[n.length-1]},n.length=sn,n.nth=Fn,n.reverse=function(n){return Array.isArray(n)?n.slice().reverse():n.split("").reverse().join("")},n.slice=Wn,n.add=Ln,n.between=_n,n.clamp=Gn,n.dec=function(n){return n-1},n.divide=Hn,n.even=Jn,n.factors=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=n<0?Kn(n):n;return n?E(on(A(function(n){return 0===Vn(n,r)}),Qn(0),r)).concat([r]):[]},n.gcd=Xn,n.inc=function(n){return n+1},n.isEven=Yn,n.isOdd=$n,n.isPrime=rr,n.lcm=tr,n.mean=function(n){return Hn(sn(n),c(Ln,0,n))},n.multiply=er,n.negate=Kn,n.odd=Zn,n.pow=ur,n.prime=nr,n.range=Qn,n.rem=Vn,n.round=cr,n.subtract=or,n.zero=ir,n.amend=fr,n.any=ar,n.draft=sr,n.has=s,n.height=an,n.omit=lr,n.over=dr,n.path=pr,n.pathOr=yr,n.plan=hr,n.prop=vr,n.props=gr,n.sift=mr,n.whole=br,n.capitalize=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},n.fuzzySearch=Ar,n.join=Or,n.match=wr,n.replace=jr,n.split=kr,n.test=xr,n.toLower=function(n){return n.toLowerCase()},n.toUpper=function(n){return n.toUpperCase()},n.trim=function(n){return n.trim()},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.kyanite={})}(this,function(n){"use strict";function r(n){return function r(t,e){return arguments.length?1===arguments.length?function(r){return n(t,r)}:n(t,e):r}}var t=r(function(n,r){return r.concat(n)});function e(n){return function t(e,u,c){switch(arguments.length){case 0:return t;case 1:return r(function(r,t){return n(e,r,t)});case 2:return function(r){return n(e,u,r)};default:return n(e,u,c)}}}var u=function(n){return{"@@transducer/result":function(n){return n},"@@transducer/step":n}},c=e(function(n,r,t){for(var e=u(n),c=0,o=t.length;c<o;c++)if((r=e["@@transducer/step"](t[c],r))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}return e["@@transducer/result"](r)}),o=r(function(n,r){return c(function(r,e){return t(n(r),e)},[],r)}),i=e(function(n,r,t){return n[r]=t,n}),a=r(function(n,r){return c(function(r,t){var e=n(r),u=i(t,e);return t.hasOwnProperty(e)?u(t[e]+1):u(1)},{},r)}),f=function(n,r){return n.push(r),n},s=r(function(n,r){return c(function(r,t){var e=n(r),u=i(t,e);return t.hasOwnProperty(e)?u(f(t[e],r)):u([r])},{},r)}),l=function(n){return n},d=r(function(n,r){return Object.values(r.reduce(function(r,t){var e=n(t);return r.hasOwnProperty(e)?r:i(r,e,t)},{}))}),p=d(l),y=r(function(n,r){return c(function(r,t){return n(r)?f(t,r):t},[],r)}),h=r(function(n,r){return r.slice(n,1/0)}),v=r(function(n,r){var t=r.findIndex(function(r){return!n(r)});return t<0?[]:r.slice(t)}),g=function(n){return null==n},m=function(n){return n&&n["@@transducer/reduced"]?n:{"@@transducer/value":n,"@@transducer/reduced":!0}},b=r(function(n,r){return c(function(r,t){return n(r)?t:m(!1)},!0,r)}),w=r(function(n,r){return c(function(r,t){return n(r)?m(r):t},null,r)}),A=r(function(n,r){return r.findIndex(n)}),O=e(function(n,r,t){var e=n<t.length&&n>=0?n:t.length,u=t.slice(0);return u.splice(e,0,r),u}),j=function(n){return Object.prototype.toString.call(n).slice(8,-1)},k=r(function(n,r){var t=j(r);switch(t){case"Array":case"String":return r.includes(n);case"Object":case"Arguments":return r.hasOwnProperty(n);case"Map":case"Set":return r.has(n);default:throw new TypeError("Unsupported type: ".concat(t))}}),S=r(function(n,r){var t=s(l,r);return p(n.filter(function(n){return k(n,t)}))}),x=r(function(n,r){for(var t=r.length,e=Array(t),u=0;u<t;u++)i(e,u,n(r[u]));return e}),N=r(function(n,r){return r.reduce(function(r,t){return n(r)>=n(t)?r:t})}),P=r(function(n,r){return r.reduce(function(r,t){return n(r)<=n(t)?r:t})});function z(n){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function B(n,r){return M(n)||function(n,r){var t=[],e=!0,u=!1,c=void 0;try{for(var o,i=n[Symbol.iterator]();!(e=(o=i.next()).done)&&(t.push(o.value),!r||t.length!==r);e=!0);}catch(n){u=!0,c=n}finally{try{e||null==i.return||i.return()}finally{if(u)throw c}}return t}(n,r)||U()}function E(n){return function(n){if(Array.isArray(n)){for(var r=0,t=new Array(n.length);r<n.length;r++)t[r]=n[r];return t}}(n)||I(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function M(n){if(Array.isArray(n))return n}function I(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function U(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}var C=r(function(n,r){return c(function(r,t){var e=B(t,2),u=e[0],c=e[1];return n(r)?[f(u,r),c]:[u,f(c,r)]},[[],[]],r)}),q=r(function(n,r){return[].concat(n,r)}),T=e(function(n,r,t){for(var e=u(n),c=t.length-1;c>=0;c--)if((r=e["@@transducer/step"](t[c],r))&&r["@@transducer/reduced"]){r=r["@@transducer/value"];break}return e["@@transducer/result"](r)}),W=function(n){return!n},R=r(function(n,r){return W(n(r))}),D=r(function(n,r){return y(R(n),r)}),F=r(function(n,r){return o(l,[r.slice(0,n),r.slice(n+1)])}),L=r(function(n,r){return c(function(r,t){return n(r)?m(!0):t},!1,r)}),_=r(function(n,r){return r.slice().sort(n)}),G=r(function(n,r){return n<r?-1:n>r?1:0});function H(n){return function t(u,c,o,i){switch(arguments.length){case 0:return t;case 1:return e(function(r,t,e){return n(u,r,t,e)});case 2:return r(function(r,t){return n(u,c,r,t)});case 3:return function(r){return n(u,c,o,r)};default:return n(u,c,o,i)}}}var J=H(function(n,r,t,e){return n(r(t),r(e))}),K=r(function(n,r){return _(J(G,n),r)}),Q=r(function(n,r){return E(r).sort(function(r,t){return n.reduce(function(n,e){return 0===n?e(r,t):n},0)})}),V=r(function(n,r){return r.slice(0,n)}),X=r(function(n,r){var t=r.findIndex(function(r){return!n(r)});return t<0?r:r.slice(0,t)}),Y=r(function(n,r){return p(n.concat(r))}),Z=e(function(n,r,t){return o(l,[t.slice(0,n),r,t.slice(n+1)])}),$=r(function(n,r){return(n.length<r.length?n:r).reduce(function(t,e,u){return i(t,n[u],r[u])},{})}),nn=r(function(n,r){return n}),rn=r(function(n,r){return n&&r}),tn=r(function(n,r){return c(function(n,e){return t(x(n,r),e)},[],n)}),en=r(function(n,r){return n.apply(void 0,E(r))}),un=e(function(n,r,t){return G(n(r),n(t))}),cn=e(function(n,r,t){return n(t)&&r(t)}),on=H(function(n,r,t,e){return n(e)?r(e):t(e)}),an=e(function(n,r,t){return n(r(t))}),fn=e(function(n,r,t){return r(t).then(n)}),sn=function(n){return n.length},ln=an(sn,Object.values),dn=function(n){var r=j(n);switch(r){case"Array":case"String":return n.length;case"Object":return ln(n);case"Map":case"Set":return n.size;default:throw new TypeError("Unsupported type: ".concat(r))}},pn=r(function(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}),yn=function(n,r,t){for(var e=0,u=t.length;e<u;e++)if(n(r,t[e]))return!0;return!1},hn=function(n){for(var r=[],t=null;!(t=n.next()).done;)r.push(t.value);return r};function vn(n,r,t,e){var u=hn(n),c=hn(r);function o(n,r){return gn(n,r,t.slice(),e.slice())}return!yn(function(n,r){return!yn(o,r,n)},c,u)}var gn=function n(r,t,e,u){if(pn(r,t))return!0;var c,o,i=j(r);if(i!==j(t)||null==r||null==t)return!1;switch(i){case"Arguments":case"Array":case"Object":if("function"==typeof r.constructor&&"Promise"===(c=r.constructor,null==(o=String(c).match(/^function (\w*)/))?"":o[1]))return r===t;break;case"Boolean":case"Number":case"String":if(z(r)!==z(t)||!pn(r.valueOf(),t.valueOf()))return!1;break;case"Date":if(!pn(r.valueOf(),t.valueOf()))return!1;break;case"Error":return r.name===t.name&&r.message===t.message;case"RegExp":if(r.source!==t.source||r.global!==t.global||r.ignoreCase!==t.ignoreCase||r.multiline!==t.multiline||r.sticky!==t.sticky||r.unicode!==t.unicode)return!1}for(var a=e.length-1;a>=0;a--)if(e[a]===r)return u[a]===t;switch(i){case"Map":return r.size===t.size&&vn(r.entries(),t.entries(),e.concat([r]),u.concat([t]));case"Set":return r.size===t.size&&vn(r.values(),t.values(),e.concat([r]),u.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var f=Object.keys(r);if(f.length!==Object.values(t).length)return!1;for(var s=e.concat([r]),l=u.concat([t]),d=f.length-1;d>=0;d--){var p=f[d];if(!Object.prototype.hasOwnProperty.call(t,p)||!n(t[p],r[p],s,l))return!1}return!0},mn=r(function(n,r){return gn(n,r,[],[])}),bn=r(function(n,r){return g(r)||pn(NaN,r)?n:r}),wn=r(function(n,r){return n>r?-1:n<r?1:0}),An=e(function(n,r,t){return wn(n(r),n(t))}),On=e(function(n,r,t){return n(t)||r(t)}),jn=function(n){return g(n)||!dn(n)},kn=r(function(n,r){try{return n(r)}catch(n){return}}),Sn=e(function(n,r,t){return pn(n(r),n(t))}),xn=e(function(n,r,t){return n(t,r)}),Nn=r(function(n,r){return r>n}),Pn=r(function(n,r){return r>=n}),zn=jn,Bn=g,En=r(function(n,r){return r<n}),Mn=r(function(n,r){return r<=n}),In=r(function(n,r){return n||r}),Un=r(function(n,r){return n.reduce(function(n,r){return r(n)},r)}),Cn=r(function(n,r){return n.reduce(function(n,r){return n.then(r)},Promise.resolve(r))}),qn=e(function(n,r,t){return n(t)?t:r(t)}),Tn=e(function(n,r,t){return n(t)?r(t):t}),Wn=e(function(n,r,t){return t.slice(n,r)}),Rn=r(function(n,r){return an(mn(n),Wn(-n.length,1/0),r)}),Dn=r(function(n,r){return-1!==r.indexOf(n)}),Fn=r(function(n,r){return r[n<0?r.length+n:n]}),Ln=r(function(n,r){return n+r}),_n=e(function(n,r,t){return n<=t&&r>=t}),Gn=e(function(n,r,t){if(n>r)throw new Error("Min cannot be greater than max in clamp");return t>n&&t<r?t:t<=n?n:r}),Hn=r(function(n,r){return r/n}),Jn=function(n){return rn(!pn(n,NaN),pn(n%2,0))},Kn=function(n){return-n},Qn=r(function(n,r){for(var t=[],e=Number(n),u=Number(r);e<u;e++)t.push(e);return t}),Vn=r(function(n,r){return r%n}),Xn=r(function n(r,t){return t?n(t,r%t):r}),Yn=Jn,Zn=function(n){if(!pn(n,NaN)){var r=pn(n%2);return!r(NaN)&&!r(0)}return!1},$n=Zn,nr=function(n){for(var r=Math.sqrt(n),t=2;t<=r;t++)if(!Vn(t,n))return!1;return n&&1!==n},rr=nr,tr=r(function(n,r){return Math.abs(Math.floor(n/Xn(n,r)*r))}),er=r(function(n,r){return n*r}),ur=r(function(n,r){return Math.pow(r,n)}),cr=r(function(n,r){return Number("".concat(Math.round("".concat(r,"e").concat(n)),"e-").concat(n))}),or=r(function(n,r){return r-n}),ir=e(function(n,r,t){return n<t&&r>t}),ar=pn(0),fr=r(function(n,r){return Object.assign({},r,n)}),sr=r(function(n,r){return Object.keys(n).some(function(t){return n[t](r[t])})}),lr=r(function(n,r){return Object.keys(r).reduce(function(t,e){return i(t,e,n(r[e]))},{})}),dr=r(function(n,r){return c(function(t,e){return W(Dn(t,n))?i(e,t,r[t]):e},{},Object.keys(r))}),pr=e(function(n,r,t){return Object.assign({},t,function(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}({},n,r(t[n])))}),yr=r(function n(r,t){var e,u=M(e=r)||I(e)||U(),c=u[0],o=u.slice(1);return o.length?g(t[c])?void 0:n(o,t[c]):t[c]}),hr=e(function(n,r,t){var e=yr(r,t);return g(e)?n:e}),vr=r(function(n,r){return Object.assign({},r,Object.keys(n).reduce(function(t,e){return r.hasOwnProperty(e)?i(t,e,n[e](r[e])):t},{}))}),gr=r(function(n,r){return r[n]}),mr=r(function(n,r){return x(function(n){return r[n]},n)}),br=r(function(n,r){return Object.keys(r).reduce(function(t,e){return n(r[e])?i(t,e,r[e]):t},{})}),wr=r(function(n,r){return Object.keys(n).every(function(t){return n[t](r[t])})}),Ar=r(function(n,r){var t=r.length,e=n.length,u=0;if(e>t)return!1;if(e===t)return n===r;n:for(var c=0;c<e;c++){for(var o=n.charCodeAt(c);u<t;u++)if(r.charCodeAt(u)===o)continue n;return!1}return!0}),Or=r(function(n,r){return r.join(n)}),jr=r(function(n,r){return r.match(n)}),kr=e(function(n,r,t){return t.replace(n,r)}),Sr=r(function(n,r){return r.split(n)}),xr=r(function(n,r){return n.test(r)});n.concatMap=o,n.countBy=a,n.difference=function(n){var r=o(p,n),t=s(l,r);return y(function(n){return 1===t[n].length},r)},n.drop=h,n.dropWhile=v,n.ensureArray=function(n){return Array.isArray(n)?n:g(n)?[]:[n]},n.every=b,n.filter=y,n.find=w,n.findIndex=A,n.groupBy=s,n.insert=O,n.intersection=S,n.map=x,n.max=function(n){return n.reduce(function(n,r){return n>=r?n:r})},n.maxBy=N,n.min=function(n){return n.reduce(function(n,r){return n<=r?n:r})},n.minBy=P,n.partition=C,n.prepend=q,n.reduce=c,n.reduced=m,n.reduceRight=T,n.reject=D,n.remove=F,n.some=L,n.sort=_,n.sortBy=K,n.sortWith=Q,n.take=V,n.takeWhile=X,n.union=Y,n.uniq=p,n.uniqBy=d,n.update=Z,n.zip=$,n.always=nn,n.and=rn,n.ap=tn,n.apply=en,n.ascend=G,n.ascendBy=un,n.both=cn,n.branch=on,n.complement=R,n.compose=an,n.composeP=fn,n.count=dn,n.curry=function n(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),u=1;u<t;u++)e[u-1]=arguments[u];return r.length<=e.length?r.apply(void 0,e):function(){for(var t=arguments.length,u=new Array(t),c=0;c<t;c++)u[c]=arguments[c];return n.apply(void 0,[r].concat(e,u))}},n.curryN=function n(r,t){for(var e=arguments.length,u=new Array(e>2?e-2:0),c=2;c<e;c++)u[c-2]=arguments[c];return r<=0?t.apply(void 0,u):function(){for(var e=arguments.length,c=new Array(e),o=0;o<e;o++)c[o]=arguments[o];return n.apply(void 0,[r-c.length,t].concat(u,c))}},n.deepEq=mn,n.defaultTo=bn,n.descend=wn,n.descendBy=An,n.either=On,n.empty=jn,n.encase=kn,n.eq=pn,n.eqBy=Sn,n.flip=xn,n.gt=Nn,n.gte=Pn,n.has=k,n.identity=l,n.isEmpty=zn,n.isNil=Bn,n.juxt=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return x(function(n){return n.apply(void 0,t)},n)}},n.lt=En,n.lte=Mn,n.nil=g,n.not=W,n.on=J,n.or=In,n.pipe=Un,n.pipeP=Cn,n.size=function(n){return n.size},n.type=j,n.unless=qn,n.when=Tn,n.concat=t,n.endsWith=Rn,n.first=function(n){return n[0]},n.includes=Dn,n.last=function(n){return n[n.length-1]},n.length=sn,n.nth=Fn,n.reverse=function(n){return Array.isArray(n)?n.slice().reverse():n.split("").reverse().join("")},n.slice=Wn,n.add=Ln,n.between=_n,n.clamp=Gn,n.dec=function(n){return n-1},n.divide=Hn,n.even=Jn,n.factors=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=n<0?Kn(n):n;return n?E(an(y(function(n){return 0===Vn(n,r)}),Qn(0),r)).concat([r]):[]},n.gcd=Xn,n.inc=function(n){return n+1},n.isEven=Yn,n.isOdd=$n,n.isPrime=rr,n.lcm=tr,n.mean=function(n){return Hn(sn(n),c(Ln,0,n))},n.multiply=er,n.negate=Kn,n.odd=Zn,n.pow=ur,n.prime=nr,n.range=Qn,n.rem=Vn,n.round=cr,n.subtract=or,n.within=ir,n.zero=ar,n.amend=fr,n.any=sr,n.draft=lr,n.height=ln,n.omit=dr,n.over=pr,n.path=yr,n.pathOr=hr,n.plan=vr,n.prop=gr,n.props=mr,n.sift=br,n.whole=wr,n.capitalize=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},n.fuzzySearch=Ar,n.join=Or,n.match=jr,n.replace=kr,n.split=Sr,n.test=xr,n.toLower=function(n){return n.toLowerCase()},n.toUpper=function(n){return n.toUpperCase()},n.trim=function(n){return n.trim()},Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "kyanite", | ||
"version": "0.11.0-beta.5", | ||
"version": "0.11.0-beta.6", | ||
"description": "A small library of pure functional utilities to make life easier and data better", | ||
@@ -5,0 +5,0 @@ "main": "dist/kyanite.min.js", |
@@ -1,6 +0,6 @@ | ||
<h1 align=center> | ||
<div align=center> | ||
<a href="https://kyanite.dusty.codes/" title="Kyanite Documentation"> | ||
<img alt="Kyanite Logo" src="https://user-images.githubusercontent.com/8997380/48008308-69174500-e0e7-11e8-9a57-ebd558f094f8.png"> | ||
</a> | ||
</h1> | ||
</div> | ||
<br /> | ||
@@ -7,0 +7,0 @@ <p align=center> |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import _curry3 from './_curry3' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import _curry2 from './_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from './_curry2' |
@@ -1,2 +0,1 @@ | ||
import has from '../object/has' | ||
import type from '../function/type' | ||
@@ -149,3 +148,3 @@ import eq from '../function/eq' | ||
if (!(has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { | ||
if (!(Object.prototype.hasOwnProperty.call(b, key) && _equals(b[key], a[key], extendedStackA, extendedStackB))) { | ||
return false | ||
@@ -152,0 +151,0 @@ } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
import _curry2 from '../_internals/_curry2' | ||
import _assocǃ from '../_internals/_assocǃ' | ||
import reduce from './reduce' | ||
@@ -30,3 +31,3 @@ /** | ||
const countBy = (fn, arr) => | ||
arr.reduce((acc, a) => { | ||
reduce((a, acc) => { | ||
const k = fn(a) | ||
@@ -36,4 +37,4 @@ const _an = _assocǃ(acc, k) | ||
return acc.hasOwnProperty(k) ? _an(acc[k] + 1) : _an(1) | ||
}, {}) | ||
}, {}, arr) | ||
export default _curry2(countBy) |
@@ -5,2 +5,3 @@ import concatMap from './concatMap' | ||
import uniq from './uniq' | ||
import filter from './filter' | ||
@@ -27,5 +28,5 @@ /** | ||
return arr.filter(x => grouped[x].length === 1) | ||
return filter(x => grouped[x].length === 1, arr) | ||
} | ||
export default difference |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
import _curry2 from '../_internals/_curry2' | ||
import _appendǃ from '../_internals/_appendǃ' | ||
import _assocǃ from '../_internals/_assocǃ' | ||
import has from '../object/has' | ||
import reduce from './reduce' | ||
@@ -29,9 +29,9 @@ /** | ||
const groupBy = (fn, list) => | ||
list.reduce((acc, v) => { | ||
reduce((v, acc) => { | ||
const k = fn(v) | ||
const _an = _assocǃ(acc, k) | ||
return has(k, acc) ? _an(_appendǃ(acc[k], v)) : _an([v]) | ||
}, {}) | ||
return acc.hasOwnProperty(k) ? _an(_appendǃ(acc[k], v)) : _an([v]) | ||
}, {}, list) | ||
export default _curry2(groupBy) |
import _curry2 from '../_internals/_curry2' | ||
import groupBy from './groupBy' | ||
import has from '../object/has' | ||
import has from '../function/has' | ||
import identity from '../function/identity' | ||
@@ -5,0 +5,0 @@ import uniq from './uniq' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import ascend from '../function/ascend' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry4 from '../_internals/_curry4' |
@@ -18,6 +18,11 @@ import _curry2 from '../_internals/_curry2' | ||
* | ||
* const isNot = complement(is(String)) | ||
* complement(x => x > 10, 11) // => false | ||
* complement(x => x < 10, 11) // => true | ||
* | ||
* isNot(1) // => true | ||
* isNot('test') // => false | ||
* // It's also curried | ||
* | ||
* const notGtTen = complement(x => x > 10) | ||
* | ||
* notGtTen(11) // => false | ||
* notGtTen(10) // => true | ||
*/ | ||
@@ -24,0 +29,0 @@ const complement = (fn, a) => not(fn(a)) |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
import height from '../object/height' | ||
import length from '../list/length' | ||
import size from './size' | ||
import type from './type' | ||
@@ -30,19 +28,18 @@ | ||
const count = a => { | ||
const match = { | ||
Array: length, | ||
String: length, | ||
Object: height, | ||
Map: size, | ||
Set: size | ||
} | ||
const key = type(a) | ||
const fn = match[key] | ||
if (fn) { | ||
return fn(a) | ||
switch (key) { | ||
case 'Array': | ||
case 'String': | ||
return a.length | ||
case 'Object': | ||
return height(a) | ||
case 'Map': | ||
case 'Set': | ||
return a.size | ||
default: | ||
throw new TypeError(`Unsupported type: ${key}`) | ||
} | ||
throw new TypeError(`Unexpected type given to count: ${key}`) | ||
} | ||
export default count |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
import nil from './nil' | ||
import count from './count' | ||
@@ -19,10 +20,12 @@ /** | ||
* empty('') // => true | ||
* empty(NaN) // => true | ||
* empty(new Map()) // => true | ||
* empty(new Set()) // => true | ||
* empty(null) // => true | ||
* empty(undefined) // => true | ||
* empty(true) // => true | ||
* empty(false) // => true | ||
* empty(NaN) // => TypeError: Unsupported type: Number | ||
* empty(true) // => TypeError: Unsupported type: Boolean | ||
* empty(false) // => TypeError: Unsupported type: Boolean | ||
*/ | ||
const empty = x => nil(x) || !Object.keys(x).length | ||
const empty = x => nil(x) || !count(x) | ||
export default empty |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import _curry4 from '../_internals/_curry4' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -22,4 +22,4 @@ export { default as concatMap } from './array/concatMap.js' | ||
export { default as reduce } from './array/reduce.js' | ||
export { default as reduced } from './array/reduced.js' | ||
export { default as reduceRight } from './array/reduceRight.js' | ||
export { default as reduced } from './array/reduced.js' | ||
export { default as reject } from './array/reject.js' | ||
@@ -64,2 +64,3 @@ export { default as remove } from './array/remove.js' | ||
export { default as gte } from './function/gte.js' | ||
export { default as has } from './function/has.js' | ||
export { default as identity } from './function/identity.js' | ||
@@ -113,2 +114,3 @@ export { default as isEmpty } from './function/isEmpty.js' | ||
export { default as subtract } from './number/subtract.js' | ||
export { default as within } from './number/within.js' | ||
export { default as zero } from './number/zero.js' | ||
@@ -118,3 +120,2 @@ export { default as amend } from './object/amend.js' | ||
export { default as draft } from './object/draft.js' | ||
export { default as has } from './object/has.js' | ||
export { default as height } from './object/height.js' | ||
@@ -121,0 +122,0 @@ export { default as omit } from './object/omit.js' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import compose from '../function/compose' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -9,3 +9,3 @@ import _curry3 from '../_internals/_curry3' | ||
* @sig Number -> Number -> Number -> Boolean | ||
* @description Checks to see if a number is between two other provided numbers | ||
* @description Checks to see if a number is between two other provided numbers (inclusive) | ||
* @param {Number} min The number our value should be greater than or equal too | ||
@@ -12,0 +12,0 @@ * @param {Number} max The number our value should be less than or equal too |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import and from '../function/and' |
@@ -0,0 +0,0 @@ import compose from '../function/compose' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import even from './even' |
@@ -0,0 +0,0 @@ import odd from './odd' |
@@ -0,0 +0,0 @@ import prime from './prime' |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ import eq from '../function/eq' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import rem from './rem' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import eq from '../function/eq' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,1 +1,3 @@ | ||
import compose from '../function/compose' | ||
import length from '../list/length' | ||
@@ -16,4 +18,4 @@ /** | ||
*/ | ||
const height = obj => Object.values(obj).length | ||
const height = compose(length, Object.values) | ||
export default height |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry3 from '../_internals/_curry3' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ import _curry2 from '../_internals/_curry2' |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ // Type definitions for Kyanite v0.10.2 |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234717
152
6066