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

prelude-extension

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prelude-extension - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

118

index.js
// Generated by LiveScript 1.4.0
(function(){
var ref$, filter, find, map, partition, reverse, sortBy, clamp, findAll, partitionString;
ref$ = require('prelude-ls'), filter = ref$.filter, find = ref$.find, map = ref$.map, partition = ref$.partition, reverse = ref$.reverse, sortBy = ref$.sortBy;
var ref$, all, any, each, filter, find, isType, keys, map, Obj, partition, reverse, sortBy, clamp, findAll, get, isEqualToObject, partitionString, mappend, rextend, set, transpose, slice$ = [].slice, toString$ = {}.toString;
ref$ = require('prelude-ls'), all = ref$.all, any = ref$.any, each = ref$.each, filter = ref$.filter, find = ref$.find, isType = ref$.isType, keys = ref$.keys, map = ref$.map, Obj = ref$.Obj, partition = ref$.partition, reverse = ref$.reverse, sortBy = ref$.sortBy;
clamp = curry$(function(n, min, max){

@@ -17,2 +17,53 @@ return Math.max(min, Math.min(max, n));

});
get = curry$(function(object, arg$){
var p, ps, ref$;
p = arg$[0], ps = slice$.call(arg$, 1);
if (ps.length === 0) {
return (ref$ = object[p]) != null ? ref$ : null;
} else {
if (typeof object[p] === 'undefined') {
return null;
} else {
return get(object[p], ps);
}
}
});
isEqualToObject = function(o1, o2){
if (any(function(it){
return isType(it, o1);
})(
['Boolan', 'Number', 'String'])) {
return o1 === o2;
}
if ((typeof o1 === 'undefined' || o1 === null) || (typeof o2 === 'undefined' || o2 === null)) {
return false;
}
if (toString$.call(o1).slice(8, -1) !== toString$.call(o2).slice(8, -1)) {
return false;
}
if (toString$.call(o1).slice(8, -1) === 'Array') {
if (o1.length !== o2.length) {
return false;
}
return all(function(index){
return isEqualToObject(o1[index], o2[index]);
})(
(function(){
var i$, to$, results$ = [];
for (i$ = 0, to$ = o1.length; i$ < to$; ++i$) {
results$.push(i$);
}
return results$;
}()));
} else {
return all(function(key){
if (isType('Object', o1[key]) || isType('Array', o1[key])) {
return isEqualToObject(o1[key], o2[key]);
} else {
return o1[key] === o2[key];
}
})(
keys(o1));
}
};
partitionString = curry$(function(text, search){

@@ -51,6 +102,62 @@ var indices, first, x, last, high, low;

});
mappend = curry$(function(object, path, nextValue, combinator){
var current;
current = get(object, path);
return set(object, path, !!current ? combinator(current, nextValue) : nextValue);
});
rextend = curry$(function(a, b){
var btype, bkeys;
btype = toString$.call(b).slice(8, -1);
if (any((function(it){
return it === btype;
}), ['Boolean', 'Number', 'String', 'Function'])) {
return b;
}
if (a === null || 'Undefined' === toString$.call(a).slice(8, -1)) {
return b;
}
bkeys = Obj.keys(b);
if (bkeys.length === 0) {
return a;
}
each(function(key){
return a[key] = rextend(Obj.keys(a[key]).length > 0
? import$({}, a[key])
: a[key], b[key]);
})(
bkeys);
return a;
});
set = curry$(function(object, arg$, value){
var p, ps, ref$;
p = arg$[0], ps = slice$.call(arg$, 1);
if (ps.length > 0) {
object[p] = (ref$ = object[p]) != null
? ref$
: {};
return set(object[p], ps, value);
} else {
object[p] = value;
return object;
}
});
transpose = function(arr){
return map(function(column){
return map(function(row){
return row[column];
})(
arr);
})(
keys(arr[0]));
};
module.exports = {
clamp: clamp,
findAll: findAll,
partitionString: partitionString
get: get,
isEqualToObject: isEqualToObject,
mappend: mappend,
partitionString: partitionString,
rextend: rextend,
set: set,
transpose: transpose
};

@@ -70,2 +177,7 @@ function curry$(f, bound){

}
function import$(obj, src){
var own = {}.hasOwnProperty;
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
return obj;
}
}).call(this);

2

package.json
{
"name": "prelude-extension",
"version": "0.0.4",
"version": "0.0.5",
"description": "prelude-extension",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,6 +7,18 @@ # Functions

`get :: a -> [String] -> b`
`is-equal-to-object :: a -> b -> Boolean`
`mappend :: a -> [String] -> b -> (b -> b -> b) -> a`
`partition-string :: String -> String -> [[Int, Int, Bool]]`
`rextend :: a -> b -> c`
`set :: a -> [String] -> b -> a`
`transpose :: [[a]] -> [[a]]`
# Test
`./test.sh`
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