-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit faffc87
Showing
16 changed files
with
1,865 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"modules": "umd" | ||
}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["exports"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports); | ||
global.consts = mod.exports; | ||
} | ||
})(this, function (exports) { | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var lodashFpConvertOptions = exports.lodashFpConvertOptions = { | ||
rearg: false, | ||
curry: false | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', './set', './unset', './update'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('./set'), require('./unset'), require('./update')); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.set, global.unset, global.update); | ||
global.index = mod.exports; | ||
} | ||
})(this, function (exports, _set, _unset, _update) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.keys(_set).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _set[key]; | ||
} | ||
}); | ||
}); | ||
Object.keys(_unset).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _unset[key]; | ||
} | ||
}); | ||
}); | ||
Object.keys(_update).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _update[key]; | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'lodash/fp/set', './consts'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('lodash/fp/set'), require('./consts')); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.set, global.consts); | ||
global.set = mod.exports; | ||
} | ||
})(this, function (exports, _set, _consts) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.set = undefined; | ||
|
||
var _set2 = _interopRequireDefault(_set); | ||
|
||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
|
||
var set = exports.set = _set2.default.convert(_consts.lodashFpConvertOptions); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'lodash/fp/unset', './consts'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('lodash/fp/unset'), require('./consts')); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.unset, global.consts); | ||
global.unset = mod.exports; | ||
} | ||
})(this, function (exports, _unset, _consts) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.unset = undefined; | ||
|
||
var _unset2 = _interopRequireDefault(_unset); | ||
|
||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
|
||
var unset = exports.unset = _unset2.default.convert(_consts.lodashFpConvertOptions); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', 'lodash/fp/update', 'lodash/isFunction', './consts'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('lodash/fp/update'), require('lodash/isFunction'), require('./consts')); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.update, global.isFunction, global.consts); | ||
global.update = mod.exports; | ||
} | ||
})(this, function (exports, _update, _isFunction, _consts) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.update = undefined; | ||
|
||
var _update2 = _interopRequireDefault(_update); | ||
|
||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
|
||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
|
||
var rawUpdate = _update2.default.convert(_consts.lodashFpConvertOptions); | ||
|
||
var updatePassingArgs = function updatePassingArgs(obj, path, fn) { | ||
for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { | ||
args[_key - 3] = arguments[_key]; | ||
} | ||
|
||
return rawUpdate(obj, path, function (v) { | ||
return fn.apply(undefined, [v].concat(args)); | ||
}); | ||
}; | ||
|
||
var update = exports.update = function update() { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
|
||
if (args.length === 1 && (0, _isFunction2.default)(args[0])) { | ||
return function (obj, path) { | ||
for (var _len3 = arguments.length, rest = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { | ||
rest[_key3 - 2] = arguments[_key3]; | ||
} | ||
|
||
return updatePassingArgs.apply(undefined, [obj, path, args[0]].concat(rest)); | ||
}; | ||
} | ||
return updatePassingArgs.apply(undefined, args); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const lodashFpConvertOptions = { | ||
rearg: false, | ||
curry: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './set' | ||
export * from './unset' | ||
export * from './update' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import fpSet from 'lodash/fp/set' | ||
|
||
import { lodashFpConvertOptions } from './consts' | ||
|
||
export const set = fpSet.convert(lodashFpConvertOptions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import fpUnset from 'lodash/fp/unset' | ||
|
||
import { lodashFpConvertOptions } from './consts' | ||
|
||
export const unset = fpUnset.convert(lodashFpConvertOptions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fpUpdate from 'lodash/fp/update' | ||
import isFunction from 'lodash/isFunction' | ||
|
||
import { lodashFpConvertOptions } from './consts' | ||
|
||
const rawUpdate = fpUpdate.convert(lodashFpConvertOptions) | ||
|
||
const updatePassingArgs = (obj, path, fn, ...args) => rawUpdate(obj, path, v => fn(v, ...args)) | ||
|
||
export const update = (...args) => { | ||
if (args.length === 1 && isFunction(args[0])) { | ||
return (obj, path, ...rest) => updatePassingArgs(obj, path, args[0], ...rest) | ||
} | ||
return updatePassingArgs(...args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(['exports', './core'], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require('./core')); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod.exports, global.core); | ||
global.index = mod.exports; | ||
} | ||
})(this, function (exports, _core) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.keys(_core).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _core[key]; | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "immutable", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-env": "^1.4.0" | ||
}, | ||
"peerDependencies": { | ||
"lodash": "^4.17.4" | ||
}, | ||
"scripts": { | ||
"build": "babel es6 -d ." | ||
} | ||
} |
Oops, something went wrong.