MCPcopy Create free account
hub / github.com/immutable-js/immutable-js / throwOnInvalidDefaultValues

Function throwOnInvalidDefaultValues

src/Record.js:26–44  ·  view source on GitHub ↗
(defaultValues)

Source from the content-addressed store, hash-verified

24import quoteString from './utils/quoteString';
25
26function throwOnInvalidDefaultValues(defaultValues) {
27 if (isRecord(defaultValues)) {
28 throw new Error(
29 'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'
30 );
31 }
32
33 if (isImmutable(defaultValues)) {
34 throw new Error(
35 'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'
36 );
37 }
38
39 if (defaultValues === null || typeof defaultValues !== 'object') {
40 throw new Error(
41 'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'
42 );
43 }
44}
45
46export class Record {
47 constructor(defaultValues, name) {

Callers 1

constructorMethod · 0.85

Calls 2

isRecordFunction · 0.90
isImmutableFunction · 0.90

Tested by

no test coverage detected