UNPKG

512 BJavaScriptView Raw
1import {color} from "d3-color";
2import rgb from "./rgb";
3import array from "./array";
4import number from "./number";
5import object from "./object";
6import string from "./string";
7import constant from "./constant";
8
9export default function(a, b) {
10 var t = typeof b, c;
11 return b == null || t === "boolean" ? constant(b)
12 : (t === "number" ? number
13 : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
14 : b instanceof color ? rgb
15 : Array.isArray(b) ? array
16 : object)(a, b);
17}