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

fun-model

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fun-model - npm Package Compare versions

Comparing version 6.3.1 to 6.4.0

index.js.map

8

CHANGELOG.md
CHANGELOG
===
6.4.0
--
Fixed
-
Shallow copy backward compatibility for primitive types. Callback is used again also for primitive types.
6.3.0

@@ -4,0 +12,0 @@ --

1

index.js

@@ -17,1 +17,2 @@ "use strict";

};
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "fun-model",
"version": "6.3.1",
"version": "6.4.0",
"description": "fun-model is pure functional implementation of FLUX architecture.",

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

@@ -251,1 +251,2 @@ "use strict";

};
//# sourceMappingURL=actionFactory.spec.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var h = require("../src/helpers");
var debug_1 = require("../src/debug");
describe('helpers', function () {

@@ -79,2 +80,23 @@ describe('shallowCopy', function () {

});
describe('on primitive', function () {
it('calls callback', function () {
var callback = jasmine.createSpy('callback');
h.shallowCopy('test', callback);
expect(callback).toHaveBeenCalledWith('test');
});
it('calls debug because of wrong usage', function () {
var debug = jasmine.createSpy('debug');
debug_1.bootstrap(debug);
h.shallowCopy('test');
expect(debug).toHaveBeenCalled();
});
it('returns value when no callback provided', function () {
var returnValue = h.shallowCopy('test');
expect(returnValue).toBe('test');
});
it('respects returned value', function () {
var returnValue = h.shallowCopy('test', function (_original) { return 'changed value'; });
expect(returnValue).toBe('changed value');
});
});
});

@@ -104,1 +126,2 @@ describe('deepFreeze', function () {

});
//# sourceMappingURL=helpers.spec.js.map
import * as h from '../src/helpers';
import { bootstrap } from '../src/debug';

@@ -96,2 +97,30 @@ describe('helpers', () => {

});
describe('on primitive', () => {
it('calls callback', () => {
const callback = jasmine.createSpy('callback');
h.shallowCopy('test', callback);
expect(callback).toHaveBeenCalledWith('test');
});
it('calls debug because of wrong usage', () => {
const debug = jasmine.createSpy('debug');
bootstrap(debug);
h.shallowCopy('test');
expect(debug).toHaveBeenCalled();
});
it('returns value when no callback provided', () => {
const returnValue = h.shallowCopy('test');
expect(returnValue).toBe('test');
});
it('respects returned value', () => {
const returnValue = h.shallowCopy('test', (_original: string) => 'changed value');
expect(returnValue).toBe('changed value');
});
});
});

@@ -98,0 +127,0 @@

@@ -253,1 +253,2 @@ "use strict";

});
//# sourceMappingURL=store.spec.js.map

@@ -15,1 +15,2 @@ "use strict";

};
//# sourceMappingURL=todosState.js.map

@@ -114,1 +114,2 @@ "use strict";

}
//# sourceMappingURL=actionFactory.js.map

@@ -10,1 +10,2 @@ "use strict";

};
//# sourceMappingURL=debug.js.map
export declare function shallowCopy<T>(source: T, callback?: (target: T) => void | T): T;
export declare function shallowCopy<T>(source: T[], callback?: (target: T[]) => void | T[]): T[];
export declare function objectShallowCopy<T extends Object>(source: T, callback?: (target: T) => void | T): T;
export declare function deepFreeze<T extends Object>(source: T): T;
export declare function isFunction(val: any): val is Function;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var debug_1 = require("./debug");
function shallowCopy(source, callback) {
if (source instanceof Array) {
source = source.slice();
var result = callback ? callback(source) : undefined;
return result || source;
var result_1 = callback ? callback(source) : undefined;
return result_1 || source;
}

@@ -12,3 +13,7 @@ if (typeof source === "object") {

}
return source;
if (debug_1.debug) {
debug_1.debug("Shallow copy should not be used for primitive types.");
}
var result = callback && callback(source);
return result || source;
}

@@ -45,1 +50,2 @@ exports.shallowCopy = shallowCopy;

exports.isFunction = isFunction;
//# sourceMappingURL=helpers.js.map

@@ -0,7 +1,6 @@

import { debug } from "./debug";
export function shallowCopy<T>(source: T, callback?: (target: T) => void | T): T;
export function shallowCopy<T>(source: T[], callback?: (target: T[]) => void | T[]): T[];
export function shallowCopy(source: any, callback?: (target: any) => void | any): any {
export function shallowCopy<T>(source: T, callback?: (target: T) => void | T): T {
if (source instanceof Array) {
source = [...source];
source = [...source] as unknown as T;
const result = callback ? callback(source) : undefined;

@@ -13,3 +12,8 @@ return result || source;

}
return source;
if (debug) {
debug("Shallow copy should not be used for primitive types.");
}
const result = callback && callback(source);
return result || source;
}

@@ -16,0 +20,0 @@

@@ -139,1 +139,2 @@ "use strict";

}
//# sourceMappingURL=store.js.map
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