File tree Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 3434 "types" : " ./dist/schema.d.cts" ,
3535 "default" : " ./dist/schema.cjs"
3636 }
37+ },
38+ "./local-helpers" : {
39+ "import" : {
40+ "types" : " ./dist/local-helpers.d.ts" ,
41+ "default" : " ./dist/local-helpers.js"
42+ },
43+ "require" : {
44+ "types" : " ./dist/local-helpers.d.cts" ,
45+ "default" : " ./dist/local-helpers.cjs"
46+ }
3747 }
3848 },
3949 "dependencies" : {
Original file line number Diff line number Diff line change 1+ export * from './is-plain-object' ;
2+ export * from './lower-case-first' ;
3+ export * from './upper-case-first' ;
4+ export * from './tiny-invariant' ;
Original file line number Diff line number Diff line change 1+ function isObject ( o : unknown ) {
2+ return Object . prototype . toString . call ( o ) === '[object Object]' ;
3+ }
4+
5+ export function isPlainObject ( o : unknown ) {
6+ if ( isObject ( o ) === false ) return false ;
7+
8+ // If has modified constructor
9+ const ctor = ( o as { constructor : unknown } ) . constructor ;
10+ if ( ctor === undefined ) return true ;
11+
12+ // If has modified prototype
13+ const prot = ( ctor as { prototype : unknown } ) . prototype ;
14+ if ( isObject ( prot ) === false ) return false ;
15+
16+ // If constructor does not have an Object-specific method
17+ if ( Object . prototype . hasOwnProperty . call ( prot , 'isPrototypeOf' ) === false ) {
18+ return false ;
19+ }
20+
21+ // Most likely a plain Object
22+ return true ;
23+ }
Original file line number Diff line number Diff line change 1+ export function lowerCaseFirst ( input : string ) {
2+ return input . charAt ( 0 ) . toLowerCase ( ) + input . slice ( 1 ) ;
3+ }
4+
5+ export { lowerCaseFirst as uncapitalize } ;
Original file line number Diff line number Diff line change 1+ const isProduction = process . env [ 'NODE_ENV' ] === 'production' ;
2+ const prefix = 'Invariant failed' ;
3+
4+ export function invariant (
5+ condition : unknown ,
6+ message ?: string ,
7+ ) : asserts condition {
8+ if ( condition ) {
9+ return ;
10+ }
11+
12+ if ( isProduction ) {
13+ throw new Error ( prefix ) ;
14+ }
15+
16+ throw new Error ( message ? `${ prefix } : ${ message } ` : prefix ) ;
17+ }
Original file line number Diff line number Diff line change 1+ export function upperCaseFirst ( input : string ) {
2+ return input . charAt ( 0 ) . toUpperCase ( ) + input . slice ( 1 ) ;
3+ }
4+
5+ export { upperCaseFirst as capitalize } ;
You can’t perform that action at this time.
0 commit comments